aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/random.c6
-rw-r--r--fs/dcache.c2
-rw-r--r--include/linux/idr.h2
-rw-r--r--include/linux/init_task.h10
-rw-r--r--include/linux/notifier.h2
-rw-r--r--include/linux/seqlock.h12
-rw-r--r--include/linux/spinlock_types.h15
-rw-r--r--include/linux/wait.h2
-rw-r--r--kernel/rcupdate.c4
-rw-r--r--kernel/timer.c2
-rw-r--r--mm/swap_state.c2
-rw-r--r--net/ipv4/tcp_ipv4.c2
-rw-r--r--net/ipv4/tcp_minisocks.c2
13 files changed, 37 insertions, 26 deletions
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 164bddae047f..4c3a5ca9d8f7 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -416,7 +416,7 @@ static struct entropy_store input_pool = {
416 .poolinfo = &poolinfo_table[0], 416 .poolinfo = &poolinfo_table[0],
417 .name = "input", 417 .name = "input",
418 .limit = 1, 418 .limit = 1,
419 .lock = SPIN_LOCK_UNLOCKED, 419 .lock = __SPIN_LOCK_UNLOCKED(&input_pool.lock),
420 .pool = input_pool_data 420 .pool = input_pool_data
421}; 421};
422 422
@@ -425,7 +425,7 @@ static struct entropy_store blocking_pool = {
425 .name = "blocking", 425 .name = "blocking",
426 .limit = 1, 426 .limit = 1,
427 .pull = &input_pool, 427 .pull = &input_pool,
428 .lock = SPIN_LOCK_UNLOCKED, 428 .lock = __SPIN_LOCK_UNLOCKED(&blocking_pool.lock),
429 .pool = blocking_pool_data 429 .pool = blocking_pool_data
430}; 430};
431 431
@@ -433,7 +433,7 @@ static struct entropy_store nonblocking_pool = {
433 .poolinfo = &poolinfo_table[1], 433 .poolinfo = &poolinfo_table[1],
434 .name = "nonblocking", 434 .name = "nonblocking",
435 .pull = &input_pool, 435 .pull = &input_pool,
436 .lock = SPIN_LOCK_UNLOCKED, 436 .lock = __SPIN_LOCK_UNLOCKED(&nonblocking_pool.lock),
437 .pool = nonblocking_pool_data 437 .pool = nonblocking_pool_data
438}; 438};
439 439
diff --git a/fs/dcache.c b/fs/dcache.c
index c6e3535be192..bec4de176c81 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -38,7 +38,7 @@ int sysctl_vfs_cache_pressure __read_mostly = 100;
38EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure); 38EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
39 39
40 __cacheline_aligned_in_smp DEFINE_SPINLOCK(dcache_lock); 40 __cacheline_aligned_in_smp DEFINE_SPINLOCK(dcache_lock);
41static seqlock_t rename_lock __cacheline_aligned_in_smp = SEQLOCK_UNLOCKED; 41static __cacheline_aligned_in_smp DEFINE_SEQLOCK(rename_lock);
42 42
43EXPORT_SYMBOL(dcache_lock); 43EXPORT_SYMBOL(dcache_lock);
44 44
diff --git a/include/linux/idr.h b/include/linux/idr.h
index f559a719dbe8..826803449db7 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -66,7 +66,7 @@ struct idr {
66 .id_free = NULL, \ 66 .id_free = NULL, \
67 .layers = 0, \ 67 .layers = 0, \
68 .id_free_cnt = 0, \ 68 .id_free_cnt = 0, \
69 .lock = SPIN_LOCK_UNLOCKED, \ 69 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
70} 70}
71#define DEFINE_IDR(name) struct idr name = IDR_INIT(name) 71#define DEFINE_IDR(name) struct idr name = IDR_INIT(name)
72 72
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index 678c1a90380d..1b7bb37624bb 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -21,7 +21,7 @@
21 .count = ATOMIC_INIT(1), \ 21 .count = ATOMIC_INIT(1), \
22 .fdt = &init_files.fdtab, \ 22 .fdt = &init_files.fdtab, \
23 .fdtab = INIT_FDTABLE, \ 23 .fdtab = INIT_FDTABLE, \
24 .file_lock = SPIN_LOCK_UNLOCKED, \ 24 .file_lock = __SPIN_LOCK_UNLOCKED(init_task.file_lock), \
25 .next_fd = 0, \ 25 .next_fd = 0, \
26 .close_on_exec_init = { { 0, } }, \ 26 .close_on_exec_init = { { 0, } }, \
27 .open_fds_init = { { 0, } }, \ 27 .open_fds_init = { { 0, } }, \
@@ -36,7 +36,7 @@
36 .user_id = 0, \ 36 .user_id = 0, \
37 .next = NULL, \ 37 .next = NULL, \
38 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait), \ 38 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(name.wait), \
39 .ctx_lock = SPIN_LOCK_UNLOCKED, \ 39 .ctx_lock = __SPIN_LOCK_UNLOCKED(name.ctx_lock), \
40 .reqs_active = 0U, \ 40 .reqs_active = 0U, \
41 .max_reqs = ~0U, \ 41 .max_reqs = ~0U, \
42} 42}
@@ -48,7 +48,7 @@
48 .mm_users = ATOMIC_INIT(2), \ 48 .mm_users = ATOMIC_INIT(2), \
49 .mm_count = ATOMIC_INIT(1), \ 49 .mm_count = ATOMIC_INIT(1), \
50 .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \ 50 .mmap_sem = __RWSEM_INITIALIZER(name.mmap_sem), \
51 .page_table_lock = SPIN_LOCK_UNLOCKED, \ 51 .page_table_lock = __SPIN_LOCK_UNLOCKED(name.page_table_lock), \
52 .mmlist = LIST_HEAD_INIT(name.mmlist), \ 52 .mmlist = LIST_HEAD_INIT(name.mmlist), \
53 .cpu_vm_mask = CPU_MASK_ALL, \ 53 .cpu_vm_mask = CPU_MASK_ALL, \
54} 54}
@@ -69,7 +69,7 @@
69#define INIT_SIGHAND(sighand) { \ 69#define INIT_SIGHAND(sighand) { \
70 .count = ATOMIC_INIT(1), \ 70 .count = ATOMIC_INIT(1), \
71 .action = { { { .sa_handler = NULL, } }, }, \ 71 .action = { { { .sa_handler = NULL, } }, }, \
72 .siglock = SPIN_LOCK_UNLOCKED, \ 72 .siglock = __SPIN_LOCK_UNLOCKED(sighand.siglock), \
73} 73}
74 74
75extern struct group_info init_groups; 75extern struct group_info init_groups;
@@ -119,7 +119,7 @@ extern struct group_info init_groups;
119 .list = LIST_HEAD_INIT(tsk.pending.list), \ 119 .list = LIST_HEAD_INIT(tsk.pending.list), \
120 .signal = {{0}}}, \ 120 .signal = {{0}}}, \
121 .blocked = {{0}}, \ 121 .blocked = {{0}}, \
122 .alloc_lock = SPIN_LOCK_UNLOCKED, \ 122 .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \
123 .journal_info = NULL, \ 123 .journal_info = NULL, \
124 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ 124 .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \
125 .fs_excl = ATOMIC_INIT(0), \ 125 .fs_excl = ATOMIC_INIT(0), \
diff --git a/include/linux/notifier.h b/include/linux/notifier.h
index 51dbab9710c7..7ff386a6ae87 100644
--- a/include/linux/notifier.h
+++ b/include/linux/notifier.h
@@ -65,7 +65,7 @@ struct raw_notifier_head {
65 } while (0) 65 } while (0)
66 66
67#define ATOMIC_NOTIFIER_INIT(name) { \ 67#define ATOMIC_NOTIFIER_INIT(name) { \
68 .lock = SPIN_LOCK_UNLOCKED, \ 68 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
69 .head = NULL } 69 .head = NULL }
70#define BLOCKING_NOTIFIER_INIT(name) { \ 70#define BLOCKING_NOTIFIER_INIT(name) { \
71 .rwsem = __RWSEM_INITIALIZER((name).rwsem), \ 71 .rwsem = __RWSEM_INITIALIZER((name).rwsem), \
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index 7bc5c7c12b54..46000936f8f1 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -38,9 +38,17 @@ typedef struct {
38 * These macros triggered gcc-3.x compile-time problems. We think these are 38 * These macros triggered gcc-3.x compile-time problems. We think these are
39 * OK now. Be cautious. 39 * OK now. Be cautious.
40 */ 40 */
41#define SEQLOCK_UNLOCKED { 0, SPIN_LOCK_UNLOCKED } 41#define __SEQLOCK_UNLOCKED(lockname) \
42#define seqlock_init(x) do { *(x) = (seqlock_t) SEQLOCK_UNLOCKED; } while (0) 42 { 0, __SPIN_LOCK_UNLOCKED(lockname) }
43 43
44#define SEQLOCK_UNLOCKED \
45 __SEQLOCK_UNLOCKED(old_style_seqlock_init)
46
47#define seqlock_init(x) \
48 do { *(x) = (seqlock_t) __SEQLOCK_UNLOCKED(x); } while (0)
49
50#define DEFINE_SEQLOCK(x) \
51 seqlock_t x = __SEQLOCK_UNLOCKED(x)
44 52
45/* Lock out other writers and update the count. 53/* Lock out other writers and update the count.
46 * Acts like a normal spin_lock/unlock. 54 * Acts like a normal spin_lock/unlock.
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 9cb51e070390..f5d4ed7bc785 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 */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index 544e855c7c02..bc4f389c49bb 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -68,7 +68,7 @@ struct task_struct;
68 wait_queue_t name = __WAITQUEUE_INITIALIZER(name, tsk) 68 wait_queue_t name = __WAITQUEUE_INITIALIZER(name, tsk)
69 69
70#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \ 70#define __WAIT_QUEUE_HEAD_INITIALIZER(name) { \
71 .lock = SPIN_LOCK_UNLOCKED, \ 71 .lock = __SPIN_LOCK_UNLOCKED(name.lock), \
72 .task_list = { &(name).task_list, &(name).task_list } } 72 .task_list = { &(name).task_list, &(name).task_list } }
73 73
74#define DECLARE_WAIT_QUEUE_HEAD(name) \ 74#define DECLARE_WAIT_QUEUE_HEAD(name) \
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index f464f5ae3f11..759805c9859a 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -53,13 +53,13 @@
53static struct rcu_ctrlblk rcu_ctrlblk = { 53static struct rcu_ctrlblk rcu_ctrlblk = {
54 .cur = -300, 54 .cur = -300,
55 .completed = -300, 55 .completed = -300,
56 .lock = SPIN_LOCK_UNLOCKED, 56 .lock = __SPIN_LOCK_UNLOCKED(&rcu_ctrlblk.lock),
57 .cpumask = CPU_MASK_NONE, 57 .cpumask = CPU_MASK_NONE,
58}; 58};
59static struct rcu_ctrlblk rcu_bh_ctrlblk = { 59static struct rcu_ctrlblk rcu_bh_ctrlblk = {
60 .cur = -300, 60 .cur = -300,
61 .completed = -300, 61 .completed = -300,
62 .lock = SPIN_LOCK_UNLOCKED, 62 .lock = __SPIN_LOCK_UNLOCKED(&rcu_bh_ctrlblk.lock),
63 .cpumask = CPU_MASK_NONE, 63 .cpumask = CPU_MASK_NONE,
64}; 64};
65 65
diff --git a/kernel/timer.c b/kernel/timer.c
index 5a8960253063..4dd9a10d67d0 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1208,7 +1208,7 @@ unsigned long wall_jiffies = INITIAL_JIFFIES;
1208 * playing with xtime and avenrun. 1208 * playing with xtime and avenrun.
1209 */ 1209 */
1210#ifndef ARCH_HAVE_XTIME_LOCK 1210#ifndef ARCH_HAVE_XTIME_LOCK
1211seqlock_t xtime_lock __cacheline_aligned_in_smp = SEQLOCK_UNLOCKED; 1211__cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock);
1212 1212
1213EXPORT_SYMBOL(xtime_lock); 1213EXPORT_SYMBOL(xtime_lock);
1214#endif 1214#endif
diff --git a/mm/swap_state.c b/mm/swap_state.c
index fccbd9bba77b..5f7cf2a4cb55 100644
--- a/mm/swap_state.c
+++ b/mm/swap_state.c
@@ -38,7 +38,7 @@ static struct backing_dev_info swap_backing_dev_info = {
38 38
39struct address_space swapper_space = { 39struct address_space swapper_space = {
40 .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN), 40 .page_tree = RADIX_TREE_INIT(GFP_ATOMIC|__GFP_NOWARN),
41 .tree_lock = RW_LOCK_UNLOCKED, 41 .tree_lock = __RW_LOCK_UNLOCKED(swapper_space.tree_lock),
42 .a_ops = &swap_aops, 42 .a_ops = &swap_aops,
43 .i_mmap_nonlinear = LIST_HEAD_INIT(swapper_space.i_mmap_nonlinear), 43 .i_mmap_nonlinear = LIST_HEAD_INIT(swapper_space.i_mmap_nonlinear),
44 .backing_dev_info = &swap_backing_dev_info, 44 .backing_dev_info = &swap_backing_dev_info,
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 8355b729fa95..823717285c6d 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -90,7 +90,7 @@ static struct socket *tcp_socket;
90void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); 90void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb);
91 91
92struct inet_hashinfo __cacheline_aligned tcp_hashinfo = { 92struct inet_hashinfo __cacheline_aligned tcp_hashinfo = {
93 .lhash_lock = RW_LOCK_UNLOCKED, 93 .lhash_lock = __RW_LOCK_UNLOCKED(tcp_hashinfo.lhash_lock),
94 .lhash_users = ATOMIC_INIT(0), 94 .lhash_users = ATOMIC_INIT(0),
95 .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait), 95 .lhash_wait = __WAIT_QUEUE_HEAD_INITIALIZER(tcp_hashinfo.lhash_wait),
96}; 96};
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index e0851697ad5e..0ccb7cb22b15 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -40,7 +40,7 @@ int sysctl_tcp_abort_on_overflow;
40struct inet_timewait_death_row tcp_death_row = { 40struct inet_timewait_death_row tcp_death_row = {
41 .sysctl_max_tw_buckets = NR_FILE * 2, 41 .sysctl_max_tw_buckets = NR_FILE * 2,
42 .period = TCP_TIMEWAIT_LEN / INET_TWDR_TWKILL_SLOTS, 42 .period = TCP_TIMEWAIT_LEN / INET_TWDR_TWKILL_SLOTS,
43 .death_lock = SPIN_LOCK_UNLOCKED, 43 .death_lock = __SPIN_LOCK_UNLOCKED(tcp_death_row.death_lock),
44 .hashinfo = &tcp_hashinfo, 44 .hashinfo = &tcp_hashinfo,
45 .tw_timer = TIMER_INITIALIZER(inet_twdr_hangman, 0, 45 .tw_timer = TIMER_INITIALIZER(inet_twdr_hangman, 0,
46 (unsigned long)&tcp_death_row), 46 (unsigned long)&tcp_death_row),