[PATCH] bcm43xx: Fix array overrun in bcm43xx_geo_init
[linux-2.6/kmemtrace.git] / include / linux / spinlock_types.h
blob9cb51e0703909ccaaea60108349f11366c6284d5
1 #ifndef __LINUX_SPINLOCK_TYPES_H
2 #define __LINUX_SPINLOCK_TYPES_H
4 /*
5 * include/linux/spinlock_types.h - generic spinlock type definitions
6 * and initializers
8 * portions Copyright 2005, Red Hat, Inc., Ingo Molnar
9 * Released under the General Public License (GPL).
12 #if defined(CONFIG_SMP)
13 # include <asm/spinlock_types.h>
14 #else
15 # include <linux/spinlock_types_up.h>
16 #endif
18 typedef struct {
19 raw_spinlock_t raw_lock;
20 #if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
21 unsigned int break_lock;
22 #endif
23 #ifdef CONFIG_DEBUG_SPINLOCK
24 unsigned int magic, owner_cpu;
25 void *owner;
26 #endif
27 } spinlock_t;
29 #define SPINLOCK_MAGIC 0xdead4ead
31 typedef struct {
32 raw_rwlock_t raw_lock;
33 #if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP)
34 unsigned int break_lock;
35 #endif
36 #ifdef CONFIG_DEBUG_SPINLOCK
37 unsigned int magic, owner_cpu;
38 void *owner;
39 #endif
40 } rwlock_t;
42 #define RWLOCK_MAGIC 0xdeaf1eed
44 #define SPINLOCK_OWNER_INIT ((void *)-1L)
46 #ifdef CONFIG_DEBUG_SPINLOCK
47 # define SPIN_LOCK_UNLOCKED \
48 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED, \
49 .magic = SPINLOCK_MAGIC, \
50 .owner = SPINLOCK_OWNER_INIT, \
51 .owner_cpu = -1 }
52 #define RW_LOCK_UNLOCKED \
53 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED, \
54 .magic = RWLOCK_MAGIC, \
55 .owner = SPINLOCK_OWNER_INIT, \
56 .owner_cpu = -1 }
57 #else
58 # define SPIN_LOCK_UNLOCKED \
59 (spinlock_t) { .raw_lock = __RAW_SPIN_LOCK_UNLOCKED }
60 #define RW_LOCK_UNLOCKED \
61 (rwlock_t) { .raw_lock = __RAW_RW_LOCK_UNLOCKED }
62 #endif
64 #define DEFINE_SPINLOCK(x) spinlock_t x = SPIN_LOCK_UNLOCKED
65 #define DEFINE_RWLOCK(x) rwlock_t x = RW_LOCK_UNLOCKED
67 #endif /* __LINUX_SPINLOCK_TYPES_H */