diff options
author | David S. Miller <davem@davemloft.net> | 2006-11-16 16:38:57 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-10 05:39:09 -0500 |
commit | 10e267234cc0133bc9ed26bc34eb09de90c248c0 (patch) | |
tree | 8493e2767e1752f5873e50cc899a4c701cc55fbb /include/asm-sparc64/rwsem.h | |
parent | af1713e0f111647052953ba12fd10a59c74a5dde (diff) |
[SPARC64]: Add irqtrace/stacktrace/lockdep support.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/asm-sparc64/rwsem.h')
-rw-r--r-- | include/asm-sparc64/rwsem.h | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/include/asm-sparc64/rwsem.h b/include/asm-sparc64/rwsem.h index cef5e8270421..1294b7ce5d06 100644 --- a/include/asm-sparc64/rwsem.h +++ b/include/asm-sparc64/rwsem.h | |||
@@ -23,20 +23,33 @@ struct rw_semaphore { | |||
23 | signed int count; | 23 | signed int count; |
24 | spinlock_t wait_lock; | 24 | spinlock_t wait_lock; |
25 | struct list_head wait_list; | 25 | struct list_head wait_list; |
26 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
27 | struct lockdep_map dep_map; | ||
28 | #endif | ||
26 | }; | 29 | }; |
27 | 30 | ||
31 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
32 | # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } | ||
33 | #else | ||
34 | # define __RWSEM_DEP_MAP_INIT(lockname) | ||
35 | #endif | ||
36 | |||
28 | #define __RWSEM_INITIALIZER(name) \ | 37 | #define __RWSEM_INITIALIZER(name) \ |
29 | { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) } | 38 | { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, LIST_HEAD_INIT((name).wait_list) \ |
39 | __RWSEM_DEP_MAP_INIT(name) } | ||
30 | 40 | ||
31 | #define DECLARE_RWSEM(name) \ | 41 | #define DECLARE_RWSEM(name) \ |
32 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | 42 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) |
33 | 43 | ||
34 | static __inline__ void init_rwsem(struct rw_semaphore *sem) | 44 | extern void __init_rwsem(struct rw_semaphore *sem, const char *name, |
35 | { | 45 | struct lock_class_key *key); |
36 | sem->count = RWSEM_UNLOCKED_VALUE; | 46 | |
37 | spin_lock_init(&sem->wait_lock); | 47 | #define init_rwsem(sem) \ |
38 | INIT_LIST_HEAD(&sem->wait_list); | 48 | do { \ |
39 | } | 49 | static struct lock_class_key __key; \ |
50 | \ | ||
51 | __init_rwsem((sem), #sem, &__key); \ | ||
52 | } while (0) | ||
40 | 53 | ||
41 | extern void __down_read(struct rw_semaphore *sem); | 54 | extern void __down_read(struct rw_semaphore *sem); |
42 | extern int __down_read_trylock(struct rw_semaphore *sem); | 55 | extern int __down_read_trylock(struct rw_semaphore *sem); |
@@ -46,6 +59,11 @@ extern void __up_read(struct rw_semaphore *sem); | |||
46 | extern void __up_write(struct rw_semaphore *sem); | 59 | extern void __up_write(struct rw_semaphore *sem); |
47 | extern void __downgrade_write(struct rw_semaphore *sem); | 60 | extern void __downgrade_write(struct rw_semaphore *sem); |
48 | 61 | ||
62 | static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) | ||
63 | { | ||
64 | __down_write(sem); | ||
65 | } | ||
66 | |||
49 | static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) | 67 | static inline int rwsem_atomic_update(int delta, struct rw_semaphore *sem) |
50 | { | 68 | { |
51 | return atomic_add_return(delta, (atomic_t *)(&sem->count)); | 69 | return atomic_add_return(delta, (atomic_t *)(&sem->count)); |