Re: [PATCH 5/6] sh: Emulate two-byte cmpxchg
From: Bradley Morgan
Date: Wed Sep 16 2026 - 15:57:28 EST
On 16 September 2026 20:16:16 BST, John Paul Adrian Glaubitz
<glaubitz@xxxxxxxxxxxxxxxxxxx> wrote:
>Hi Bradley,
>
>On Fri, 2026-09-11 at 19:25 +0000, Bradley Morgan wrote:
>> SH has no byte or halfword atomic memory operations, so the
>> __cmpxchg() switch routes case 1 through cmpxchg_emu_u8() and
>> lets case 2 fall through to __cmpxchg_called_with_bad_pointer(),
>> which is declared but never defined, so a two-byte cmpxchg()
>> fails at link time. Route case 2 through the new cmpxchg_emu_u16().
>>
>> Signed-off-by: Bradley Morgan <brads@xxxxxxxxxxxxxx>
>> ---
>> arch/sh/include/asm/cmpxchg.h | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/arch/sh/include/asm/cmpxchg.h
>b/arch/sh/include/asm/cmpxchg.h
>> index 1e5dc5ccf7bf..477d3025a441 100644
>> --- a/arch/sh/include/asm/cmpxchg.h
>> +++ b/arch/sh/include/asm/cmpxchg.h
>> @@ -59,6 +59,8 @@ static inline unsigned long __cmpxchg(volatile void *
>ptr, unsigned long old,
>> switch (size) {
>> case 1:
>> return cmpxchg_emu_u8(ptr, old, new);
>> + case 2:
>> + return cmpxchg_emu_u16(ptr, old, new);
>> case 4:
>> return __cmpxchg_u32(ptr, old, new);
>> }
>
>Odd, I thought this series was merged long time ago. Was there anything
>holding it back?
>
ARM had a board where 16 bit wouldn't have been supported, so the V2 is
ready now anyway, let me add ur a-b and submit
>Either way:
>
>Acked-by: John Paul Adrian Glaubitz <glaubitz@xxxxxxxxxxxxxxxxxxx>
>
>Adrian
>
>
--- Thanks!
https://lore.kernel.org/all/EE579805-42F2-4C58-B752-F28779EEB717@xxxxxxxxx/