1 #ifndef _LWK_SPINLOCK_TYPES_H
2 #define _LWK_SPINLOCK_TYPES_H
5 * include/lwk/spinlock_types.h - generic spinlock type definitions
8 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
9 * Released under the General Public License (GPL).
12 #include <arch/spinlock_types.h>
15 raw_spinlock_t raw_lock;
16 #ifdef CONFIG_DEBUG_SPINLOCK
17 unsigned int magic, owner_cpu;
22 #define SPINLOCK_MAGIC 0xdead4ead
25 raw_rwlock_t raw_lock;
26 #ifdef CONFIG_DEBUG_SPINLOCK
27 unsigned int magic, owner_cpu;
32 #define RWLOCK_MAGIC 0xdeaf1eed
34 #define SPINLOCK_OWNER_INIT ((void *)-1L)
36 #ifdef CONFIG_DEBUG_SPINLOCK
37 # define SPIN_LOCK_UNLOCKED \
38 { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \
39 .magic = SPINLOCK_MAGIC, \
40 .owner = SPINLOCK_OWNER_INIT, \
42 #define RW_LOCK_UNLOCKED \
43 { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \
44 .magic = RWLOCK_MAGIC, \
45 .owner = SPINLOCK_OWNER_INIT, \
48 # define SPIN_LOCK_UNLOCKED \
49 { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED }
50 #define RW_LOCK_UNLOCKED \
51 { .raw_lock = __RAW_RW_LOCK_UNLOCKED }
54 #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
55 #define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
57 #endif /* _LWK_SPINLOCK_TYPES_H */