xref: /openbmc/linux/arch/sh/include/asm/futex-irq.h (revision 82e6fdd6)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_SH_FUTEX_IRQ_H
3 #define __ASM_SH_FUTEX_IRQ_H
4 
5 static inline int atomic_futex_op_cmpxchg_inatomic(u32 *uval,
6 						   u32 __user *uaddr,
7 						   u32 oldval, u32 newval)
8 {
9 	unsigned long flags;
10 	int ret;
11 	u32 prev = 0;
12 
13 	local_irq_save(flags);
14 
15 	ret = get_user(prev, uaddr);
16 	if (!ret && oldval == prev)
17 		ret = put_user(newval, uaddr);
18 
19 	local_irq_restore(flags);
20 
21 	*uval = prev;
22 	return ret;
23 }
24 
25 #endif /* __ASM_SH_FUTEX_IRQ_H */
26