Commit 85f65179 authored by Hirokazu Takata's avatar Hirokazu Takata Committed by Linus Torvalds

[PATCH] m32r: revise __raw_read_trylock()

Signed-off-by: default avatarHirokazu Takata <takata@linux-m32r.org>
Cc: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a27f3113
...@@ -298,7 +298,14 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) ...@@ -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) static inline int __raw_write_trylock(raw_rwlock_t *lock)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment