summaryrefslogtreecommitdiff
path: root/arch/sparc/include/asm/atomic_32.h
diff options
context:
space:
mode:
authorAndreas Larsson <andreas@gaisler.com>2014-11-05 15:52:08 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-11-21 09:22:52 -0800
commit96920746658f98dbdaccc90ab818443471accc89 (patch)
tree90c3956ca5c0d736056e45ae5fa1b9136edb8459 /arch/sparc/include/asm/atomic_32.h
parent134712463afbd65c6b11193cd8000c83fc5b3a1b (diff)
sparc32: Implement xchg and atomic_xchg using ATOMIC_HASH locks
[ Upstream commit 1a17fdc4f4ed06b63fac1937470378a5441a663a ] Atomicity between xchg and cmpxchg cannot be guaranteed when xchg is implemented with a swap and cmpxchg is implemented with locks. Without this, e.g. mcs_spin_lock and mcs_spin_unlock are broken. Signed-off-by: Andreas Larsson <andreas@gaisler.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/sparc/include/asm/atomic_32.h')
-rw-r--r--arch/sparc/include/asm/atomic_32.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h
index 905832aa9e9e..a0ed182ae73c 100644
--- a/arch/sparc/include/asm/atomic_32.h
+++ b/arch/sparc/include/asm/atomic_32.h
@@ -21,7 +21,7 @@
extern int __atomic_add_return(int, atomic_t *);
extern int atomic_cmpxchg(atomic_t *, int, int);
-#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
+extern int atomic_xchg(atomic_t *, int);
extern int __atomic_add_unless(atomic_t *, int, int);
extern void atomic_set(atomic_t *, int);