public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2.6.15-rc5] Define an ia64 version of __raw_read_trylock
@ 2005-12-10  3:24 Keith Owens
  2005-12-12  2:34 ` Luck, Tony
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Keith Owens @ 2005-12-10  3:24 UTC (permalink / raw)
  To: linux-ia64

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>

Index: linux/include/asm-ia64/spinlock.h
=================================--- linux.orig/include/asm-ia64/spinlock.h	2005-12-09 14:44:56.883252331 +1100
+++ linux/include/asm-ia64/spinlock.h	2005-12-10 14:20:44.459423430 +1100
@@ -201,6 +201,16 @@ static inline void __raw_write_unlock(ra
 
 #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 */


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-12-12 13:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-10  3:24 [patch 2.6.15-rc5] Define an ia64 version of __raw_read_trylock Keith Owens
2005-12-12  2:34 ` Luck, Tony
2005-12-12  3:04 ` Keith Owens
2005-12-12  6:16 ` Zou Nan hai
2005-12-12 13:20 ` Keith Owens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox