Linux 6.13-rc4
[linux.git] / arch / sh / include / asm / futex-irq.h
blob9bc053242ea037958af5124b9ffb2ac861203c4e
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_SH_FUTEX_IRQ_H
3 #define __ASM_SH_FUTEX_IRQ_H
5 static inline int atomic_futex_op_cmpxchg_inatomic(u32 *uval,
6 u32 __user *uaddr,
7 u32 oldval, u32 newval)
9 unsigned long flags;
10 int ret;
11 u32 prev = 0;
13 local_irq_save(flags);
15 ret = get_user(prev, uaddr);
16 if (!ret && oldval == prev)
17 ret = put_user(newval, uaddr);
19 local_irq_restore(flags);
21 *uval = prev;
22 return ret;
25 #endif /* __ASM_SH_FUTEX_IRQ_H */