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