aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm/spinlock.h
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-04 06:41:37 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-04 06:41:37 -0400
commitf9bcda7760e1373615c9f6d9ce24209b0ab97de1 (patch)
treef90b3031126c4e4beb8161f38ea436303e2b8b73 /include/asm-arm/spinlock.h
parent9bec2e38527a9f2497b3d976715c672d08d6160d (diff)
parentc336923b668fdcf0312efbec3b44895d713f4d81 (diff)
Merge branch 'master' into upstream
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 406ca97a8ab2..e2f1d75171df 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)
199 : "cc"); 199 : "cc");
200} 200}
201 201
202#define __raw_read_trylock(lock) generic__raw_read_trylock(lock) 202static inline int __raw_read_trylock(raw_rwlock_t *rw)
203{
204 unsigned long tmp tmp2 = 1;
205
206 __asm__ __volatile__(
207"1: ldrex %0, [%2]\n"
208" adds %0, %0, #1\n"
209" strexpl %1, %0, [%2]\n"
210 : "=&r" (tmp), "+r" (tmp2)
211 : "r" (&rw->lock)
212 : "cc");
213
214 smp_mb();
215 return tmp2 == 0;
216}
203 217
204/* read_can_lock - would read_trylock() succeed? */ 218/* read_can_lock - would read_trylock() succeed? */
205#define __raw_read_can_lock(x) ((x)->lock < 0x80000000) 219#define __raw_read_can_lock(x) ((x)->lock < 0x80000000)