diff options
| author | Ed L. Cashin <ecashin@coraid.com> | 2007-07-16 02:41:50 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:52 -0400 |
| commit | 017f021c7e5fe3f82ccc5cbb7b1750e66e00f527 (patch) | |
| tree | 755a3f0f15a4adc1254ebb2ed1497afcf406ba55 | |
| parent | 7e7d136e9e083f04b859411248c699cbb89e418d (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.txt | 20 |
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 @@ | |||
| 1 | UPDATE March 21 2005 Amit Gud <gud@eth.net> | 1 | SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED defeat lockdep state tracking and |
| 2 | are hence deprecated. | ||
| 2 | 3 | ||
| 3 | Macros SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED are deprecated and will be | 4 | Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or |
| 4 | removed soon. So for any new code dynamic initialization should be used: | 5 | __SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate for static |
| 6 | initialization. | ||
| 7 | |||
| 8 | Dynamic initialization, when necessary, may be performed as | ||
| 9 | demonstrated 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 | ||
| 18 | Reasons for deprecation | 23 | The following discussion is still valid, however, with the dynamic |
| 19 | - it hurts automatic lock validators | 24 | initialization of spinlocks or with DEFINE_SPINLOCK, etc., used |
| 20 | - it becomes intrusive for the realtime preemption patches | 25 | instead of SPIN_LOCK_UNLOCKED. |
| 21 | |||
| 22 | Following discussion is still valid, however, with the dynamic initialization | ||
| 23 | of spinlocks instead of static. | ||
| 24 | 26 | ||
| 25 | ----------------------- | 27 | ----------------------- |
| 26 | 28 | ||
