object: add a macro to define object lock/unlock functions
This commit is contained in:
@@ -11,6 +11,28 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DEFINE_OBJECT_LOCK_FUNCTION(object_name, base) \
|
||||
static inline void object_name##_lock(struct object_name *p) \
|
||||
{ \
|
||||
object_lock(&p->base); \
|
||||
} \
|
||||
static inline void object_name##_unlock(struct object_name *p) \
|
||||
{ \
|
||||
object_unlock(&p->base); \
|
||||
} \
|
||||
static inline void object_name##_lock_irqsave( \
|
||||
struct object_name *p, \
|
||||
unsigned long *flags) \
|
||||
{ \
|
||||
object_lock_irqsave(&p->base, flags); \
|
||||
} \
|
||||
static inline void object_name##_unlock_irqrestore( \
|
||||
struct object_name *p, \
|
||||
unsigned long flags) \
|
||||
{ \
|
||||
object_unlock_irqrestore(&p->base, flags); \
|
||||
}
|
||||
|
||||
#define OBJECT_MAGIC 0xBADDCAFE
|
||||
#define OBJECT_NAME_MAX 64
|
||||
#define OBJECT_PATH_MAX 256
|
||||
|
||||
Reference in New Issue
Block a user