From d84b8c41a6544419f6f2a408e88f521e3d89c21a Mon Sep 17 00:00:00 2001 From: Keith Owens Date: Sat, 10 Dec 2005 14:24:28 +1100 Subject: [PATCH] --- yaml --- r: 15083 b: refs/heads/master c: bf7ececa9b68f4720f1ce344f442435660bcdae7 h: refs/heads/master i: 15081: 5857f6b96fdaa3586e8ce067bd935c58c05b5cab 15079: 516182494413a52b66127df19afd6486ff56fdd5 v: v3 --- [refs] | 2 +- trunk/include/asm-ia64/spinlock.h | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 17affb4bb4ac..a5e1702141f1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f64fa6772aa874e5cad02a9d87e6b0d99ced3d48 +refs/heads/master: bf7ececa9b68f4720f1ce344f442435660bcdae7 diff --git a/trunk/include/asm-ia64/spinlock.h b/trunk/include/asm-ia64/spinlock.h index 5b78611411c3..0c91a76c5ea3 100644 --- a/trunk/include/asm-ia64/spinlock.h +++ b/trunk/include/asm-ia64/spinlock.h @@ -201,6 +201,16 @@ static inline void __raw_write_unlock(raw_rwlock_t *x) #endif /* !ASM_SUPPORTED */ -#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) +static inline int __raw_read_trylock(raw_rwlock_t *x) +{ + union { + raw_rwlock_t lock; + __u32 word; + } old, new; + old.lock = new.lock = *x; + old.lock.write_lock = new.lock.write_lock = 0; + ++new.lock.read_counter; + return (u32)ia64_cmpxchg4_acq((__u32 *)(x), new.word, old.word) == old.word; +} #endif /* _ASM_IA64_SPINLOCK_H */