diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2012-10-09 17:49:54 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-10 01:15:44 -0400 |
commit | 4b2c551f77f5a0c496e2125b1d883f4b26aabf2c (patch) | |
tree | 13b861ea27340133a057b1a9e90fa5be8b4d1283 /include/linux/lglock.h | |
parent | 466cab878ef98a0618734a1fa64a02e5fbf90867 (diff) |
lglock: add DEFINE_STATIC_LGLOCK()
When the lglock doesn't need to be exported we can use
DEFINE_STATIC_LGLOCK().
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/lglock.h')
-rw-r--r-- | include/linux/lglock.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/lglock.h b/include/linux/lglock.h index 8f974517c48a..0d24e932db0b 100644 --- a/include/linux/lglock.h +++ b/include/linux/lglock.h | |||
@@ -32,7 +32,8 @@ | |||
32 | #define br_write_lock(name) lg_global_lock(name) | 32 | #define br_write_lock(name) lg_global_lock(name) |
33 | #define br_write_unlock(name) lg_global_unlock(name) | 33 | #define br_write_unlock(name) lg_global_unlock(name) |
34 | 34 | ||
35 | #define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name) | 35 | #define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name) |
36 | #define DEFINE_STATIC_BRLOCK(name) DEFINE_STATIC_LGLOCK(name) | ||
36 | 37 | ||
37 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 38 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
38 | #define LOCKDEP_INIT_MAP lockdep_init_map | 39 | #define LOCKDEP_INIT_MAP lockdep_init_map |
@@ -53,6 +54,11 @@ struct lglock { | |||
53 | = __ARCH_SPIN_LOCK_UNLOCKED; \ | 54 | = __ARCH_SPIN_LOCK_UNLOCKED; \ |
54 | struct lglock name = { .lock = &name ## _lock } | 55 | struct lglock name = { .lock = &name ## _lock } |
55 | 56 | ||
57 | #define DEFINE_STATIC_LGLOCK(name) \ | ||
58 | static DEFINE_PER_CPU(arch_spinlock_t, name ## _lock) \ | ||
59 | = __ARCH_SPIN_LOCK_UNLOCKED; \ | ||
60 | static struct lglock name = { .lock = &name ## _lock } | ||
61 | |||
56 | void lg_lock_init(struct lglock *lg, char *name); | 62 | void lg_lock_init(struct lglock *lg, char *name); |
57 | void lg_local_lock(struct lglock *lg); | 63 | void lg_local_lock(struct lglock *lg); |
58 | void lg_local_unlock(struct lglock *lg); | 64 | void lg_local_unlock(struct lglock *lg); |