aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-arm/atomic.h
diff options
context:
space:
mode:
authorNicolas Pitre <nico@cam.org>2005-11-16 10:05:11 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-16 10:05:11 -0500
commita7d068336197945dc4af65c5973c996e526d51cb (patch)
treecbe903bef21fce0d5923cc83071b7b66d00d94c4 /include/asm-arm/atomic.h
parent224b5be6ddc12fa7587433878866cd39e7b935f5 (diff)
[ARM] 3165/1: fix atomic_cmpxchg() implementation for ARMv6+
Patch from Nicolas Pitre If 'old' and 'oldval' are different then 'res' never gets set. In that case, if ever %0 happened to contain anything but zero (rather likely) then the code will loop forever (or until another CPU just come along and change the atomic value to match 'old' which is rather unlikely). Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/asm-arm/atomic.h')
-rw-r--r--include/asm-arm/atomic.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/asm-arm/atomic.h b/include/asm-arm/atomic.h
index 75b802719723..5f827509e923 100644
--- a/include/asm-arm/atomic.h
+++ b/include/asm-arm/atomic.h
@@ -87,6 +87,7 @@ static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
87 do { 87 do {
88 __asm__ __volatile__("@ atomic_cmpxchg\n" 88 __asm__ __volatile__("@ atomic_cmpxchg\n"
89 "ldrex %1, [%2]\n" 89 "ldrex %1, [%2]\n"
90 "mov %0, #0\n"
90 "teq %1, %3\n" 91 "teq %1, %3\n"
91 "strexeq %0, %4, [%2]\n" 92 "strexeq %0, %4, [%2]\n"
92 : "=&r" (res), "=&r" (oldval) 93 : "=&r" (res), "=&r" (oldval)