locking: Make sparse work with inline spinlocks and rwlocks
[linux-2.6.git] / include / linux / rwlock.h
index 71e0b00..bc2994e 100644 (file)
@@ -29,25 +29,25 @@ do {                                                                \
 #endif
 
 #ifdef CONFIG_DEBUG_SPINLOCK
- extern void do_raw_read_lock(rwlock_t *lock);
+ extern void do_raw_read_lock(rwlock_t *lock) __acquires(lock);
 #define do_raw_read_lock_flags(lock, flags) do_raw_read_lock(lock)
  extern int do_raw_read_trylock(rwlock_t *lock);
- extern void do_raw_read_unlock(rwlock_t *lock);
- extern void do_raw_write_lock(rwlock_t *lock);
+ extern void do_raw_read_unlock(rwlock_t *lock) __releases(lock);
+ extern void do_raw_write_lock(rwlock_t *lock) __acquires(lock);
 #define do_raw_write_lock_flags(lock, flags) do_raw_write_lock(lock)
  extern int do_raw_write_trylock(rwlock_t *lock);
- extern void do_raw_write_unlock(rwlock_t *lock);
+ extern void do_raw_write_unlock(rwlock_t *lock) __releases(lock);
 #else
-# define do_raw_read_lock(rwlock)      arch_read_lock(&(rwlock)->raw_lock)
+# define do_raw_read_lock(rwlock)      do {__acquire(lock); arch_read_lock(&(rwlock)->raw_lock); } while (0)
 # define do_raw_read_lock_flags(lock, flags) \
-               arch_read_lock_flags(&(lock)->raw_lock, *(flags))
+               do {__acquire(lock); arch_read_lock_flags(&(lock)->raw_lock, *(flags)); } while (0)
 # define do_raw_read_trylock(rwlock)   arch_read_trylock(&(rwlock)->raw_lock)
-# define do_raw_read_unlock(rwlock)    arch_read_unlock(&(rwlock)->raw_lock)
-# define do_raw_write_lock(rwlock)     arch_write_lock(&(rwlock)->raw_lock)
+# define do_raw_read_unlock(rwlock)    do {arch_read_unlock(&(rwlock)->raw_lock); __release(lock); } while (0)
+# define do_raw_write_lock(rwlock)     do {__acquire(lock); arch_write_lock(&(rwlock)->raw_lock); } while (0)
 # define do_raw_write_lock_flags(lock, flags) \
-               arch_write_lock_flags(&(lock)->raw_lock, *(flags))
+               do {__acquire(lock); arch_write_lock_flags(&(lock)->raw_lock, *(flags)); } while (0)
 # define do_raw_write_trylock(rwlock)  arch_write_trylock(&(rwlock)->raw_lock)
-# define do_raw_write_unlock(rwlock)   arch_write_unlock(&(rwlock)->raw_lock)
+# define do_raw_write_unlock(rwlock)   do {arch_write_unlock(&(rwlock)->raw_lock); __release(lock); } while (0)
 #endif
 
 #define read_can_lock(rwlock)          arch_read_can_lock(&(rwlock)->raw_lock)