summaryrefslogtreecommitdiffstats
path: root/arch/sh/include/asm/futex-irq.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/include/asm/futex-irq.h')
-rw-r--r--arch/sh/include/asm/futex-irq.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/sh/include/asm/futex-irq.h b/arch/sh/include/asm/futex-irq.h
new file mode 100644
index 000000000..9bc053242
--- /dev/null
+++ b/arch/sh/include/asm/futex-irq.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __ASM_SH_FUTEX_IRQ_H
+#define __ASM_SH_FUTEX_IRQ_H
+
+static inline int atomic_futex_op_cmpxchg_inatomic(u32 *uval,
+ u32 __user *uaddr,
+ u32 oldval, u32 newval)
+{
+ unsigned long flags;
+ int ret;
+ u32 prev = 0;
+
+ local_irq_save(flags);
+
+ ret = get_user(prev, uaddr);
+ if (!ret && oldval == prev)
+ ret = put_user(newval, uaddr);
+
+ local_irq_restore(flags);
+
+ *uval = prev;
+ return ret;
+}
+
+#endif /* __ASM_SH_FUTEX_IRQ_H */