summaryrefslogtreecommitdiffstats
path: root/include/asm-m32r/spinlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-m32r/spinlock.h')
-rw-r--r--include/asm-m32r/spinlock.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/asm-m32r/spinlock.h b/include/asm-m32r/spinlock.h
index f94c1a673569..f5cfba81ee10 100644
--- a/include/asm-m32r/spinlock.h
+++ b/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)
{
@@ -309,4 +316,8 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock)
return 0;
}
+#define _raw_spin_relax(lock) cpu_relax()
+#define _raw_read_relax(lock) cpu_relax()
+#define _raw_write_relax(lock) cpu_relax()
+
#endif /* _ASM_M32R_SPINLOCK_H */