aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd L. Cashin <ecashin@coraid.com>2007-07-16 02:41:50 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-16 12:05:52 -0400
commit017f021c7e5fe3f82ccc5cbb7b1750e66e00f527 (patch)
tree755a3f0f15a4adc1254ebb2ed1497afcf406ba55
parent7e7d136e9e083f04b859411248c699cbb89e418d (diff)
docs: static initialization of spinlocks is OK
Static initialization of spinlocks is preferable to dynamic initialization when it is practical. This patch updates documentation for consistency with comments in spinlock_types.h. Signed-off-by: Ed L. Cashin <ecashin@coraid.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/spinlocks.txt20
1 files changed, 11 insertions, 9 deletions
diff --git a/Documentation/spinlocks.txt b/Documentation/spinlocks.txt
index a661d684768e..471e75389778 100644
--- a/Documentation/spinlocks.txt
+++ b/Documentation/spinlocks.txt
@@ -1,7 +1,12 @@
1UPDATE March 21 2005 Amit Gud <gud@eth.net> 1SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED defeat lockdep state tracking and
2are hence deprecated.
2 3
3Macros SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED are deprecated and will be 4Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or
4removed soon. So for any new code dynamic initialization should be used: 5__SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate for static
6initialization.
7
8Dynamic initialization, when necessary, may be performed as
9demonstrated below.
5 10
6 spinlock_t xxx_lock; 11 spinlock_t xxx_lock;
7 rwlock_t xxx_rw_lock; 12 rwlock_t xxx_rw_lock;
@@ -15,12 +20,9 @@ removed soon. So for any new code dynamic initialization should be used:
15 20
16 module_init(xxx_init); 21 module_init(xxx_init);
17 22
18Reasons for deprecation 23The following discussion is still valid, however, with the dynamic
19 - it hurts automatic lock validators 24initialization of spinlocks or with DEFINE_SPINLOCK, etc., used
20 - it becomes intrusive for the realtime preemption patches 25instead of SPIN_LOCK_UNLOCKED.
21
22Following discussion is still valid, however, with the dynamic initialization
23of spinlocks instead of static.
24 26
25----------------------- 27-----------------------
26 28