aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/rwsem.h
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-04-17 00:35:01 -0400
committerPaul Mackerras <paulus@samba.org>2008-04-18 01:38:47 -0400
commit945feb174b14e7098cc7ecf0cf4768d35bc52f9c (patch)
tree9810b2ff0efe8edbfb1506f65834ea0d553e2848 /include/asm-powerpc/rwsem.h
parentfd3e0bbc6052ca9747a5332b382584ece83aab6d (diff)
[POWERPC] irqtrace support for 64-bit powerpc
This adds the low level irq tracing hooks to the powerpc architecture needed to enable full lockdep functionality. This is partly based on Johannes Berg's initial version. I removed the asm trampoline that isn't needed (thus improving performance) and modified all sorts of bits and pieces, reworking most of the assembly, etc... Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/rwsem.h')
-rw-r--r--include/asm-powerpc/rwsem.h35
1 files changed, 26 insertions, 9 deletions
diff --git a/include/asm-powerpc/rwsem.h b/include/asm-powerpc/rwsem.h
index cefc14728cc5..a6cc93b78b98 100644
--- a/include/asm-powerpc/rwsem.h
+++ b/include/asm-powerpc/rwsem.h
@@ -32,11 +32,20 @@ struct rw_semaphore {
32#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 32#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
33 spinlock_t wait_lock; 33 spinlock_t wait_lock;
34 struct list_head wait_list; 34 struct list_head wait_list;
35#ifdef CONFIG_DEBUG_LOCK_ALLOC
36 struct lockdep_map dep_map;
37#endif
35}; 38};
36 39
40#ifdef CONFIG_DEBUG_LOCK_ALLOC
41# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
42#else
43# define __RWSEM_DEP_MAP_INIT(lockname)
44#endif
45
37#define __RWSEM_INITIALIZER(name) \ 46#define __RWSEM_INITIALIZER(name) \
38 { RWSEM_UNLOCKED_VALUE, SPIN_LOCK_UNLOCKED, \ 47 { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
39 LIST_HEAD_INIT((name).wait_list) } 48 LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) }
40 49
41#define DECLARE_RWSEM(name) \ 50#define DECLARE_RWSEM(name) \
42 struct rw_semaphore name = __RWSEM_INITIALIZER(name) 51 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
@@ -46,12 +55,15 @@ extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
46extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); 55extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem);
47extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 56extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
48 57
49static inline void init_rwsem(struct rw_semaphore *sem) 58extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
50{ 59 struct lock_class_key *key);
51 sem->count = RWSEM_UNLOCKED_VALUE; 60
52 spin_lock_init(&sem->wait_lock); 61#define init_rwsem(sem) \
53 INIT_LIST_HEAD(&sem->wait_list); 62 do { \
54} 63 static struct lock_class_key __key; \
64 \
65 __init_rwsem((sem), #sem, &__key); \
66 } while (0)
55 67
56/* 68/*
57 * lock for reading 69 * lock for reading
@@ -78,7 +90,7 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
78/* 90/*
79 * lock for writing 91 * lock for writing
80 */ 92 */
81static inline void __down_write(struct rw_semaphore *sem) 93static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
82{ 94{
83 int tmp; 95 int tmp;
84 96
@@ -88,6 +100,11 @@ static inline void __down_write(struct rw_semaphore *sem)
88 rwsem_down_write_failed(sem); 100 rwsem_down_write_failed(sem);
89} 101}
90 102
103static inline void __down_write(struct rw_semaphore *sem)
104{
105 __down_write_nested(sem, 0);
106}
107
91static inline int __down_write_trylock(struct rw_semaphore *sem) 108static inline int __down_write_trylock(struct rw_semaphore *sem)
92{ 109{
93 int tmp; 110 int tmp;