diff options
-rw-r--r-- | include/linux/rwsem.h | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h index 25cd9aa2f3d7..716807f0eb2d 100644 --- a/include/linux/rwsem.h +++ b/include/linux/rwsem.h | |||
@@ -24,15 +24,15 @@ struct rw_semaphore; | |||
24 | /* All arch specific implementations share the same struct */ | 24 | /* All arch specific implementations share the same struct */ |
25 | struct rw_semaphore { | 25 | struct rw_semaphore { |
26 | long count; | 26 | long count; |
27 | raw_spinlock_t wait_lock; | ||
28 | struct list_head wait_list; | 27 | struct list_head wait_list; |
28 | raw_spinlock_t wait_lock; | ||
29 | #ifdef CONFIG_SMP | 29 | #ifdef CONFIG_SMP |
30 | struct optimistic_spin_queue osq; /* spinner MCS lock */ | ||
30 | /* | 31 | /* |
31 | * Write owner. Used as a speculative check to see | 32 | * Write owner. Used as a speculative check to see |
32 | * if the owner is running on the cpu. | 33 | * if the owner is running on the cpu. |
33 | */ | 34 | */ |
34 | struct task_struct *owner; | 35 | struct task_struct *owner; |
35 | struct optimistic_spin_queue osq; /* spinner MCS lock */ | ||
36 | #endif | 36 | #endif |
37 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 37 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
38 | struct lockdep_map dep_map; | 38 | struct lockdep_map dep_map; |
@@ -64,21 +64,18 @@ static inline int rwsem_is_locked(struct rw_semaphore *sem) | |||
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | #if defined(CONFIG_SMP) && !defined(CONFIG_RWSEM_GENERIC_SPINLOCK) | 66 | #if defined(CONFIG_SMP) && !defined(CONFIG_RWSEM_GENERIC_SPINLOCK) |
67 | #define __RWSEM_INITIALIZER(name) \ | 67 | #define __RWSEM_OPT_INIT(lockname) , .osq = OSQ_LOCK_UNLOCKED, .owner = NULL |
68 | { RWSEM_UNLOCKED_VALUE, \ | ||
69 | __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \ | ||
70 | LIST_HEAD_INIT((name).wait_list), \ | ||
71 | NULL, /* owner */ \ | ||
72 | OSQ_LOCK_UNLOCKED /* osq */ \ | ||
73 | __RWSEM_DEP_MAP_INIT(name) } | ||
74 | #else | 68 | #else |
75 | #define __RWSEM_INITIALIZER(name) \ | 69 | #define __RWSEM_OPT_INIT(lockname) |
76 | { RWSEM_UNLOCKED_VALUE, \ | ||
77 | __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock), \ | ||
78 | LIST_HEAD_INIT((name).wait_list) \ | ||
79 | __RWSEM_DEP_MAP_INIT(name) } | ||
80 | #endif | 70 | #endif |
81 | 71 | ||
72 | #define __RWSEM_INITIALIZER(name) \ | ||
73 | { .count = RWSEM_UNLOCKED_VALUE, \ | ||
74 | .wait_list = LIST_HEAD_INIT((name).wait_list), \ | ||
75 | .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(name.wait_lock) \ | ||
76 | __RWSEM_OPT_INIT(name) \ | ||
77 | __RWSEM_DEP_MAP_INIT(name) } | ||
78 | |||
82 | #define DECLARE_RWSEM(name) \ | 79 | #define DECLARE_RWSEM(name) \ |
83 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | 80 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) |
84 | 81 | ||