mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-07 13:43:51 +00:00
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>
This commit is contained in:
parent
7e7d136e9e
commit
017f021c7e
@ -1,7 +1,12 @@
|
|||||||
UPDATE March 21 2005 Amit Gud <gud@eth.net>
|
SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED defeat lockdep state tracking and
|
||||||
|
are hence deprecated.
|
||||||
|
|
||||||
Macros SPIN_LOCK_UNLOCKED and RW_LOCK_UNLOCKED are deprecated and will be
|
Please use DEFINE_SPINLOCK()/DEFINE_RWLOCK() or
|
||||||
removed soon. So for any new code dynamic initialization should be used:
|
__SPIN_LOCK_UNLOCKED()/__RW_LOCK_UNLOCKED() as appropriate for static
|
||||||
|
initialization.
|
||||||
|
|
||||||
|
Dynamic initialization, when necessary, may be performed as
|
||||||
|
demonstrated below.
|
||||||
|
|
||||||
spinlock_t xxx_lock;
|
spinlock_t xxx_lock;
|
||||||
rwlock_t xxx_rw_lock;
|
rwlock_t xxx_rw_lock;
|
||||||
@ -15,12 +20,9 @@ removed soon. So for any new code dynamic initialization should be used:
|
|||||||
|
|
||||||
module_init(xxx_init);
|
module_init(xxx_init);
|
||||||
|
|
||||||
Reasons for deprecation
|
The following discussion is still valid, however, with the dynamic
|
||||||
- it hurts automatic lock validators
|
initialization of spinlocks or with DEFINE_SPINLOCK, etc., used
|
||||||
- it becomes intrusive for the realtime preemption patches
|
instead of SPIN_LOCK_UNLOCKED.
|
||||||
|
|
||||||
Following discussion is still valid, however, with the dynamic initialization
|
|
||||||
of spinlocks instead of static.
|
|
||||||
|
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user