Blame view
include/linux/spinlock_types.h
2.28 KB
fb1c8f93d [PATCH] spinlock ... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#ifndef __LINUX_SPINLOCK_TYPES_H #define __LINUX_SPINLOCK_TYPES_H /* * include/linux/spinlock_types.h - generic spinlock type definitions * and initializers * * portions Copyright 2005, Red Hat, Inc., Ingo Molnar * Released under the General Public License (GPL). */ #if defined(CONFIG_SMP) # include <asm/spinlock_types.h> #else # include <linux/spinlock_types_up.h> #endif |
21f8ca3bf fix raw_spinlock_... |
17 |
#include <linux/lockdep.h> |
c2f21ce2e locking: Implemen... |
18 |
typedef struct raw_spinlock { |
445c89514 locking: Convert ... |
19 |
arch_spinlock_t raw_lock; |
95c354fe9 spinlock: lockbre... |
20 |
#ifdef CONFIG_GENERIC_LOCKBREAK |
fb1c8f93d [PATCH] spinlock ... |
21 22 23 24 25 26 |
unsigned int break_lock; #endif #ifdef CONFIG_DEBUG_SPINLOCK unsigned int magic, owner_cpu; void *owner; #endif |
8a25d5deb [PATCH] lockdep: ... |
27 28 29 |
#ifdef CONFIG_DEBUG_LOCK_ALLOC struct lockdep_map dep_map; #endif |
c2f21ce2e locking: Implemen... |
30 |
} raw_spinlock_t; |
fb1c8f93d [PATCH] spinlock ... |
31 32 |
#define SPINLOCK_MAGIC 0xdead4ead |
fb1c8f93d [PATCH] spinlock ... |
33 |
#define SPINLOCK_OWNER_INIT ((void *)-1L) |
8a25d5deb [PATCH] lockdep: ... |
34 35 36 37 38 |
#ifdef CONFIG_DEBUG_LOCK_ALLOC # define SPIN_DEP_MAP_INIT(lockname) .dep_map = { .name = #lockname } #else # define SPIN_DEP_MAP_INIT(lockname) #endif |
fb1c8f93d [PATCH] spinlock ... |
39 |
#ifdef CONFIG_DEBUG_SPINLOCK |
c2f21ce2e locking: Implemen... |
40 41 42 43 |
# define SPIN_DEBUG_INIT(lockname) \ .magic = SPINLOCK_MAGIC, \ .owner_cpu = -1, \ .owner = SPINLOCK_OWNER_INIT, |
fb1c8f93d [PATCH] spinlock ... |
44 |
#else |
c2f21ce2e locking: Implemen... |
45 |
# define SPIN_DEBUG_INIT(lockname) |
fb1c8f93d [PATCH] spinlock ... |
46 |
#endif |
c2f21ce2e locking: Implemen... |
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
#define __RAW_SPIN_LOCK_INITIALIZER(lockname) \ { \ .raw_lock = __ARCH_SPIN_LOCK_UNLOCKED, \ SPIN_DEBUG_INIT(lockname) \ SPIN_DEP_MAP_INIT(lockname) } #define __RAW_SPIN_LOCK_UNLOCKED(lockname) \ (raw_spinlock_t) __RAW_SPIN_LOCK_INITIALIZER(lockname) #define DEFINE_RAW_SPINLOCK(x) raw_spinlock_t x = __RAW_SPIN_LOCK_UNLOCKED(x) typedef struct spinlock { union { struct raw_spinlock rlock; #ifdef CONFIG_DEBUG_LOCK_ALLOC # define LOCK_PADSIZE (offsetof(struct raw_spinlock, dep_map)) struct { u8 __padding[LOCK_PADSIZE]; struct lockdep_map dep_map; }; #endif }; } spinlock_t; #define __SPIN_LOCK_INITIALIZER(lockname) \ { { .rlock = __RAW_SPIN_LOCK_INITIALIZER(lockname) } } #define __SPIN_LOCK_UNLOCKED(lockname) \ (spinlock_t ) __SPIN_LOCK_INITIALIZER(lockname) |
d1ab824be Document SPIN_LOC... |
77 |
/* |
ef12f1099 locking: Split rw... |
78 79 80 81 |
* SPIN_LOCK_UNLOCKED defeats lockdep state tracking and is hence * deprecated. * Please use DEFINE_SPINLOCK() or __SPIN_LOCK_UNLOCKED() as * appropriate. |
d1ab824be Document SPIN_LOC... |
82 |
*/ |
e4d919188 [PATCH] lockdep: ... |
83 |
#define SPIN_LOCK_UNLOCKED __SPIN_LOCK_UNLOCKED(old_style_spin_init) |
e4d919188 [PATCH] lockdep: ... |
84 85 |
#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) |
ef12f1099 locking: Split rw... |
86 87 |
#include <linux/rwlock_types.h> |
fb1c8f93d [PATCH] spinlock ... |
88 89 |
#endif /* __LINUX_SPINLOCK_TYPES_H */ |