aboutsummaryrefslogtreecommitdiff
path: root/Documentation/spinlocks.txt
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-04-17 23:56:30 -0700
committerDavid S. Miller <davem@davemloft.net>2008-04-17 23:56:30 -0700
commit1e42198609d73ed1a9adcba2af275c24c2678420 (patch)
tree32fd4d9073bfc0f3909af8f9fb4bcff38951d01a /Documentation/spinlocks.txt
parent794eb6bf20ebf992c040ea831cd3a9c64b0c1f7a (diff)
parent4b119e21d0c66c22e8ca03df05d9de623d0eb50f (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'Documentation/spinlocks.txt')
-rw-r--r--Documentation/spinlocks.txt22
1 files changed, 22 insertions, 0 deletions
diff --git a/Documentation/spinlocks.txt b/Documentation/spinlocks.txt
index 471e7538977..619699dde59 100644
--- a/Documentation/spinlocks.txt
+++ b/Documentation/spinlocks.txt
@@ -5,6 +5,28 @@ Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or
__SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate for static
initialization.
+Most of the time, you can simply turn:
+
+ static spinlock_t xxx_lock = SPIN_LOCK_UNLOCKED;
+
+into:
+
+ static DEFINE_SPINLOCK(xxx_lock);
+
+Static structure member variables go from:
+
+ struct foo bar {
+ .lock = SPIN_LOCK_UNLOCKED;
+ };
+
+to:
+
+ struct foo bar {
+ .lock = __SPIN_LOCK_UNLOCKED(bar.lock);
+ };
+
+Declaration of static rw_locks undergo a similar transformation.
+
Dynamic initialization, when necessary, may be performed as
demonstrated below.