aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/spinlock_types.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-07-03 03:24:34 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-03 18:27:02 -0400
commite4d919188554a77c798a267e098059bc9aa39726 (patch)
treebb5e47e09f5d107db44358ad668988f5ae768ade /include/linux/spinlock_types.h
parent9cebb5526833059f327d237a032422c762378b2a (diff)
[PATCH] lockdep: locking init debugging improvement
Locking init improvement: - introduce and use __SPIN_LOCK_UNLOCKED for array initializations, to pass in the name string of locks, used by debugging Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/spinlock_types.h')
-rw-r--r--include/linux/spinlock_types.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 9cb51e07039..f5d4ed7bc78 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -44,24 +44,27 @@ typedef struct {
44#define SPINLOCK_OWNER_INIT ((void *)-1L) 44#define SPINLOCK_OWNER_INIT ((void *)-1L)
45 45
46#ifdef CONFIG_DEBUG_SPINLOCK 46#ifdef CONFIG_DEBUG_SPINLOCK
47# define SPIN_LOCK_UNLOCKED \ 47# define __SPIN_LOCK_UNLOCKED(lockname) \
48 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \ 48 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \
49 .magic = SPINLOCK_MAGIC, \ 49 .magic = SPINLOCK_MAGIC, \
50 .owner = SPINLOCK_OWNER_INIT, \ 50 .owner = SPINLOCK_OWNER_INIT, \
51 .owner_cpu = -1 } 51 .owner_cpu = -1 }
52#define RW_LOCK_UNLOCKED \ 52#define __RW_LOCK_UNLOCKED(lockname) \
53 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \ 53 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \
54 .magic = RWLOCK_MAGIC, \ 54 .magic = RWLOCK_MAGIC, \
55 .owner = SPINLOCK_OWNER_INIT, \ 55 .owner = SPINLOCK_OWNER_INIT, \
56 .owner_cpu = -1 } 56 .owner_cpu = -1 }
57#else 57#else
58# define SPIN_LOCK_UNLOCKED \ 58# define __SPIN_LOCK_UNLOCKED(lockname) \
59 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED } 59 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED }
60#define RW_LOCK_UNLOCKED \ 60#define __RW_LOCK_UNLOCKED(lockname) \
61 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED } 61 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED }
62#endif 62#endif
63 63
64#define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED 64#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init)
65#define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED 65#define RW_LOCK_UNLOCKED __RW_LOCK_UNLOCKED(old_style_rw_init)
66
67#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x)
68#define DEFINE_RWLOCK(x) rwlock_t x = __RW_LOCK_UNLOCKED(x)
66 69
67#endif /* __LINUX_SPINLOCK_TYPES_H */ 70#endif /* __LINUX_SPINLOCK_TYPES_H */