From 717ebfb1522b1206ecf557b2b1ce63810f44151e Mon Sep 17 00:00:00 2001 From: Paul Mundt Date: Tue, 3 Oct 2006 14:13:09 +0900 Subject: [PATCH] --- yaml --- r: 38201 b: refs/heads/master c: fac99d97469e7f91102f97101bea620e5f073196 h: refs/heads/master i: 38199: e6ec130e57f732a116f0c85ce2f2e81b0f74ac56 v: v3 --- [refs] | 2 +- trunk/include/asm-sh/spinlock.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 31c705e39b8a..6e63379aff6d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2914d4da172f53f71d0563d3c3bae14e496cbc86 +refs/heads/master: fac99d97469e7f91102f97101bea620e5f073196 diff --git a/trunk/include/asm-sh/spinlock.h b/trunk/include/asm-sh/spinlock.h index 54458fd24981..2586eef07d57 100644 --- a/trunk/include/asm-sh/spinlock.h +++ b/trunk/include/asm-sh/spinlock.h @@ -88,7 +88,14 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) __raw_spin_unlock(&rw->lock); } -#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 *rw) {