[PATCH] m32r: revise __raw_read_trylock()
authorHirokazu Takata <takata.hirokazu@renesas.com>
Wed, 27 Sep 2006 08:50:24 +0000 (01:50 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 27 Sep 2006 15:26:15 +0000 (08:26 -0700)
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Cc: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/asm-m32r/spinlock.h

index f94c1a673569109cbe336c2849b7f228183bc988..f9f90727a4a1f9c88485150e380db6113d461218 100644 (file)
@@ -298,7 +298,14 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
        );
 }
 
-#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
+static inline int __raw_read_trylock(raw_rwlock_t *lock)
+{
+       atomic_t *count = (atomic_t*)lock;
+       if (atomic_dec_return(count) >= 0)
+               return 1;
+       atomic_inc(count);
+       return 0;
+}
 
 static inline int __raw_write_trylock(raw_rwlock_t *lock)
 {