Skip to content

Commit c81a748

Browse files
committed
sh: Emulate one-byte cmpxchg
Use the new cmpxchg_emu_u8() to emulate one-byte cmpxchg() on sh. [ paulmck: Drop two-byte support per Arnd Bergmann feedback. ] [ paulmck: Apply feedback from Naresh Kamboju. ] [ Apply Geert Uytterhoeven feedback. ] Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Cc: Andi Shyti <andi.shyti@linux.intel.com> Cc: Palmer Dabbelt <palmer@rivosinc.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: <linux-sh@vger.kernel.org> Acked-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
1 parent f2519d4 commit c81a748

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

arch/sh/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ config SUPERH
1414
select ARCH_HIBERNATION_POSSIBLE if MMU
1515
select ARCH_MIGHT_HAVE_PC_PARPORT
1616
select ARCH_WANT_IPC_PARSE_VERSION
17+
select ARCH_NEED_CMPXCHG_1_EMU
1718
select CPU_NO_EFFICIENT_FFS
1819
select DMA_DECLARE_COHERENT
1920
select GENERIC_ATOMIC64

arch/sh/include/asm/cmpxchg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
#include <linux/compiler.h>
1111
#include <linux/types.h>
12+
#include <linux/cmpxchg-emu.h>
1213

1314
#if defined(CONFIG_GUSA_RB)
1415
#include <asm/cmpxchg-grb.h>
@@ -56,6 +57,8 @@ static inline unsigned long __cmpxchg(volatile void * ptr, unsigned long old,
5657
unsigned long new, int size)
5758
{
5859
switch (size) {
60+
case 1:
61+
return cmpxchg_emu_u8(ptr, old, new);
5962
case 4:
6063
return __cmpxchg_u32(ptr, old, new);
6164
}

0 commit comments

Comments
 (0)