Skip to content

Commit

Permalink
sparc32: Add cmpxchg64().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed Sep 28, 2017
1 parent da61e73 commit 23198dd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/sparc/include/asm/cmpxchg_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
(unsigned long)_n_, sizeof(*(ptr))); \
})

u64 __cmpxchg_u64(u64 *ptr, u64 old, u64 new);
#define cmpxchg64(ptr, old, new) __cmpxchg_u64(ptr, old, new)

#include <asm-generic/cmpxchg-local.h>

/*
Expand Down
14 changes: 14 additions & 0 deletions arch/sparc/lib/atomic32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 23198dd

Please sign in to comment.