From 96efe71ff0eefec8b9deac4c2760d1966b25cdef Mon Sep 17 00:00:00 2001 From: Hirokazu Takata Date: Wed, 27 Sep 2006 01:50:24 -0700 Subject: [PATCH] --- yaml --- r: 36175 b: refs/heads/master c: 85f651794c46e8e3faf204a767d1caa7f9f278f0 h: refs/heads/master i: 36173: 2bc3550411899e492526ba3b7f8753c03fe8c878 36171: 04e00f49aa9045e805d90e287125af0e339c242f 36167: 7e5451fcdc6777abbac9ebef04d904730264bcbf 36159: 4864c295097bf88bf8b5ed061767111781c7c300 v: v3 --- [refs] | 2 +- trunk/include/asm-m32r/spinlock.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 5226b91ce149..13018e6126ae 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: a27f3113322edff36743014cc9e752a21ffc0324 +refs/heads/master: 85f651794c46e8e3faf204a767d1caa7f9f278f0 diff --git a/trunk/include/asm-m32r/spinlock.h b/trunk/include/asm-m32r/spinlock.h index f94c1a673569..f9f90727a4a1 100644 --- a/trunk/include/asm-m32r/spinlock.h +++ b/trunk/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) {