ARM: 7474/1: get rid of TIF_SYSCALL_RESTARTSYS

just let do_work_pending() return 1 on normal local restarts and
-1 on those that had been caused by ERESTART_RESTARTBLOCK (and 0
is still "all done, sod off to userland now").  And let the asm
glue flip scno to restart_syscall(2) one if it got negative from
us...

[will: resolved conflicts with audit fixes]

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 99851cb..f27789e 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -591,7 +591,7 @@
 		 */
 		switch (retval) {
 		case -ERESTART_RESTARTBLOCK:
-			restart++;
+			restart -= 2;
 		case -ERESTARTNOHAND:
 		case -ERESTARTSYS:
 		case -ERESTARTNOINTR:
@@ -629,13 +629,9 @@
 		return 0;
 	}
 
-	if (unlikely(restart)) {
-		if (restart > 1)
-			set_thread_flag(TIF_SYSCALL_RESTARTSYS);
-		regs->ARM_pc = continue_addr;
-	}
-
 	restore_saved_sigmask();
+	if (unlikely(restart))
+		regs->ARM_pc = continue_addr;
 	return restart;
 }
 
@@ -650,13 +646,14 @@
 				return 0;
 			local_irq_enable();
 			if (thread_flags & _TIF_SIGPENDING) {
-				if (unlikely(do_signal(regs, syscall))) {
+				int restart = do_signal(regs, syscall);
+				if (unlikely(restart)) {
 					/*
 					 * Restart without handlers.
 					 * Deal with it without leaving
 					 * the kernel space.
 					 */
-					return 1;
+					return restart;
 				}
 				syscall = 0;
 			} else {