Browse Source

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input subsystem updates from Dmitry Torokhov:
 "Just a swath of driver fixes and cleanups, no new drivers this time
  (although ALPS now supports one of the newer protocols, more to come)"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits)
  Input: wacom - add support for DTU-1031
  Input: wacom - fix wacom->shared guards for dual input devices
  Input: edt_ft5x06 - use devm_* functions where appropriate
  Input: hyperv-keyboard - pass through 0xE1 prefix
  Input: logips2pp - fix spelling s/reciver/receiver/
  Input: delete non-required instances of include <linux/init.h>
  Input: twl4030-keypad - convert to using managed resources
  Input: twl6040-vibra - remove unneeded check for CONFIG_OF
  Input: twl4030-keypad - add device tree support
  Input: twl6040-vibra - add missing of_node_put
  Input: twl4030-vibra - add missing of_node_put
  Input: i8042 - cleanup SERIO_I8042 dependencies
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on x86
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on unicore32
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on sparc
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO for SH_CAYMAN
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on powerpc
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on mips
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on IA64
  Input: i8042 - select ARCH_MIGHT_HAVE_PC_SERIO on ARM/Footbridge
  ...
Linus Torvalds 11 years ago
parent
commit
1b59bab55e
100 changed files with 482 additions and 226 deletions
  1. 13 0
      Documentation/devicetree/bindings/input/gpio-beeper.txt
  2. 41 0
      Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt
  3. 27 0
      Documentation/devicetree/bindings/input/twl4030-keypad.txt
  4. 21 0
      Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
  5. 3 3
      Documentation/input/gamepad.txt
  6. 19 19
      Documentation/input/joystick-api.txt
  7. 4 4
      Documentation/input/joystick.txt
  8. 1 0
      arch/alpha/Kconfig
  9. 1 0
      arch/arm/mach-footbridge/Kconfig
  10. 1 1
      arch/arm/mach-imx/mach-cpuimx35.c
  11. 1 1
      arch/arm/mach-imx/mach-cpuimx51sd.c
  12. 1 0
      arch/ia64/Kconfig
  13. 1 0
      arch/mips/Kconfig
  14. 1 0
      arch/powerpc/Kconfig
  15. 1 0
      arch/sh/boards/Kconfig
  16. 1 1
      arch/sh/boards/mach-ecovec24/setup.c
  17. 1 0
      arch/sparc/Kconfig
  18. 1 0
      arch/unicore32/Kconfig
  19. 1 0
      arch/x86/Kconfig
  20. 0 1
      drivers/input/gameport/emu10k1-gp.c
  21. 0 1
      drivers/input/gameport/fm801-gp.c
  22. 57 19
      drivers/input/input.c
  23. 0 1
      drivers/input/joystick/a3d.c
  24. 0 1
      drivers/input/joystick/adi.c
  25. 0 1
      drivers/input/joystick/cobra.c
  26. 0 1
      drivers/input/joystick/gf2k.c
  27. 0 1
      drivers/input/joystick/grip.c
  28. 0 1
      drivers/input/joystick/grip_mp.c
  29. 0 1
      drivers/input/joystick/guillemot.c
  30. 0 1
      drivers/input/joystick/iforce/iforce.h
  31. 0 1
      drivers/input/joystick/interact.c
  32. 0 1
      drivers/input/joystick/joydump.c
  33. 0 1
      drivers/input/joystick/magellan.c
  34. 0 1
      drivers/input/joystick/sidewinder.c
  35. 0 1
      drivers/input/joystick/spaceball.c
  36. 0 1
      drivers/input/joystick/spaceorb.c
  37. 0 1
      drivers/input/joystick/stinger.c
  38. 0 1
      drivers/input/joystick/tmdc.c
  39. 0 1
      drivers/input/joystick/twidjoy.c
  40. 0 1
      drivers/input/joystick/warrior.c
  41. 4 3
      drivers/input/joystick/xpad.c
  42. 0 1
      drivers/input/joystick/zhenhua.c
  43. 1 1
      drivers/input/keyboard/Kconfig
  44. 1 2
      drivers/input/keyboard/adp5520-keys.c
  45. 6 5
      drivers/input/keyboard/adp5588-keys.c
  46. 4 5
      drivers/input/keyboard/adp5589-keys.c
  47. 2 3
      drivers/input/keyboard/bf54x-keys.c
  48. 11 4
      drivers/input/keyboard/cros_ec_keyb.c
  49. 1 1
      drivers/input/keyboard/davinci_keyscan.c
  50. 1 1
      drivers/input/keyboard/ep93xx_keypad.c
  51. 0 1
      drivers/input/keyboard/goldfish_events.c
  52. 0 1
      drivers/input/keyboard/gpio_keys_polled.c
  53. 0 1
      drivers/input/keyboard/hil_kbd.c
  54. 2 2
      drivers/input/keyboard/imx_keypad.c
  55. 0 1
      drivers/input/keyboard/jornada680_kbd.c
  56. 0 1
      drivers/input/keyboard/jornada720_kbd.c
  57. 0 1
      drivers/input/keyboard/lkkbd.c
  58. 1 1
      drivers/input/keyboard/lm8323.c
  59. 2 1
      drivers/input/keyboard/lm8333.c
  60. 0 1
      drivers/input/keyboard/matrix_keypad.c
  61. 2 1
      drivers/input/keyboard/max7359_keypad.c
  62. 1 2
      drivers/input/keyboard/mcs_touchkey.c
  63. 2 2
      drivers/input/keyboard/mpr121_touchkey.c
  64. 0 1
      drivers/input/keyboard/newtonkbd.c
  65. 2 1
      drivers/input/keyboard/nomadik-ske-keypad.c
  66. 1 2
      drivers/input/keyboard/omap-keypad.c
  67. 0 1
      drivers/input/keyboard/omap4-keypad.c
  68. 0 1
      drivers/input/keyboard/pxa27x_keypad.c
  69. 2 2
      drivers/input/keyboard/pxa930_rotary.c
  70. 0 1
      drivers/input/keyboard/qt1070.c
  71. 0 1
      drivers/input/keyboard/qt2160.c
  72. 21 16
      drivers/input/keyboard/samsung-keypad.c
  73. 2 3
      drivers/input/keyboard/sh_keysc.c
  74. 0 1
      drivers/input/keyboard/spear-keyboard.c
  75. 0 1
      drivers/input/keyboard/stmpe-keypad.c
  76. 0 1
      drivers/input/keyboard/stowaway.c
  77. 0 1
      drivers/input/keyboard/sunkbd.c
  78. 0 1
      drivers/input/keyboard/tc3589x-keypad.c
  79. 1 1
      drivers/input/keyboard/tca6416-keypad.c
  80. 1 1
      drivers/input/keyboard/tnetv107x-keypad.c
  81. 64 58
      drivers/input/keyboard/twl4030_keypad.c
  82. 1 2
      drivers/input/keyboard/w90p910_keypad.c
  83. 0 1
      drivers/input/keyboard/xtkbd.c
  84. 9 0
      drivers/input/misc/Kconfig
  85. 1 0
      drivers/input/misc/Makefile
  86. 2 3
      drivers/input/misc/ad714x.c
  87. 1 2
      drivers/input/misc/adxl34x.c
  88. 0 1
      drivers/input/misc/atlas_btns.c
  89. 1 2
      drivers/input/misc/bfin_rotary.c
  90. 2 1
      drivers/input/misc/bma150.c
  91. 1 1
      drivers/input/misc/cma3000_d0x.c
  92. 0 1
      drivers/input/misc/cobalt_btns.c
  93. 0 1
      drivers/input/misc/da9052_onkey.c
  94. 0 1
      drivers/input/misc/da9055_onkey.c
  95. 0 1
      drivers/input/misc/dm355evm_keys.c
  96. 1 1
      drivers/input/misc/gp2ap002a00f.c
  97. 127 0
      drivers/input/misc/gpio-beeper.c
  98. 2 2
      drivers/input/misc/gpio_tilt_polled.c
  99. 0 1
      drivers/input/misc/keyspan_remote.c
  100. 2 1
      drivers/input/misc/kxtj9.c

+ 13 - 0
Documentation/devicetree/bindings/input/gpio-beeper.txt

@@ -0,0 +1,13 @@
+* GPIO beeper device tree bindings
+
+Register a beeper connected to GPIO pin.
+
+Required properties:
+- compatible:	Should be "gpio-beeper".
+- gpios:	From common gpio binding; gpio connection to beeper enable pin.
+
+Example:
+	beeper: beeper {
+		compatible = "gpio-beeper";
+		gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>;
+	};

+ 41 - 0
Documentation/devicetree/bindings/input/touchscreen/tsc2007.txt

@@ -0,0 +1,41 @@
+* Texas Instruments tsc2007 touchscreen controller
+
+Required properties:
+- compatible: must be "ti,tsc2007".
+- reg: I2C address of the chip.
+- ti,x-plate-ohms: X-plate resistance in ohms.
+
+Optional properties:
+- gpios: the interrupt gpio the chip is connected to (trough the penirq pin).
+  The penirq pin goes to low when the panel is touched.
+  (see GPIO binding[1] for more details).
+- interrupt-parent: the phandle for the gpio controller
+  (see interrupt binding[0]).
+- interrupts: (gpio) interrupt to which the chip is connected
+  (see interrupt binding[0]).
+- ti,max-rt: maximum pressure.
+- ti,fuzzx: specifies the absolute input fuzz x value.
+  If set, it will permit noise in the data up to +- the value given to the fuzz
+  parameter, that is used to filter noise from the event stream.
+- ti,fuzzy: specifies the absolute input fuzz y value.
+- ti,fuzzz: specifies the absolute input fuzz z value.
+- ti,poll-period: how much time to wait (in milliseconds) before reading again the
+  values from the tsc2007.
+
+[0]: Documentation/devicetree/bindings/interrupt-controller/interrupts.txt
+[1]: Documentation/devicetree/bindings/gpio/gpio.txt
+
+Example:
+	&i2c1 {
+		/* ... */
+		tsc2007@49 {
+			compatible = "ti,tsc2007";
+			reg = <0x49>;
+			interrupt-parent = <&gpio4>;
+			interrupts = <0x0 0x8>;
+			gpios = <&gpio4 0 0>;
+			ti,x-plate-ohms = <180>;
+		};
+
+		/* ... */
+	};

+ 27 - 0
Documentation/devicetree/bindings/input/twl4030-keypad.txt

@@ -0,0 +1,27 @@
+* TWL4030's Keypad Controller device tree bindings
+
+TWL4030's Keypad controller is used to interface a SoC with a matrix-type
+keypad device. The keypad controller supports multiple row and column lines.
+A key can be placed at each intersection of a unique row and a unique column.
+The keypad controller can sense a key-press and key-release and report the
+event using a interrupt to the cpu.
+
+This binding is based on the matrix-keymap binding with the following
+changes:
+
+ * keypad,num-rows and keypad,num-columns are required.
+
+Required SoC Specific Properties:
+- compatible: should be one of the following
+   - "ti,twl4030-keypad": For controllers compatible with twl4030 keypad
+      controller.
+- interrupt: should be one of the following
+   - <1>: For controllers compatible with twl4030 keypad controller.
+
+Example:
+	twl_keypad: keypad {
+		compatible = "ti,twl4030-keypad";
+		interrupts = <1>;
+		keypad,num-rows = <8>;
+		keypad,num-columns = <8>;
+	};

+ 21 - 0
Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt

@@ -0,0 +1,21 @@
+Texas Instruments TWL family (twl4030) pwrbutton module
+
+This module is part of the TWL4030. For more details about the whole
+chip see Documentation/devicetree/bindings/mfd/twl-familly.txt.
+
+This module provides a simple power button event via an Interrupt.
+
+Required properties:
+- compatible: should be one of the following
+   - "ti,twl4030-pwrbutton": For controllers compatible with twl4030
+- interrupts: should be one of the following
+   - <8>: For controllers compatible with twl4030
+
+Example:
+
+&twl {
+	twl_pwrbutton: pwrbutton {
+		compatible = "ti,twl4030-pwrbutton";
+		interrupts = <8>;
+	};
+};

+ 3 - 3
Documentation/input/gamepad.txt

@@ -68,7 +68,7 @@ features that you need, first. How each feature is mapped is described below.
 Legacy drivers often don't comply to these rules. As we cannot change them
 Legacy drivers often don't comply to these rules. As we cannot change them
 for backwards-compatibility reasons, you need to provide fixup mappings in
 for backwards-compatibility reasons, you need to provide fixup mappings in
 user-space yourself. Some of them might also provide module-options that
 user-space yourself. Some of them might also provide module-options that
-change the mappings so you can adivce users to set these.
+change the mappings so you can advise users to set these.
 
 
 All new gamepads are supposed to comply with this mapping. Please report any
 All new gamepads are supposed to comply with this mapping. Please report any
 bugs, if they don't.
 bugs, if they don't.
@@ -150,10 +150,10 @@ Menu-Pad:
                   BTN_START
                   BTN_START
   Many pads also have a third button which is branded or has a special symbol
   Many pads also have a third button which is branded or has a special symbol
   and meaning. Such buttons are mapped as BTN_MODE. Examples are the Nintendo
   and meaning. Such buttons are mapped as BTN_MODE. Examples are the Nintendo
-  "HOME" button, the XBox "X"-button or Sony "P" button.
+  "HOME" button, the XBox "X"-button or Sony "PS" button.
 
 
 Rumble:
 Rumble:
-  Rumble is adverticed as FF_RUMBLE.
+  Rumble is advertised as FF_RUMBLE.
 
 
 ----------------------------------------------------------------------------
 ----------------------------------------------------------------------------
   Written 2013 by David Herrmann <dh.herrmann@gmail.com>
   Written 2013 by David Herrmann <dh.herrmann@gmail.com>

+ 19 - 19
Documentation/input/joystick-api.txt

@@ -16,14 +16,14 @@ joystick.
 
 
 By default, the device is opened in blocking mode.
 By default, the device is opened in blocking mode.
 
 
-	int fd = open ("/dev/js0", O_RDONLY);
+	int fd = open ("/dev/input/js0", O_RDONLY);
 
 
 
 
 2. Event Reading
 2. Event Reading
 ~~~~~~~~~~~~~~~~
 ~~~~~~~~~~~~~~~~
 
 
 	struct js_event e;
 	struct js_event e;
-	read (fd, &e, sizeof(struct js_event));
+	read (fd, &e, sizeof(e));
 
 
 where js_event is defined as
 where js_event is defined as
 
 
@@ -34,8 +34,8 @@ where js_event is defined as
 		__u8 number;    /* axis/button number */
 		__u8 number;    /* axis/button number */
 	};
 	};
 
 
-If the read is successful, it will return sizeof(struct js_event), unless
-you wanted to read more than one event per read as described in section 3.1.
+If the read is successful, it will return sizeof(e), unless you wanted to read
+more than one event per read as described in section 3.1.
 
 
 
 
 2.1 js_event.type
 2.1 js_event.type
@@ -99,9 +99,9 @@ may work well if you handle JS_EVENT_INIT events separately,
 
 
 	if ((js_event.type & ~JS_EVENT_INIT) == JS_EVENT_BUTTON) {
 	if ((js_event.type & ~JS_EVENT_INIT) == JS_EVENT_BUTTON) {
 		if (js_event.value)
 		if (js_event.value)
-	        	buttons_state |= (1 << js_event.number);
-	   	else
-	      		buttons_state &= ~(1 << js_event.number);
+			buttons_state |= (1 << js_event.number);
+		else
+			buttons_state &= ~(1 << js_event.number);
 	}
 	}
 
 
 is much safer since it can't lose sync with the driver. As you would
 is much safer since it can't lose sync with the driver. As you would
@@ -144,14 +144,14 @@ all events on the queue (that is, until you get a -1).
 For example,
 For example,
 
 
 	while (1) {
 	while (1) {
-		while (read (fd, &e, sizeof(struct js_event)) > 0) {
-	        	process_event (e);
-	   	}
-	   	/* EAGAIN is returned when the queue is empty */
-	   	if (errno != EAGAIN) {
-	      		/* error */
-	   	}
-	   	/* do something interesting with processed events */
+		while (read (fd, &e, sizeof(e)) > 0) {
+			process_event (e);
+		}
+		/* EAGAIN is returned when the queue is empty */
+		if (errno != EAGAIN) {
+			/* error */
+		}
+		/* do something interesting with processed events */
 	}
 	}
 
 
 One reason for emptying the queue is that if it gets full you'll start
 One reason for emptying the queue is that if it gets full you'll start
@@ -181,7 +181,7 @@ at a time using the typical read(2) functionality. For that, you would
 replace the read above with something like
 replace the read above with something like
 
 
 	struct js_event mybuffer[0xff];
 	struct js_event mybuffer[0xff];
-	int i = read (fd, mybuffer, sizeof(struct mybuffer));
+	int i = read (fd, mybuffer, sizeof(mybuffer));
 
 
 In this case, read would return -1 if the queue was empty, or some
 In this case, read would return -1 if the queue was empty, or some
 other value in which the number of events read would be i /
 other value in which the number of events read would be i /
@@ -269,9 +269,9 @@ The driver offers backward compatibility, though. Here's a quick summary:
 	struct JS_DATA_TYPE js;
 	struct JS_DATA_TYPE js;
 	while (1) {
 	while (1) {
 		if (read (fd, &js, JS_RETURN) != JS_RETURN) {
 		if (read (fd, &js, JS_RETURN) != JS_RETURN) {
-	      		/* error */
-	   	}
-	   	usleep (1000);
+			/* error */
+		}
+		usleep (1000);
 	}
 	}
 
 
 As you can figure out from the example, the read returns immediately,
 As you can figure out from the example, the read returns immediately,

+ 4 - 4
Documentation/input/joystick.txt

@@ -116,7 +116,7 @@ your needs:
   For testing the joystick driver functionality, there is the jstest
   For testing the joystick driver functionality, there is the jstest
 program in the utilities package. You run it by typing:
 program in the utilities package. You run it by typing:
 
 
-	jstest /dev/js0
+	jstest /dev/input/js0
 
 
   And it should show a line with the joystick values, which update as you
   And it should show a line with the joystick values, which update as you
 move the stick, and press its buttons. The axes should all be zero when the
 move the stick, and press its buttons. The axes should all be zero when the
@@ -136,7 +136,7 @@ joystick should be autocalibrated by the driver automagically. However, with
 some analog joysticks, that either do not use linear resistors, or if you
 some analog joysticks, that either do not use linear resistors, or if you
 want better precision, you can use the jscal program
 want better precision, you can use the jscal program
 
 
-	jscal -c /dev/js0
+	jscal -c /dev/input/js0
 
 
  included in the joystick package to set better correction coefficients than
  included in the joystick package to set better correction coefficients than
 what the driver would choose itself.
 what the driver would choose itself.
@@ -145,7 +145,7 @@ what the driver would choose itself.
 calibration using the jstest command, and if you do, you then can save the
 calibration using the jstest command, and if you do, you then can save the
 correction coefficients into a file
 correction coefficients into a file
 
 
-	jscal -p /dev/js0 > /etc/joystick.cal
+	jscal -p /dev/input/js0 > /etc/joystick.cal
 
 
   And add a line to your rc script executing that file
   And add a line to your rc script executing that file
 
 
@@ -556,7 +556,7 @@ interface, and "old" for the "0.x" interface. You run it by typing:
 
 
 5. FAQ
 5. FAQ
 ~~~~~~
 ~~~~~~
-Q: Running 'jstest /dev/js0' results in "File not found" error. What's the
+Q: Running 'jstest /dev/input/js0' results in "File not found" error. What's the
    cause?
    cause?
 A: The device files don't exist. Create them (see section 2.2).
 A: The device files don't exist. Create them (see section 2.2).
 
 

+ 1 - 0
arch/alpha/Kconfig

@@ -2,6 +2,7 @@ config ALPHA
 	bool
 	bool
 	default y
 	default y
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_MIGHT_HAVE_PC_PARPORT
+	select ARCH_MIGHT_HAVE_PC_SERIO
 	select HAVE_AOUT
 	select HAVE_AOUT
 	select HAVE_IDE
 	select HAVE_IDE
 	select HAVE_OPROFILE
 	select HAVE_OPROFILE

+ 1 - 0
arch/arm/mach-footbridge/Kconfig

@@ -85,6 +85,7 @@ config FOOTBRIDGE
 # Footbridge in host mode
 # Footbridge in host mode
 config FOOTBRIDGE_HOST
 config FOOTBRIDGE_HOST
 	bool
 	bool
+	select ARCH_MIGHT_HAVE_PC_SERIO
 
 
 # Footbridge in addin mode
 # Footbridge in addin mode
 config FOOTBRIDGE_ADDIN
 config FOOTBRIDGE_ADDIN

+ 1 - 1
arch/arm/mach-imx/mach-cpuimx35.c

@@ -53,7 +53,7 @@ static const struct imxi2c_platform_data
 };
 };
 
 
 #define TSC2007_IRQGPIO		IMX_GPIO_NR(3, 2)
 #define TSC2007_IRQGPIO		IMX_GPIO_NR(3, 2)
-static int tsc2007_get_pendown_state(void)
+static int tsc2007_get_pendown_state(struct device *dev)
 {
 {
 	return !gpio_get_value(TSC2007_IRQGPIO);
 	return !gpio_get_value(TSC2007_IRQGPIO);
 }
 }

+ 1 - 1
arch/arm/mach-imx/mach-cpuimx51sd.c

@@ -121,7 +121,7 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
 	.flags = IMXUART_HAVE_RTSCTS,
 	.flags = IMXUART_HAVE_RTSCTS,
 };
 };
 
 
-static int tsc2007_get_pendown_state(void)
+static int tsc2007_get_pendown_state(struct device *dev)
 {
 {
 	if (mx51_revision() < IMX_CHIP_REVISION_3_0)
 	if (mx51_revision() < IMX_CHIP_REVISION_3_0)
 		return !gpio_get_value(TSC2007_IRQGPIO_REV2);
 		return !gpio_get_value(TSC2007_IRQGPIO_REV2);

+ 1 - 0
arch/ia64/Kconfig

@@ -7,6 +7,7 @@ menu "Processor type and features"
 config IA64
 config IA64
 	bool
 	bool
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_MIGHT_HAVE_PC_PARPORT
+	select ARCH_MIGHT_HAVE_PC_SERIO
 	select PCI if (!IA64_HP_SIM)
 	select PCI if (!IA64_HP_SIM)
 	select ACPI if (!IA64_HP_SIM)
 	select ACPI if (!IA64_HP_SIM)
 	select PM if (!IA64_HP_SIM)
 	select PM if (!IA64_HP_SIM)

+ 1 - 0
arch/mips/Kconfig

@@ -2,6 +2,7 @@ config MIPS
 	bool
 	bool
 	default y
 	default y
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_MIGHT_HAVE_PC_PARPORT
+	select ARCH_MIGHT_HAVE_PC_SERIO
 	select HAVE_CONTEXT_TRACKING
 	select HAVE_CONTEXT_TRACKING
 	select HAVE_GENERIC_DMA_COHERENT
 	select HAVE_GENERIC_DMA_COHERENT
 	select HAVE_IDE
 	select HAVE_IDE

+ 1 - 0
arch/powerpc/Kconfig

@@ -86,6 +86,7 @@ config PPC
 	bool
 	bool
 	default y
 	default y
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_MIGHT_HAVE_PC_PARPORT
+	select ARCH_MIGHT_HAVE_PC_SERIO
 	select BINFMT_ELF
 	select BINFMT_ELF
 	select OF
 	select OF
 	select OF_EARLY_FLATTREE
 	select OF_EARLY_FLATTREE

+ 1 - 0
arch/sh/boards/Kconfig

@@ -321,6 +321,7 @@ config SH_CAYMAN
 	bool "Hitachi Cayman"
 	bool "Hitachi Cayman"
 	depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103
 	depends on CPU_SUBTYPE_SH5_101 || CPU_SUBTYPE_SH5_103
 	select SYS_SUPPORTS_PCI
 	select SYS_SUPPORTS_PCI
+	select ARCH_MIGHT_HAVE_PC_SERIO
 
 
 config SH_POLARIS
 config SH_POLARIS
 	bool "SMSC Polaris"
 	bool "SMSC Polaris"

+ 1 - 1
arch/sh/boards/mach-ecovec24/setup.c

@@ -502,7 +502,7 @@ static struct platform_device keysc_device = {
 /* TouchScreen */
 /* TouchScreen */
 #define IRQ0 evt2irq(0x600)
 #define IRQ0 evt2irq(0x600)
 
 
-static int ts_get_pendown_state(void)
+static int ts_get_pendown_state(struct device *dev)
 {
 {
 	int val = 0;
 	int val = 0;
 	gpio_free(GPIO_FN_INTC_IRQ0);
 	gpio_free(GPIO_FN_INTC_IRQ0);

+ 1 - 0
arch/sparc/Kconfig

@@ -13,6 +13,7 @@ config SPARC
 	bool
 	bool
 	default y
 	default y
 	select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
 	select ARCH_MIGHT_HAVE_PC_PARPORT if SPARC64 && PCI
+	select ARCH_MIGHT_HAVE_PC_SERIO
 	select OF
 	select OF
 	select OF_PROMTREE
 	select OF_PROMTREE
 	select HAVE_IDE
 	select HAVE_IDE

+ 1 - 0
arch/unicore32/Kconfig

@@ -1,6 +1,7 @@
 config UNICORE32
 config UNICORE32
 	def_bool y
 	def_bool y
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_MIGHT_HAVE_PC_PARPORT
+	select ARCH_MIGHT_HAVE_PC_SERIO
 	select HAVE_MEMBLOCK
 	select HAVE_MEMBLOCK
 	select HAVE_GENERIC_DMA_COHERENT
 	select HAVE_GENERIC_DMA_COHERENT
 	select HAVE_DMA_ATTRS
 	select HAVE_DMA_ATTRS

+ 1 - 0
arch/x86/Kconfig

@@ -23,6 +23,7 @@ config X86
 	def_bool y
 	def_bool y
 	select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
 	select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_MIGHT_HAVE_PC_PARPORT
+	select ARCH_MIGHT_HAVE_PC_SERIO
 	select HAVE_AOUT if X86_32
 	select HAVE_AOUT if X86_32
 	select HAVE_UNSTABLE_SCHED_CLOCK
 	select HAVE_UNSTABLE_SCHED_CLOCK
 	select ARCH_SUPPORTS_NUMA_BALANCING
 	select ARCH_SUPPORTS_NUMA_BALANCING

+ 0 - 1
drivers/input/gameport/emu10k1-gp.c

@@ -30,7 +30,6 @@
 
 
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/ioport.h>
 #include <linux/ioport.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/pci.h>
 #include <linux/pci.h>

+ 0 - 1
drivers/input/gameport/fm801-gp.c

@@ -27,7 +27,6 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/pci.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 
 

+ 57 - 19
drivers/input/input.c

@@ -1653,35 +1653,36 @@ static void input_dev_toggle(struct input_dev *dev, bool activate)
  */
  */
 void input_reset_device(struct input_dev *dev)
 void input_reset_device(struct input_dev *dev)
 {
 {
-	mutex_lock(&dev->mutex);
+	unsigned long flags;
 
 
-	if (dev->users) {
-		input_dev_toggle(dev, true);
+	mutex_lock(&dev->mutex);
+	spin_lock_irqsave(&dev->event_lock, flags);
 
 
-		/*
-		 * Keys that have been pressed at suspend time are unlikely
-		 * to be still pressed when we resume.
-		 */
-		spin_lock_irq(&dev->event_lock);
-		input_dev_release_keys(dev);
-		spin_unlock_irq(&dev->event_lock);
-	}
+	input_dev_toggle(dev, true);
+	input_dev_release_keys(dev);
 
 
+	spin_unlock_irqrestore(&dev->event_lock, flags);
 	mutex_unlock(&dev->mutex);
 	mutex_unlock(&dev->mutex);
 }
 }
 EXPORT_SYMBOL(input_reset_device);
 EXPORT_SYMBOL(input_reset_device);
 
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int input_dev_suspend(struct device *dev)
 static int input_dev_suspend(struct device *dev)
 {
 {
 	struct input_dev *input_dev = to_input_dev(dev);
 	struct input_dev *input_dev = to_input_dev(dev);
 
 
-	mutex_lock(&input_dev->mutex);
+	spin_lock_irq(&input_dev->event_lock);
 
 
-	if (input_dev->users)
-		input_dev_toggle(input_dev, false);
+	/*
+	 * Keys that are pressed now are unlikely to be
+	 * still pressed when we resume.
+	 */
+	input_dev_release_keys(input_dev);
 
 
-	mutex_unlock(&input_dev->mutex);
+	/* Turn off LEDs and sounds, if any are active. */
+	input_dev_toggle(input_dev, false);
+
+	spin_unlock_irq(&input_dev->event_lock);
 
 
 	return 0;
 	return 0;
 }
 }
@@ -1690,7 +1691,43 @@ static int input_dev_resume(struct device *dev)
 {
 {
 	struct input_dev *input_dev = to_input_dev(dev);
 	struct input_dev *input_dev = to_input_dev(dev);
 
 
-	input_reset_device(input_dev);
+	spin_lock_irq(&input_dev->event_lock);
+
+	/* Restore state of LEDs and sounds, if any were active. */
+	input_dev_toggle(input_dev, true);
+
+	spin_unlock_irq(&input_dev->event_lock);
+
+	return 0;
+}
+
+static int input_dev_freeze(struct device *dev)
+{
+	struct input_dev *input_dev = to_input_dev(dev);
+
+	spin_lock_irq(&input_dev->event_lock);
+
+	/*
+	 * Keys that are pressed now are unlikely to be
+	 * still pressed when we resume.
+	 */
+	input_dev_release_keys(input_dev);
+
+	spin_unlock_irq(&input_dev->event_lock);
+
+	return 0;
+}
+
+static int input_dev_poweroff(struct device *dev)
+{
+	struct input_dev *input_dev = to_input_dev(dev);
+
+	spin_lock_irq(&input_dev->event_lock);
+
+	/* Turn off LEDs and sounds, if any are active. */
+	input_dev_toggle(input_dev, false);
+
+	spin_unlock_irq(&input_dev->event_lock);
 
 
 	return 0;
 	return 0;
 }
 }
@@ -1698,7 +1735,8 @@ static int input_dev_resume(struct device *dev)
 static const struct dev_pm_ops input_dev_pm_ops = {
 static const struct dev_pm_ops input_dev_pm_ops = {
 	.suspend	= input_dev_suspend,
 	.suspend	= input_dev_suspend,
 	.resume		= input_dev_resume,
 	.resume		= input_dev_resume,
-	.poweroff	= input_dev_suspend,
+	.freeze		= input_dev_freeze,
+	.poweroff	= input_dev_poweroff,
 	.restore	= input_dev_resume,
 	.restore	= input_dev_resume,
 };
 };
 #endif /* CONFIG_PM */
 #endif /* CONFIG_PM */
@@ -1707,7 +1745,7 @@ static struct device_type input_dev_type = {
 	.groups		= input_dev_attr_groups,
 	.groups		= input_dev_attr_groups,
 	.release	= input_dev_release,
 	.release	= input_dev_release,
 	.uevent		= input_dev_uevent,
 	.uevent		= input_dev_uevent,
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 	.pm		= &input_dev_pm_ops,
 	.pm		= &input_dev_pm_ops,
 #endif
 #endif
 };
 };

+ 0 - 1
drivers/input/joystick/a3d.c

@@ -29,7 +29,6 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/jiffies.h>
 #include <linux/jiffies.h>

+ 0 - 1
drivers/input/joystick/adi.c

@@ -33,7 +33,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
-#include <linux/init.h>
 #include <linux/jiffies.h>
 #include <linux/jiffies.h>
 
 
 #define DRIVER_DESC	"Logitech ADI joystick family driver"
 #define DRIVER_DESC	"Logitech ADI joystick family driver"

+ 0 - 1
drivers/input/joystick/cobra.c

@@ -29,7 +29,6 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/jiffies.h>
 #include <linux/jiffies.h>

+ 0 - 1
drivers/input/joystick/gf2k.c

@@ -30,7 +30,6 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/jiffies.h>
 #include <linux/jiffies.h>

+ 0 - 1
drivers/input/joystick/grip.c

@@ -28,7 +28,6 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/input.h>

+ 0 - 1
drivers/input/joystick/grip_mp.c

@@ -11,7 +11,6 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/input.h>

+ 0 - 1
drivers/input/joystick/guillemot.c

@@ -30,7 +30,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/jiffies.h>
 #include <linux/jiffies.h>

+ 0 - 1
drivers/input/joystick/iforce/iforce.h

@@ -29,7 +29,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/spinlock.h>
 #include <linux/spinlock.h>
 #include <linux/usb.h>
 #include <linux/usb.h>
 #include <linux/serio.h>
 #include <linux/serio.h>

+ 0 - 1
drivers/input/joystick/interact.c

@@ -33,7 +33,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/jiffies.h>
 #include <linux/jiffies.h>

+ 0 - 1
drivers/input/joystick/joydump.c

@@ -31,7 +31,6 @@
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 
 
 #define DRIVER_DESC	"Gameport data dumper module"
 #define DRIVER_DESC	"Gameport data dumper module"

+ 0 - 1
drivers/input/joystick/magellan.c

@@ -31,7 +31,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 
 #define DRIVER_DESC	"Magellan and SpaceMouse 6dof controller driver"
 #define DRIVER_DESC	"Magellan and SpaceMouse 6dof controller driver"
 
 

+ 0 - 1
drivers/input/joystick/sidewinder.c

@@ -30,7 +30,6 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/jiffies.h>
 #include <linux/jiffies.h>

+ 0 - 1
drivers/input/joystick/spaceball.c

@@ -33,7 +33,6 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
 
 

+ 0 - 1
drivers/input/joystick/spaceorb.c

@@ -32,7 +32,6 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
 
 

+ 0 - 1
drivers/input/joystick/stinger.c

@@ -32,7 +32,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 
 #define DRIVER_DESC	"Gravis Stinger gamepad driver"
 #define DRIVER_DESC	"Gravis Stinger gamepad driver"
 
 

+ 0 - 1
drivers/input/joystick/tmdc.c

@@ -33,7 +33,6 @@
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/gameport.h>
 #include <linux/gameport.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/jiffies.h>
 #include <linux/jiffies.h>

+ 0 - 1
drivers/input/joystick/twidjoy.c

@@ -52,7 +52,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 
 #define DRIVER_DESC	"Handykey Twiddler keyboard as a joystick driver"
 #define DRIVER_DESC	"Handykey Twiddler keyboard as a joystick driver"
 
 

+ 0 - 1
drivers/input/joystick/warrior.c

@@ -31,7 +31,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 
 #define DRIVER_DESC	"Logitech WingMan Warrior joystick driver"
 #define DRIVER_DESC	"Logitech WingMan Warrior joystick driver"
 
 

+ 4 - 3
drivers/input/joystick/xpad.c

@@ -74,7 +74,6 @@
  */
  */
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/stat.h>
 #include <linux/stat.h>
 #include <linux/module.h>
 #include <linux/module.h>
@@ -125,6 +124,8 @@ static const struct xpad_device {
 	{ 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
 	{ 0x045e, 0x0291, "Xbox 360 Wireless Receiver (XBOX)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
 	{ 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
 	{ 0x045e, 0x0719, "Xbox 360 Wireless Receiver", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360W },
 	{ 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
 	{ 0x044f, 0x0f07, "Thrustmaster, Inc. Controller", 0, XTYPE_XBOX },
+	{ 0x046d, 0xc21d, "Logitech Gamepad F310", 0, XTYPE_XBOX360 },
+	{ 0x046d, 0xc21f, "Logitech Gamepad F710", 0, XTYPE_XBOX360 },
 	{ 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 },
 	{ 0x046d, 0xc242, "Logitech Chillstream Controller", 0, XTYPE_XBOX360 },
 	{ 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX },
 	{ 0x046d, 0xca84, "Logitech Xbox Cordless Controller", 0, XTYPE_XBOX },
 	{ 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX },
 	{ 0x046d, 0xca88, "Logitech Compact Controller for Xbox", 0, XTYPE_XBOX },
@@ -166,8 +167,8 @@ static const struct xpad_device {
 	{ 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 },
 	{ 0x1430, 0x4748, "RedOctane Guitar Hero X-plorer", 0, XTYPE_XBOX360 },
 	{ 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
 	{ 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
 	{ 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
 	{ 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
-	{ 0x1689, 0xfd00, "Razer Onza Tournament Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
-	{ 0x1689, 0xfd01, "Razer Onza Classic Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
+	{ 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 },
+	{ 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 },
 	{ 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 },
 	{ 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 },
 	{ 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
 	{ 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 },
 	{ 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },
 	{ 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },

+ 0 - 1
drivers/input/joystick/zhenhua.c

@@ -49,7 +49,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
-#include <linux/init.h>
 
 
 #define DRIVER_DESC	"RC transmitter with 5-byte Zhen Hua protocol joystick driver"
 #define DRIVER_DESC	"RC transmitter with 5-byte Zhen Hua protocol joystick driver"
 
 

+ 1 - 1
drivers/input/keyboard/Kconfig

@@ -525,7 +525,7 @@ config KEYBOARD_SUNKBD
 
 
 config KEYBOARD_SH_KEYSC
 config KEYBOARD_SH_KEYSC
 	tristate "SuperH KEYSC keypad support"
 	tristate "SuperH KEYSC keypad support"
-	depends on SUPERH || ARM || COMPILE_TEST
+	depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST
 	help
 	help
 	  Say Y here if you want to use a keypad attached to the KEYSC block
 	  Say Y here if you want to use a keypad attached to the KEYSC block
 	  on SuperH processors such as sh7722 and sh7343.
 	  on SuperH processors such as sh7722 and sh7343.

+ 1 - 2
drivers/input/keyboard/adp5520-keys.c

@@ -8,7 +8,6 @@
 
 
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/mfd/adp5520.h>
 #include <linux/mfd/adp5520.h>
@@ -71,7 +70,7 @@ static int adp5520_keys_notifier(struct notifier_block *nb,
 
 
 static int adp5520_keys_probe(struct platform_device *pdev)
 static int adp5520_keys_probe(struct platform_device *pdev)
 {
 {
-	struct adp5520_keys_platform_data *pdata = pdev->dev.platform_data;
+	struct adp5520_keys_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	struct input_dev *input;
 	struct input_dev *input;
 	struct adp5520_keys *dev;
 	struct adp5520_keys *dev;
 	int ret, i;
 	int ret, i;

+ 6 - 5
drivers/input/keyboard/adp5588-keys.c

@@ -9,7 +9,6 @@
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/workqueue.h>
 #include <linux/workqueue.h>
@@ -173,7 +172,7 @@ static int adp5588_build_gpiomap(struct adp5588_kpad *kpad,
 static int adp5588_gpio_add(struct adp5588_kpad *kpad)
 static int adp5588_gpio_add(struct adp5588_kpad *kpad)
 {
 {
 	struct device *dev = &kpad->client->dev;
 	struct device *dev = &kpad->client->dev;
-	const struct adp5588_kpad_platform_data *pdata = dev->platform_data;
+	const struct adp5588_kpad_platform_data *pdata = dev_get_platdata(dev);
 	const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
 	const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
 	int i, error;
 	int i, error;
 
 
@@ -227,7 +226,7 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad)
 static void adp5588_gpio_remove(struct adp5588_kpad *kpad)
 static void adp5588_gpio_remove(struct adp5588_kpad *kpad)
 {
 {
 	struct device *dev = &kpad->client->dev;
 	struct device *dev = &kpad->client->dev;
-	const struct adp5588_kpad_platform_data *pdata = dev->platform_data;
+	const struct adp5588_kpad_platform_data *pdata = dev_get_platdata(dev);
 	const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
 	const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
 	int error;
 	int error;
 
 
@@ -321,7 +320,8 @@ static irqreturn_t adp5588_irq(int irq, void *handle)
 
 
 static int adp5588_setup(struct i2c_client *client)
 static int adp5588_setup(struct i2c_client *client)
 {
 {
-	const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data;
+	const struct adp5588_kpad_platform_data *pdata =
+			dev_get_platdata(&client->dev);
 	const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
 	const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data;
 	int i, ret;
 	int i, ret;
 	unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
 	unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
@@ -424,7 +424,8 @@ static int adp5588_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 			 const struct i2c_device_id *id)
 {
 {
 	struct adp5588_kpad *kpad;
 	struct adp5588_kpad *kpad;
-	const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data;
+	const struct adp5588_kpad_platform_data *pdata =
+			dev_get_platdata(&client->dev);
 	struct input_dev *input;
 	struct input_dev *input;
 	unsigned int revid;
 	unsigned int revid;
 	int ret, i;
 	int ret, i;

+ 4 - 5
drivers/input/keyboard/adp5589-keys.c

@@ -8,7 +8,6 @@
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/workqueue.h>
 #include <linux/workqueue.h>
@@ -499,7 +498,7 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad,
 static int adp5589_gpio_add(struct adp5589_kpad *kpad)
 static int adp5589_gpio_add(struct adp5589_kpad *kpad)
 {
 {
 	struct device *dev = &kpad->client->dev;
 	struct device *dev = &kpad->client->dev;
-	const struct adp5589_kpad_platform_data *pdata = dev->platform_data;
+	const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
 	const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
 	const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
 	int i, error;
 	int i, error;
 
 
@@ -553,7 +552,7 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad)
 static void adp5589_gpio_remove(struct adp5589_kpad *kpad)
 static void adp5589_gpio_remove(struct adp5589_kpad *kpad)
 {
 {
 	struct device *dev = &kpad->client->dev;
 	struct device *dev = &kpad->client->dev;
-	const struct adp5589_kpad_platform_data *pdata = dev->platform_data;
+	const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
 	const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
 	const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
 	int error;
 	int error;
 
 
@@ -658,7 +657,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
 {
 {
 	struct i2c_client *client = kpad->client;
 	struct i2c_client *client = kpad->client;
 	const struct adp5589_kpad_platform_data *pdata =
 	const struct adp5589_kpad_platform_data *pdata =
-		client->dev.platform_data;
+		dev_get_platdata(&client->dev);
 	u8 (*reg) (u8) = kpad->var->reg;
 	u8 (*reg) (u8) = kpad->var->reg;
 	unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
 	unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
 	unsigned char pull_mask = 0;
 	unsigned char pull_mask = 0;
@@ -864,7 +863,7 @@ static int adp5589_probe(struct i2c_client *client,
 {
 {
 	struct adp5589_kpad *kpad;
 	struct adp5589_kpad *kpad;
 	const struct adp5589_kpad_platform_data *pdata =
 	const struct adp5589_kpad_platform_data *pdata =
-		client->dev.platform_data;
+		dev_get_platdata(&client->dev);
 	struct input_dev *input;
 	struct input_dev *input;
 	unsigned int revid;
 	unsigned int revid;
 	int ret, i;
 	int ret, i;

+ 2 - 3
drivers/input/keyboard/bf54x-keys.c

@@ -30,7 +30,6 @@
 
 
 #include <linux/module.h>
 #include <linux/module.h>
 
 
-#include <linux/init.h>
 #include <linux/fs.h>
 #include <linux/fs.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
@@ -180,7 +179,7 @@ static irqreturn_t bfin_kpad_isr(int irq, void *dev_id)
 static int bfin_kpad_probe(struct platform_device *pdev)
 static int bfin_kpad_probe(struct platform_device *pdev)
 {
 {
 	struct bf54x_kpad *bf54x_kpad;
 	struct bf54x_kpad *bf54x_kpad;
-	struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data;
+	struct bfin_kpad_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	struct input_dev *input;
 	struct input_dev *input;
 	int i, error;
 	int i, error;
 
 
@@ -333,7 +332,7 @@ out:
 
 
 static int bfin_kpad_remove(struct platform_device *pdev)
 static int bfin_kpad_remove(struct platform_device *pdev)
 {
 {
-	struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data;
+	struct bfin_kpad_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
 	struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
 
 
 	del_timer_sync(&bf54x_kpad->timer);
 	del_timer_sync(&bf54x_kpad->timer);

+ 11 - 4
drivers/input/keyboard/cros_ec_keyb.c

@@ -38,6 +38,7 @@
  * @row_shift: log2 or number of rows, rounded up
  * @row_shift: log2 or number of rows, rounded up
  * @keymap_data: Matrix keymap data used to convert to keyscan values
  * @keymap_data: Matrix keymap data used to convert to keyscan values
  * @ghost_filter: true to enable the matrix key-ghosting filter
  * @ghost_filter: true to enable the matrix key-ghosting filter
+ * @old_kb_state: bitmap of keys pressed last scan
  * @dev: Device pointer
  * @dev: Device pointer
  * @idev: Input device
  * @idev: Input device
  * @ec: Top level ChromeOS device to use to talk to EC
  * @ec: Top level ChromeOS device to use to talk to EC
@@ -49,6 +50,7 @@ struct cros_ec_keyb {
 	int row_shift;
 	int row_shift;
 	const struct matrix_keymap_data *keymap_data;
 	const struct matrix_keymap_data *keymap_data;
 	bool ghost_filter;
 	bool ghost_filter;
+	uint8_t *old_kb_state;
 
 
 	struct device *dev;
 	struct device *dev;
 	struct input_dev *idev;
 	struct input_dev *idev;
@@ -135,6 +137,7 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
 	struct input_dev *idev = ckdev->idev;
 	struct input_dev *idev = ckdev->idev;
 	int col, row;
 	int col, row;
 	int new_state;
 	int new_state;
+	int old_state;
 	int num_cols;
 	int num_cols;
 
 
 	num_cols = len;
 	num_cols = len;
@@ -153,18 +156,19 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
 		for (row = 0; row < ckdev->rows; row++) {
 		for (row = 0; row < ckdev->rows; row++) {
 			int pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift);
 			int pos = MATRIX_SCAN_CODE(row, col, ckdev->row_shift);
 			const unsigned short *keycodes = idev->keycode;
 			const unsigned short *keycodes = idev->keycode;
-			int code;
 
 
-			code = keycodes[pos];
 			new_state = kb_state[col] & (1 << row);
 			new_state = kb_state[col] & (1 << row);
-			if (!!new_state != test_bit(code, idev->key)) {
+			old_state = ckdev->old_kb_state[col] & (1 << row);
+			if (new_state != old_state) {
 				dev_dbg(ckdev->dev,
 				dev_dbg(ckdev->dev,
 					"changed: [r%d c%d]: byte %02x\n",
 					"changed: [r%d c%d]: byte %02x\n",
 					row, col, new_state);
 					row, col, new_state);
 
 
-				input_report_key(idev, code, new_state);
+				input_report_key(idev, keycodes[pos],
+						 new_state);
 			}
 			}
 		}
 		}
+		ckdev->old_kb_state[col] = kb_state[col];
 	}
 	}
 	input_sync(ckdev->idev);
 	input_sync(ckdev->idev);
 }
 }
@@ -226,6 +230,9 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
 					    &ckdev->cols);
 					    &ckdev->cols);
 	if (err)
 	if (err)
 		return err;
 		return err;
+	ckdev->old_kb_state = devm_kzalloc(&pdev->dev, ckdev->cols, GFP_KERNEL);
+	if (!ckdev->old_kb_state)
+		return -ENOMEM;
 
 
 	idev = devm_input_allocate_device(&pdev->dev);
 	idev = devm_input_allocate_device(&pdev->dev);
 	if (!idev)
 	if (!idev)

+ 1 - 1
drivers/input/keyboard/davinci_keyscan.c

@@ -172,7 +172,7 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
 	struct input_dev *key_dev;
 	struct input_dev *key_dev;
 	struct resource *res, *mem;
 	struct resource *res, *mem;
 	struct device *dev = &pdev->dev;
 	struct device *dev = &pdev->dev;
-	struct davinci_ks_platform_data *pdata = pdev->dev.platform_data;
+	struct davinci_ks_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	int error, i;
 	int error, i;
 
 
 	if (pdata->device_enable) {
 	if (pdata->device_enable) {

+ 1 - 1
drivers/input/keyboard/ep93xx_keypad.c

@@ -244,7 +244,7 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
 	if (!keypad)
 	if (!keypad)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
-	keypad->pdata = pdev->dev.platform_data;
+	keypad->pdata = dev_get_platdata(&pdev->dev);
 	if (!keypad->pdata) {
 	if (!keypad->pdata) {
 		err = -EINVAL;
 		err = -EINVAL;
 		goto failed_free;
 		goto failed_free;

+ 0 - 1
drivers/input/keyboard/goldfish_events.c

@@ -14,7 +14,6 @@
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/types.h>
 #include <linux/input.h>
 #include <linux/input.h>

+ 0 - 1
drivers/input/keyboard/gpio_keys_polled.c

@@ -17,7 +17,6 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/input-polldev.h>
 #include <linux/input-polldev.h>

+ 0 - 1
drivers/input/keyboard/hil_kbd.c

@@ -36,7 +36,6 @@
 #include <linux/serio.h>
 #include <linux/serio.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/completion.h>
 #include <linux/completion.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/pci_ids.h>
 #include <linux/pci_ids.h>

+ 2 - 2
drivers/input/keyboard/imx_keypad.c

@@ -13,7 +13,6 @@
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/err.h>
-#include <linux/init.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/io.h>
@@ -425,7 +424,8 @@ MODULE_DEVICE_TABLE(of, imx_keypad_of_match);
 
 
 static int imx_keypad_probe(struct platform_device *pdev)
 static int imx_keypad_probe(struct platform_device *pdev)
 {
 {
-	const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data;
+	const struct matrix_keymap_data *keymap_data =
+			dev_get_platdata(&pdev->dev);
 	struct imx_keypad *keypad;
 	struct imx_keypad *keypad;
 	struct input_dev *input_dev;
 	struct input_dev *input_dev;
 	struct resource *res;
 	struct resource *res;

+ 0 - 1
drivers/input/keyboard/jornada680_kbd.c

@@ -16,7 +16,6 @@
  * published by the Free Software Foundation.
  * published by the Free Software Foundation.
  */
  */
 
 
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/input-polldev.h>
 #include <linux/input-polldev.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>

+ 0 - 1
drivers/input/keyboard/jornada720_kbd.c

@@ -18,7 +18,6 @@
 #include <linux/device.h>
 #include <linux/device.h>
 #include <linux/errno.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>

+ 0 - 1
drivers/input/keyboard/lkkbd.c

@@ -65,7 +65,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
 #include <linux/workqueue.h>
 #include <linux/workqueue.h>

+ 1 - 1
drivers/input/keyboard/lm8323.c

@@ -627,7 +627,7 @@ static DEVICE_ATTR(disable_kp, 0644, lm8323_show_disable, lm8323_set_disable);
 static int lm8323_probe(struct i2c_client *client,
 static int lm8323_probe(struct i2c_client *client,
 				  const struct i2c_device_id *id)
 				  const struct i2c_device_id *id)
 {
 {
-	struct lm8323_platform_data *pdata = client->dev.platform_data;
+	struct lm8323_platform_data *pdata = dev_get_platdata(&client->dev);
 	struct input_dev *idev;
 	struct input_dev *idev;
 	struct lm8323_chip *lm;
 	struct lm8323_chip *lm;
 	int pwm;
 	int pwm;

+ 2 - 1
drivers/input/keyboard/lm8333.c

@@ -131,7 +131,8 @@ static irqreturn_t lm8333_irq_thread(int irq, void *data)
 static int lm8333_probe(struct i2c_client *client,
 static int lm8333_probe(struct i2c_client *client,
 				  const struct i2c_device_id *id)
 				  const struct i2c_device_id *id)
 {
 {
-	const struct lm8333_platform_data *pdata = client->dev.platform_data;
+	const struct lm8333_platform_data *pdata =
+			dev_get_platdata(&client->dev);
 	struct lm8333 *lm8333;
 	struct lm8333 *lm8333;
 	struct input_dev *input;
 	struct input_dev *input;
 	int err, active_time;
 	int err, active_time;

+ 0 - 1
drivers/input/keyboard/matrix_keypad.c

@@ -14,7 +14,6 @@
 #include <linux/types.h>
 #include <linux/types.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>

+ 2 - 1
drivers/input/keyboard/max7359_keypad.c

@@ -182,7 +182,8 @@ static void max7359_initialize(struct i2c_client *client)
 static int max7359_probe(struct i2c_client *client,
 static int max7359_probe(struct i2c_client *client,
 					const struct i2c_device_id *id)
 					const struct i2c_device_id *id)
 {
 {
-	const struct matrix_keymap_data *keymap_data = client->dev.platform_data;
+	const struct matrix_keymap_data *keymap_data =
+			dev_get_platdata(&client->dev);
 	struct max7359_keypad *keypad;
 	struct max7359_keypad *keypad;
 	struct input_dev *input_dev;
 	struct input_dev *input_dev;
 	int ret;
 	int ret;

+ 1 - 2
drivers/input/keyboard/mcs_touchkey.c

@@ -12,7 +12,6 @@
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/i2c.h>
 #include <linux/i2c/mcs.h>
 #include <linux/i2c/mcs.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
@@ -108,7 +107,7 @@ static int mcs_touchkey_probe(struct i2c_client *client,
 	int error;
 	int error;
 	int i;
 	int i;
 
 
-	pdata = client->dev.platform_data;
+	pdata = dev_get_platdata(&client->dev);
 	if (!pdata) {
 	if (!pdata) {
 		dev_err(&client->dev, "no platform data defined\n");
 		dev_err(&client->dev, "no platform data defined\n");
 		return -EINVAL;
 		return -EINVAL;

+ 2 - 2
drivers/input/keyboard/mpr121_touchkey.c

@@ -13,7 +13,6 @@
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/i2c.h>
 #include <linux/i2c.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
@@ -188,7 +187,8 @@ err_i2c_write:
 static int mpr_touchkey_probe(struct i2c_client *client,
 static int mpr_touchkey_probe(struct i2c_client *client,
 			      const struct i2c_device_id *id)
 			      const struct i2c_device_id *id)
 {
 {
-	const struct mpr121_platform_data *pdata = client->dev.platform_data;
+	const struct mpr121_platform_data *pdata =
+			dev_get_platdata(&client->dev);
 	struct mpr121_touchkey *mpr121;
 	struct mpr121_touchkey *mpr121;
 	struct input_dev *input_dev;
 	struct input_dev *input_dev;
 	int error;
 	int error;

+ 0 - 1
drivers/input/keyboard/newtonkbd.c

@@ -29,7 +29,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/input.h>
 #include <linux/input.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
 
 
 #define DRIVER_DESC	"Newton keyboard driver"
 #define DRIVER_DESC	"Newton keyboard driver"

+ 2 - 1
drivers/input/keyboard/nomadik-ske-keypad.c

@@ -222,7 +222,8 @@ static irqreturn_t ske_keypad_irq(int irq, void *dev_id)
 
 
 static int __init ske_keypad_probe(struct platform_device *pdev)
 static int __init ske_keypad_probe(struct platform_device *pdev)
 {
 {
-	const struct ske_keypad_platform_data *plat = pdev->dev.platform_data;
+	const struct ske_keypad_platform_data *plat =
+			dev_get_platdata(&pdev->dev);
 	struct ske_keypad *keypad;
 	struct ske_keypad *keypad;
 	struct input_dev *input;
 	struct input_dev *input;
 	struct resource *res;
 	struct resource *res;

+ 1 - 2
drivers/input/keyboard/omap-keypad.c

@@ -25,7 +25,6 @@
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/types.h>
 #include <linux/types.h>
 #include <linux/input.h>
 #include <linux/input.h>
@@ -248,7 +247,7 @@ static int omap_kp_probe(struct platform_device *pdev)
 {
 {
 	struct omap_kp *omap_kp;
 	struct omap_kp *omap_kp;
 	struct input_dev *input_dev;
 	struct input_dev *input_dev;
-	struct omap_kp_platform_data *pdata =  pdev->dev.platform_data;
+	struct omap_kp_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	int i, col_idx, row_idx, ret;
 	int i, col_idx, row_idx, ret;
 	unsigned int row_shift, keycodemax;
 	unsigned int row_shift, keycodemax;
 
 

+ 0 - 1
drivers/input/keyboard/omap4-keypad.c

@@ -22,7 +22,6 @@
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
 #include <linux/errno.h>
 #include <linux/errno.h>

+ 0 - 1
drivers/input/keyboard/pxa27x_keypad.c

@@ -18,7 +18,6 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/device.h>
 #include <linux/device.h>

+ 2 - 2
drivers/input/keyboard/pxa930_rotary.c

@@ -8,7 +8,6 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
@@ -84,7 +83,8 @@ static void pxa930_rotary_close(struct input_dev *dev)
 
 
 static int pxa930_rotary_probe(struct platform_device *pdev)
 static int pxa930_rotary_probe(struct platform_device *pdev)
 {
 {
-	struct pxa930_rotary_platform_data *pdata = pdev->dev.platform_data;
+	struct pxa930_rotary_platform_data *pdata =
+			dev_get_platdata(&pdev->dev);
 	struct pxa930_rotary *r;
 	struct pxa930_rotary *r;
 	struct input_dev *input_dev;
 	struct input_dev *input_dev;
 	struct resource *res;
 	struct resource *res;

+ 0 - 1
drivers/input/keyboard/qt1070.c

@@ -25,7 +25,6 @@
  */
  */
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/i2c.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/slab.h>
 #include <linux/slab.h>

+ 0 - 1
drivers/input/keyboard/qt2160.c

@@ -19,7 +19,6 @@
  */
  */
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/leds.h>
 #include <linux/leds.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/slab.h>

+ 21 - 16
drivers/input/keyboard/samsung-keypad.c

@@ -14,7 +14,6 @@
 #include <linux/clk.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/err.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/io.h>
@@ -244,8 +243,8 @@ static void samsung_keypad_close(struct input_dev *input_dev)
 }
 }
 
 
 #ifdef CONFIG_OF
 #ifdef CONFIG_OF
-static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
-				struct device *dev)
+static struct samsung_keypad_platdata *
+samsung_keypad_parse_dt(struct device *dev)
 {
 {
 	struct samsung_keypad_platdata *pdata;
 	struct samsung_keypad_platdata *pdata;
 	struct matrix_keymap_data *keymap_data;
 	struct matrix_keymap_data *keymap_data;
@@ -253,17 +252,22 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
 	struct device_node *np = dev->of_node, *key_np;
 	struct device_node *np = dev->of_node, *key_np;
 	unsigned int key_count;
 	unsigned int key_count;
 
 
+	if (!np) {
+		dev_err(dev, "missing device tree data\n");
+		return ERR_PTR(-EINVAL);
+	}
+
 	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
 	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
 	if (!pdata) {
 	if (!pdata) {
 		dev_err(dev, "could not allocate memory for platform data\n");
 		dev_err(dev, "could not allocate memory for platform data\n");
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 	}
 	}
 
 
 	of_property_read_u32(np, "samsung,keypad-num-rows", &num_rows);
 	of_property_read_u32(np, "samsung,keypad-num-rows", &num_rows);
 	of_property_read_u32(np, "samsung,keypad-num-columns", &num_cols);
 	of_property_read_u32(np, "samsung,keypad-num-columns", &num_cols);
 	if (!num_rows || !num_cols) {
 	if (!num_rows || !num_cols) {
 		dev_err(dev, "number of keypad rows/columns not specified\n");
 		dev_err(dev, "number of keypad rows/columns not specified\n");
-		return NULL;
+		return ERR_PTR(-EINVAL);
 	}
 	}
 	pdata->rows = num_rows;
 	pdata->rows = num_rows;
 	pdata->cols = num_cols;
 	pdata->cols = num_cols;
@@ -271,7 +275,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
 	keymap_data = devm_kzalloc(dev, sizeof(*keymap_data), GFP_KERNEL);
 	keymap_data = devm_kzalloc(dev, sizeof(*keymap_data), GFP_KERNEL);
 	if (!keymap_data) {
 	if (!keymap_data) {
 		dev_err(dev, "could not allocate memory for keymap data\n");
 		dev_err(dev, "could not allocate memory for keymap data\n");
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 	}
 	}
 	pdata->keymap_data = keymap_data;
 	pdata->keymap_data = keymap_data;
 
 
@@ -280,7 +284,7 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
 	keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL);
 	keymap = devm_kzalloc(dev, sizeof(uint32_t) * key_count, GFP_KERNEL);
 	if (!keymap) {
 	if (!keymap) {
 		dev_err(dev, "could not allocate memory for keymap\n");
 		dev_err(dev, "could not allocate memory for keymap\n");
-		return NULL;
+		return ERR_PTR(-ENOMEM);
 	}
 	}
 	keymap_data->keymap = keymap;
 	keymap_data->keymap = keymap;
 
 
@@ -294,16 +298,19 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt(
 
 
 	if (of_get_property(np, "linux,input-no-autorepeat", NULL))
 	if (of_get_property(np, "linux,input-no-autorepeat", NULL))
 		pdata->no_autorepeat = true;
 		pdata->no_autorepeat = true;
+
 	if (of_get_property(np, "linux,input-wakeup", NULL))
 	if (of_get_property(np, "linux,input-wakeup", NULL))
 		pdata->wakeup = true;
 		pdata->wakeup = true;
 
 
 	return pdata;
 	return pdata;
 }
 }
 #else
 #else
-static
-struct samsung_keypad_platdata *samsung_keypad_parse_dt(struct device *dev)
+static struct samsung_keypad_platdata *
+samsung_keypad_parse_dt(struct device *dev)
 {
 {
-	return NULL;
+	dev_err(dev, "no platform data defined\n");
+
+	return ERR_PTR(-EINVAL);
 }
 }
 #endif
 #endif
 
 
@@ -318,13 +325,11 @@ static int samsung_keypad_probe(struct platform_device *pdev)
 	unsigned int keymap_size;
 	unsigned int keymap_size;
 	int error;
 	int error;
 
 
-	if (pdev->dev.of_node)
-		pdata = samsung_keypad_parse_dt(&pdev->dev);
-	else
-		pdata = pdev->dev.platform_data;
+	pdata = dev_get_platdata(&pdev->dev);
 	if (!pdata) {
 	if (!pdata) {
-		dev_err(&pdev->dev, "no platform data defined\n");
-		return -EINVAL;
+		pdata = samsung_keypad_parse_dt(&pdev->dev);
+		if (IS_ERR(pdata))
+			return PTR_ERR(pdata);
 	}
 	}
 
 
 	keymap_data = pdata->keymap_data;
 	keymap_data = pdata->keymap_data;

+ 2 - 3
drivers/input/keyboard/sh_keysc.c

@@ -12,7 +12,6 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
@@ -171,7 +170,7 @@ static int sh_keysc_probe(struct platform_device *pdev)
 	int i;
 	int i;
 	int irq, error;
 	int irq, error;
 
 
-	if (!pdev->dev.platform_data) {
+	if (!dev_get_platdata(&pdev->dev)) {
 		dev_err(&pdev->dev, "no platform data defined\n");
 		dev_err(&pdev->dev, "no platform data defined\n");
 		error = -EINVAL;
 		error = -EINVAL;
 		goto err0;
 		goto err0;
@@ -198,7 +197,7 @@ static int sh_keysc_probe(struct platform_device *pdev)
 	}
 	}
 
 
 	platform_set_drvdata(pdev, priv);
 	platform_set_drvdata(pdev, priv);
-	memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata));
+	memcpy(&priv->pdata, dev_get_platdata(&pdev->dev), sizeof(priv->pdata));
 	pdata = &priv->pdata;
 	pdata = &priv->pdata;
 
 
 	priv->iomem_base = ioremap_nocache(res->start, resource_size(res));
 	priv->iomem_base = ioremap_nocache(res->start, resource_size(res));

+ 0 - 1
drivers/input/keyboard/spear-keyboard.c

@@ -12,7 +12,6 @@
 
 
 #include <linux/clk.h>
 #include <linux/clk.h>
 #include <linux/errno.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/io.h>
 #include <linux/io.h>

+ 0 - 1
drivers/input/keyboard/stmpe-keypad.c

@@ -6,7 +6,6 @@
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>

+ 0 - 1
drivers/input/keyboard/stowaway.c

@@ -32,7 +32,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/input.h>
 #include <linux/input.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
 
 
 #define DRIVER_DESC	"Stowaway keyboard driver"
 #define DRIVER_DESC	"Stowaway keyboard driver"

+ 0 - 1
drivers/input/keyboard/sunkbd.c

@@ -31,7 +31,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
 #include <linux/workqueue.h>
 #include <linux/workqueue.h>

+ 0 - 1
drivers/input/keyboard/tc3589x-keypad.c

@@ -10,7 +10,6 @@
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>

+ 1 - 1
drivers/input/keyboard/tca6416-keypad.c

@@ -213,7 +213,7 @@ static int tca6416_keypad_probe(struct i2c_client *client,
 		return -ENODEV;
 		return -ENODEV;
 	}
 	}
 
 
-	pdata = client->dev.platform_data;
+	pdata = dev_get_platdata(&client->dev);
 	if (!pdata) {
 	if (!pdata) {
 		dev_dbg(&client->dev, "no platform data\n");
 		dev_dbg(&client->dev, "no platform data\n");
 		return -EINVAL;
 		return -EINVAL;

+ 1 - 1
drivers/input/keyboard/tnetv107x-keypad.c

@@ -162,7 +162,7 @@ static int keypad_probe(struct platform_device *pdev)
 	int error = 0, sz, row_shift;
 	int error = 0, sz, row_shift;
 	u32 rev = 0;
 	u32 rev = 0;
 
 
-	pdata = pdev->dev.platform_data;
+	pdata = dev_get_platdata(&pdev->dev);
 	if (!pdata) {
 	if (!pdata) {
 		dev_err(dev, "cannot find device data\n");
 		dev_err(dev, "cannot find device data\n");
 		return -EINVAL;
 		return -EINVAL;

+ 64 - 58
drivers/input/keyboard/twl4030_keypad.c

@@ -27,12 +27,12 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
 #include <linux/i2c/twl.h>
 #include <linux/i2c/twl.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
+#include <linux/of.h>
 
 
 /*
 /*
  * The TWL4030 family chips include a keypad controller that supports
  * The TWL4030 family chips include a keypad controller that supports
@@ -60,6 +60,7 @@
 struct twl4030_keypad {
 struct twl4030_keypad {
 	unsigned short	keymap[TWL4030_KEYMAP_SIZE];
 	unsigned short	keymap[TWL4030_KEYMAP_SIZE];
 	u16		kp_state[TWL4030_MAX_ROWS];
 	u16		kp_state[TWL4030_MAX_ROWS];
+	bool		autorepeat;
 	unsigned	n_rows;
 	unsigned	n_rows;
 	unsigned	n_cols;
 	unsigned	n_cols;
 	unsigned	irq;
 	unsigned	irq;
@@ -330,70 +331,89 @@ static int twl4030_kp_program(struct twl4030_keypad *kp)
  */
  */
 static int twl4030_kp_probe(struct platform_device *pdev)
 static int twl4030_kp_probe(struct platform_device *pdev)
 {
 {
-	struct twl4030_keypad_data *pdata = pdev->dev.platform_data;
-	const struct matrix_keymap_data *keymap_data;
+	struct twl4030_keypad_data *pdata = dev_get_platdata(&pdev->dev);
+	const struct matrix_keymap_data *keymap_data = NULL;
 	struct twl4030_keypad *kp;
 	struct twl4030_keypad *kp;
 	struct input_dev *input;
 	struct input_dev *input;
 	u8 reg;
 	u8 reg;
 	int error;
 	int error;
 
 
-	if (!pdata || !pdata->rows || !pdata->cols || !pdata->keymap_data ||
-	    pdata->rows > TWL4030_MAX_ROWS || pdata->cols > TWL4030_MAX_COLS) {
-		dev_err(&pdev->dev, "Invalid platform_data\n");
-		return -EINVAL;
-	}
+	kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL);
+	if (!kp)
+		return -ENOMEM;
 
 
-	keymap_data = pdata->keymap_data;
-
-	kp = kzalloc(sizeof(*kp), GFP_KERNEL);
-	input = input_allocate_device();
-	if (!kp || !input) {
-		error = -ENOMEM;
-		goto err1;
-	}
+	input = devm_input_allocate_device(&pdev->dev);
+	if (!input)
+		return -ENOMEM;
 
 
-	/* Get the debug Device */
-	kp->dbg_dev = &pdev->dev;
-	kp->input = input;
-
-	kp->n_rows = pdata->rows;
-	kp->n_cols = pdata->cols;
-	kp->irq = platform_get_irq(pdev, 0);
+	/* get the debug device */
+	kp->dbg_dev		= &pdev->dev;
+	kp->input		= input;
 
 
 	/* setup input device */
 	/* setup input device */
 	input->name		= "TWL4030 Keypad";
 	input->name		= "TWL4030 Keypad";
 	input->phys		= "twl4030_keypad/input0";
 	input->phys		= "twl4030_keypad/input0";
-	input->dev.parent	= &pdev->dev;
 
 
 	input->id.bustype	= BUS_HOST;
 	input->id.bustype	= BUS_HOST;
 	input->id.vendor	= 0x0001;
 	input->id.vendor	= 0x0001;
 	input->id.product	= 0x0001;
 	input->id.product	= 0x0001;
 	input->id.version	= 0x0003;
 	input->id.version	= 0x0003;
 
 
+	if (pdata) {
+		if (!pdata->rows || !pdata->cols || !pdata->keymap_data) {
+			dev_err(&pdev->dev, "Missing platform_data\n");
+			return -EINVAL;
+		}
+
+		kp->n_rows = pdata->rows;
+		kp->n_cols = pdata->cols;
+		kp->autorepeat = pdata->rep;
+		keymap_data = pdata->keymap_data;
+	} else {
+		error = matrix_keypad_parse_of_params(&pdev->dev, &kp->n_rows,
+						      &kp->n_cols);
+		if (error)
+			return error;
+
+		kp->autorepeat = true;
+	}
+
+	if (kp->n_rows > TWL4030_MAX_ROWS || kp->n_cols > TWL4030_MAX_COLS) {
+		dev_err(&pdev->dev,
+			"Invalid rows/cols amount specified in platform/devicetree data\n");
+		return -EINVAL;
+	}
+
+	kp->irq = platform_get_irq(pdev, 0);
+	if (!kp->irq) {
+		dev_err(&pdev->dev, "no keyboard irq assigned\n");
+		return -EINVAL;
+	}
+
 	error = matrix_keypad_build_keymap(keymap_data, NULL,
 	error = matrix_keypad_build_keymap(keymap_data, NULL,
 					   TWL4030_MAX_ROWS,
 					   TWL4030_MAX_ROWS,
 					   1 << TWL4030_ROW_SHIFT,
 					   1 << TWL4030_ROW_SHIFT,
 					   kp->keymap, input);
 					   kp->keymap, input);
 	if (error) {
 	if (error) {
 		dev_err(kp->dbg_dev, "Failed to build keymap\n");
 		dev_err(kp->dbg_dev, "Failed to build keymap\n");
-		goto err1;
+		return error;
 	}
 	}
 
 
 	input_set_capability(input, EV_MSC, MSC_SCAN);
 	input_set_capability(input, EV_MSC, MSC_SCAN);
 	/* Enable auto repeat feature of Linux input subsystem */
 	/* Enable auto repeat feature of Linux input subsystem */
-	if (pdata->rep)
+	if (kp->autorepeat)
 		__set_bit(EV_REP, input->evbit);
 		__set_bit(EV_REP, input->evbit);
 
 
 	error = input_register_device(input);
 	error = input_register_device(input);
 	if (error) {
 	if (error) {
 		dev_err(kp->dbg_dev,
 		dev_err(kp->dbg_dev,
 			"Unable to register twl4030 keypad device\n");
 			"Unable to register twl4030 keypad device\n");
-		goto err1;
+		return error;
 	}
 	}
 
 
 	error = twl4030_kp_program(kp);
 	error = twl4030_kp_program(kp);
 	if (error)
 	if (error)
-		goto err2;
+		return error;
 
 
 	/*
 	/*
 	 * This ISR will always execute in kernel thread context because of
 	 * This ISR will always execute in kernel thread context because of
@@ -401,47 +421,33 @@ static int twl4030_kp_probe(struct platform_device *pdev)
 	 *
 	 *
 	 * NOTE:  we assume this host is wired to TWL4040 INT1, not INT2 ...
 	 * NOTE:  we assume this host is wired to TWL4040 INT1, not INT2 ...
 	 */
 	 */
-	error = request_threaded_irq(kp->irq, NULL, do_kp_irq,
-			0, pdev->name, kp);
+	error = devm_request_threaded_irq(&pdev->dev, kp->irq, NULL, do_kp_irq,
+					  0, pdev->name, kp);
 	if (error) {
 	if (error) {
-		dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n",
-			kp->irq);
-		goto err2;
+		dev_info(kp->dbg_dev, "request_irq failed for irq no=%d: %d\n",
+			kp->irq, error);
+		return error;
 	}
 	}
 
 
 	/* Enable KP and TO interrupts now. */
 	/* Enable KP and TO interrupts now. */
 	reg = (u8) ~(KEYP_IMR1_KP | KEYP_IMR1_TO);
 	reg = (u8) ~(KEYP_IMR1_KP | KEYP_IMR1_TO);
 	if (twl4030_kpwrite_u8(kp, reg, KEYP_IMR1)) {
 	if (twl4030_kpwrite_u8(kp, reg, KEYP_IMR1)) {
-		error = -EIO;
-		goto err3;
+		/* mask all events - we don't care about the result */
+		(void) twl4030_kpwrite_u8(kp, 0xff, KEYP_IMR1);
+		return -EIO;
 	}
 	}
 
 
 	platform_set_drvdata(pdev, kp);
 	platform_set_drvdata(pdev, kp);
 	return 0;
 	return 0;
-
-err3:
-	/* mask all events - we don't care about the result */
-	(void) twl4030_kpwrite_u8(kp, 0xff, KEYP_IMR1);
-	free_irq(kp->irq, kp);
-err2:
-	input_unregister_device(input);
-	input = NULL;
-err1:
-	input_free_device(input);
-	kfree(kp);
-	return error;
 }
 }
 
 
-static int twl4030_kp_remove(struct platform_device *pdev)
-{
-	struct twl4030_keypad *kp = platform_get_drvdata(pdev);
-
-	free_irq(kp->irq, kp);
-	input_unregister_device(kp->input);
-	kfree(kp);
-
-	return 0;
-}
+#ifdef CONFIG_OF
+static const struct of_device_id twl4030_keypad_dt_match_table[] = {
+	{ .compatible = "ti,twl4030-keypad" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, twl4030_keypad_dt_match_table);
+#endif
 
 
 /*
 /*
  * NOTE: twl4030 are multi-function devices connected via I2C.
  * NOTE: twl4030 are multi-function devices connected via I2C.
@@ -451,10 +457,10 @@ static int twl4030_kp_remove(struct platform_device *pdev)
 
 
 static struct platform_driver twl4030_kp_driver = {
 static struct platform_driver twl4030_kp_driver = {
 	.probe		= twl4030_kp_probe,
 	.probe		= twl4030_kp_probe,
-	.remove		= twl4030_kp_remove,
 	.driver		= {
 	.driver		= {
 		.name	= "twl4030_keypad",
 		.name	= "twl4030_keypad",
 		.owner	= THIS_MODULE,
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(twl4030_keypad_dt_match_table),
 	},
 	},
 };
 };
 module_platform_driver(twl4030_kp_driver);
 module_platform_driver(twl4030_kp_driver);

+ 1 - 2
drivers/input/keyboard/w90p910_keypad.c

@@ -11,7 +11,6 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/device.h>
 #include <linux/device.h>
@@ -121,7 +120,7 @@ static void w90p910_keypad_close(struct input_dev *dev)
 static int w90p910_keypad_probe(struct platform_device *pdev)
 static int w90p910_keypad_probe(struct platform_device *pdev)
 {
 {
 	const struct w90p910_keypad_platform_data *pdata =
 	const struct w90p910_keypad_platform_data *pdata =
-						pdev->dev.platform_data;
+						dev_get_platdata(&pdev->dev);
 	const struct matrix_keymap_data *keymap_data;
 	const struct matrix_keymap_data *keymap_data;
 	struct w90p910_keypad *keypad;
 	struct w90p910_keypad *keypad;
 	struct input_dev *input_dev;
 	struct input_dev *input_dev;

+ 0 - 1
drivers/input/keyboard/xtkbd.c

@@ -29,7 +29,6 @@
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/input.h>
 #include <linux/input.h>
-#include <linux/init.h>
 #include <linux/serio.h>
 #include <linux/serio.h>
 
 
 #define DRIVER_DESC	"XT keyboard driver"
 #define DRIVER_DESC	"XT keyboard driver"

+ 9 - 0
drivers/input/misc/Kconfig

@@ -222,6 +222,15 @@ config INPUT_GP2A
 	  To compile this driver as a module, choose M here: the
 	  To compile this driver as a module, choose M here: the
 	  module will be called gp2ap002a00f.
 	  module will be called gp2ap002a00f.
 
 
+config INPUT_GPIO_BEEPER
+	tristate "Generic GPIO Beeper support"
+	depends on OF_GPIO
+	help
+	  Say Y here if you have a beeper connected to a GPIO pin.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called gpio-beeper.
+
 config INPUT_GPIO_TILT_POLLED
 config INPUT_GPIO_TILT_POLLED
 	tristate "Polled GPIO tilt switch"
 	tristate "Polled GPIO tilt switch"
 	depends on GPIOLIB
 	depends on GPIOLIB

+ 1 - 0
drivers/input/misc/Makefile

@@ -27,6 +27,7 @@ obj-$(CONFIG_INPUT_DA9052_ONKEY)	+= da9052_onkey.o
 obj-$(CONFIG_INPUT_DA9055_ONKEY)	+= da9055_onkey.o
 obj-$(CONFIG_INPUT_DA9055_ONKEY)	+= da9055_onkey.o
 obj-$(CONFIG_INPUT_DM355EVM)		+= dm355evm_keys.o
 obj-$(CONFIG_INPUT_DM355EVM)		+= dm355evm_keys.o
 obj-$(CONFIG_INPUT_GP2A)		+= gp2ap002a00f.o
 obj-$(CONFIG_INPUT_GP2A)		+= gp2ap002a00f.o
+obj-$(CONFIG_INPUT_GPIO_BEEPER)		+= gpio-beeper.o
 obj-$(CONFIG_INPUT_GPIO_TILT_POLLED)	+= gpio_tilt_polled.o
 obj-$(CONFIG_INPUT_GPIO_TILT_POLLED)	+= gpio_tilt_polled.o
 obj-$(CONFIG_HP_SDC_RTC)		+= hp_sdc_rtc.o
 obj-$(CONFIG_HP_SDC_RTC)		+= hp_sdc_rtc.o
 obj-$(CONFIG_INPUT_IMS_PCU)		+= ims-pcu.o
 obj-$(CONFIG_INPUT_IMS_PCU)		+= ims-pcu.o

+ 2 - 3
drivers/input/misc/ad714x.c

@@ -7,7 +7,6 @@
  */
  */
 
 
 #include <linux/device.h>
 #include <linux/device.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
@@ -969,7 +968,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
 	int error;
 	int error;
 	struct input_dev *input[MAX_DEVICE_NUM];
 	struct input_dev *input[MAX_DEVICE_NUM];
 
 
-	struct ad714x_platform_data *plat_data = dev->platform_data;
+	struct ad714x_platform_data *plat_data = dev_get_platdata(dev);
 	struct ad714x_chip *ad714x;
 	struct ad714x_chip *ad714x;
 	void *drv_mem;
 	void *drv_mem;
 	unsigned long irqflags;
 	unsigned long irqflags;
@@ -986,7 +985,7 @@ struct ad714x_chip *ad714x_probe(struct device *dev, u16 bus_type, int irq,
 		goto err_out;
 		goto err_out;
 	}
 	}
 
 
-	if (dev->platform_data == NULL) {
+	if (dev_get_platdata(dev) == NULL) {
 		dev_err(dev, "platform data for ad714x doesn't exist\n");
 		dev_err(dev, "platform data for ad714x doesn't exist\n");
 		error = -EINVAL;
 		error = -EINVAL;
 		goto err_out;
 		goto err_out;

+ 1 - 2
drivers/input/misc/adxl34x.c

@@ -8,7 +8,6 @@
  */
  */
 
 
 #include <linux/device.h>
 #include <linux/device.h>
-#include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
@@ -714,7 +713,7 @@ struct adxl34x *adxl34x_probe(struct device *dev, int irq,
 
 
 	ac->fifo_delay = fifo_delay_default;
 	ac->fifo_delay = fifo_delay_default;
 
 
-	pdata = dev->platform_data;
+	pdata = dev_get_platdata(dev);
 	if (!pdata) {
 	if (!pdata) {
 		dev_dbg(dev,
 		dev_dbg(dev,
 			"No platform data: Using default initialization\n");
 			"No platform data: Using default initialization\n");

+ 0 - 1
drivers/input/misc/atlas_btns.c

@@ -25,7 +25,6 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/types.h>
 #include <linux/types.h>
 #include <linux/acpi.h>
 #include <linux/acpi.h>

+ 1 - 2
drivers/input/misc/bfin_rotary.c

@@ -6,7 +6,6 @@
  */
  */
 
 
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irq.h>
 #include <linux/pm.h>
 #include <linux/pm.h>
@@ -92,7 +91,7 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id)
 
 
 static int bfin_rotary_probe(struct platform_device *pdev)
 static int bfin_rotary_probe(struct platform_device *pdev)
 {
 {
-	struct bfin_rotary_platform_data *pdata = pdev->dev.platform_data;
+	struct bfin_rotary_platform_data *pdata = dev_get_platdata(&pdev->dev);
 	struct bfin_rot *rotary;
 	struct bfin_rot *rotary;
 	struct input_dev *input;
 	struct input_dev *input;
 	int error;
 	int error;

+ 2 - 1
drivers/input/misc/bma150.c

@@ -526,7 +526,8 @@ static int bma150_register_polled_device(struct bma150_data *bma150)
 static int bma150_probe(struct i2c_client *client,
 static int bma150_probe(struct i2c_client *client,
 				  const struct i2c_device_id *id)
 				  const struct i2c_device_id *id)
 {
 {
-	const struct bma150_platform_data *pdata = client->dev.platform_data;
+	const struct bma150_platform_data *pdata =
+			dev_get_platdata(&client->dev);
 	const struct bma150_cfg *cfg;
 	const struct bma150_cfg *cfg;
 	struct bma150_data *bma150;
 	struct bma150_data *bma150;
 	int chip_id;
 	int chip_id;

+ 1 - 1
drivers/input/misc/cma3000_d0x.c

@@ -284,7 +284,7 @@ EXPORT_SYMBOL(cma3000_resume);
 struct cma3000_accl_data *cma3000_init(struct device *dev, int irq,
 struct cma3000_accl_data *cma3000_init(struct device *dev, int irq,
 				       const struct cma3000_bus_ops *bops)
 				       const struct cma3000_bus_ops *bops)
 {
 {
-	const struct cma3000_platform_data *pdata = dev->platform_data;
+	const struct cma3000_platform_data *pdata = dev_get_platdata(dev);
 	struct cma3000_accl_data *data;
 	struct cma3000_accl_data *data;
 	struct input_dev *input_dev;
 	struct input_dev *input_dev;
 	int rev;
 	int rev;

+ 0 - 1
drivers/input/misc/cobalt_btns.c

@@ -17,7 +17,6 @@
  *  along with this program; if not, write to the Free Software
  *  along with this program; if not, write to the Free Software
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
  */
-#include <linux/init.h>
 #include <linux/input-polldev.h>
 #include <linux/input-polldev.h>
 #include <linux/ioport.h>
 #include <linux/ioport.h>
 #include <linux/module.h>
 #include <linux/module.h>

+ 0 - 1
drivers/input/misc/da9052_onkey.c

@@ -11,7 +11,6 @@
  * option) any later version.
  * option) any later version.
  */
  */
 
 
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>

+ 0 - 1
drivers/input/misc/da9055_onkey.c

@@ -11,7 +11,6 @@
  * option) any later version.
  * option) any later version.
  */
  */
 
 
-#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>

+ 0 - 1
drivers/input/misc/dm355evm_keys.c

@@ -9,7 +9,6 @@
  * 2 of the License, or (at your option) any later version.
  * 2 of the License, or (at your option) any later version.
  */
  */
 #include <linux/kernel.h>
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/input/sparse-keymap.h>
 #include <linux/input/sparse-keymap.h>

+ 1 - 1
drivers/input/misc/gp2ap002a00f.c

@@ -125,7 +125,7 @@ static int gp2a_initialize(struct gp2a_data *dt)
 static int gp2a_probe(struct i2c_client *client,
 static int gp2a_probe(struct i2c_client *client,
 				const struct i2c_device_id *id)
 				const struct i2c_device_id *id)
 {
 {
-	const struct gp2a_platform_data *pdata = client->dev.platform_data;
+	const struct gp2a_platform_data *pdata = dev_get_platdata(&client->dev);
 	struct gp2a_data *dt;
 	struct gp2a_data *dt;
 	int error;
 	int error;
 
 

+ 127 - 0
drivers/input/misc/gpio-beeper.c

@@ -0,0 +1,127 @@
+/*
+ * Generic GPIO beeper driver
+ *
+ * Copyright (C) 2013 Alexander Shiyan <shc_work@mail.ru>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/input.h>
+#include <linux/module.h>
+#include <linux/of_gpio.h>
+#include <linux/workqueue.h>
+#include <linux/platform_device.h>
+
+#define BEEPER_MODNAME		"gpio-beeper"
+
+struct gpio_beeper {
+	struct work_struct	work;
+	int			gpio;
+	bool			active_low;
+	bool			beeping;
+};
+
+static void gpio_beeper_toggle(struct gpio_beeper *beep, bool on)
+{
+	gpio_set_value_cansleep(beep->gpio, on ^ beep->active_low);
+}
+
+static void gpio_beeper_work(struct work_struct *work)
+{
+	struct gpio_beeper *beep = container_of(work, struct gpio_beeper, work);
+
+	gpio_beeper_toggle(beep, beep->beeping);
+}
+
+static int gpio_beeper_event(struct input_dev *dev, unsigned int type,
+			     unsigned int code, int value)
+{
+	struct gpio_beeper *beep = input_get_drvdata(dev);
+
+	if (type != EV_SND || code != SND_BELL)
+		return -ENOTSUPP;
+
+	if (value < 0)
+		return -EINVAL;
+
+	beep->beeping = value;
+	/* Schedule work to actually turn the beeper on or off */
+	schedule_work(&beep->work);
+
+	return 0;
+}
+
+static void gpio_beeper_close(struct input_dev *input)
+{
+	struct gpio_beeper *beep = input_get_drvdata(input);
+
+	cancel_work_sync(&beep->work);
+	gpio_beeper_toggle(beep, false);
+}
+
+static int gpio_beeper_probe(struct platform_device *pdev)
+{
+	struct gpio_beeper *beep;
+	enum of_gpio_flags flags;
+	struct input_dev *input;
+	unsigned long gflags;
+	int err;
+
+	beep = devm_kzalloc(&pdev->dev, sizeof(*beep), GFP_KERNEL);
+	if (!beep)
+		return -ENOMEM;
+
+	beep->gpio = of_get_gpio_flags(pdev->dev.of_node, 0, &flags);
+	if (!gpio_is_valid(beep->gpio))
+		return beep->gpio;
+
+	input = devm_input_allocate_device(&pdev->dev);
+	if (!input)
+		return -ENOMEM;
+
+	INIT_WORK(&beep->work, gpio_beeper_work);
+
+	input->name		= pdev->name;
+	input->id.bustype	= BUS_HOST;
+	input->id.vendor	= 0x0001;
+	input->id.product	= 0x0001;
+	input->id.version	= 0x0100;
+	input->close		= gpio_beeper_close;
+	input->event		= gpio_beeper_event;
+
+	input_set_capability(input, EV_SND, SND_BELL);
+
+	beep->active_low = flags & OF_GPIO_ACTIVE_LOW;
+	gflags = beep->active_low ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
+
+	err = devm_gpio_request_one(&pdev->dev, beep->gpio, gflags, pdev->name);
+	if (err)
+		return err;
+
+	input_set_drvdata(input, beep);
+
+	return input_register_device(input);
+}
+
+static struct of_device_id gpio_beeper_of_match[] = {
+	{ .compatible = BEEPER_MODNAME, },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, gpio_beeper_of_match);
+
+static struct platform_driver gpio_beeper_platform_driver = {
+	.driver	= {
+		.name		= BEEPER_MODNAME,
+		.owner		= THIS_MODULE,
+		.of_match_table	= gpio_beeper_of_match,
+	},
+	.probe	= gpio_beeper_probe,
+};
+module_platform_driver(gpio_beeper_platform_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
+MODULE_DESCRIPTION("Generic GPIO beeper driver");

+ 2 - 2
drivers/input/misc/gpio_tilt_polled.c

@@ -16,7 +16,6 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/module.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/input.h>
 #include <linux/input-polldev.h>
 #include <linux/input-polldev.h>
@@ -98,7 +97,8 @@ static void gpio_tilt_polled_close(struct input_polled_dev *dev)
 
 
 static int gpio_tilt_polled_probe(struct platform_device *pdev)
 static int gpio_tilt_polled_probe(struct platform_device *pdev)
 {
 {
-	const struct gpio_tilt_platform_data *pdata = pdev->dev.platform_data;
+	const struct gpio_tilt_platform_data *pdata =
+			dev_get_platdata(&pdev->dev);
 	struct device *dev = &pdev->dev;
 	struct device *dev = &pdev->dev;
 	struct gpio_tilt_polled_dev *tdev;
 	struct gpio_tilt_polled_dev *tdev;
 	struct input_polled_dev *poll_dev;
 	struct input_polled_dev *poll_dev;

+ 0 - 1
drivers/input/misc/keyspan_remote.c

@@ -13,7 +13,6 @@
 
 
 #include <linux/kernel.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/errno.h>
-#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/module.h>
 #include <linux/usb/input.h>
 #include <linux/usb/input.h>

+ 2 - 1
drivers/input/misc/kxtj9.c

@@ -509,7 +509,8 @@ out:
 static int kxtj9_probe(struct i2c_client *client,
 static int kxtj9_probe(struct i2c_client *client,
 				 const struct i2c_device_id *id)
 				 const struct i2c_device_id *id)
 {
 {
-	const struct kxtj9_platform_data *pdata = client->dev.platform_data;
+	const struct kxtj9_platform_data *pdata =
+			dev_get_platdata(&client->dev);
 	struct kxtj9_data *tj9;
 	struct kxtj9_data *tj9;
 	int err;
 	int err;
 
 

Some files were not shown because too many files changed in this diff