Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33786
b: refs/heads/master
c: 8e34703
h: refs/heads/master
v: v3
  • Loading branch information
Russell King authored and Russell King committed Aug 31, 2006
1 parent 61318c8 commit 7033c84
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0355b3e039c621d15321fd0d5cf72d8bdb8f723d
refs/heads/master: 8e34703b9315688305306d26148088b0a8292563
16 changes: 15 additions & 1 deletion trunk/include/asm-arm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7033c84

Please sign in to comment.