Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

Advertisement
[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.25 /Documentation/spinlocks.txt

Filename:/Documentation/spinlocks.txt
Lines Added:22
Lines Deleted:0
Also changed in: (Previous) 2.6.25-rc9  2.6.23  2.6.23-rc9  2.6.23-rc8  2.6.23-rc7  2.6.23-rc6 
(Following)

Location
[  2.6.25
  [  Documentation
     o  spinlocks.txt

Patch

diff --git a/Documentation/spinlocks.txt b/Documentation/spinlocks.txt
index 471e753..619699d 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.
 


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.