Go to the documentation of this file.
10 #include <linux/linkage.h>
12 #include <linux/types.h>
13 #include <linux/kernel.h>
14 #include <linux/list.h>
21 #ifdef CONFIG_RWSEM_GENERIC_SPINLOCK
29 #ifdef CONFIG_DEBUG_LOCK_ALLOC
30 struct lockdep_map dep_map;
40 #include <asm/rwsem.h>
45 return sem->
count != 0;
52 #ifdef CONFIG_DEBUG_LOCK_ALLOC
53 # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
55 # define __RWSEM_DEP_MAP_INIT(lockname)
58 #define __RWSEM_INITIALIZER(name) \
59 { RWSEM_UNLOCKED_VALUE, \
60 __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \
61 LIST_HEAD_INIT((name).wait_list) \
62 __RWSEM_DEP_MAP_INIT(name) }
64 #define DECLARE_RWSEM(name) \
65 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
70 #define init_rwsem(sem) \
72 static struct lock_class_key __key; \
74 __init_rwsem((sem), #sem, &__key); \
112 #ifdef CONFIG_DEBUG_LOCK_ALLOC
129 # define down_read_nested(sem, subclass) down_read(sem)
130 # define down_write_nested(sem, subclass) down_write(sem)