aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKeith Owens <kaos@sgi.com>2005-12-09 22:24:28 -0500
committerTony Luck <tony.luck@intel.com>2005-12-12 11:54:18 -0500
commitbf7ececa9b68f4720f1ce344f442435660bcdae7 (patch)
tree7caff55f6ce8cfee2547ad0c93ad893c8f9583cb /include
parentf64fa6772aa874e5cad02a9d87e6b0d99ced3d48 (diff)
[IA64] Define an ia64 version of __raw_read_trylock
IA64 is using the generic version of __raw_read_trylock, which always waits for the lock to be free instead of returning when the lock is in use. Define an ia64 version of __raw_read_trylock which behaves correctly, and drop the generic one. Signed-off-by: Keith Owens <kaos@sgi.com> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-ia64/spinlock.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/asm-ia64/spinlock.h b/include/asm-ia64/spinlock.h
index 5b78611411c3..0c91a76c5ea3 100644
--- a/include/asm-ia64/spinlock.h
+++ b/include/asm-ia64/spinlock.h
@@ -201,6 +201,16 @@ static inline void __raw_write_unlock(raw_rwlock_t *x)
201 201
202#endif /* !ASM_SUPPORTED */ 202#endif /* !ASM_SUPPORTED */
203 203
204#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 204static inline int __raw_read_trylock(raw_rwlock_t *x)
205{
206 union {
207 raw_rwlock_t lock;
208 __u32 word;
209 } old, new;
210 old.lock = new.lock = *x;
211 old.lock.write_lock = new.lock.write_lock = 0;
212 ++new.lock.read_counter;
213 return (u32)ia64_cmpxchg4_acq((__u32 *)(x), new.word, old.word) == old.word;
214}
205 215
206#endif /* _ASM_IA64_SPINLOCK_H */ 216#endif /* _ASM_IA64_SPINLOCK_H */