[PATCH] Fix sparse annotation of spin unlock macros in one case
authorPavel Roskin <proski@gnu.org>
Sat, 10 Feb 2007 09:46:37 +0000 (01:46 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sun, 11 Feb 2007 19:18:07 +0000 (11:18 -0800)
SMP systems without premption and spinlock debugging enabled use unlock
macros that don't tell sparse that the lock is being released.  Add sparse
annotations in this case.

Signed-off-by: Pavel Roskin <proski@gnu.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/spinlock.h

index 94b767d6427561297772ad556d9466333f424732..61fef376ed2e6161299719f8b3a7cfaf4f246b33 100644 (file)
@@ -228,15 +228,30 @@ do {                                                              \
 # define read_unlock_irq(lock)         _read_unlock_irq(lock)
 # define write_unlock_irq(lock)                _write_unlock_irq(lock)
 #else
-# define spin_unlock(lock)             __raw_spin_unlock(&(lock)->raw_lock)
-# define read_unlock(lock)             __raw_read_unlock(&(lock)->raw_lock)
-# define write_unlock(lock)            __raw_write_unlock(&(lock)->raw_lock)
-# define spin_unlock_irq(lock) \
-    do { __raw_spin_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
-# define read_unlock_irq(lock) \
-    do { __raw_read_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
-# define write_unlock_irq(lock) \
-    do { __raw_write_unlock(&(lock)->raw_lock); local_irq_enable(); } while (0)
+# define spin_unlock(lock) \
+    do {__raw_spin_unlock(&(lock)->raw_lock); __release(lock); } while (0)
+# define read_unlock(lock) \
+    do {__raw_read_unlock(&(lock)->raw_lock); __release(lock); } while (0)
+# define write_unlock(lock) \
+    do {__raw_write_unlock(&(lock)->raw_lock); __release(lock); } while (0)
+# define spin_unlock_irq(lock)                 \
+do {                                           \
+       __raw_spin_unlock(&(lock)->raw_lock);   \
+       __release(lock);                        \
+       local_irq_enable();                     \
+} while (0)
+# define read_unlock_irq(lock)                 \
+do {                                           \
+       __raw_read_unlock(&(lock)->raw_lock);   \
+       __release(lock);                        \
+       local_irq_enable();                     \
+} while (0)
+# define write_unlock_irq(lock)                        \
+do {                                           \
+       __raw_write_unlock(&(lock)->raw_lock);  \
+       __release(lock);                        \
+       local_irq_enable();                     \
+} while (0)
 #endif
 
 #define spin_unlock_irqrestore(lock, flags) \