aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-01-26 15:06:00 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-01-27 06:30:39 -0500
commit12249b34414dba7f386aadcf6be7ca36c6878300 (patch)
treeb096b2fd1c9064b1be78f8781ef3ec8938b3abf5 /arch/sh
parent1c8ed640d918290ddc1de5ada02ef6686a733c9f (diff)
rwsem: Move duplicate init macros and functions to linux/rwsem.h
The rwsem initializers and related macros and functions are mostly the same. Some of them lack the lockdep initializer, but having it in place does not matter for architectures which do not support lockdep. powerpc, sparc, x86: No functional change sh, s390: Removes the duplicate init_rwsem (inline and #define) alpha, ia64, xtensa: Use the lockdep capable init function in lib/rwsem.c which is just uninlining the init function for the LOCKDEP=n case Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: David Howells <dhowells@redhat.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Matt Turner <mattst88@gmail.com> Acked-by: Tony Luck <tony.luck@intel.com> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Paul Mundt <lethal@linux-sh.org> Acked-by: David Miller <davem@davemloft.net> Cc: Chris Zankel <chris@zankel.net> LKML-Reference: <20110126195833.771812729@linutronix.de>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/include/asm/rwsem.h31
1 files changed, 0 insertions, 31 deletions
diff --git a/arch/sh/include/asm/rwsem.h b/arch/sh/include/asm/rwsem.h
index dffc62589f79..798699d0687b 100644
--- a/arch/sh/include/asm/rwsem.h
+++ b/arch/sh/include/asm/rwsem.h
@@ -19,42 +19,11 @@
19#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS 19#define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS
20#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) 20#define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS)
21 21
22#ifdef CONFIG_DEBUG_LOCK_ALLOC
23# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
24#else
25# define __RWSEM_DEP_MAP_INIT(lockname)
26#endif
27
28#define __RWSEM_INITIALIZER(name) \
29 { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \
30 LIST_HEAD_INIT((name).wait_list) \
31 __RWSEM_DEP_MAP_INIT(name) }
32
33#define DECLARE_RWSEM(name) \
34 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
35
36extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); 22extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem);
37extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); 23extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem);
38extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); 24extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem);
39extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); 25extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem);
40 26
41extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
42 struct lock_class_key *key);
43
44#define init_rwsem(sem) \
45do { \
46 static struct lock_class_key __key; \
47 \
48 __init_rwsem((sem), #sem, &__key); \
49} while (0)
50
51static inline void init_rwsem(struct rw_semaphore *sem)
52{
53 sem->count = RWSEM_UNLOCKED_VALUE;
54 spin_lock_init(&sem->wait_lock);
55 INIT_LIST_HEAD(&sem->wait_list);
56}
57
58/* 27/*
59 * lock for reading 28 * lock for reading
60 */ 29 */