Skip to content

Commit

Permalink
sh: Fixup __raw_read_trylock().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Paul Mundt committed Oct 3, 2006
1 parent 2914d4d commit fac99d9
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/asm-sh/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit fac99d9

Please sign in to comment.