diff options
Diffstat (limited to 'Documentation/spinlocks.txt')
-rw-r--r-- | Documentation/spinlocks.txt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Documentation/spinlocks.txt b/Documentation/spinlocks.txt index 471e75389778..619699dde593 100644 --- a/Documentation/spinlocks.txt +++ b/Documentation/spinlocks.txt | |||
@@ -5,6 +5,28 @@ Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or | |||
5 | __SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate for static | 5 | __SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate for static |
6 | initialization. | 6 | initialization. |
7 | 7 | ||
8 | Most of the time, you can simply turn: | ||
9 | |||
10 | static spinlock_t xxx_lock = SPIN_LOCK_UNLOCKED; | ||
11 | |||
12 | into: | ||
13 | |||
14 | static DEFINE_SPINLOCK(xxx_lock); | ||
15 | |||
16 | Static structure member variables go from: | ||
17 | |||
18 | struct foo bar { | ||
19 | .lock = SPIN_LOCK_UNLOCKED; | ||
20 | }; | ||
21 | |||
22 | to: | ||
23 | |||
24 | struct foo bar { | ||
25 | .lock = __SPIN_LOCK_UNLOCKED(bar.lock); | ||
26 | }; | ||
27 | |||
28 | Declaration of static rw_locks undergo a similar transformation. | ||
29 | |||
8 | Dynamic initialization, when necessary, may be performed as | 30 | Dynamic initialization, when necessary, may be performed as |
9 | demonstrated below. | 31 | demonstrated below. |
10 | 32 | ||