A mutex lock "object" is represented in the kernel as a struct mutex data structure. Consider the following code:
#include <linux/mutex.h>
struct mutex mymtx;
To use a mutex lock, it must be explicitly initialized to the unlocked state. Initialization can be performed statically (declare and initialize the object) with the DEFINE_MUTEX() macro, or dynamically via the mutex_init() function (this is actually a macro wrapper over the __mutex_init() function).
For example, to declare and initialize a mutex object called mymtx, we can use DEFINE_MUTEX(mymtx);.
We can also do this dynamically. Why dynamically? Often, the mutex lock is a member of the (global) data structure that it protects (clever!). For example, let's say we have the following global context structure in our driver code (note that this code is fictional):
struct mydrv_priv {
<member 1>;
<member 2>;
[...]
struct...