aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rwsem-spinlock.h
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 /include/linux/rwsem-spinlock.h
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 'include/linux/rwsem-spinlock.h')
-rw-r--r--include/linux/rwsem-spinlock.h23
1 files changed, 1 insertions, 22 deletions
diff --git a/include/linux/rwsem-spinlock.h b/include/linux/rwsem-spinlock.h
index 8c0dc7fc07a4..34701241b673 100644
--- a/include/linux/rwsem-spinlock.h
+++ b/include/linux/rwsem-spinlock.h
@@ -29,28 +29,7 @@ struct rw_semaphore {
29#endif 29#endif
30}; 30};
31 31
32#ifdef CONFIG_DEBUG_LOCK_ALLOC 32#define RWSEM_UNLOCKED_VALUE 0x00000000
33# define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname }
34#else
35# define __RWSEM_DEP_MAP_INIT(lockname)
36#endif
37
38#define __RWSEM_INITIALIZER(name) \
39{ 0, __SPIN_LOCK_UNLOCKED(name.wait_lock), LIST_HEAD_INIT((name).wait_list) \
40 __RWSEM_DEP_MAP_INIT(name) }
41
42#define DECLARE_RWSEM(name) \
43 struct rw_semaphore name = __RWSEM_INITIALIZER(name)
44
45extern void __init_rwsem(struct rw_semaphore *sem, const char *name,
46 struct lock_class_key *key);
47
48#define init_rwsem(sem) \
49do { \
50 static struct lock_class_key __key; \
51 \
52 __init_rwsem((sem), #sem, &__key); \
53} while (0)
54 33
55extern void __down_read(struct rw_semaphore *sem); 34extern void __down_read(struct rw_semaphore *sem);
56extern int __down_read_trylock(struct rw_semaphore *sem); 35extern int __down_read_trylock(struct rw_semaphore *sem);