diff options
Diffstat (limited to 'include/asm-sh/spinlock.h')
-rw-r--r-- | include/asm-sh/spinlock.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/asm-sh/spinlock.h b/include/asm-sh/spinlock.h index 846322d4c35d..2586eef07d57 100644 --- a/include/asm-sh/spinlock.h +++ b/include/asm-sh/spinlock.h | |||
@@ -88,7 +88,14 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
88 | __raw_spin_unlock(&rw->lock); | 88 | __raw_spin_unlock(&rw->lock); |
89 | } | 89 | } |
90 | 90 | ||
91 | #define __raw_read_trylock(lock) generic__raw_read_trylock(lock) | 91 | static inline int __raw_read_trylock(raw_rwlock_t *lock) |
92 | { | ||
93 | atomic_t *count = (atomic_t*)lock; | ||
94 | if (atomic_dec_return(count) >= 0) | ||
95 | return 1; | ||
96 | atomic_inc(count); | ||
97 | return 0; | ||
98 | } | ||
92 | 99 | ||
93 | static inline int __raw_write_trylock(raw_rwlock_t *rw) | 100 | static inline int __raw_write_trylock(raw_rwlock_t *rw) |
94 | { | 101 | { |
@@ -100,4 +107,8 @@ static inline int __raw_write_trylock(raw_rwlock_t *rw) | |||
100 | return 0; | 107 | return 0; |
101 | } | 108 | } |
102 | 109 | ||
110 | #define _raw_spin_relax(lock) cpu_relax() | ||
111 | #define _raw_read_relax(lock) cpu_relax() | ||
112 | #define _raw_write_relax(lock) cpu_relax() | ||
113 | |||
103 | #endif /* __ASM_SH_SPINLOCK_H */ | 114 | #endif /* __ASM_SH_SPINLOCK_H */ |