From 348d467644fe5553bda73d16babe52510ef47f47 Mon Sep 17 00:00:00 2001 From: Mark Fasheh Date: Thu, 10 Apr 2008 13:55:21 -0700 Subject: [PATCH] --- yaml --- r: 88288 b: refs/heads/master c: 14dadf1d5eb5bea2dd115852cfee880505c1c169 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/spinlocks.txt | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 463796a6e56d..343d1dd1011b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: d396c5f158547e50c2b78bc984cb4a72d76e969b +refs/heads/master: 14dadf1d5eb5bea2dd115852cfee880505c1c169 diff --git a/trunk/Documentation/spinlocks.txt b/trunk/Documentation/spinlocks.txt index 471e75389778..619699dde593 100644 --- a/trunk/Documentation/spinlocks.txt +++ b/trunk/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.