Skip to content

Commit 23198dd

Browse files
committed
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>
1 parent da61e73 commit 23198dd

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

arch/sparc/include/asm/cmpxchg_32.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
6262
(unsigned long)_n_, sizeof(*(ptr))); \
6363
})
6464

65+
u64 __cmpxchg_u64(u64 *ptr, u64 old, u64 new);
66+
#define cmpxchg64(ptr, old, new) __cmpxchg_u64(ptr, old, new)
67+
6568
#include <asm-generic/cmpxchg-local.h>
6669

6770
/*

arch/sparc/lib/atomic32.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,20 @@ unsigned long __cmpxchg_u32(volatile u32 *ptr, u32 old, u32 new)
172172
}
173173
EXPORT_SYMBOL(__cmpxchg_u32);
174174

175+
u64 __cmpxchg_u64(u64 *ptr, u64 old, u64 new)
176+
{
177+
unsigned long flags;
178+
u64 prev;
179+
180+
spin_lock_irqsave(ATOMIC_HASH(ptr), flags);
181+
if ((prev = *ptr) == old)
182+
*ptr = new;
183+
spin_unlock_irqrestore(ATOMIC_HASH(ptr), flags);
184+
185+
return prev;
186+
}
187+
EXPORT_SYMBOL(__cmpxchg_u64);
188+
175189
unsigned long __xchg_u32(volatile u32 *ptr, u32 new)
176190
{
177191
unsigned long flags;

0 commit comments

Comments
 (0)