summaryrefslogtreecommitdiffstats
path: root/arch/sparc/lib/atomic32.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-09-28 07:38:19 +0200
committerDavid S. Miller <davem@davemloft.net>2017-09-28 07:38:19 +0200
commit23198ddffb6cddb5d5824230af4dd4b46e4046a4 (patch)
tree652e124f2107f25a2d2507057905695375414b72 /arch/sparc/lib/atomic32.c
parentsbus: char: Move D7S_MINOR to include/linux/miscdevice.h (diff)
downloadlinux-23198ddffb6cddb5d5824230af4dd4b46e4046a4.tar.xz
linux-23198ddffb6cddb5d5824230af4dd4b46e4046a4.zip
sparc32: Add cmpxchg64().
This fixes the build with i40e driver enabled. Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/lib/atomic32.c')
-rw-r--r--arch/sparc/lib/atomic32.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c
index 2c373329d5cb..ddacb5aeb424 100644
--- a/arch/sparc/lib/atomic32.c
+++ b/arch/sparc/lib/atomic32.c
@@ -172,6 +172,20 @@ unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new)
}
EXPORT_SYMBOL(__cmpxchg_u32);
+u64 __cmpxchg_u64(u64 *ptr, u64 old, u64 new)
+{
+ unsigned long flags;
+ u64 prev;
+
+ spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
+ if ((prev = *ptr) == old)
+ *ptr = new;
+ spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
+
+ return prev;
+}
+EXPORT_SYMBOL(__cmpxchg_u64);
+
unsigned long __xchg_u32(volatile u32 *ptr, u32 new)
{
unsigned long flags;