aboutsummaryrefslogtreecommitdiff
path: root/include/asm-arm/spinlock.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-02 14:51:45 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-02 14:51:45 -0700
commite694420258cb1af5eb5a06e4b1a027e8c917d027 (patch)
tree09848cd700e10fe98c3c299d0a4ecb2df1928c7d /include/asm-arm/spinlock.h
parent3b6362b833b9f7a9d4222cf1bb35f99c411abb31 (diff)
parenta188ad2bc7dbfa16ccdcaa8d43ade185b969baff (diff)
Merge master.kernel.org:/home/rmk/linux-2.6-arm
* master.kernel.org:/home/rmk/linux-2.6-arm: [ARM] 3762/1: Fix ptrace cache coherency bug for ARM1136 VIPT nonaliasing Harvard caches [ARM] 3765/1: S3C24XX: cleanup include/asm-arm/arch-s3c2410/dma.h [ARM] 3764/1: S3C24XX: change type naming to kernel style [ARM] 3763/1: add both rtcs to csb337 defconfig [ARM] Fix ARM __raw_read_trylock() implementation [ARM] 3750/3: Fix double VFP emulation for EABI kernels
Diffstat (limited to 'include/asm-arm/spinlock.h')
-rw-r--r--include/asm-arm/spinlock.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/asm-arm/spinlock.h b/include/asm-arm/spinlock.h
index 406ca97a8ab..e2f1d75171d 100644
--- a/include/asm-arm/spinlock.h
+++ b/include/asm-arm/spinlock.h
@@ -199,7 +199,21 @@ static inline void __raw_read_unlock(raw_rwlock_t *rw)
: "cc");
}
-#define __raw_read_trylock(lock) generic__raw_read_trylock(lock)
+static inline int __raw_read_trylock(raw_rwlock_t *rw)
+{
+ unsigned long tmp tmp2 = 1;
+
+ __asm__ __volatile__(
+"1: ldrex %0, [%2]\n"
+" adds %0, %0, #1\n"
+" strexpl %1, %0, [%2]\n"
+ : "=&r" (tmp), "+r" (tmp2)
+ : "r" (&rw->lock)
+ : "cc");
+
+ smp_mb();
+ return tmp2 == 0;
+}
/* read_can_lock - would read_trylock() succeed? */
#define __raw_read_can_lock(x) ((x)->lock < 0x80000000)