summaryrefslogtreecommitdiffstats
path: root/arch/sparc/include/asm/cmpxchg_32.h
diff options
context:
space:
mode:
authorAndreas Larsson <andreas@gaisler.com>2014-11-05 15:52:08 +0100
committerDavid S. Miller <davem@davemloft.net>2014-11-07 12:51:44 -0800
commit1a17fdc4f4ed06b63fac1937470378a5441a663a (patch)
tree1590a724b9a40458ba1a990ceb41fc51839196fc /arch/sparc/include/asm/cmpxchg_32.h
parentab5c780913bca0a5763ca05dd5c2cb5cb08ccb26 (diff)
downloadtalos-op-linux-1a17fdc4f4ed06b63fac1937470378a5441a663a.tar.gz
talos-op-linux-1a17fdc4f4ed06b63fac1937470378a5441a663a.zip
sparc32: Implement xchg and atomic_xchg using ATOMIC_HASH locks
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>
Diffstat (limited to 'arch/sparc/include/asm/cmpxchg_32.h')
-rw-r--r--arch/sparc/include/asm/cmpxchg_32.h12
1 files changed, 2 insertions, 10 deletions
diff --git a/arch/sparc/include/asm/cmpxchg_32.h b/arch/sparc/include/asm/cmpxchg_32.h
index 32c29a133f9d..d38b52dca216 100644
--- a/arch/sparc/include/asm/cmpxchg_32.h
+++ b/arch/sparc/include/asm/cmpxchg_32.h
@@ -11,22 +11,14 @@
#ifndef __ARCH_SPARC_CMPXCHG__
#define __ARCH_SPARC_CMPXCHG__
-static inline unsigned long xchg_u32(__volatile__ unsigned long *m, unsigned long val)
-{
- __asm__ __volatile__("swap [%2], %0"
- : "=&r" (val)
- : "0" (val), "r" (m)
- : "memory");
- return val;
-}
-
+unsigned long __xchg_u32(volatile u32 *m, u32 new);
void __xchg_called_with_bad_pointer(void);
static inline unsigned long __xchg(unsigned long x, __volatile__ void * ptr, int size)
{
switch (size) {
case 4:
- return xchg_u32(ptr, x);
+ return __xchg_u32(ptr, x);
}
__xchg_called_with_bad_pointer();
return x;
OpenPOWER on IntegriCloud