diff options
author | Paul Mundt <lethal@linux-sh.org> | 2006-12-04 04:17:28 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-12-05 20:45:40 -0500 |
commit | afbfb52e47273a440df33274452c603e8c332de2 (patch) | |
tree | 041dc70061a67e787b362959298e093830b4b4d7 /include/asm-sh/rwsem.h | |
parent | c03c69610bfa728805deceeb624ee4268c722a5a (diff) |
sh: stacktrace/lockdep/irqflags tracing support.
Wire up all of the essentials for lockdep..
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/asm-sh/rwsem.h')
-rw-r--r-- | include/asm-sh/rwsem.h | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/include/asm-sh/rwsem.h b/include/asm-sh/rwsem.h index 9d2aea5e8488..4931ba817d73 100644 --- a/include/asm-sh/rwsem.h +++ b/include/asm-sh/rwsem.h | |||
@@ -25,11 +25,21 @@ struct rw_semaphore { | |||
25 | #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) | 25 | #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) |
26 | spinlock_t wait_lock; | 26 | spinlock_t wait_lock; |
27 | struct list_head wait_list; | 27 | struct list_head wait_list; |
28 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
29 | struct lockdep_map dep_map; | ||
30 | #endif | ||
28 | }; | 31 | }; |
29 | 32 | ||
33 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
34 | # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } | ||
35 | #else | ||
36 | # define __RWSEM_DEP_MAP_INIT(lockname) | ||
37 | #endif | ||
38 | |||
30 | #define __RWSEM_INITIALIZER(name) \ | 39 | #define __RWSEM_INITIALIZER(name) \ |
31 | { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ | 40 | { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ |
32 | LIST_HEAD_INIT((name).wait_list) } | 41 | LIST_HEAD_INIT((name).wait_list) \ |
42 | __RWSEM_DEP_MAP_INIT(name) } | ||
33 | 43 | ||
34 | #define DECLARE_RWSEM(name) \ | 44 | #define DECLARE_RWSEM(name) \ |
35 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | 45 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) |
@@ -39,6 +49,16 @@ extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); | |||
39 | extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); | 49 | extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); |
40 | extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); | 50 | extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); |
41 | 51 | ||
52 | extern void __init_rwsem(struct rw_semaphore *sem, const char *name, | ||
53 | struct lock_class_key *key); | ||
54 | |||
55 | #define init_rwsem(sem) \ | ||
56 | do { \ | ||
57 | static struct lock_class_key __key; \ | ||
58 | \ | ||
59 | __init_rwsem((sem), #sem, &__key); \ | ||
60 | } while (0) | ||
61 | |||
42 | static inline void init_rwsem(struct rw_semaphore *sem) | 62 | static inline void init_rwsem(struct rw_semaphore *sem) |
43 | { | 63 | { |
44 | sem->count = RWSEM_UNLOCKED_VALUE; | 64 | sem->count = RWSEM_UNLOCKED_VALUE; |
@@ -141,6 +161,11 @@ static inline void __downgrade_write(struct rw_semaphore *sem) | |||
141 | rwsem_downgrade_wake(sem); | 161 | rwsem_downgrade_wake(sem); |
142 | } | 162 | } |
143 | 163 | ||
164 | static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) | ||
165 | { | ||
166 | __down_write(sem); | ||
167 | } | ||
168 | |||
144 | /* | 169 | /* |
145 | * implement exchange and add functionality | 170 | * implement exchange and add functionality |
146 | */ | 171 | */ |