aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m32r/spinlock.h
diff options
context:
space:
mode:
authorHirokazu Takata <takata.hirokazu@renesas.com>2006-09-27 01:50:24 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 08:26:15 -0700
commit85f651794c46e8e3faf204a767d1caa7f9f278f0 (patch)
treea57f99fa8f84c95a7a9899d1ab28a118c7ad15e3 /include/asm-m32r/spinlock.h
parenta27f3113322edff36743014cc9e752a21ffc0324 (diff)
downloadkernel_samsung_smdk4412-85f651794c46e8e3faf204a767d1caa7f9f278f0.zip
kernel_samsung_smdk4412-85f651794c46e8e3faf204a767d1caa7f9f278f0.tar.gz
kernel_samsung_smdk4412-85f651794c46e8e3faf204a767d1caa7f9f278f0.tar.bz2
[PATCH] m32r: revise __raw_read_trylock()
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>
Diffstat (limited to 'include/asm-m32r/spinlock.h')
-rw-r--r--include/asm-m32r/spinlock.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h
index f94c1a6..f9f9072 100644
--- a/include/asm-m32r/spinlock.h
+++ b/include/asm-m32r/spinlock.h
@@ -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)
{