aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-10-03 01:13:09 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-10-03 01:13:09 -0400
commitfac99d97469e7f91102f97101bea620e5f073196 (patch)
treedc1c9dfc3bebfb6fc0a2fd48b8f5c8b7a90c017a
parent2914d4da172f53f71d0563d3c3bae14e496cbc86 (diff)
sh: Fixup __raw_read_trylock().
generic__raw_read_trylock() was broken, fix up the __raw_read_trylock() implementation for something sensible. Taken from m32r, which has the same use cases. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--include/asm-sh/spinlock.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h
index 54458fd24981..2586eef07d57 100644
--- a/include/asm-sh/spinlock.h
+++ b/include/asm-sh/spinlock.h
@@ -88,7 +88,14 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
88 __raw_spin_unlock(&rw->lock); 88 __raw_spin_unlock(&rw->lock);
89} 89}
90 90
91#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 91static inline int __raw_read_trylock(raw_rwlock_t *lock)
92{
93 atomic_t *count = (atomic_t*)lock;
94 if (atomic_dec_return(count) >= 0)
95 return 1;
96 atomic_inc(count);
97 return 0;
98}
92 99
93static inline int __raw_write_trylock(raw_rwlock_t *rw) 100static inline int __raw_write_trylock(raw_rwlock_t *rw)
94{ 101{