summaryrefslogtreecommitdiff
path: root/arch/arm/include/asm/spinlock.h
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-11-12 10:58:27 +0000
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-11-12 10:58:27 +0000
commitec1e20a02fe33b767ffcca8920a32211492416d7 (patch)
tree85cfc0bbc1aac672b5ee4d540d1eeb2cc0d96f61 /arch/arm/include/asm/spinlock.h
parent959f58544b7f20c92d5eb43d1232c96c15c01bfb (diff)
parentaed3a4ed7222ae37860ae33cbad3ea7a6b2eaf8e (diff)
Merge branch 'misc' into for-next
Diffstat (limited to 'arch/arm/include/asm/spinlock.h')
-rw-r--r--arch/arm/include/asm/spinlock.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/arm/include/asm/spinlock.h b/arch/arm/include/asm/spinlock.h
index 4f2c28060c9a..ed6c22919e47 100644
--- a/arch/arm/include/asm/spinlock.h
+++ b/arch/arm/include/asm/spinlock.h
@@ -127,10 +127,14 @@ static inline void arch_spin_unlock(arch_spinlock_t *lock)
dsb_sev();
}
+static inline int arch_spin_value_unlocked(arch_spinlock_t lock)
+{
+ return lock.tickets.owner == lock.tickets.next;
+}
+
static inline int arch_spin_is_locked(arch_spinlock_t *lock)
{
- struct __raw_tickets tickets = ACCESS_ONCE(lock->tickets);
- return tickets.owner != tickets.next;
+ return !arch_spin_value_unlocked(ACCESS_ONCE(*lock));
}
static inline int arch_spin_is_contended(arch_spinlock_t *lock)