Skip to content

Commit

Permalink
[PATCH] m32r: revise __raw_read_trylock()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hirokazu Takata authored and Linus Torvalds committed Sep 27, 2006
1 parent a27f311 commit 85f6517
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion include/asm-m32r/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down

0 comments on commit 85f6517

Please sign in to comment.