summaryrefslogtreecommitdiffstats
path: root/arch/arc/kernel/process.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2016-11-16 10:16:28 +0100
committerIngo Molnar <mingo@kernel.org>2016-11-16 10:16:28 +0100
commit0acbc7aa4713b450ff46f9c9f6ce0060ea6947b1 (patch)
tree480508a78b7d9e9c0da0ffbd33b40e0b4e076a16 /arch/arc/kernel/process.c
parent353c50ebe329daaf2c94dc41c1c481cbba2a31fd (diff)
parent81bcfe5e48f9b8c42cf547f1c74c7f60c44c34c8 (diff)
downloadlinux-0acbc7aa4713b450ff46f9c9f6ce0060ea6947b1.tar.bz2
Merge branch 'linus' into sched/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/arc/kernel/process.c')
-rw-r--r--arch/arc/kernel/process.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/arch/arc/kernel/process.c b/arch/arc/kernel/process.c
index 59aa43cb146e..a41a79a4f4fe 100644
--- a/arch/arc/kernel/process.c
+++ b/arch/arc/kernel/process.c
@@ -43,8 +43,8 @@ SYSCALL_DEFINE0(arc_gettls)
SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
{
- int uval;
- int ret;
+ struct pt_regs *regs = current_pt_regs();
+ int uval = -EFAULT;
/*
* This is only for old cores lacking LLOCK/SCOND, which by defintion
@@ -54,24 +54,26 @@ SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
*/
WARN_ON_ONCE(IS_ENABLED(CONFIG_SMP));
+ /* Z indicates to userspace if operation succeded */
+ regs->status32 &= ~STATUS_Z_MASK;
+
if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
return -EFAULT;
preempt_disable();
- ret = __get_user(uval, uaddr);
- if (ret)
+ if (__get_user(uval, uaddr))
goto done;
- if (uval != expected)
- ret = -EAGAIN;
- else
- ret = __put_user(new, uaddr);
+ if (uval == expected) {
+ if (!__put_user(new, uaddr))
+ regs->status32 |= STATUS_Z_MASK;
+ }
done:
preempt_enable();
- return ret;
+ return uval;
}
void arch_cpu_idle(void)