summary refs log tree commit diff
path: root/drivers/tty/sysrq.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-04 15:35:08 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-04 15:35:08 -0700
commitf5b63ac0f77ecab46796ba5d368ea5dd51834e6e (patch)
tree66788b3327afa62aa7f8fe05951945a2ee1e9e4e /drivers/tty/sysrq.c
parent98f486f18d16e2214728d101ed8b6a12dce75539 (diff)
parent57961e3ba72f4a8a1aa52e978020ecc2ca03a79f (diff)
downloadlinux-f5b63ac0f77ecab46796ba5d368ea5dd51834e6e.tar.gz
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:
 "First round of updates for the input subsystem.

  You will get a new touchsreen driver for Cypress 4th generation
  devices, a driver for a special controller implementing PS/2 protocol
  in OLPC devices, and a driver for power key for SiRFprimaII PWRC.

  HID and bcm5497 now support for the 2013 MacBook Air.

  EVIOCGKEY and the rest of evdev ioctls now flush events of matching
  type from the client's event queue so that clients can be sure any
  events received after issuing EVIOCG* ioctl are new events.

  And a host of cleanups and improvements in other drivers"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (87 commits)
  Input: cyttsp4 - kfree xfer_buf on error path in probe()
  Input: tps6507x-ts - select INPUT_POLLDEV
  Input: bcm5974 - add support for the 2013 MacBook Air
  HID: apple: Add support for the 2013 Macbook Air
  Input: cyttsp4 - leak on error path in probe()
  Input: cyttsp4 - silence NULL dereference warning
  Input: cyttsp4 - silence shift wrap warning
  Input: tps6507x-ts - convert to polled input device infrastructure
  ARM: davinci: da850-evm: remove vref from touchscreen platform data
  Input: cyttsp4 - SPI driver for Cypress TMA4XX touchscreen devices
  Input: cyttsp4 - I2C driver for Cypress TMA4XX touchscreen devices
  Input: cyttsp4 - add core driver for Cypress TMA4XX touchscreen devices
  Input: cyttsp - I2C driver split into two modules
  Input: add OLPC AP-SP driver
  Input: nspire-keypad - remove redundant dev_err call in nspire_keypad_probe()
  Input: tps6507x-ts - remove vref from platform data
  Input: tps6507x-ts - use bool for booleans
  Input: tps6507x-ts - remove bogus unreachable code
  Input: samsung-keypad - let device core setup the default pin configuration
  Input: wacom_i2c - implement hovering capability
  ...
Diffstat (limited to 'drivers/tty/sysrq.c')
-rw-r--r--drivers/tty/sysrq.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
index 5f68f2cfdfd0..d5cc3acecfd3 100644
--- a/drivers/tty/sysrq.c
+++ b/drivers/tty/sysrq.c
@@ -44,6 +44,7 @@
 #include <linux/uaccess.h>
 #include <linux/moduleparam.h>
 #include <linux/jiffies.h>
+#include <linux/syscalls.h>
 
 #include <asm/ptrace.h>
 #include <asm/irq_regs.h>
@@ -586,6 +587,7 @@ struct sysrq_state {
 
 	/* reset sequence handling */
 	bool reset_canceled;
+	bool reset_requested;
 	unsigned long reset_keybit[BITS_TO_LONGS(KEY_CNT)];
 	int reset_seq_len;
 	int reset_seq_cnt;
@@ -624,18 +626,26 @@ static void sysrq_parse_reset_sequence(struct sysrq_state *state)
 	state->reset_seq_version = sysrq_reset_seq_version;
 }
 
-static void sysrq_do_reset(unsigned long dummy)
+static void sysrq_do_reset(unsigned long _state)
 {
-	__handle_sysrq(sysrq_xlate[KEY_B], false);
+	struct sysrq_state *state = (struct sysrq_state *) _state;
+
+	state->reset_requested = true;
+
+	sys_sync();
+	kernel_restart(NULL);
 }
 
 static void sysrq_handle_reset_request(struct sysrq_state *state)
 {
+	if (state->reset_requested)
+		__handle_sysrq(sysrq_xlate[KEY_B], false);
+
 	if (sysrq_reset_downtime_ms)
 		mod_timer(&state->keyreset_timer,
 			jiffies + msecs_to_jiffies(sysrq_reset_downtime_ms));
 	else
-		sysrq_do_reset(0);
+		sysrq_do_reset((unsigned long)state);
 }
 
 static void sysrq_detect_reset_sequence(struct sysrq_state *state,
@@ -837,7 +847,8 @@ static int sysrq_connect(struct input_handler *handler,
 	sysrq->handle.handler = handler;
 	sysrq->handle.name = "sysrq";
 	sysrq->handle.private = sysrq;
-	setup_timer(&sysrq->keyreset_timer, sysrq_do_reset, 0);
+	setup_timer(&sysrq->keyreset_timer,
+		    sysrq_do_reset, (unsigned long)sysrq);
 
 	error = input_register_handle(&sysrq->handle);
 	if (error) {