diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-12-17 01:04:14 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-12-17 01:04:14 -0500 |
commit | 022573c275500e1a50889949f679d04b5446edf6 (patch) | |
tree | 766ab0e13fc38275466f8544d1bbf4982833cbff | |
parent | 516d798f656614f59553b1ff3592c2c36102b684 (diff) | |
parent | a455e2985f57e2a71566bb8850094af38b2c932d (diff) |
Merge branch 'next' into for-linus
Prepare first set of updates for 3.8 merge window.
360 files changed, 4367 insertions, 2829 deletions
diff --git a/Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt b/Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt new file mode 100644 index 00000000000..ead641c65e0 --- /dev/null +++ b/Documentation/devicetree/bindings/input/gpio-matrix-keypad.txt | |||
@@ -0,0 +1,46 @@ | |||
1 | * GPIO driven matrix keypad device tree bindings | ||
2 | |||
3 | GPIO driven matrix keypad is used to interface a SoC with a matrix keypad. | ||
4 | The matrix keypad supports multiple row and column lines, a key can be | ||
5 | placed at each intersection of a unique row and a unique column. The matrix | ||
6 | keypad can sense a key-press and key-release by means of GPIO lines and | ||
7 | report the event using GPIO interrupts to the cpu. | ||
8 | |||
9 | Required Properties: | ||
10 | - compatible: Should be "gpio-matrix-keypad" | ||
11 | - row-gpios: List of gpios used as row lines. The gpio specifier | ||
12 | for this property depends on the gpio controller to | ||
13 | which these row lines are connected. | ||
14 | - col-gpios: List of gpios used as column lines. The gpio specifier | ||
15 | for this property depends on the gpio controller to | ||
16 | which these column lines are connected. | ||
17 | - linux,keymap: The definition can be found at | ||
18 | bindings/input/matrix-keymap.txt | ||
19 | |||
20 | Optional Properties: | ||
21 | - linux,no-autorepeat: do no enable autorepeat feature. | ||
22 | - linux,wakeup: use any event on keypad as wakeup event. | ||
23 | - debounce-delay-ms: debounce interval in milliseconds | ||
24 | - col-scan-delay-us: delay, measured in microseconds, that is needed | ||
25 | before we can scan keypad after activating column gpio | ||
26 | |||
27 | Example: | ||
28 | matrix-keypad { | ||
29 | compatible = "gpio-matrix-keypad"; | ||
30 | debounce-delay-ms = <5>; | ||
31 | col-scan-delay-us = <2>; | ||
32 | |||
33 | row-gpios = <&gpio2 25 0 | ||
34 | &gpio2 26 0 | ||
35 | &gpio2 27 0>; | ||
36 | |||
37 | col-gpios = <&gpio2 21 0 | ||
38 | &gpio2 22 0>; | ||
39 | |||
40 | linux,keymap = <0x0000008B | ||
41 | 0x0100009E | ||
42 | 0x02000069 | ||
43 | 0x0001006A | ||
44 | 0x0101001C | ||
45 | 0x0201006C>; | ||
46 | }; | ||
diff --git a/Documentation/devicetree/bindings/input/pwm-beeper.txt b/Documentation/devicetree/bindings/input/pwm-beeper.txt new file mode 100644 index 00000000000..be332ae4f2d --- /dev/null +++ b/Documentation/devicetree/bindings/input/pwm-beeper.txt | |||
@@ -0,0 +1,7 @@ | |||
1 | * PWM beeper device tree bindings | ||
2 | |||
3 | Registers a PWM device as beeper. | ||
4 | |||
5 | Required properties: | ||
6 | - compatible: should be "pwm-beeper" | ||
7 | - pwms: phandle to the physical PWM device | ||
diff --git a/Documentation/devicetree/bindings/input/stmpe-keypad.txt b/Documentation/devicetree/bindings/input/stmpe-keypad.txt new file mode 100644 index 00000000000..1b97222e8a0 --- /dev/null +++ b/Documentation/devicetree/bindings/input/stmpe-keypad.txt | |||
@@ -0,0 +1,39 @@ | |||
1 | * STMPE Keypad | ||
2 | |||
3 | Required properties: | ||
4 | - compatible : "st,stmpe-keypad" | ||
5 | - linux,keymap : See ./matrix-keymap.txt | ||
6 | |||
7 | Optional properties: | ||
8 | - debounce-interval : Debouncing interval time in milliseconds | ||
9 | - st,scan-count : Scanning cycles elapsed before key data is updated | ||
10 | - st,no-autorepeat : If specified device will not autorepeat | ||
11 | |||
12 | Example: | ||
13 | |||
14 | stmpe_keypad { | ||
15 | compatible = "st,stmpe-keypad"; | ||
16 | |||
17 | debounce-interval = <64>; | ||
18 | st,scan-count = <8>; | ||
19 | st,no-autorepeat; | ||
20 | |||
21 | linux,keymap = <0x205006b | ||
22 | 0x4010074 | ||
23 | 0x3050072 | ||
24 | 0x1030004 | ||
25 | 0x502006a | ||
26 | 0x500000a | ||
27 | 0x5008b | ||
28 | 0x706001c | ||
29 | 0x405000b | ||
30 | 0x6070003 | ||
31 | 0x3040067 | ||
32 | 0x303006c | ||
33 | 0x60400e7 | ||
34 | 0x602009e | ||
35 | 0x4020073 | ||
36 | 0x5050002 | ||
37 | 0x4030069 | ||
38 | 0x3020008>; | ||
39 | }; | ||
diff --git a/Documentation/devicetree/bindings/input/tca8418_keypad.txt b/Documentation/devicetree/bindings/input/tca8418_keypad.txt new file mode 100644 index 00000000000..2a1538f0053 --- /dev/null +++ b/Documentation/devicetree/bindings/input/tca8418_keypad.txt | |||
@@ -0,0 +1,8 @@ | |||
1 | |||
2 | Required properties: | ||
3 | - compatible: "ti,tca8418" | ||
4 | - reg: the I2C address | ||
5 | - interrupts: IRQ line number, should trigger on falling edge | ||
6 | - keypad,num-rows: The number of rows | ||
7 | - keypad,num-columns: The number of columns | ||
8 | - linux,keymap: Keys definitions, see keypad-matrix. | ||
diff --git a/Documentation/devicetree/bindings/input/touchscreen/mms114.txt b/Documentation/devicetree/bindings/input/touchscreen/mms114.txt new file mode 100644 index 00000000000..89d4c56c567 --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/mms114.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | * MELFAS MMS114 touchscreen controller | ||
2 | |||
3 | Required properties: | ||
4 | - compatible: must be "melfas,mms114" | ||
5 | - reg: I2C address of the chip | ||
6 | - interrupts: interrupt to which the chip is connected | ||
7 | - x-size: horizontal resolution of touchscreen | ||
8 | - y-size: vertical resolution of touchscreen | ||
9 | |||
10 | Optional properties: | ||
11 | - contact-threshold: | ||
12 | - moving-threshold: | ||
13 | - x-invert: invert X axis | ||
14 | - y-invert: invert Y axis | ||
15 | |||
16 | Example: | ||
17 | |||
18 | i2c@00000000 { | ||
19 | /* ... */ | ||
20 | |||
21 | touchscreen@48 { | ||
22 | compatible = "melfas,mms114"; | ||
23 | reg = <0x48>; | ||
24 | interrupts = <39 0>; | ||
25 | x-size = <720>; | ||
26 | y-size = <1280>; | ||
27 | contact-threshold = <10>; | ||
28 | moving-threshold = <10>; | ||
29 | x-invert; | ||
30 | y-invert; | ||
31 | }; | ||
32 | |||
33 | /* ... */ | ||
34 | }; | ||
diff --git a/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt new file mode 100644 index 00000000000..127baa31a77 --- /dev/null +++ b/Documentation/devicetree/bindings/input/touchscreen/stmpe.txt | |||
@@ -0,0 +1,43 @@ | |||
1 | STMPE Touchscreen | ||
2 | ---------------- | ||
3 | |||
4 | Required properties: | ||
5 | - compatible: "st,stmpe-ts" | ||
6 | |||
7 | Optional properties: | ||
8 | - st,sample-time: ADC converstion time in number of clock. (0 -> 36 clocks, 1 -> | ||
9 | 44 clocks, 2 -> 56 clocks, 3 -> 64 clocks, 4 -> 80 clocks, 5 -> 96 clocks, 6 | ||
10 | -> 144 clocks), recommended is 4. | ||
11 | - st,mod-12b: ADC Bit mode (0 -> 10bit ADC, 1 -> 12bit ADC) | ||
12 | - st,ref-sel: ADC reference source (0 -> internal reference, 1 -> external | ||
13 | reference) | ||
14 | - st,adc-freq: ADC Clock speed (0 -> 1.625 MHz, 1 -> 3.25 MHz, 2 || 3 -> 6.5 MHz) | ||
15 | - st,ave-ctrl: Sample average control (0 -> 1 sample, 1 -> 2 samples, 2 -> 4 | ||
16 | samples, 3 -> 8 samples) | ||
17 | - st,touch-det-delay: Touch detect interrupt delay (0 -> 10 us, 1 -> 50 us, 2 -> | ||
18 | 100 us, 3 -> 500 us, 4-> 1 ms, 5 -> 5 ms, 6 -> 10 ms, 7 -> 50 ms) recommended | ||
19 | is 3 | ||
20 | - st,settling: Panel driver settling time (0 -> 10 us, 1 -> 100 us, 2 -> 500 us, 3 | ||
21 | -> 1 ms, 4 -> 5 ms, 5 -> 10 ms, 6 for 50 ms, 7 -> 100 ms) recommended is 2 | ||
22 | - st,fraction-z: Length of the fractional part in z (fraction-z ([0..7]) = Count of | ||
23 | the fractional part) recommended is 7 | ||
24 | - st,i-drive: current limit value of the touchscreen drivers (0 -> 20 mA typical 35 | ||
25 | mA max, 1 -> 50 mA typical 80 mA max) | ||
26 | |||
27 | Node name must be stmpe_touchscreen and should be child node of stmpe node to | ||
28 | which it belongs. | ||
29 | |||
30 | Example: | ||
31 | |||
32 | stmpe_touchscreen { | ||
33 | compatible = "st,stmpe-ts"; | ||
34 | st,sample-time = <4>; | ||
35 | st,mod-12b = <1>; | ||
36 | st,ref-sel = <0>; | ||
37 | st,adc-freq = <1>; | ||
38 | st,ave-ctrl = <1>; | ||
39 | st,touch-det-delay = <2>; | ||
40 | st,settling = <2>; | ||
41 | st,fraction-z = <7>; | ||
42 | st,i-drive = <1>; | ||
43 | }; | ||
diff --git a/Documentation/hwmon/fam15h_power b/Documentation/hwmon/fam15h_power index a92918e0bd6..80654813d04 100644 --- a/Documentation/hwmon/fam15h_power +++ b/Documentation/hwmon/fam15h_power | |||
@@ -10,7 +10,7 @@ Supported chips: | |||
10 | BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors | 10 | BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors |
11 | (not yet published) | 11 | (not yet published) |
12 | 12 | ||
13 | Author: Andreas Herrmann <andreas.herrmann3@amd.com> | 13 | Author: Andreas Herrmann <herrmann.der.user@googlemail.com> |
14 | 14 | ||
15 | Description | 15 | Description |
16 | ----------- | 16 | ----------- |
diff --git a/MAINTAINERS b/MAINTAINERS index 1fa907441f8..59203e77ce9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -503,7 +503,7 @@ F: include/linux/altera_uart.h | |||
503 | F: include/linux/altera_jtaguart.h | 503 | F: include/linux/altera_jtaguart.h |
504 | 504 | ||
505 | AMD FAM15H PROCESSOR POWER MONITORING DRIVER | 505 | AMD FAM15H PROCESSOR POWER MONITORING DRIVER |
506 | M: Andreas Herrmann <andreas.herrmann3@amd.com> | 506 | M: Andreas Herrmann <herrmann.der.user@googlemail.com> |
507 | L: lm-sensors@lm-sensors.org | 507 | L: lm-sensors@lm-sensors.org |
508 | S: Maintained | 508 | S: Maintained |
509 | F: Documentation/hwmon/fam15h_power | 509 | F: Documentation/hwmon/fam15h_power |
@@ -2507,6 +2507,7 @@ M: Joonyoung Shim <jy0922.shim@samsung.com> | |||
2507 | M: Seung-Woo Kim <sw0312.kim@samsung.com> | 2507 | M: Seung-Woo Kim <sw0312.kim@samsung.com> |
2508 | M: Kyungmin Park <kyungmin.park@samsung.com> | 2508 | M: Kyungmin Park <kyungmin.park@samsung.com> |
2509 | L: dri-devel@lists.freedesktop.org | 2509 | L: dri-devel@lists.freedesktop.org |
2510 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git | ||
2510 | S: Supported | 2511 | S: Supported |
2511 | F: drivers/gpu/drm/exynos | 2512 | F: drivers/gpu/drm/exynos |
2512 | F: include/drm/exynos* | 2513 | F: include/drm/exynos* |
@@ -5647,7 +5648,7 @@ S: Maintained | |||
5647 | F: drivers/pinctrl/spear/ | 5648 | F: drivers/pinctrl/spear/ |
5648 | 5649 | ||
5649 | PKTCDVD DRIVER | 5650 | PKTCDVD DRIVER |
5650 | M: Peter Osterlund <petero2@telia.com> | 5651 | M: Jiri Kosina <jkosina@suse.cz> |
5651 | S: Maintained | 5652 | S: Maintained |
5652 | F: drivers/block/pktcdvd.c | 5653 | F: drivers/block/pktcdvd.c |
5653 | F: include/linux/pktcdvd.h | 5654 | F: include/linux/pktcdvd.h |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 3 | 1 | VERSION = 3 |
2 | PATCHLEVEL = 7 | 2 | PATCHLEVEL = 7 |
3 | SUBLEVEL = 0 | 3 | SUBLEVEL = 0 |
4 | EXTRAVERSION = -rc3 | 4 | EXTRAVERSION = -rc4 |
5 | NAME = Terrified Chipmunk | 5 | NAME = Terrified Chipmunk |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index 7d5c06d6a52..be6490b5eb2 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c | |||
@@ -112,17 +112,6 @@ static void __init mipid_dev_init(void) | |||
112 | omapfb_set_lcd_config(&nokia770_lcd_config); | 112 | omapfb_set_lcd_config(&nokia770_lcd_config); |
113 | } | 113 | } |
114 | 114 | ||
115 | static void __init ads7846_dev_init(void) | ||
116 | { | ||
117 | if (gpio_request(ADS7846_PENDOWN_GPIO, "ADS7846 pendown") < 0) | ||
118 | printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); | ||
119 | } | ||
120 | |||
121 | static int ads7846_get_pendown_state(void) | ||
122 | { | ||
123 | return !gpio_get_value(ADS7846_PENDOWN_GPIO); | ||
124 | } | ||
125 | |||
126 | static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = { | 115 | static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = { |
127 | .x_max = 0x0fff, | 116 | .x_max = 0x0fff, |
128 | .y_max = 0x0fff, | 117 | .y_max = 0x0fff, |
@@ -131,7 +120,7 @@ static struct ads7846_platform_data nokia770_ads7846_platform_data __initdata = | |||
131 | .debounce_max = 10, | 120 | .debounce_max = 10, |
132 | .debounce_tol = 3, | 121 | .debounce_tol = 3, |
133 | .debounce_rep = 1, | 122 | .debounce_rep = 1, |
134 | .get_pendown_state = ads7846_get_pendown_state, | 123 | .gpio_pendown = ADS7846_PENDOWN_GPIO, |
135 | }; | 124 | }; |
136 | 125 | ||
137 | static struct spi_board_info nokia770_spi_board_info[] __initdata = { | 126 | static struct spi_board_info nokia770_spi_board_info[] __initdata = { |
@@ -241,7 +230,6 @@ static void __init omap_nokia770_init(void) | |||
241 | omap_serial_init(); | 230 | omap_serial_init(); |
242 | omap_register_i2c_bus(1, 100, NULL, 0); | 231 | omap_register_i2c_bus(1, 100, NULL, 0); |
243 | hwa742_dev_init(); | 232 | hwa742_dev_init(); |
244 | ads7846_dev_init(); | ||
245 | mipid_dev_init(); | 233 | mipid_dev_init(); |
246 | omap1_usb_init(&nokia770_usb_config); | 234 | omap1_usb_init(&nokia770_usb_config); |
247 | nokia770_mmc_init(); | 235 | nokia770_mmc_init(); |
diff --git a/arch/arm/mach-ux500/board-mop500-stuib.c b/arch/arm/mach-ux500/board-mop500-stuib.c index 8c979770d87..7e1f294f043 100644 --- a/arch/arm/mach-ux500/board-mop500-stuib.c +++ b/arch/arm/mach-ux500/board-mop500-stuib.c | |||
@@ -77,9 +77,6 @@ static struct i2c_board_info __initdata mop500_i2c0_devices_stuib[] = { | |||
77 | * BU21013 ROHM touchscreen interface on the STUIBs | 77 | * BU21013 ROHM touchscreen interface on the STUIBs |
78 | */ | 78 | */ |
79 | 79 | ||
80 | /* tracks number of bu21013 devices being enabled */ | ||
81 | static int bu21013_devices; | ||
82 | |||
83 | #define TOUCH_GPIO_PIN 84 | 80 | #define TOUCH_GPIO_PIN 84 |
84 | 81 | ||
85 | #define TOUCH_XMAX 384 | 82 | #define TOUCH_XMAX 384 |
@@ -88,85 +85,8 @@ static int bu21013_devices; | |||
88 | #define PRCMU_CLOCK_OCR 0x1CC | 85 | #define PRCMU_CLOCK_OCR 0x1CC |
89 | #define TSC_EXT_CLOCK_9_6MHZ 0x840000 | 86 | #define TSC_EXT_CLOCK_9_6MHZ 0x840000 |
90 | 87 | ||
91 | /** | ||
92 | * bu21013_gpio_board_init : configures the touch panel. | ||
93 | * @reset_pin: reset pin number | ||
94 | * This function can be used to configures | ||
95 | * the voltage and reset the touch panel controller. | ||
96 | */ | ||
97 | static int bu21013_gpio_board_init(int reset_pin) | ||
98 | { | ||
99 | int retval = 0; | ||
100 | |||
101 | bu21013_devices++; | ||
102 | if (bu21013_devices == 1) { | ||
103 | retval = gpio_request(reset_pin, "touchp_reset"); | ||
104 | if (retval) { | ||
105 | printk(KERN_ERR "Unable to request gpio reset_pin"); | ||
106 | return retval; | ||
107 | } | ||
108 | retval = gpio_direction_output(reset_pin, 1); | ||
109 | if (retval < 0) { | ||
110 | printk(KERN_ERR "%s: gpio direction failed\n", | ||
111 | __func__); | ||
112 | return retval; | ||
113 | } | ||
114 | } | ||
115 | |||
116 | return retval; | ||
117 | } | ||
118 | |||
119 | /** | ||
120 | * bu21013_gpio_board_exit : deconfigures the touch panel controller | ||
121 | * @reset_pin: reset pin number | ||
122 | * This function can be used to deconfigures the chip selection | ||
123 | * for touch panel controller. | ||
124 | */ | ||
125 | static int bu21013_gpio_board_exit(int reset_pin) | ||
126 | { | ||
127 | int retval = 0; | ||
128 | |||
129 | if (bu21013_devices == 1) { | ||
130 | retval = gpio_direction_output(reset_pin, 0); | ||
131 | if (retval < 0) { | ||
132 | printk(KERN_ERR "%s: gpio direction failed\n", | ||
133 | __func__); | ||
134 | return retval; | ||
135 | } | ||
136 | gpio_set_value(reset_pin, 0); | ||
137 | } | ||
138 | bu21013_devices--; | ||
139 | |||
140 | return retval; | ||
141 | } | ||
142 | |||
143 | /** | ||
144 | * bu21013_read_pin_val : get the interrupt pin value | ||
145 | * This function can be used to get the interrupt pin value for touch panel | ||
146 | * controller. | ||
147 | */ | ||
148 | static int bu21013_read_pin_val(void) | ||
149 | { | ||
150 | return gpio_get_value(TOUCH_GPIO_PIN); | ||
151 | } | ||
152 | |||
153 | static struct bu21013_platform_device tsc_plat_device = { | 88 | static struct bu21013_platform_device tsc_plat_device = { |
154 | .cs_en = bu21013_gpio_board_init, | 89 | .touch_pin = TOUCH_GPIO_PIN, |
155 | .cs_dis = bu21013_gpio_board_exit, | ||
156 | .irq_read_val = bu21013_read_pin_val, | ||
157 | .irq = NOMADIK_GPIO_TO_IRQ(TOUCH_GPIO_PIN), | ||
158 | .touch_x_max = TOUCH_XMAX, | ||
159 | .touch_y_max = TOUCH_YMAX, | ||
160 | .ext_clk = false, | ||
161 | .x_flip = false, | ||
162 | .y_flip = true, | ||
163 | }; | ||
164 | |||
165 | static struct bu21013_platform_device tsc_plat2_device = { | ||
166 | .cs_en = bu21013_gpio_board_init, | ||
167 | .cs_dis = bu21013_gpio_board_exit, | ||
168 | .irq_read_val = bu21013_read_pin_val, | ||
169 | .irq = NOMADIK_GPIO_TO_IRQ(TOUCH_GPIO_PIN), | ||
170 | .touch_x_max = TOUCH_XMAX, | 90 | .touch_x_max = TOUCH_XMAX, |
171 | .touch_y_max = TOUCH_YMAX, | 91 | .touch_y_max = TOUCH_YMAX, |
172 | .ext_clk = false, | 92 | .ext_clk = false, |
@@ -181,21 +101,16 @@ static struct i2c_board_info __initdata u8500_i2c3_devices_stuib[] = { | |||
181 | }, | 101 | }, |
182 | { | 102 | { |
183 | I2C_BOARD_INFO("bu21013_tp", 0x5D), | 103 | I2C_BOARD_INFO("bu21013_tp", 0x5D), |
184 | .platform_data = &tsc_plat2_device, | 104 | .platform_data = &tsc_plat_device, |
185 | }, | 105 | }, |
186 | |||
187 | }; | 106 | }; |
188 | 107 | ||
189 | void __init mop500_stuib_init(void) | 108 | void __init mop500_stuib_init(void) |
190 | { | 109 | { |
191 | if (machine_is_hrefv60()) { | 110 | if (machine_is_hrefv60()) |
192 | tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO; | 111 | tsc_plat_device.cs_pin = HREFV60_TOUCH_RST_GPIO; |
193 | tsc_plat2_device.cs_pin = HREFV60_TOUCH_RST_GPIO; | 112 | else |
194 | } else { | ||
195 | tsc_plat_device.cs_pin = GPIO_BU21013_CS; | 113 | tsc_plat_device.cs_pin = GPIO_BU21013_CS; |
196 | tsc_plat2_device.cs_pin = GPIO_BU21013_CS; | ||
197 | |||
198 | } | ||
199 | 114 | ||
200 | mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib, | 115 | mop500_uib_i2c_add(0, mop500_i2c0_devices_stuib, |
201 | ARRAY_SIZE(mop500_i2c0_devices_stuib)); | 116 | ARRAY_SIZE(mop500_i2c0_devices_stuib)); |
diff --git a/arch/arm/xen/hypercall.S b/arch/arm/xen/hypercall.S index 074f5ed101b..71f723984cb 100644 --- a/arch/arm/xen/hypercall.S +++ b/arch/arm/xen/hypercall.S | |||
@@ -48,20 +48,16 @@ | |||
48 | 48 | ||
49 | #include <linux/linkage.h> | 49 | #include <linux/linkage.h> |
50 | #include <asm/assembler.h> | 50 | #include <asm/assembler.h> |
51 | #include <asm/opcodes-virt.h> | ||
51 | #include <xen/interface/xen.h> | 52 | #include <xen/interface/xen.h> |
52 | 53 | ||
53 | 54 | ||
54 | /* HVC 0xEA1 */ | 55 | #define XEN_IMM 0xEA1 |
55 | #ifdef CONFIG_THUMB2_KERNEL | ||
56 | #define xen_hvc .word 0xf7e08ea1 | ||
57 | #else | ||
58 | #define xen_hvc .word 0xe140ea71 | ||
59 | #endif | ||
60 | 56 | ||
61 | #define HYPERCALL_SIMPLE(hypercall) \ | 57 | #define HYPERCALL_SIMPLE(hypercall) \ |
62 | ENTRY(HYPERVISOR_##hypercall) \ | 58 | ENTRY(HYPERVISOR_##hypercall) \ |
63 | mov r12, #__HYPERVISOR_##hypercall; \ | 59 | mov r12, #__HYPERVISOR_##hypercall; \ |
64 | xen_hvc; \ | 60 | __HVC(XEN_IMM); \ |
65 | mov pc, lr; \ | 61 | mov pc, lr; \ |
66 | ENDPROC(HYPERVISOR_##hypercall) | 62 | ENDPROC(HYPERVISOR_##hypercall) |
67 | 63 | ||
@@ -76,7 +72,7 @@ ENTRY(HYPERVISOR_##hypercall) \ | |||
76 | stmdb sp!, {r4} \ | 72 | stmdb sp!, {r4} \ |
77 | ldr r4, [sp, #4] \ | 73 | ldr r4, [sp, #4] \ |
78 | mov r12, #__HYPERVISOR_##hypercall; \ | 74 | mov r12, #__HYPERVISOR_##hypercall; \ |
79 | xen_hvc \ | 75 | __HVC(XEN_IMM); \ |
80 | ldm sp!, {r4} \ | 76 | ldm sp!, {r4} \ |
81 | mov pc, lr \ | 77 | mov pc, lr \ |
82 | ENDPROC(HYPERVISOR_##hypercall) | 78 | ENDPROC(HYPERVISOR_##hypercall) |
@@ -100,7 +96,7 @@ ENTRY(privcmd_call) | |||
100 | mov r2, r3 | 96 | mov r2, r3 |
101 | ldr r3, [sp, #8] | 97 | ldr r3, [sp, #8] |
102 | ldr r4, [sp, #4] | 98 | ldr r4, [sp, #4] |
103 | xen_hvc | 99 | __HVC(XEN_IMM) |
104 | ldm sp!, {r4} | 100 | ldm sp!, {r4} |
105 | mov pc, lr | 101 | mov pc, lr |
106 | ENDPROC(privcmd_call); | 102 | ENDPROC(privcmd_call); |
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig index b7412504f08..df2eb4bd9fa 100644 --- a/arch/frv/Kconfig +++ b/arch/frv/Kconfig | |||
@@ -13,6 +13,7 @@ config FRV | |||
13 | select GENERIC_CPU_DEVICES | 13 | select GENERIC_CPU_DEVICES |
14 | select ARCH_WANT_IPC_PARSE_VERSION | 14 | select ARCH_WANT_IPC_PARSE_VERSION |
15 | select GENERIC_KERNEL_THREAD | 15 | select GENERIC_KERNEL_THREAD |
16 | select GENERIC_KERNEL_EXECVE | ||
16 | 17 | ||
17 | config ZONE_DMA | 18 | config ZONE_DMA |
18 | bool | 19 | bool |
diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile index 6ae3254da01..636d5bbcd53 100644 --- a/arch/frv/boot/Makefile +++ b/arch/frv/boot/Makefile | |||
@@ -17,6 +17,8 @@ PARAMS_PHYS = 0x0207c000 | |||
17 | INITRD_PHYS = 0x02180000 | 17 | INITRD_PHYS = 0x02180000 |
18 | INITRD_VIRT = 0x02180000 | 18 | INITRD_VIRT = 0x02180000 |
19 | 19 | ||
20 | OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment | ||
21 | |||
20 | # | 22 | # |
21 | # If you don't define ZRELADDR above, | 23 | # If you don't define ZRELADDR above, |
22 | # then it defaults to ZTEXTADDR | 24 | # then it defaults to ZTEXTADDR |
@@ -32,18 +34,18 @@ Image: $(obj)/Image | |||
32 | targets: $(obj)/Image | 34 | targets: $(obj)/Image |
33 | 35 | ||
34 | $(obj)/Image: vmlinux FORCE | 36 | $(obj)/Image: vmlinux FORCE |
35 | $(OBJCOPY) -O binary -R .note -R .comment -S vmlinux $@ | 37 | $(OBJCOPY) $(OBJCOPYFLAGS) -S vmlinux $@ |
36 | 38 | ||
37 | #$(obj)/Image: $(CONFIGURE) $(SYSTEM) | 39 | #$(obj)/Image: $(CONFIGURE) $(SYSTEM) |
38 | # $(OBJCOPY) -O binary -R .note -R .comment -g -S $(SYSTEM) $@ | 40 | # $(OBJCOPY) $(OBJCOPYFLAGS) -g -S $(SYSTEM) $@ |
39 | 41 | ||
40 | bzImage: zImage | 42 | bzImage: zImage |
41 | 43 | ||
42 | zImage: $(CONFIGURE) compressed/$(LINUX) | 44 | zImage: $(CONFIGURE) compressed/$(LINUX) |
43 | $(OBJCOPY) -O binary -R .note -R .comment -S compressed/$(LINUX) $@ | 45 | $(OBJCOPY) $(OBJCOPYFLAGS) -S compressed/$(LINUX) $@ |
44 | 46 | ||
45 | bootpImage: bootp/bootp | 47 | bootpImage: bootp/bootp |
46 | $(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@ | 48 | $(OBJCOPY) $(OBJCOPYFLAGS) -S bootp/bootp $@ |
47 | 49 | ||
48 | compressed/$(LINUX): $(LINUX) dep | 50 | compressed/$(LINUX): $(LINUX) dep |
49 | @$(MAKE) -C compressed $(LINUX) | 51 | @$(MAKE) -C compressed $(LINUX) |
diff --git a/arch/frv/include/asm/unistd.h b/arch/frv/include/asm/unistd.h index 266a5b25a0c..2358634cacc 100644 --- a/arch/frv/include/asm/unistd.h +++ b/arch/frv/include/asm/unistd.h | |||
@@ -30,7 +30,6 @@ | |||
30 | #define __ARCH_WANT_SYS_RT_SIGACTION | 30 | #define __ARCH_WANT_SYS_RT_SIGACTION |
31 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 31 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
32 | #define __ARCH_WANT_SYS_EXECVE | 32 | #define __ARCH_WANT_SYS_EXECVE |
33 | #define __ARCH_WANT_KERNEL_EXECVE | ||
34 | 33 | ||
35 | /* | 34 | /* |
36 | * "Conditional" syscalls | 35 | * "Conditional" syscalls |
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S index ee0beb354e4..dfcd263c051 100644 --- a/arch/frv/kernel/entry.S +++ b/arch/frv/kernel/entry.S | |||
@@ -869,11 +869,6 @@ ret_from_kernel_thread: | |||
869 | call schedule_tail | 869 | call schedule_tail |
870 | calll.p @(gr21,gr0) | 870 | calll.p @(gr21,gr0) |
871 | or gr20,gr20,gr8 | 871 | or gr20,gr20,gr8 |
872 | bra sys_exit | ||
873 | |||
874 | .globl ret_from_kernel_execve | ||
875 | ret_from_kernel_execve: | ||
876 | ori gr28,0,sp | ||
877 | bra __syscall_exit | 872 | bra __syscall_exit |
878 | 873 | ||
879 | ################################################################################################### | 874 | ################################################################################################### |
@@ -1080,27 +1075,10 @@ __entry_return_from_kernel_interrupt: | |||
1080 | subicc gr5,#0,gr0,icc0 | 1075 | subicc gr5,#0,gr0,icc0 |
1081 | beq icc0,#0,__entry_return_direct | 1076 | beq icc0,#0,__entry_return_direct |
1082 | 1077 | ||
1083 | __entry_preempt_need_resched: | 1078 | subcc gr0,gr0,gr0,icc2 /* set Z and clear C */ |
1084 | ldi @(gr15,#TI_FLAGS),gr4 | 1079 | call preempt_schedule_irq |
1085 | andicc gr4,#_TIF_NEED_RESCHED,gr0,icc0 | ||
1086 | beq icc0,#1,__entry_return_direct | ||
1087 | |||
1088 | setlos #PREEMPT_ACTIVE,gr5 | ||
1089 | sti gr5,@(gr15,#TI_FLAGS) | ||
1090 | |||
1091 | andi gr23,#~PSR_PIL,gr23 | ||
1092 | movgs gr23,psr | ||
1093 | |||
1094 | call schedule | ||
1095 | sti gr0,@(gr15,#TI_PRE_COUNT) | ||
1096 | |||
1097 | movsg psr,gr23 | ||
1098 | ori gr23,#PSR_PIL_14,gr23 | ||
1099 | movgs gr23,psr | ||
1100 | bra __entry_preempt_need_resched | ||
1101 | #else | ||
1102 | bra __entry_return_direct | ||
1103 | #endif | 1080 | #endif |
1081 | bra __entry_return_direct | ||
1104 | 1082 | ||
1105 | 1083 | ||
1106 | ############################################################################### | 1084 | ############################################################################### |
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c index e1e3aa196aa..7e33215f1d8 100644 --- a/arch/frv/kernel/process.c +++ b/arch/frv/kernel/process.c | |||
@@ -181,6 +181,9 @@ int copy_thread(unsigned long clone_flags, | |||
181 | childregs = (struct pt_regs *) | 181 | childregs = (struct pt_regs *) |
182 | (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); | 182 | (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE); |
183 | 183 | ||
184 | /* set up the userspace frame (the only place that the USP is stored) */ | ||
185 | *childregs = *__kernel_frame0_ptr; | ||
186 | |||
184 | p->set_child_tid = p->clear_child_tid = NULL; | 187 | p->set_child_tid = p->clear_child_tid = NULL; |
185 | 188 | ||
186 | p->thread.frame = childregs; | 189 | p->thread.frame = childregs; |
@@ -191,10 +194,8 @@ int copy_thread(unsigned long clone_flags, | |||
191 | p->thread.frame0 = childregs; | 194 | p->thread.frame0 = childregs; |
192 | 195 | ||
193 | if (unlikely(!regs)) { | 196 | if (unlikely(!regs)) { |
194 | memset(childregs, 0, sizeof(struct pt_regs)); | ||
195 | childregs->gr9 = usp; /* function */ | 197 | childregs->gr9 = usp; /* function */ |
196 | childregs->gr8 = arg; | 198 | childregs->gr8 = arg; |
197 | childregs->psr = PSR_S; | ||
198 | p->thread.pc = (unsigned long) ret_from_kernel_thread; | 199 | p->thread.pc = (unsigned long) ret_from_kernel_thread; |
199 | save_user_regs(p->thread.user); | 200 | save_user_regs(p->thread.user); |
200 | return 0; | 201 | return 0; |
diff --git a/arch/frv/mb93090-mb00/pci-dma-nommu.c b/arch/frv/mb93090-mb00/pci-dma-nommu.c index e47857f889b..b99c2a7cc7a 100644 --- a/arch/frv/mb93090-mb00/pci-dma-nommu.c +++ b/arch/frv/mb93090-mb00/pci-dma-nommu.c | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/export.h> | ||
14 | #include <linux/dma-mapping.h> | 15 | #include <linux/dma-mapping.h> |
15 | #include <linux/list.h> | 16 | #include <linux/list.h> |
16 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h index 66d0fff1ee8..125f344f06a 100644 --- a/arch/x86/include/asm/xen/hypervisor.h +++ b/arch/x86/include/asm/xen/hypervisor.h | |||
@@ -33,7 +33,6 @@ | |||
33 | #ifndef _ASM_X86_XEN_HYPERVISOR_H | 33 | #ifndef _ASM_X86_XEN_HYPERVISOR_H |
34 | #define _ASM_X86_XEN_HYPERVISOR_H | 34 | #define _ASM_X86_XEN_HYPERVISOR_H |
35 | 35 | ||
36 | /* arch/i386/kernel/setup.c */ | ||
37 | extern struct shared_info *HYPERVISOR_shared_info; | 36 | extern struct shared_info *HYPERVISOR_shared_info; |
38 | extern struct start_info *xen_start_info; | 37 | extern struct start_info *xen_start_info; |
39 | 38 | ||
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 1eefebe5d72..224a7e78cb6 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c | |||
@@ -3779,7 +3779,7 @@ static int write_exit_mmio(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
3779 | { | 3779 | { |
3780 | struct kvm_mmio_fragment *frag = &vcpu->mmio_fragments[0]; | 3780 | struct kvm_mmio_fragment *frag = &vcpu->mmio_fragments[0]; |
3781 | 3781 | ||
3782 | memcpy(vcpu->run->mmio.data, frag->data, frag->len); | 3782 | memcpy(vcpu->run->mmio.data, frag->data, min(8u, frag->len)); |
3783 | return X86EMUL_CONTINUE; | 3783 | return X86EMUL_CONTINUE; |
3784 | } | 3784 | } |
3785 | 3785 | ||
@@ -3832,18 +3832,11 @@ mmio: | |||
3832 | bytes -= handled; | 3832 | bytes -= handled; |
3833 | val += handled; | 3833 | val += handled; |
3834 | 3834 | ||
3835 | while (bytes) { | 3835 | WARN_ON(vcpu->mmio_nr_fragments >= KVM_MAX_MMIO_FRAGMENTS); |
3836 | unsigned now = min(bytes, 8U); | 3836 | frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++]; |
3837 | 3837 | frag->gpa = gpa; | |
3838 | frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++]; | 3838 | frag->data = val; |
3839 | frag->gpa = gpa; | 3839 | frag->len = bytes; |
3840 | frag->data = val; | ||
3841 | frag->len = now; | ||
3842 | |||
3843 | gpa += now; | ||
3844 | val += now; | ||
3845 | bytes -= now; | ||
3846 | } | ||
3847 | return X86EMUL_CONTINUE; | 3840 | return X86EMUL_CONTINUE; |
3848 | } | 3841 | } |
3849 | 3842 | ||
@@ -3890,7 +3883,7 @@ int emulator_read_write(struct x86_emulate_ctxt *ctxt, unsigned long addr, | |||
3890 | vcpu->mmio_needed = 1; | 3883 | vcpu->mmio_needed = 1; |
3891 | vcpu->mmio_cur_fragment = 0; | 3884 | vcpu->mmio_cur_fragment = 0; |
3892 | 3885 | ||
3893 | vcpu->run->mmio.len = vcpu->mmio_fragments[0].len; | 3886 | vcpu->run->mmio.len = min(8u, vcpu->mmio_fragments[0].len); |
3894 | vcpu->run->mmio.is_write = vcpu->mmio_is_write = ops->write; | 3887 | vcpu->run->mmio.is_write = vcpu->mmio_is_write = ops->write; |
3895 | vcpu->run->exit_reason = KVM_EXIT_MMIO; | 3888 | vcpu->run->exit_reason = KVM_EXIT_MMIO; |
3896 | vcpu->run->mmio.phys_addr = gpa; | 3889 | vcpu->run->mmio.phys_addr = gpa; |
@@ -5522,28 +5515,44 @@ static int complete_emulated_pio(struct kvm_vcpu *vcpu) | |||
5522 | * | 5515 | * |
5523 | * read: | 5516 | * read: |
5524 | * for each fragment | 5517 | * for each fragment |
5525 | * write gpa, len | 5518 | * for each mmio piece in the fragment |
5526 | * exit | 5519 | * write gpa, len |
5527 | * copy data | 5520 | * exit |
5521 | * copy data | ||
5528 | * execute insn | 5522 | * execute insn |
5529 | * | 5523 | * |
5530 | * write: | 5524 | * write: |
5531 | * for each fragment | 5525 | * for each fragment |
5532 | * write gpa, len | 5526 | * for each mmio piece in the fragment |
5533 | * copy data | 5527 | * write gpa, len |
5534 | * exit | 5528 | * copy data |
5529 | * exit | ||
5535 | */ | 5530 | */ |
5536 | static int complete_emulated_mmio(struct kvm_vcpu *vcpu) | 5531 | static int complete_emulated_mmio(struct kvm_vcpu *vcpu) |
5537 | { | 5532 | { |
5538 | struct kvm_run *run = vcpu->run; | 5533 | struct kvm_run *run = vcpu->run; |
5539 | struct kvm_mmio_fragment *frag; | 5534 | struct kvm_mmio_fragment *frag; |
5535 | unsigned len; | ||
5540 | 5536 | ||
5541 | BUG_ON(!vcpu->mmio_needed); | 5537 | BUG_ON(!vcpu->mmio_needed); |
5542 | 5538 | ||
5543 | /* Complete previous fragment */ | 5539 | /* Complete previous fragment */ |
5544 | frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment++]; | 5540 | frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment]; |
5541 | len = min(8u, frag->len); | ||
5545 | if (!vcpu->mmio_is_write) | 5542 | if (!vcpu->mmio_is_write) |
5546 | memcpy(frag->data, run->mmio.data, frag->len); | 5543 | memcpy(frag->data, run->mmio.data, len); |
5544 | |||
5545 | if (frag->len <= 8) { | ||
5546 | /* Switch to the next fragment. */ | ||
5547 | frag++; | ||
5548 | vcpu->mmio_cur_fragment++; | ||
5549 | } else { | ||
5550 | /* Go forward to the next mmio piece. */ | ||
5551 | frag->data += len; | ||
5552 | frag->gpa += len; | ||
5553 | frag->len -= len; | ||
5554 | } | ||
5555 | |||
5547 | if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { | 5556 | if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) { |
5548 | vcpu->mmio_needed = 0; | 5557 | vcpu->mmio_needed = 0; |
5549 | if (vcpu->mmio_is_write) | 5558 | if (vcpu->mmio_is_write) |
@@ -5551,13 +5560,12 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu) | |||
5551 | vcpu->mmio_read_completed = 1; | 5560 | vcpu->mmio_read_completed = 1; |
5552 | return complete_emulated_io(vcpu); | 5561 | return complete_emulated_io(vcpu); |
5553 | } | 5562 | } |
5554 | /* Initiate next fragment */ | 5563 | |
5555 | ++frag; | ||
5556 | run->exit_reason = KVM_EXIT_MMIO; | 5564 | run->exit_reason = KVM_EXIT_MMIO; |
5557 | run->mmio.phys_addr = frag->gpa; | 5565 | run->mmio.phys_addr = frag->gpa; |
5558 | if (vcpu->mmio_is_write) | 5566 | if (vcpu->mmio_is_write) |
5559 | memcpy(run->mmio.data, frag->data, frag->len); | 5567 | memcpy(run->mmio.data, frag->data, min(8u, frag->len)); |
5560 | run->mmio.len = frag->len; | 5568 | run->mmio.len = min(8u, frag->len); |
5561 | run->mmio.is_write = vcpu->mmio_is_write; | 5569 | run->mmio.is_write = vcpu->mmio_is_write; |
5562 | vcpu->arch.complete_userspace_io = complete_emulated_mmio; | 5570 | vcpu->arch.complete_userspace_io = complete_emulated_mmio; |
5563 | return 0; | 5571 | return 0; |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 6226c99729b..dcf5f2dd91e 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -1288,6 +1288,25 @@ unsigned long xen_read_cr2_direct(void) | |||
1288 | return this_cpu_read(xen_vcpu_info.arch.cr2); | 1288 | return this_cpu_read(xen_vcpu_info.arch.cr2); |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | void xen_flush_tlb_all(void) | ||
1292 | { | ||
1293 | struct mmuext_op *op; | ||
1294 | struct multicall_space mcs; | ||
1295 | |||
1296 | trace_xen_mmu_flush_tlb_all(0); | ||
1297 | |||
1298 | preempt_disable(); | ||
1299 | |||
1300 | mcs = xen_mc_entry(sizeof(*op)); | ||
1301 | |||
1302 | op = mcs.args; | ||
1303 | op->cmd = MMUEXT_TLB_FLUSH_ALL; | ||
1304 | MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF); | ||
1305 | |||
1306 | xen_mc_issue(PARAVIRT_LAZY_MMU); | ||
1307 | |||
1308 | preempt_enable(); | ||
1309 | } | ||
1291 | static void xen_flush_tlb(void) | 1310 | static void xen_flush_tlb(void) |
1292 | { | 1311 | { |
1293 | struct mmuext_op *op; | 1312 | struct mmuext_op *op; |
@@ -2518,7 +2537,7 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma, | |||
2518 | err = 0; | 2537 | err = 0; |
2519 | out: | 2538 | out: |
2520 | 2539 | ||
2521 | flush_tlb_all(); | 2540 | xen_flush_tlb_all(); |
2522 | 2541 | ||
2523 | return err; | 2542 | return err; |
2524 | } | 2543 | } |
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig index cdcb48adee4..0d1f36a22c9 100644 --- a/arch/xtensa/Kconfig +++ b/arch/xtensa/Kconfig | |||
@@ -13,6 +13,8 @@ config XTENSA | |||
13 | select GENERIC_CPU_DEVICES | 13 | select GENERIC_CPU_DEVICES |
14 | select MODULES_USE_ELF_RELA | 14 | select MODULES_USE_ELF_RELA |
15 | select GENERIC_PCI_IOMAP | 15 | select GENERIC_PCI_IOMAP |
16 | select GENERIC_KERNEL_THREAD | ||
17 | select GENERIC_KERNEL_EXECVE | ||
16 | select ARCH_WANT_OPTIONAL_GPIOLIB | 18 | select ARCH_WANT_OPTIONAL_GPIOLIB |
17 | help | 19 | help |
18 | Xtensa processors are 32-bit RISC machines designed by Tensilica | 20 | Xtensa processors are 32-bit RISC machines designed by Tensilica |
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h index e6be5b9091c..700c2e6f2d2 100644 --- a/arch/xtensa/include/asm/io.h +++ b/arch/xtensa/include/asm/io.h | |||
@@ -62,6 +62,10 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size) | |||
62 | static inline void iounmap(volatile void __iomem *addr) | 62 | static inline void iounmap(volatile void __iomem *addr) |
63 | { | 63 | { |
64 | } | 64 | } |
65 | |||
66 | #define virt_to_bus virt_to_phys | ||
67 | #define bus_to_virt phys_to_virt | ||
68 | |||
65 | #endif /* CONFIG_MMU */ | 69 | #endif /* CONFIG_MMU */ |
66 | 70 | ||
67 | /* | 71 | /* |
diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h index 5c371d8d452..2d630e7399c 100644 --- a/arch/xtensa/include/asm/processor.h +++ b/arch/xtensa/include/asm/processor.h | |||
@@ -152,6 +152,7 @@ struct thread_struct { | |||
152 | 152 | ||
153 | /* Clearing a0 terminates the backtrace. */ | 153 | /* Clearing a0 terminates the backtrace. */ |
154 | #define start_thread(regs, new_pc, new_sp) \ | 154 | #define start_thread(regs, new_pc, new_sp) \ |
155 | memset(regs, 0, sizeof(*regs)); \ | ||
155 | regs->pc = new_pc; \ | 156 | regs->pc = new_pc; \ |
156 | regs->ps = USER_PS_VALUE; \ | 157 | regs->ps = USER_PS_VALUE; \ |
157 | regs->areg[1] = new_sp; \ | 158 | regs->areg[1] = new_sp; \ |
@@ -168,9 +169,6 @@ struct mm_struct; | |||
168 | /* Free all resources held by a thread. */ | 169 | /* Free all resources held by a thread. */ |
169 | #define release_thread(thread) do { } while(0) | 170 | #define release_thread(thread) do { } while(0) |
170 | 171 | ||
171 | /* Create a kernel thread without removing it from tasklists */ | ||
172 | extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); | ||
173 | |||
174 | /* Copy and release all segment info associated with a VM */ | 172 | /* Copy and release all segment info associated with a VM */ |
175 | #define copy_segments(p, mm) do { } while(0) | 173 | #define copy_segments(p, mm) do { } while(0) |
176 | #define release_segments(mm) do { } while(0) | 174 | #define release_segments(mm) do { } while(0) |
diff --git a/arch/xtensa/include/asm/syscall.h b/arch/xtensa/include/asm/syscall.h index c1dacca312f..124aeee0d38 100644 --- a/arch/xtensa/include/asm/syscall.h +++ b/arch/xtensa/include/asm/syscall.h | |||
@@ -10,7 +10,7 @@ | |||
10 | 10 | ||
11 | struct pt_regs; | 11 | struct pt_regs; |
12 | struct sigaction; | 12 | struct sigaction; |
13 | asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*); | 13 | asmlinkage long sys_execve(char*, char**, char**, struct pt_regs*); |
14 | asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*); | 14 | asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*); |
15 | asmlinkage long xtensa_ptrace(long, long, long, long); | 15 | asmlinkage long xtensa_ptrace(long, long, long, long); |
16 | asmlinkage long xtensa_sigreturn(struct pt_regs*); | 16 | asmlinkage long xtensa_sigreturn(struct pt_regs*); |
diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h index 9ef1c31d2c8..f4e6eaa40d1 100644 --- a/arch/xtensa/include/asm/unistd.h +++ b/arch/xtensa/include/asm/unistd.h | |||
@@ -1,16 +1,9 @@ | |||
1 | /* | 1 | #ifndef _XTENSA_UNISTD_H |
2 | * include/asm-xtensa/unistd.h | 2 | #define _XTENSA_UNISTD_H |
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2005 Tensilica Inc. | ||
9 | */ | ||
10 | 3 | ||
4 | #define __ARCH_WANT_SYS_EXECVE | ||
11 | #include <uapi/asm/unistd.h> | 5 | #include <uapi/asm/unistd.h> |
12 | 6 | ||
13 | |||
14 | /* | 7 | /* |
15 | * "Conditional" syscalls | 8 | * "Conditional" syscalls |
16 | * | 9 | * |
@@ -37,3 +30,5 @@ | |||
37 | #define __IGNORE_mmap /* use mmap2 */ | 30 | #define __IGNORE_mmap /* use mmap2 */ |
38 | #define __IGNORE_vfork /* use clone */ | 31 | #define __IGNORE_vfork /* use clone */ |
39 | #define __IGNORE_fadvise64 /* use fadvise64_64 */ | 32 | #define __IGNORE_fadvise64 /* use fadvise64_64 */ |
33 | |||
34 | #endif /* _XTENSA_UNISTD_H */ | ||
diff --git a/arch/xtensa/include/uapi/asm/unistd.h b/arch/xtensa/include/uapi/asm/unistd.h index 479abaea5aa..9f36d0e3e0a 100644 --- a/arch/xtensa/include/uapi/asm/unistd.h +++ b/arch/xtensa/include/uapi/asm/unistd.h | |||
@@ -1,14 +1,4 @@ | |||
1 | /* | 1 | #if !defined(_UAPI_XTENSA_UNISTD_H) || defined(__SYSCALL) |
2 | * include/asm-xtensa/unistd.h | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2001 - 2012 Tensilica Inc. | ||
9 | */ | ||
10 | |||
11 | #ifndef _UAPI_XTENSA_UNISTD_H | ||
12 | #define _UAPI_XTENSA_UNISTD_H | 2 | #define _UAPI_XTENSA_UNISTD_H |
13 | 3 | ||
14 | #ifndef __SYSCALL | 4 | #ifndef __SYSCALL |
@@ -272,7 +262,7 @@ __SYSCALL(115, sys_sendmmsg, 4) | |||
272 | #define __NR_clone 116 | 262 | #define __NR_clone 116 |
273 | __SYSCALL(116, xtensa_clone, 5) | 263 | __SYSCALL(116, xtensa_clone, 5) |
274 | #define __NR_execve 117 | 264 | #define __NR_execve 117 |
275 | __SYSCALL(117, xtensa_execve, 3) | 265 | __SYSCALL(117, sys_execve, 3) |
276 | #define __NR_exit 118 | 266 | #define __NR_exit 118 |
277 | __SYSCALL(118, sys_exit, 1) | 267 | __SYSCALL(118, sys_exit, 1) |
278 | #define __NR_exit_group 119 | 268 | #define __NR_exit_group 119 |
@@ -759,4 +749,6 @@ __SYSCALL(331, sys_kcmp, 5) | |||
759 | 749 | ||
760 | #define SYS_XTENSA_COUNT 5 /* count */ | 750 | #define SYS_XTENSA_COUNT 5 /* count */ |
761 | 751 | ||
752 | #undef __SYSCALL | ||
753 | |||
762 | #endif /* _UAPI_XTENSA_UNISTD_H */ | 754 | #endif /* _UAPI_XTENSA_UNISTD_H */ |
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index 18453067c25..90bfc1dbc13 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
@@ -1833,50 +1833,6 @@ ENTRY(system_call) | |||
1833 | 1833 | ||
1834 | 1834 | ||
1835 | /* | 1835 | /* |
1836 | * Create a kernel thread | ||
1837 | * | ||
1838 | * int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) | ||
1839 | * a2 a2 a3 a4 | ||
1840 | */ | ||
1841 | |||
1842 | ENTRY(kernel_thread) | ||
1843 | entry a1, 16 | ||
1844 | |||
1845 | mov a5, a2 # preserve fn over syscall | ||
1846 | mov a7, a3 # preserve args over syscall | ||
1847 | |||
1848 | movi a3, _CLONE_VM | _CLONE_UNTRACED | ||
1849 | movi a2, __NR_clone | ||
1850 | or a6, a4, a3 # arg0: flags | ||
1851 | mov a3, a1 # arg1: sp | ||
1852 | syscall | ||
1853 | |||
1854 | beq a3, a1, 1f # branch if parent | ||
1855 | mov a6, a7 # args | ||
1856 | callx4 a5 # fn(args) | ||
1857 | |||
1858 | movi a2, __NR_exit | ||
1859 | syscall # return value of fn(args) still in a6 | ||
1860 | |||
1861 | 1: retw | ||
1862 | |||
1863 | /* | ||
1864 | * Do a system call from kernel instead of calling sys_execve, so we end up | ||
1865 | * with proper pt_regs. | ||
1866 | * | ||
1867 | * int kernel_execve(const char *fname, char *const argv[], charg *const envp[]) | ||
1868 | * a2 a2 a3 a4 | ||
1869 | */ | ||
1870 | |||
1871 | ENTRY(kernel_execve) | ||
1872 | entry a1, 16 | ||
1873 | mov a6, a2 # arg0 is in a6 | ||
1874 | movi a2, __NR_execve | ||
1875 | syscall | ||
1876 | |||
1877 | retw | ||
1878 | |||
1879 | /* | ||
1880 | * Task switch. | 1836 | * Task switch. |
1881 | * | 1837 | * |
1882 | * struct task* _switch_to (struct task* prev, struct task* next) | 1838 | * struct task* _switch_to (struct task* prev, struct task* next) |
@@ -1958,3 +1914,16 @@ ENTRY(ret_from_fork) | |||
1958 | 1914 | ||
1959 | j common_exception_return | 1915 | j common_exception_return |
1960 | 1916 | ||
1917 | /* | ||
1918 | * Kernel thread creation helper | ||
1919 | * On entry, set up by copy_thread: a2 = thread_fn, a3 = thread_fn arg | ||
1920 | * left from _switch_to: a6 = prev | ||
1921 | */ | ||
1922 | ENTRY(ret_from_kernel_thread) | ||
1923 | |||
1924 | call4 schedule_tail | ||
1925 | mov a6, a3 | ||
1926 | callx4 a2 | ||
1927 | j common_exception_return | ||
1928 | |||
1929 | ENDPROC(ret_from_kernel_thread) | ||
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c index 1908f6642d3..09ae7bfab9a 100644 --- a/arch/xtensa/kernel/process.c +++ b/arch/xtensa/kernel/process.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <asm/regs.h> | 45 | #include <asm/regs.h> |
46 | 46 | ||
47 | extern void ret_from_fork(void); | 47 | extern void ret_from_fork(void); |
48 | extern void ret_from_kernel_thread(void); | ||
48 | 49 | ||
49 | struct task_struct *current_set[NR_CPUS] = {&init_task, }; | 50 | struct task_struct *current_set[NR_CPUS] = {&init_task, }; |
50 | 51 | ||
@@ -158,18 +159,30 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | |||
158 | /* | 159 | /* |
159 | * Copy thread. | 160 | * Copy thread. |
160 | * | 161 | * |
162 | * There are two modes in which this function is called: | ||
163 | * 1) Userspace thread creation, | ||
164 | * regs != NULL, usp_thread_fn is userspace stack pointer. | ||
165 | * It is expected to copy parent regs (in case CLONE_VM is not set | ||
166 | * in the clone_flags) and set up passed usp in the childregs. | ||
167 | * 2) Kernel thread creation, | ||
168 | * regs == NULL, usp_thread_fn is the function to run in the new thread | ||
169 | * and thread_fn_arg is its parameter. | ||
170 | * childregs are not used for the kernel threads. | ||
171 | * | ||
161 | * The stack layout for the new thread looks like this: | 172 | * The stack layout for the new thread looks like this: |
162 | * | 173 | * |
163 | * +------------------------+ <- sp in childregs (= tos) | 174 | * +------------------------+ |
164 | * | childregs | | 175 | * | childregs | |
165 | * +------------------------+ <- thread.sp = sp in dummy-frame | 176 | * +------------------------+ <- thread.sp = sp in dummy-frame |
166 | * | dummy-frame | (saved in dummy-frame spill-area) | 177 | * | dummy-frame | (saved in dummy-frame spill-area) |
167 | * +------------------------+ | 178 | * +------------------------+ |
168 | * | 179 | * |
169 | * We create a dummy frame to return to ret_from_fork: | 180 | * We create a dummy frame to return to either ret_from_fork or |
170 | * a0 points to ret_from_fork (simulating a call4) | 181 | * ret_from_kernel_thread: |
182 | * a0 points to ret_from_fork/ret_from_kernel_thread (simulating a call4) | ||
171 | * sp points to itself (thread.sp) | 183 | * sp points to itself (thread.sp) |
172 | * a2, a3 are unused. | 184 | * a2, a3 are unused for userspace threads, |
185 | * a2 points to thread_fn, a3 holds thread_fn arg for kernel threads. | ||
173 | * | 186 | * |
174 | * Note: This is a pristine frame, so we don't need any spill region on top of | 187 | * Note: This is a pristine frame, so we don't need any spill region on top of |
175 | * childregs. | 188 | * childregs. |
@@ -185,43 +198,63 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) | |||
185 | * involved. Much simpler to just not copy those live frames across. | 198 | * involved. Much simpler to just not copy those live frames across. |
186 | */ | 199 | */ |
187 | 200 | ||
188 | int copy_thread(unsigned long clone_flags, unsigned long usp, | 201 | int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn, |
189 | unsigned long unused, | 202 | unsigned long thread_fn_arg, |
190 | struct task_struct * p, struct pt_regs * regs) | 203 | struct task_struct *p, struct pt_regs *unused) |
191 | { | 204 | { |
192 | struct pt_regs *childregs; | 205 | struct pt_regs *childregs = task_pt_regs(p); |
193 | unsigned long tos; | ||
194 | int user_mode = user_mode(regs); | ||
195 | 206 | ||
196 | #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS) | 207 | #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS) |
197 | struct thread_info *ti; | 208 | struct thread_info *ti; |
198 | #endif | 209 | #endif |
199 | 210 | ||
200 | /* Set up new TSS. */ | ||
201 | tos = (unsigned long)task_stack_page(p) + THREAD_SIZE; | ||
202 | if (user_mode) | ||
203 | childregs = (struct pt_regs*)(tos - PT_USER_SIZE); | ||
204 | else | ||
205 | childregs = (struct pt_regs*)tos - 1; | ||
206 | |||
207 | /* This does not copy all the regs. In a bout of brilliance or madness, | ||
208 | ARs beyond a0-a15 exist past the end of the struct. */ | ||
209 | *childregs = *regs; | ||
210 | |||
211 | /* Create a call4 dummy-frame: a0 = 0, a1 = childregs. */ | 211 | /* Create a call4 dummy-frame: a0 = 0, a1 = childregs. */ |
212 | *((int*)childregs - 3) = (unsigned long)childregs; | 212 | *((int*)childregs - 3) = (unsigned long)childregs; |
213 | *((int*)childregs - 4) = 0; | 213 | *((int*)childregs - 4) = 0; |
214 | 214 | ||
215 | childregs->areg[2] = 0; | ||
216 | p->set_child_tid = p->clear_child_tid = NULL; | ||
217 | p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1); | ||
218 | p->thread.sp = (unsigned long)childregs; | 215 | p->thread.sp = (unsigned long)childregs; |
219 | 216 | ||
220 | if (user_mode(regs)) { | 217 | if (!(p->flags & PF_KTHREAD)) { |
218 | struct pt_regs *regs = current_pt_regs(); | ||
219 | unsigned long usp = usp_thread_fn ? | ||
220 | usp_thread_fn : regs->areg[1]; | ||
221 | 221 | ||
222 | p->thread.ra = MAKE_RA_FOR_CALL( | ||
223 | (unsigned long)ret_from_fork, 0x1); | ||
224 | |||
225 | /* This does not copy all the regs. | ||
226 | * In a bout of brilliance or madness, | ||
227 | * ARs beyond a0-a15 exist past the end of the struct. | ||
228 | */ | ||
229 | *childregs = *regs; | ||
222 | childregs->areg[1] = usp; | 230 | childregs->areg[1] = usp; |
231 | childregs->areg[2] = 0; | ||
232 | |||
233 | /* When sharing memory with the parent thread, the child | ||
234 | usually starts on a pristine stack, so we have to reset | ||
235 | windowbase, windowstart and wmask. | ||
236 | (Note that such a new thread is required to always create | ||
237 | an initial call4 frame) | ||
238 | The exception is vfork, where the new thread continues to | ||
239 | run on the parent's stack until it calls execve. This could | ||
240 | be a call8 or call12, which requires a legal stack frame | ||
241 | of the previous caller for the overflow handlers to work. | ||
242 | (Note that it's always legal to overflow live registers). | ||
243 | In this case, ensure to spill at least the stack pointer | ||
244 | of that frame. */ | ||
245 | |||
223 | if (clone_flags & CLONE_VM) { | 246 | if (clone_flags & CLONE_VM) { |
224 | childregs->wmask = 1; /* can't share live windows */ | 247 | /* check that caller window is live and same stack */ |
248 | int len = childregs->wmask & ~0xf; | ||
249 | if (regs->areg[1] == usp && len != 0) { | ||
250 | int callinc = (regs->areg[0] >> 30) & 3; | ||
251 | int caller_ars = XCHAL_NUM_AREGS - callinc * 4; | ||
252 | put_user(regs->areg[caller_ars+1], | ||
253 | (unsigned __user*)(usp - 12)); | ||
254 | } | ||
255 | childregs->wmask = 1; | ||
256 | childregs->windowstart = 1; | ||
257 | childregs->windowbase = 0; | ||
225 | } else { | 258 | } else { |
226 | int len = childregs->wmask & ~0xf; | 259 | int len = childregs->wmask & ~0xf; |
227 | memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4], | 260 | memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4], |
@@ -230,11 +263,19 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, | |||
230 | // FIXME: we need to set THREADPTR in thread_info... | 263 | // FIXME: we need to set THREADPTR in thread_info... |
231 | if (clone_flags & CLONE_SETTLS) | 264 | if (clone_flags & CLONE_SETTLS) |
232 | childregs->areg[2] = childregs->areg[6]; | 265 | childregs->areg[2] = childregs->areg[6]; |
233 | |||
234 | } else { | 266 | } else { |
235 | /* In kernel space, we start a new thread with a new stack. */ | 267 | p->thread.ra = MAKE_RA_FOR_CALL( |
236 | childregs->wmask = 1; | 268 | (unsigned long)ret_from_kernel_thread, 1); |
237 | childregs->areg[1] = tos; | 269 | |
270 | /* pass parameters to ret_from_kernel_thread: | ||
271 | * a2 = thread_fn, a3 = thread_fn arg | ||
272 | */ | ||
273 | *((int *)childregs - 1) = thread_fn_arg; | ||
274 | *((int *)childregs - 2) = usp_thread_fn; | ||
275 | |||
276 | /* Childregs are only used when we're going to userspace | ||
277 | * in which case start_thread will set them up. | ||
278 | */ | ||
238 | } | 279 | } |
239 | 280 | ||
240 | #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS) | 281 | #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS) |
@@ -330,32 +371,5 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp, | |||
330 | void __user *child_tid, long a5, | 371 | void __user *child_tid, long a5, |
331 | struct pt_regs *regs) | 372 | struct pt_regs *regs) |
332 | { | 373 | { |
333 | if (!newsp) | ||
334 | newsp = regs->areg[1]; | ||
335 | return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid); | 374 | return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid); |
336 | } | 375 | } |
337 | |||
338 | /* | ||
339 | * xtensa_execve() executes a new program. | ||
340 | */ | ||
341 | |||
342 | asmlinkage | ||
343 | long xtensa_execve(const char __user *name, | ||
344 | const char __user *const __user *argv, | ||
345 | const char __user *const __user *envp, | ||
346 | long a3, long a4, long a5, | ||
347 | struct pt_regs *regs) | ||
348 | { | ||
349 | long error; | ||
350 | struct filename *filename; | ||
351 | |||
352 | filename = getname(name); | ||
353 | error = PTR_ERR(filename); | ||
354 | if (IS_ERR(filename)) | ||
355 | goto out; | ||
356 | error = do_execve(filename->name, argv, envp, regs); | ||
357 | putname(filename); | ||
358 | out: | ||
359 | return error; | ||
360 | } | ||
361 | |||
diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c index a5c01e74d5d..5702065f472 100644 --- a/arch/xtensa/kernel/syscall.c +++ b/arch/xtensa/kernel/syscall.c | |||
@@ -32,10 +32,8 @@ typedef void (*syscall_t)(void); | |||
32 | syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= { | 32 | syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= { |
33 | [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall, | 33 | [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall, |
34 | 34 | ||
35 | #undef __SYSCALL | ||
36 | #define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol, | 35 | #define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol, |
37 | #undef __KERNEL_SYSCALLS__ | 36 | #include <uapi/asm/unistd.h> |
38 | #include <asm/unistd.h> | ||
39 | }; | 37 | }; |
40 | 38 | ||
41 | asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg) | 39 | asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg) |
@@ -49,7 +47,8 @@ asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg) | |||
49 | return (long)ret; | 47 | return (long)ret; |
50 | } | 48 | } |
51 | 49 | ||
52 | asmlinkage long xtensa_fadvise64_64(int fd, int advice, unsigned long long offset, unsigned long long len) | 50 | asmlinkage long xtensa_fadvise64_64(int fd, int advice, |
51 | unsigned long long offset, unsigned long long len) | ||
53 | { | 52 | { |
54 | return sys_fadvise64_64(fd, offset, len, advice); | 53 | return sys_fadvise64_64(fd, offset, len, advice); |
55 | } | 54 | } |
diff --git a/arch/xtensa/kernel/xtensa_ksyms.c b/arch/xtensa/kernel/xtensa_ksyms.c index a8b9f1fd1e1..afe058b24e6 100644 --- a/arch/xtensa/kernel/xtensa_ksyms.c +++ b/arch/xtensa/kernel/xtensa_ksyms.c | |||
@@ -43,7 +43,6 @@ EXPORT_SYMBOL(__strncpy_user); | |||
43 | EXPORT_SYMBOL(clear_page); | 43 | EXPORT_SYMBOL(clear_page); |
44 | EXPORT_SYMBOL(copy_page); | 44 | EXPORT_SYMBOL(copy_page); |
45 | 45 | ||
46 | EXPORT_SYMBOL(kernel_thread); | ||
47 | EXPORT_SYMBOL(empty_zero_page); | 46 | EXPORT_SYMBOL(empty_zero_page); |
48 | 47 | ||
49 | /* | 48 | /* |
diff --git a/block/Kconfig b/block/Kconfig index 09acf1b3990..a7e40a7c821 100644 --- a/block/Kconfig +++ b/block/Kconfig | |||
@@ -89,7 +89,7 @@ config BLK_DEV_INTEGRITY | |||
89 | 89 | ||
90 | config BLK_DEV_THROTTLING | 90 | config BLK_DEV_THROTTLING |
91 | bool "Block layer bio throttling support" | 91 | bool "Block layer bio throttling support" |
92 | depends on BLK_CGROUP=y && EXPERIMENTAL | 92 | depends on BLK_CGROUP=y |
93 | default n | 93 | default n |
94 | ---help--- | 94 | ---help--- |
95 | Block layer bio throttling support. It can be used to limit | 95 | Block layer bio throttling support. It can be used to limit |
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index cafcd743118..d0b770391ad 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c | |||
@@ -285,6 +285,13 @@ static void blkg_destroy_all(struct request_queue *q) | |||
285 | blkg_destroy(blkg); | 285 | blkg_destroy(blkg); |
286 | spin_unlock(&blkcg->lock); | 286 | spin_unlock(&blkcg->lock); |
287 | } | 287 | } |
288 | |||
289 | /* | ||
290 | * root blkg is destroyed. Just clear the pointer since | ||
291 | * root_rl does not take reference on root blkg. | ||
292 | */ | ||
293 | q->root_blkg = NULL; | ||
294 | q->root_rl.blkg = NULL; | ||
288 | } | 295 | } |
289 | 296 | ||
290 | static void blkg_rcu_free(struct rcu_head *rcu_head) | 297 | static void blkg_rcu_free(struct rcu_head *rcu_head) |
@@ -326,6 +333,9 @@ struct request_list *__blk_queue_next_rl(struct request_list *rl, | |||
326 | */ | 333 | */ |
327 | if (rl == &q->root_rl) { | 334 | if (rl == &q->root_rl) { |
328 | ent = &q->blkg_list; | 335 | ent = &q->blkg_list; |
336 | /* There are no more block groups, hence no request lists */ | ||
337 | if (list_empty(ent)) | ||
338 | return NULL; | ||
329 | } else { | 339 | } else { |
330 | blkg = container_of(rl, struct blkcg_gq, rl); | 340 | blkg = container_of(rl, struct blkcg_gq, rl); |
331 | ent = &blkg->q_node; | 341 | ent = &blkg->q_node; |
diff --git a/block/blk-core.c b/block/blk-core.c index a33870b1847..3c95c4d6e31 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -2868,7 +2868,8 @@ static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b) | |||
2868 | struct request *rqa = container_of(a, struct request, queuelist); | 2868 | struct request *rqa = container_of(a, struct request, queuelist); |
2869 | struct request *rqb = container_of(b, struct request, queuelist); | 2869 | struct request *rqb = container_of(b, struct request, queuelist); |
2870 | 2870 | ||
2871 | return !(rqa->q <= rqb->q); | 2871 | return !(rqa->q < rqb->q || |
2872 | (rqa->q == rqb->q && blk_rq_pos(rqa) < blk_rq_pos(rqb))); | ||
2872 | } | 2873 | } |
2873 | 2874 | ||
2874 | /* | 2875 | /* |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index f94d4c818fc..0230cb6cbb3 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -1345,12 +1345,15 @@ static int | |||
1345 | acpi_video_bus_get_devices(struct acpi_video_bus *video, | 1345 | acpi_video_bus_get_devices(struct acpi_video_bus *video, |
1346 | struct acpi_device *device) | 1346 | struct acpi_device *device) |
1347 | { | 1347 | { |
1348 | int status; | 1348 | int status = 0; |
1349 | struct acpi_device *dev; | 1349 | struct acpi_device *dev; |
1350 | 1350 | ||
1351 | status = acpi_video_device_enumerate(video); | 1351 | /* |
1352 | if (status) | 1352 | * There are systems where video module known to work fine regardless |
1353 | return status; | 1353 | * of broken _DOD and ignoring returned value here doesn't cause |
1354 | * any issues later. | ||
1355 | */ | ||
1356 | acpi_video_device_enumerate(video); | ||
1354 | 1357 | ||
1355 | list_for_each_entry(dev, &device->children, node) { | 1358 | list_for_each_entry(dev, &device->children, node) { |
1356 | 1359 | ||
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index f529407db93..824e09c4d0d 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -131,6 +131,7 @@ config BLK_CPQ_DA | |||
131 | config BLK_CPQ_CISS_DA | 131 | config BLK_CPQ_CISS_DA |
132 | tristate "Compaq Smart Array 5xxx support" | 132 | tristate "Compaq Smart Array 5xxx support" |
133 | depends on PCI | 133 | depends on PCI |
134 | select CHECK_SIGNATURE | ||
134 | help | 135 | help |
135 | This is the driver for Compaq Smart Array 5xxx controllers. | 136 | This is the driver for Compaq Smart Array 5xxx controllers. |
136 | Everyone using these boards should say Y here. | 137 | Everyone using these boards should say Y here. |
@@ -166,8 +167,8 @@ config BLK_DEV_DAC960 | |||
166 | module will be called DAC960. | 167 | module will be called DAC960. |
167 | 168 | ||
168 | config BLK_DEV_UMEM | 169 | config BLK_DEV_UMEM |
169 | tristate "Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL)" | 170 | tristate "Micro Memory MM5415 Battery Backed RAM support" |
170 | depends on PCI && EXPERIMENTAL | 171 | depends on PCI |
171 | ---help--- | 172 | ---help--- |
172 | Saying Y here will include support for the MM5415 family of | 173 | Saying Y here will include support for the MM5415 family of |
173 | battery backed (Non-volatile) RAM cards. | 174 | battery backed (Non-volatile) RAM cards. |
@@ -430,8 +431,8 @@ config CDROM_PKTCDVD_BUFFERS | |||
430 | a disc is opened for writing. | 431 | a disc is opened for writing. |
431 | 432 | ||
432 | config CDROM_PKTCDVD_WCACHE | 433 | config CDROM_PKTCDVD_WCACHE |
433 | bool "Enable write caching (EXPERIMENTAL)" | 434 | bool "Enable write caching" |
434 | depends on CDROM_PKTCDVD && EXPERIMENTAL | 435 | depends on CDROM_PKTCDVD |
435 | help | 436 | help |
436 | If enabled, write caching will be set for the CD-R/W device. For now | 437 | If enabled, write caching will be set for the CD-R/W device. For now |
437 | this option is dangerous unless the CD-RW media is known good, as we | 438 | this option is dangerous unless the CD-RW media is known good, as we |
@@ -508,8 +509,8 @@ config XEN_BLKDEV_BACKEND | |||
508 | 509 | ||
509 | 510 | ||
510 | config VIRTIO_BLK | 511 | config VIRTIO_BLK |
511 | tristate "Virtio block driver (EXPERIMENTAL)" | 512 | tristate "Virtio block driver" |
512 | depends on EXPERIMENTAL && VIRTIO | 513 | depends on VIRTIO |
513 | ---help--- | 514 | ---help--- |
514 | This is the virtual block driver for virtio. It can be used with | 515 | This is the virtual block driver for virtio. It can be used with |
515 | lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. | 516 | lguest or QEMU based VMMs (like KVM or Xen). Say Y or M. |
@@ -528,7 +529,7 @@ config BLK_DEV_HD | |||
528 | 529 | ||
529 | config BLK_DEV_RBD | 530 | config BLK_DEV_RBD |
530 | tristate "Rados block device (RBD)" | 531 | tristate "Rados block device (RBD)" |
531 | depends on INET && EXPERIMENTAL && BLOCK | 532 | depends on INET && BLOCK |
532 | select CEPH_LIB | 533 | select CEPH_LIB |
533 | select LIBCRC32C | 534 | select LIBCRC32C |
534 | select CRYPTO_AES | 535 | select CRYPTO_AES |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index b0f553b26d0..ca83f96756a 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -5205,7 +5205,6 @@ static void cciss_shutdown(struct pci_dev *pdev) | |||
5205 | return; | 5205 | return; |
5206 | } | 5206 | } |
5207 | /* write all data in the battery backed cache to disk */ | 5207 | /* write all data in the battery backed cache to disk */ |
5208 | memset(flush_buf, 0, 4); | ||
5209 | return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf, | 5208 | return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf, |
5210 | 4, 0, CTLR_LUNID, TYPE_CMD); | 5209 | 4, 0, CTLR_LUNID, TYPE_CMD); |
5211 | kfree(flush_buf); | 5210 | kfree(flush_buf); |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 17c675c5229..1c49d717396 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -4109,12 +4109,19 @@ static struct platform_driver floppy_driver = { | |||
4109 | 4109 | ||
4110 | static struct platform_device floppy_device[N_DRIVE]; | 4110 | static struct platform_device floppy_device[N_DRIVE]; |
4111 | 4111 | ||
4112 | static bool floppy_available(int drive) | ||
4113 | { | ||
4114 | if (!(allowed_drive_mask & (1 << drive))) | ||
4115 | return false; | ||
4116 | if (fdc_state[FDC(drive)].version == FDC_NONE) | ||
4117 | return false; | ||
4118 | return true; | ||
4119 | } | ||
4120 | |||
4112 | static struct kobject *floppy_find(dev_t dev, int *part, void *data) | 4121 | static struct kobject *floppy_find(dev_t dev, int *part, void *data) |
4113 | { | 4122 | { |
4114 | int drive = (*part & 3) | ((*part & 0x80) >> 5); | 4123 | int drive = (*part & 3) | ((*part & 0x80) >> 5); |
4115 | if (drive >= N_DRIVE || | 4124 | if (drive >= N_DRIVE || !floppy_available(drive)) |
4116 | !(allowed_drive_mask & (1 << drive)) || | ||
4117 | fdc_state[FDC(drive)].version == FDC_NONE) | ||
4118 | return NULL; | 4125 | return NULL; |
4119 | if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type)) | 4126 | if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type)) |
4120 | return NULL; | 4127 | return NULL; |
@@ -4124,8 +4131,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data) | |||
4124 | 4131 | ||
4125 | static int __init do_floppy_init(void) | 4132 | static int __init do_floppy_init(void) |
4126 | { | 4133 | { |
4127 | int i, unit, drive; | 4134 | int i, unit, drive, err; |
4128 | int err, dr; | ||
4129 | 4135 | ||
4130 | set_debugt(); | 4136 | set_debugt(); |
4131 | interruptjiffies = resultjiffies = jiffies; | 4137 | interruptjiffies = resultjiffies = jiffies; |
@@ -4137,34 +4143,32 @@ static int __init do_floppy_init(void) | |||
4137 | 4143 | ||
4138 | raw_cmd = NULL; | 4144 | raw_cmd = NULL; |
4139 | 4145 | ||
4140 | for (dr = 0; dr < N_DRIVE; dr++) { | 4146 | floppy_wq = alloc_ordered_workqueue("floppy", 0); |
4141 | disks[dr] = alloc_disk(1); | 4147 | if (!floppy_wq) |
4142 | if (!disks[dr]) { | 4148 | return -ENOMEM; |
4143 | err = -ENOMEM; | ||
4144 | goto out_put_disk; | ||
4145 | } | ||
4146 | 4149 | ||
4147 | floppy_wq = alloc_ordered_workqueue("floppy", 0); | 4150 | for (drive = 0; drive < N_DRIVE; drive++) { |
4148 | if (!floppy_wq) { | 4151 | disks[drive] = alloc_disk(1); |
4152 | if (!disks[drive]) { | ||
4149 | err = -ENOMEM; | 4153 | err = -ENOMEM; |
4150 | goto out_put_disk; | 4154 | goto out_put_disk; |
4151 | } | 4155 | } |
4152 | 4156 | ||
4153 | disks[dr]->queue = blk_init_queue(do_fd_request, &floppy_lock); | 4157 | disks[drive]->queue = blk_init_queue(do_fd_request, &floppy_lock); |
4154 | if (!disks[dr]->queue) { | 4158 | if (!disks[drive]->queue) { |
4155 | err = -ENOMEM; | 4159 | err = -ENOMEM; |
4156 | goto out_destroy_workq; | 4160 | goto out_put_disk; |
4157 | } | 4161 | } |
4158 | 4162 | ||
4159 | blk_queue_max_hw_sectors(disks[dr]->queue, 64); | 4163 | blk_queue_max_hw_sectors(disks[drive]->queue, 64); |
4160 | disks[dr]->major = FLOPPY_MAJOR; | 4164 | disks[drive]->major = FLOPPY_MAJOR; |
4161 | disks[dr]->first_minor = TOMINOR(dr); | 4165 | disks[drive]->first_minor = TOMINOR(drive); |
4162 | disks[dr]->fops = &floppy_fops; | 4166 | disks[drive]->fops = &floppy_fops; |
4163 | sprintf(disks[dr]->disk_name, "fd%d", dr); | 4167 | sprintf(disks[drive]->disk_name, "fd%d", drive); |
4164 | 4168 | ||
4165 | init_timer(&motor_off_timer[dr]); | 4169 | init_timer(&motor_off_timer[drive]); |
4166 | motor_off_timer[dr].data = dr; | 4170 | motor_off_timer[drive].data = drive; |
4167 | motor_off_timer[dr].function = motor_off_callback; | 4171 | motor_off_timer[drive].function = motor_off_callback; |
4168 | } | 4172 | } |
4169 | 4173 | ||
4170 | err = register_blkdev(FLOPPY_MAJOR, "fd"); | 4174 | err = register_blkdev(FLOPPY_MAJOR, "fd"); |
@@ -4282,9 +4286,7 @@ static int __init do_floppy_init(void) | |||
4282 | } | 4286 | } |
4283 | 4287 | ||
4284 | for (drive = 0; drive < N_DRIVE; drive++) { | 4288 | for (drive = 0; drive < N_DRIVE; drive++) { |
4285 | if (!(allowed_drive_mask & (1 << drive))) | 4289 | if (!floppy_available(drive)) |
4286 | continue; | ||
4287 | if (fdc_state[FDC(drive)].version == FDC_NONE) | ||
4288 | continue; | 4290 | continue; |
4289 | 4291 | ||
4290 | floppy_device[drive].name = floppy_device_name; | 4292 | floppy_device[drive].name = floppy_device_name; |
@@ -4293,7 +4295,7 @@ static int __init do_floppy_init(void) | |||
4293 | 4295 | ||
4294 | err = platform_device_register(&floppy_device[drive]); | 4296 | err = platform_device_register(&floppy_device[drive]); |
4295 | if (err) | 4297 | if (err) |
4296 | goto out_release_dma; | 4298 | goto out_remove_drives; |
4297 | 4299 | ||
4298 | err = device_create_file(&floppy_device[drive].dev, | 4300 | err = device_create_file(&floppy_device[drive].dev, |
4299 | &dev_attr_cmos); | 4301 | &dev_attr_cmos); |
@@ -4311,29 +4313,34 @@ static int __init do_floppy_init(void) | |||
4311 | 4313 | ||
4312 | out_unreg_platform_dev: | 4314 | out_unreg_platform_dev: |
4313 | platform_device_unregister(&floppy_device[drive]); | 4315 | platform_device_unregister(&floppy_device[drive]); |
4316 | out_remove_drives: | ||
4317 | while (drive--) { | ||
4318 | if (floppy_available(drive)) { | ||
4319 | del_gendisk(disks[drive]); | ||
4320 | device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); | ||
4321 | platform_device_unregister(&floppy_device[drive]); | ||
4322 | } | ||
4323 | } | ||
4314 | out_release_dma: | 4324 | out_release_dma: |
4315 | if (atomic_read(&usage_count)) | 4325 | if (atomic_read(&usage_count)) |
4316 | floppy_release_irq_and_dma(); | 4326 | floppy_release_irq_and_dma(); |
4317 | out_unreg_region: | 4327 | out_unreg_region: |
4318 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); | 4328 | blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256); |
4319 | platform_driver_unregister(&floppy_driver); | 4329 | platform_driver_unregister(&floppy_driver); |
4320 | out_destroy_workq: | ||
4321 | destroy_workqueue(floppy_wq); | ||
4322 | out_unreg_blkdev: | 4330 | out_unreg_blkdev: |
4323 | unregister_blkdev(FLOPPY_MAJOR, "fd"); | 4331 | unregister_blkdev(FLOPPY_MAJOR, "fd"); |
4324 | out_put_disk: | 4332 | out_put_disk: |
4325 | while (dr--) { | 4333 | for (drive = 0; drive < N_DRIVE; drive++) { |
4326 | del_timer_sync(&motor_off_timer[dr]); | 4334 | if (!disks[drive]) |
4327 | if (disks[dr]->queue) { | 4335 | break; |
4328 | blk_cleanup_queue(disks[dr]->queue); | 4336 | if (disks[drive]->queue) { |
4329 | /* | 4337 | del_timer_sync(&motor_off_timer[drive]); |
4330 | * put_disk() is not paired with add_disk() and | 4338 | blk_cleanup_queue(disks[drive]->queue); |
4331 | * will put queue reference one extra time. fix it. | 4339 | disks[drive]->queue = NULL; |
4332 | */ | ||
4333 | disks[dr]->queue = NULL; | ||
4334 | } | 4340 | } |
4335 | put_disk(disks[dr]); | 4341 | put_disk(disks[drive]); |
4336 | } | 4342 | } |
4343 | destroy_workqueue(floppy_wq); | ||
4337 | return err; | 4344 | return err; |
4338 | } | 4345 | } |
4339 | 4346 | ||
@@ -4551,8 +4558,7 @@ static void __exit floppy_module_exit(void) | |||
4551 | for (drive = 0; drive < N_DRIVE; drive++) { | 4558 | for (drive = 0; drive < N_DRIVE; drive++) { |
4552 | del_timer_sync(&motor_off_timer[drive]); | 4559 | del_timer_sync(&motor_off_timer[drive]); |
4553 | 4560 | ||
4554 | if ((allowed_drive_mask & (1 << drive)) && | 4561 | if (floppy_available(drive)) { |
4555 | fdc_state[FDC(drive)].version != FDC_NONE) { | ||
4556 | del_gendisk(disks[drive]); | 4562 | del_gendisk(disks[drive]); |
4557 | device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); | 4563 | device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos); |
4558 | platform_device_unregister(&floppy_device[drive]); | 4564 | platform_device_unregister(&floppy_device[drive]); |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index e9d594fd12c..54046e51160 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -976,8 +976,21 @@ static int loop_clr_fd(struct loop_device *lo) | |||
976 | if (lo->lo_state != Lo_bound) | 976 | if (lo->lo_state != Lo_bound) |
977 | return -ENXIO; | 977 | return -ENXIO; |
978 | 978 | ||
979 | if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */ | 979 | /* |
980 | return -EBUSY; | 980 | * If we've explicitly asked to tear down the loop device, |
981 | * and it has an elevated reference count, set it for auto-teardown when | ||
982 | * the last reference goes away. This stops $!~#$@ udev from | ||
983 | * preventing teardown because it decided that it needs to run blkid on | ||
984 | * the loopback device whenever they appear. xfstests is notorious for | ||
985 | * failing tests because blkid via udev races with a losetup | ||
986 | * <dev>/do something like mkfs/losetup -d <dev> causing the losetup -d | ||
987 | * command to fail with EBUSY. | ||
988 | */ | ||
989 | if (lo->lo_refcnt > 1) { | ||
990 | lo->lo_flags |= LO_FLAGS_AUTOCLEAR; | ||
991 | mutex_unlock(&lo->lo_ctl_mutex); | ||
992 | return 0; | ||
993 | } | ||
981 | 994 | ||
982 | if (filp == NULL) | 995 | if (filp == NULL) |
983 | return -EINVAL; | 996 | return -EINVAL; |
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index f946d31d691..adc6f36564c 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c | |||
@@ -2035,8 +2035,9 @@ static unsigned int implicit_sector(unsigned char command, | |||
2035 | } | 2035 | } |
2036 | return rv; | 2036 | return rv; |
2037 | } | 2037 | } |
2038 | 2038 | static void mtip_set_timeout(struct driver_data *dd, | |
2039 | static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout) | 2039 | struct host_to_dev_fis *fis, |
2040 | unsigned int *timeout, u8 erasemode) | ||
2040 | { | 2041 | { |
2041 | switch (fis->command) { | 2042 | switch (fis->command) { |
2042 | case ATA_CMD_DOWNLOAD_MICRO: | 2043 | case ATA_CMD_DOWNLOAD_MICRO: |
@@ -2044,7 +2045,10 @@ static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout) | |||
2044 | break; | 2045 | break; |
2045 | case ATA_CMD_SEC_ERASE_UNIT: | 2046 | case ATA_CMD_SEC_ERASE_UNIT: |
2046 | case 0xFC: | 2047 | case 0xFC: |
2047 | *timeout = 240000; /* 4 minutes */ | 2048 | if (erasemode) |
2049 | *timeout = ((*(dd->port->identify + 90) * 2) * 60000); | ||
2050 | else | ||
2051 | *timeout = ((*(dd->port->identify + 89) * 2) * 60000); | ||
2048 | break; | 2052 | break; |
2049 | case ATA_CMD_STANDBYNOW1: | 2053 | case ATA_CMD_STANDBYNOW1: |
2050 | *timeout = 120000; /* 2 minutes */ | 2054 | *timeout = 120000; /* 2 minutes */ |
@@ -2087,6 +2091,7 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
2087 | unsigned int transfer_size; | 2091 | unsigned int transfer_size; |
2088 | unsigned long task_file_data; | 2092 | unsigned long task_file_data; |
2089 | int intotal = outtotal + req_task->out_size; | 2093 | int intotal = outtotal + req_task->out_size; |
2094 | int erasemode = 0; | ||
2090 | 2095 | ||
2091 | taskout = req_task->out_size; | 2096 | taskout = req_task->out_size; |
2092 | taskin = req_task->in_size; | 2097 | taskin = req_task->in_size; |
@@ -2212,7 +2217,13 @@ static int exec_drive_taskfile(struct driver_data *dd, | |||
2212 | fis.lba_hi, | 2217 | fis.lba_hi, |
2213 | fis.device); | 2218 | fis.device); |
2214 | 2219 | ||
2215 | mtip_set_timeout(&fis, &timeout); | 2220 | /* check for erase mode support during secure erase.*/ |
2221 | if ((fis.command == ATA_CMD_SEC_ERASE_UNIT) | ||
2222 | && (outbuf[0] & MTIP_SEC_ERASE_MODE)) { | ||
2223 | erasemode = 1; | ||
2224 | } | ||
2225 | |||
2226 | mtip_set_timeout(dd, &fis, &timeout, erasemode); | ||
2216 | 2227 | ||
2217 | /* Determine the correct transfer size.*/ | 2228 | /* Determine the correct transfer size.*/ |
2218 | if (force_single_sector) | 2229 | if (force_single_sector) |
diff --git a/drivers/block/mtip32xx/mtip32xx.h b/drivers/block/mtip32xx/mtip32xx.h index 18627a1d04c..5f4a917bd8b 100644 --- a/drivers/block/mtip32xx/mtip32xx.h +++ b/drivers/block/mtip32xx/mtip32xx.h | |||
@@ -33,6 +33,9 @@ | |||
33 | /* offset of Device Control register in PCIe extended capabilites space */ | 33 | /* offset of Device Control register in PCIe extended capabilites space */ |
34 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 | 34 | #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48 |
35 | 35 | ||
36 | /* check for erase mode support during secure erase */ | ||
37 | #define MTIP_SEC_ERASE_MODE 0x3 | ||
38 | |||
36 | /* # of times to retry timed out/failed IOs */ | 39 | /* # of times to retry timed out/failed IOs */ |
37 | #define MTIP_MAX_RETRIES 2 | 40 | #define MTIP_MAX_RETRIES 2 |
38 | 41 | ||
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 9ad3b5ec1dc..9a54623e52d 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h | |||
@@ -158,8 +158,8 @@ struct xen_vbd { | |||
158 | struct block_device *bdev; | 158 | struct block_device *bdev; |
159 | /* Cached size parameter. */ | 159 | /* Cached size parameter. */ |
160 | sector_t size; | 160 | sector_t size; |
161 | bool flush_support; | 161 | unsigned int flush_support:1; |
162 | bool discard_secure; | 162 | unsigned int discard_secure:1; |
163 | }; | 163 | }; |
164 | 164 | ||
165 | struct backend_info; | 165 | struct backend_info; |
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index 4f66171c668..f58434c2617 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c | |||
@@ -105,11 +105,10 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) | |||
105 | { | 105 | { |
106 | struct xen_blkif *blkif; | 106 | struct xen_blkif *blkif; |
107 | 107 | ||
108 | blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL); | 108 | blkif = kmem_cache_zalloc(xen_blkif_cachep, GFP_KERNEL); |
109 | if (!blkif) | 109 | if (!blkif) |
110 | return ERR_PTR(-ENOMEM); | 110 | return ERR_PTR(-ENOMEM); |
111 | 111 | ||
112 | memset(blkif, 0, sizeof(*blkif)); | ||
113 | blkif->domid = domid; | 112 | blkif->domid = domid; |
114 | spin_lock_init(&blkif->blk_ring_lock); | 113 | spin_lock_init(&blkif->blk_ring_lock); |
115 | atomic_set(&blkif->refcnt, 1); | 114 | atomic_set(&blkif->refcnt, 1); |
@@ -196,7 +195,7 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif) | |||
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | void xen_blkif_free(struct xen_blkif *blkif) | 198 | static void xen_blkif_free(struct xen_blkif *blkif) |
200 | { | 199 | { |
201 | if (!atomic_dec_and_test(&blkif->refcnt)) | 200 | if (!atomic_dec_and_test(&blkif->refcnt)) |
202 | BUG(); | 201 | BUG(); |
@@ -257,7 +256,7 @@ static struct attribute_group xen_vbdstat_group = { | |||
257 | VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor); | 256 | VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor); |
258 | VBD_SHOW(mode, "%s\n", be->mode); | 257 | VBD_SHOW(mode, "%s\n", be->mode); |
259 | 258 | ||
260 | int xenvbd_sysfs_addif(struct xenbus_device *dev) | 259 | static int xenvbd_sysfs_addif(struct xenbus_device *dev) |
261 | { | 260 | { |
262 | int error; | 261 | int error; |
263 | 262 | ||
@@ -281,7 +280,7 @@ fail1: device_remove_file(&dev->dev, &dev_attr_physical_device); | |||
281 | return error; | 280 | return error; |
282 | } | 281 | } |
283 | 282 | ||
284 | void xenvbd_sysfs_delif(struct xenbus_device *dev) | 283 | static void xenvbd_sysfs_delif(struct xenbus_device *dev) |
285 | { | 284 | { |
286 | sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group); | 285 | sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group); |
287 | device_remove_file(&dev->dev, &dev_attr_mode); | 286 | device_remove_file(&dev->dev, &dev_attr_mode); |
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index c16a3a593ba..e3ebb4fa2c3 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * http://www.gnu.org/licenses/gpl.html | 5 | * http://www.gnu.org/licenses/gpl.html |
6 | * | 6 | * |
7 | * Maintainer: | 7 | * Maintainer: |
8 | * Andreas Herrmann <andreas.herrmann3@amd.com> | 8 | * Andreas Herrmann <herrmann.der.user@googlemail.com> |
9 | * | 9 | * |
10 | * Based on the powernow-k7.c module written by Dave Jones. | 10 | * Based on the powernow-k7.c module written by Dave Jones. |
11 | * (C) 2003 Dave Jones on behalf of SuSE Labs | 11 | * (C) 2003 Dave Jones on behalf of SuSE Labs |
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c index ed3e55161bd..f05e54258ff 100644 --- a/drivers/gpio/gpio-74x164.c +++ b/drivers/gpio/gpio-74x164.c | |||
@@ -153,7 +153,7 @@ static int __devinit gen_74x164_probe(struct spi_device *spi) | |||
153 | } | 153 | } |
154 | 154 | ||
155 | chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers; | 155 | chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers; |
156 | chip->buffer = devm_kzalloc(&spi->dev, chip->gpio_chip.ngpio, GFP_KERNEL); | 156 | chip->buffer = devm_kzalloc(&spi->dev, chip->registers, GFP_KERNEL); |
157 | if (!chip->buffer) { | 157 | if (!chip->buffer) { |
158 | ret = -ENOMEM; | 158 | ret = -ENOMEM; |
159 | goto exit_destroy; | 159 | goto exit_destroy; |
diff --git a/drivers/gpio/gpio-mvebu.c b/drivers/gpio/gpio-mvebu.c index 7a874129e5d..cf7afb9eb61 100644 --- a/drivers/gpio/gpio-mvebu.c +++ b/drivers/gpio/gpio-mvebu.c | |||
@@ -244,6 +244,8 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin, | |||
244 | if (ret) | 244 | if (ret) |
245 | return ret; | 245 | return ret; |
246 | 246 | ||
247 | mvebu_gpio_set(chip, pin, value); | ||
248 | |||
247 | spin_lock_irqsave(&mvchip->lock, flags); | 249 | spin_lock_irqsave(&mvchip->lock, flags); |
248 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); | 250 | u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip)); |
249 | u &= ~(1 << pin); | 251 | u &= ~(1 << pin); |
@@ -644,7 +646,7 @@ static int __devinit mvebu_gpio_probe(struct platform_device *pdev) | |||
644 | ct->handler = handle_edge_irq; | 646 | ct->handler = handle_edge_irq; |
645 | ct->chip.name = mvchip->chip.label; | 647 | ct->chip.name = mvchip->chip.label; |
646 | 648 | ||
647 | irq_setup_generic_chip(gc, IRQ_MSK(ngpios), IRQ_GC_INIT_MASK_CACHE, | 649 | irq_setup_generic_chip(gc, IRQ_MSK(ngpios), 0, |
648 | IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); | 650 | IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE); |
649 | 651 | ||
650 | /* Setup irq domain on top of the generic chip. */ | 652 | /* Setup irq domain on top of the generic chip. */ |
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index 94cbc842fbc..d335af1d4d8 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c | |||
@@ -251,6 +251,40 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio, | |||
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | /** | ||
255 | * _clear_gpio_debounce - clear debounce settings for a gpio | ||
256 | * @bank: the gpio bank we're acting upon | ||
257 | * @gpio: the gpio number on this @gpio | ||
258 | * | ||
259 | * If a gpio is using debounce, then clear the debounce enable bit and if | ||
260 | * this is the only gpio in this bank using debounce, then clear the debounce | ||
261 | * time too. The debounce clock will also be disabled when calling this function | ||
262 | * if this is the only gpio in the bank using debounce. | ||
263 | */ | ||
264 | static void _clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio) | ||
265 | { | ||
266 | u32 gpio_bit = GPIO_BIT(bank, gpio); | ||
267 | |||
268 | if (!bank->dbck_flag) | ||
269 | return; | ||
270 | |||
271 | if (!(bank->dbck_enable_mask & gpio_bit)) | ||
272 | return; | ||
273 | |||
274 | bank->dbck_enable_mask &= ~gpio_bit; | ||
275 | bank->context.debounce_en &= ~gpio_bit; | ||
276 | __raw_writel(bank->context.debounce_en, | ||
277 | bank->base + bank->regs->debounce_en); | ||
278 | |||
279 | if (!bank->dbck_enable_mask) { | ||
280 | bank->context.debounce = 0; | ||
281 | __raw_writel(bank->context.debounce, bank->base + | ||
282 | bank->regs->debounce); | ||
283 | clk_disable(bank->dbck); | ||
284 | bank->dbck_enabled = false; | ||
285 | } | ||
286 | } | ||
287 | |||
254 | static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, | 288 | static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio, |
255 | unsigned trigger) | 289 | unsigned trigger) |
256 | { | 290 | { |
@@ -539,6 +573,7 @@ static void _reset_gpio(struct gpio_bank *bank, int gpio) | |||
539 | _set_gpio_irqenable(bank, gpio, 0); | 573 | _set_gpio_irqenable(bank, gpio, 0); |
540 | _clear_gpio_irqstatus(bank, gpio); | 574 | _clear_gpio_irqstatus(bank, gpio); |
541 | _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); | 575 | _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE); |
576 | _clear_gpio_debounce(bank, gpio); | ||
542 | } | 577 | } |
543 | 578 | ||
544 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ | 579 | /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */ |
diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c index 031c6adf5b6..1a3e2b9b477 100644 --- a/drivers/gpio/gpio-timberdale.c +++ b/drivers/gpio/gpio-timberdale.c | |||
@@ -116,7 +116,7 @@ static void timbgpio_irq_disable(struct irq_data *d) | |||
116 | unsigned long flags; | 116 | unsigned long flags; |
117 | 117 | ||
118 | spin_lock_irqsave(&tgpio->lock, flags); | 118 | spin_lock_irqsave(&tgpio->lock, flags); |
119 | tgpio->last_ier &= ~(1 << offset); | 119 | tgpio->last_ier &= ~(1UL << offset); |
120 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); | 120 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); |
121 | spin_unlock_irqrestore(&tgpio->lock, flags); | 121 | spin_unlock_irqrestore(&tgpio->lock, flags); |
122 | } | 122 | } |
@@ -128,7 +128,7 @@ static void timbgpio_irq_enable(struct irq_data *d) | |||
128 | unsigned long flags; | 128 | unsigned long flags; |
129 | 129 | ||
130 | spin_lock_irqsave(&tgpio->lock, flags); | 130 | spin_lock_irqsave(&tgpio->lock, flags); |
131 | tgpio->last_ier |= 1 << offset; | 131 | tgpio->last_ier |= 1UL << offset; |
132 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); | 132 | iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER); |
133 | spin_unlock_irqrestore(&tgpio->lock, flags); | 133 | spin_unlock_irqrestore(&tgpio->lock, flags); |
134 | } | 134 | } |
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 5d6c71edc73..1c8d9e3380e 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -623,9 +623,11 @@ static ssize_t export_store(struct class *class, | |||
623 | */ | 623 | */ |
624 | 624 | ||
625 | status = gpio_request(gpio, "sysfs"); | 625 | status = gpio_request(gpio, "sysfs"); |
626 | if (status < 0) | 626 | if (status < 0) { |
627 | if (status == -EPROBE_DEFER) | ||
628 | status = -ENODEV; | ||
627 | goto done; | 629 | goto done; |
628 | 630 | } | |
629 | status = gpio_export(gpio, true); | 631 | status = gpio_export(gpio, true); |
630 | if (status < 0) | 632 | if (status < 0) |
631 | gpio_free(gpio); | 633 | gpio_free(gpio); |
@@ -1191,8 +1193,10 @@ int gpio_request(unsigned gpio, const char *label) | |||
1191 | 1193 | ||
1192 | spin_lock_irqsave(&gpio_lock, flags); | 1194 | spin_lock_irqsave(&gpio_lock, flags); |
1193 | 1195 | ||
1194 | if (!gpio_is_valid(gpio)) | 1196 | if (!gpio_is_valid(gpio)) { |
1197 | status = -EINVAL; | ||
1195 | goto done; | 1198 | goto done; |
1199 | } | ||
1196 | desc = &gpio_desc[gpio]; | 1200 | desc = &gpio_desc[gpio]; |
1197 | chip = desc->chip; | 1201 | chip = desc->chip; |
1198 | if (chip == NULL) | 1202 | if (chip == NULL) |
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 59a26e577b5..fc345d4ebb0 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config DRM_EXYNOS | 1 | config DRM_EXYNOS |
2 | tristate "DRM Support for Samsung SoC EXYNOS Series" | 2 | tristate "DRM Support for Samsung SoC EXYNOS Series" |
3 | depends on DRM && PLAT_SAMSUNG | 3 | depends on DRM && (PLAT_SAMSUNG || ARCH_MULTIPLATFORM) |
4 | select DRM_KMS_HELPER | 4 | select DRM_KMS_HELPER |
5 | select FB_CFB_FILLRECT | 5 | select FB_CFB_FILLRECT |
6 | select FB_CFB_COPYAREA | 6 | select FB_CFB_COPYAREA |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c b/drivers/gpu/drm/exynos/exynos_drm_connector.c index 18c271862ca..0f68a287267 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_connector.c +++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c | |||
@@ -374,6 +374,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, | |||
374 | exynos_connector->encoder_id = encoder->base.id; | 374 | exynos_connector->encoder_id = encoder->base.id; |
375 | exynos_connector->manager = manager; | 375 | exynos_connector->manager = manager; |
376 | exynos_connector->dpms = DRM_MODE_DPMS_OFF; | 376 | exynos_connector->dpms = DRM_MODE_DPMS_OFF; |
377 | connector->dpms = DRM_MODE_DPMS_OFF; | ||
377 | connector->encoder = encoder; | 378 | connector->encoder = encoder; |
378 | 379 | ||
379 | err = drm_mode_connector_attach_encoder(connector, encoder); | 380 | err = drm_mode_connector_attach_encoder(connector, encoder); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_encoder.c b/drivers/gpu/drm/exynos/exynos_drm_encoder.c index e51503fbaf2..241ad1eeec6 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_encoder.c +++ b/drivers/gpu/drm/exynos/exynos_drm_encoder.c | |||
@@ -43,12 +43,14 @@ | |||
43 | * @manager: specific encoder has its own manager to control a hardware | 43 | * @manager: specific encoder has its own manager to control a hardware |
44 | * appropriately and we can access a hardware drawing on this manager. | 44 | * appropriately and we can access a hardware drawing on this manager. |
45 | * @dpms: store the encoder dpms value. | 45 | * @dpms: store the encoder dpms value. |
46 | * @updated: indicate whether overlay data updating is needed or not. | ||
46 | */ | 47 | */ |
47 | struct exynos_drm_encoder { | 48 | struct exynos_drm_encoder { |
48 | struct drm_crtc *old_crtc; | 49 | struct drm_crtc *old_crtc; |
49 | struct drm_encoder drm_encoder; | 50 | struct drm_encoder drm_encoder; |
50 | struct exynos_drm_manager *manager; | 51 | struct exynos_drm_manager *manager; |
51 | int dpms; | 52 | int dpms; |
53 | bool updated; | ||
52 | }; | 54 | }; |
53 | 55 | ||
54 | static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode) | 56 | static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode) |
@@ -85,7 +87,9 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
85 | switch (mode) { | 87 | switch (mode) { |
86 | case DRM_MODE_DPMS_ON: | 88 | case DRM_MODE_DPMS_ON: |
87 | if (manager_ops && manager_ops->apply) | 89 | if (manager_ops && manager_ops->apply) |
88 | manager_ops->apply(manager->dev); | 90 | if (!exynos_encoder->updated) |
91 | manager_ops->apply(manager->dev); | ||
92 | |||
89 | exynos_drm_connector_power(encoder, mode); | 93 | exynos_drm_connector_power(encoder, mode); |
90 | exynos_encoder->dpms = mode; | 94 | exynos_encoder->dpms = mode; |
91 | break; | 95 | break; |
@@ -94,6 +98,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) | |||
94 | case DRM_MODE_DPMS_OFF: | 98 | case DRM_MODE_DPMS_OFF: |
95 | exynos_drm_connector_power(encoder, mode); | 99 | exynos_drm_connector_power(encoder, mode); |
96 | exynos_encoder->dpms = mode; | 100 | exynos_encoder->dpms = mode; |
101 | exynos_encoder->updated = false; | ||
97 | break; | 102 | break; |
98 | default: | 103 | default: |
99 | DRM_ERROR("unspecified mode %d\n", mode); | 104 | DRM_ERROR("unspecified mode %d\n", mode); |
@@ -205,13 +210,22 @@ static void exynos_drm_encoder_prepare(struct drm_encoder *encoder) | |||
205 | 210 | ||
206 | static void exynos_drm_encoder_commit(struct drm_encoder *encoder) | 211 | static void exynos_drm_encoder_commit(struct drm_encoder *encoder) |
207 | { | 212 | { |
208 | struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder); | 213 | struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder); |
214 | struct exynos_drm_manager *manager = exynos_encoder->manager; | ||
209 | struct exynos_drm_manager_ops *manager_ops = manager->ops; | 215 | struct exynos_drm_manager_ops *manager_ops = manager->ops; |
210 | 216 | ||
211 | DRM_DEBUG_KMS("%s\n", __FILE__); | 217 | DRM_DEBUG_KMS("%s\n", __FILE__); |
212 | 218 | ||
213 | if (manager_ops && manager_ops->commit) | 219 | if (manager_ops && manager_ops->commit) |
214 | manager_ops->commit(manager->dev); | 220 | manager_ops->commit(manager->dev); |
221 | |||
222 | /* | ||
223 | * this will avoid one issue that overlay data is updated to | ||
224 | * real hardware two times. | ||
225 | * And this variable will be used to check if the data was | ||
226 | * already updated or not by exynos_drm_encoder_dpms function. | ||
227 | */ | ||
228 | exynos_encoder->updated = true; | ||
215 | } | 229 | } |
216 | 230 | ||
217 | static void exynos_drm_encoder_disable(struct drm_encoder *encoder) | 231 | static void exynos_drm_encoder_disable(struct drm_encoder *encoder) |
@@ -401,19 +415,6 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data) | |||
401 | manager_ops->dpms(manager->dev, mode); | 415 | manager_ops->dpms(manager->dev, mode); |
402 | 416 | ||
403 | /* | 417 | /* |
404 | * set current mode to new one so that data aren't updated into | ||
405 | * registers by drm_helper_connector_dpms two times. | ||
406 | * | ||
407 | * in case that drm_crtc_helper_set_mode() is called, | ||
408 | * overlay_ops->commit() and manager_ops->commit() callbacks | ||
409 | * can be called two times, first at drm_crtc_helper_set_mode() | ||
410 | * and second at drm_helper_connector_dpms(). | ||
411 | * so with this setting, when drm_helper_connector_dpms() is called | ||
412 | * encoder->funcs->dpms() will be ignored. | ||
413 | */ | ||
414 | exynos_encoder->dpms = mode; | ||
415 | |||
416 | /* | ||
417 | * if this condition is ok then it means that the crtc is already | 418 | * if this condition is ok then it means that the crtc is already |
418 | * detached from encoder and last function for detaching is properly | 419 | * detached from encoder and last function for detaching is properly |
419 | * done, so clear pipe from manager to prevent repeated call. | 420 | * done, so clear pipe from manager to prevent repeated call. |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index 614b2e9ac46..e7fbb823fd8 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -1142,7 +1142,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) | |||
1142 | const struct of_device_id *match; | 1142 | const struct of_device_id *match; |
1143 | match = of_match_node(of_match_ptr(mixer_match_types), | 1143 | match = of_match_node(of_match_ptr(mixer_match_types), |
1144 | pdev->dev.of_node); | 1144 | pdev->dev.of_node); |
1145 | drv = match->data; | 1145 | drv = (struct mixer_drv_data *)match->data; |
1146 | } else { | 1146 | } else { |
1147 | drv = (struct mixer_drv_data *) | 1147 | drv = (struct mixer_drv_data *) |
1148 | platform_get_device_id(pdev)->driver_data; | 1148 | platform_get_device_id(pdev)->driver_data; |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index c9bfd83dde6..61ae104dca8 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1505,7 +1505,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1505 | goto put_gmch; | 1505 | goto put_gmch; |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | i915_kick_out_firmware_fb(dev_priv); | 1508 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
1509 | i915_kick_out_firmware_fb(dev_priv); | ||
1509 | 1510 | ||
1510 | pci_set_master(dev->pdev); | 1511 | pci_set_master(dev->pdev); |
1511 | 1512 | ||
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index f78061af704..b726b478a4f 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -729,7 +729,7 @@ void intel_crt_init(struct drm_device *dev) | |||
729 | 729 | ||
730 | crt->base.type = INTEL_OUTPUT_ANALOG; | 730 | crt->base.type = INTEL_OUTPUT_ANALOG; |
731 | crt->base.cloneable = true; | 731 | crt->base.cloneable = true; |
732 | if (IS_HASWELL(dev)) | 732 | if (IS_HASWELL(dev) || IS_I830(dev)) |
733 | crt->base.crtc_mask = (1 << 0); | 733 | crt->base.crtc_mask = (1 << 0); |
734 | else | 734 | else |
735 | crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); | 735 | crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2); |
diff --git a/drivers/gpu/drm/i915/intel_overlay.c b/drivers/gpu/drm/i915/intel_overlay.c index 495625914e4..d7bc817f51a 100644 --- a/drivers/gpu/drm/i915/intel_overlay.c +++ b/drivers/gpu/drm/i915/intel_overlay.c | |||
@@ -341,9 +341,17 @@ static int intel_overlay_off(struct intel_overlay *overlay) | |||
341 | intel_ring_emit(ring, flip_addr); | 341 | intel_ring_emit(ring, flip_addr); |
342 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); | 342 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); |
343 | /* turn overlay off */ | 343 | /* turn overlay off */ |
344 | intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF); | 344 | if (IS_I830(dev)) { |
345 | intel_ring_emit(ring, flip_addr); | 345 | /* Workaround: Don't disable the overlay fully, since otherwise |
346 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); | 346 | * it dies on the next OVERLAY_ON cmd. */ |
347 | intel_ring_emit(ring, MI_NOOP); | ||
348 | intel_ring_emit(ring, MI_NOOP); | ||
349 | intel_ring_emit(ring, MI_NOOP); | ||
350 | } else { | ||
351 | intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF); | ||
352 | intel_ring_emit(ring, flip_addr); | ||
353 | intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP); | ||
354 | } | ||
347 | intel_ring_advance(ring); | 355 | intel_ring_advance(ring); |
348 | 356 | ||
349 | return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail); | 357 | return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail); |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index e019b236986..e2aacd32954 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -435,7 +435,7 @@ int intel_panel_setup_backlight(struct drm_device *dev) | |||
435 | props.type = BACKLIGHT_RAW; | 435 | props.type = BACKLIGHT_RAW; |
436 | props.max_brightness = _intel_panel_get_max_backlight(dev); | 436 | props.max_brightness = _intel_panel_get_max_backlight(dev); |
437 | if (props.max_brightness == 0) { | 437 | if (props.max_brightness == 0) { |
438 | DRM_ERROR("Failed to get maximum backlight value\n"); | 438 | DRM_DEBUG_DRIVER("Failed to get maximum backlight value\n"); |
439 | return -ENODEV; | 439 | return -ENODEV; |
440 | } | 440 | } |
441 | dev_priv->backlight = | 441 | dev_priv->backlight = |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index c01d97db006..79d308da29f 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -894,6 +894,45 @@ static void intel_sdvo_dump_hdmi_buf(struct intel_sdvo *intel_sdvo) | |||
894 | } | 894 | } |
895 | #endif | 895 | #endif |
896 | 896 | ||
897 | static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo, | ||
898 | unsigned if_index, uint8_t tx_rate, | ||
899 | uint8_t *data, unsigned length) | ||
900 | { | ||
901 | uint8_t set_buf_index[2] = { if_index, 0 }; | ||
902 | uint8_t hbuf_size, tmp[8]; | ||
903 | int i; | ||
904 | |||
905 | if (!intel_sdvo_set_value(intel_sdvo, | ||
906 | SDVO_CMD_SET_HBUF_INDEX, | ||
907 | set_buf_index, 2)) | ||
908 | return false; | ||
909 | |||
910 | if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO, | ||
911 | &hbuf_size, 1)) | ||
912 | return false; | ||
913 | |||
914 | /* Buffer size is 0 based, hooray! */ | ||
915 | hbuf_size++; | ||
916 | |||
917 | DRM_DEBUG_KMS("writing sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n", | ||
918 | if_index, length, hbuf_size); | ||
919 | |||
920 | for (i = 0; i < hbuf_size; i += 8) { | ||
921 | memset(tmp, 0, 8); | ||
922 | if (i < length) | ||
923 | memcpy(tmp, data + i, min_t(unsigned, 8, length - i)); | ||
924 | |||
925 | if (!intel_sdvo_set_value(intel_sdvo, | ||
926 | SDVO_CMD_SET_HBUF_DATA, | ||
927 | tmp, 8)) | ||
928 | return false; | ||
929 | } | ||
930 | |||
931 | return intel_sdvo_set_value(intel_sdvo, | ||
932 | SDVO_CMD_SET_HBUF_TXRATE, | ||
933 | &tx_rate, 1); | ||
934 | } | ||
935 | |||
897 | static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | 936 | static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) |
898 | { | 937 | { |
899 | struct dip_infoframe avi_if = { | 938 | struct dip_infoframe avi_if = { |
@@ -901,11 +940,7 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | |||
901 | .ver = DIP_VERSION_AVI, | 940 | .ver = DIP_VERSION_AVI, |
902 | .len = DIP_LEN_AVI, | 941 | .len = DIP_LEN_AVI, |
903 | }; | 942 | }; |
904 | uint8_t tx_rate = SDVO_HBUF_TX_VSYNC; | ||
905 | uint8_t set_buf_index[2] = { 1, 0 }; | ||
906 | uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)]; | 943 | uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)]; |
907 | uint64_t *data = (uint64_t *)sdvo_data; | ||
908 | unsigned i; | ||
909 | 944 | ||
910 | intel_dip_infoframe_csum(&avi_if); | 945 | intel_dip_infoframe_csum(&avi_if); |
911 | 946 | ||
@@ -915,22 +950,9 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) | |||
915 | sdvo_data[3] = avi_if.checksum; | 950 | sdvo_data[3] = avi_if.checksum; |
916 | memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi)); | 951 | memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi)); |
917 | 952 | ||
918 | if (!intel_sdvo_set_value(intel_sdvo, | 953 | return intel_sdvo_write_infoframe(intel_sdvo, SDVO_HBUF_INDEX_AVI_IF, |
919 | SDVO_CMD_SET_HBUF_INDEX, | 954 | SDVO_HBUF_TX_VSYNC, |
920 | set_buf_index, 2)) | 955 | sdvo_data, sizeof(sdvo_data)); |
921 | return false; | ||
922 | |||
923 | for (i = 0; i < sizeof(sdvo_data); i += 8) { | ||
924 | if (!intel_sdvo_set_value(intel_sdvo, | ||
925 | SDVO_CMD_SET_HBUF_DATA, | ||
926 | data, 8)) | ||
927 | return false; | ||
928 | data++; | ||
929 | } | ||
930 | |||
931 | return intel_sdvo_set_value(intel_sdvo, | ||
932 | SDVO_CMD_SET_HBUF_TXRATE, | ||
933 | &tx_rate, 1); | ||
934 | } | 956 | } |
935 | 957 | ||
936 | static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo) | 958 | static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo) |
diff --git a/drivers/gpu/drm/i915/intel_sdvo_regs.h b/drivers/gpu/drm/i915/intel_sdvo_regs.h index 9d030142ee4..770bdd6ecd9 100644 --- a/drivers/gpu/drm/i915/intel_sdvo_regs.h +++ b/drivers/gpu/drm/i915/intel_sdvo_regs.h | |||
@@ -708,6 +708,8 @@ struct intel_sdvo_enhancements_arg { | |||
708 | #define SDVO_CMD_SET_AUDIO_STAT 0x91 | 708 | #define SDVO_CMD_SET_AUDIO_STAT 0x91 |
709 | #define SDVO_CMD_GET_AUDIO_STAT 0x92 | 709 | #define SDVO_CMD_GET_AUDIO_STAT 0x92 |
710 | #define SDVO_CMD_SET_HBUF_INDEX 0x93 | 710 | #define SDVO_CMD_SET_HBUF_INDEX 0x93 |
711 | #define SDVO_HBUF_INDEX_ELD 0 | ||
712 | #define SDVO_HBUF_INDEX_AVI_IF 1 | ||
711 | #define SDVO_CMD_GET_HBUF_INDEX 0x94 | 713 | #define SDVO_CMD_GET_HBUF_INDEX 0x94 |
712 | #define SDVO_CMD_GET_HBUF_INFO 0x95 | 714 | #define SDVO_CMD_GET_HBUF_INFO 0x95 |
713 | #define SDVO_CMD_SET_HBUF_AV_SPLIT 0x96 | 715 | #define SDVO_CMD_SET_HBUF_AV_SPLIT 0x96 |
diff --git a/drivers/gpu/drm/nouveau/core/core/mm.c b/drivers/gpu/drm/nouveau/core/core/mm.c index 4d620644867..a6d3cd6490f 100644 --- a/drivers/gpu/drm/nouveau/core/core/mm.c +++ b/drivers/gpu/drm/nouveau/core/core/mm.c | |||
@@ -218,13 +218,16 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block) | |||
218 | node = kzalloc(sizeof(*node), GFP_KERNEL); | 218 | node = kzalloc(sizeof(*node), GFP_KERNEL); |
219 | if (!node) | 219 | if (!node) |
220 | return -ENOMEM; | 220 | return -ENOMEM; |
221 | node->offset = roundup(offset, mm->block_size); | 221 | |
222 | node->length = rounddown(offset + length, mm->block_size) - node->offset; | 222 | if (length) { |
223 | node->offset = roundup(offset, mm->block_size); | ||
224 | node->length = rounddown(offset + length, mm->block_size); | ||
225 | node->length -= node->offset; | ||
226 | } | ||
223 | 227 | ||
224 | list_add_tail(&node->nl_entry, &mm->nodes); | 228 | list_add_tail(&node->nl_entry, &mm->nodes); |
225 | list_add_tail(&node->fl_entry, &mm->free); | 229 | list_add_tail(&node->fl_entry, &mm->free); |
226 | mm->heap_nodes++; | 230 | mm->heap_nodes++; |
227 | mm->heap_size += length; | ||
228 | return 0; | 231 | return 0; |
229 | } | 232 | } |
230 | 233 | ||
diff --git a/drivers/gpu/drm/nouveau/core/include/core/mm.h b/drivers/gpu/drm/nouveau/core/include/core/mm.h index 9ee9bf4028c..975137ba34a 100644 --- a/drivers/gpu/drm/nouveau/core/include/core/mm.h +++ b/drivers/gpu/drm/nouveau/core/include/core/mm.h | |||
@@ -19,7 +19,6 @@ struct nouveau_mm { | |||
19 | 19 | ||
20 | u32 block_size; | 20 | u32 block_size; |
21 | int heap_nodes; | 21 | int heap_nodes; |
22 | u32 heap_size; | ||
23 | }; | 22 | }; |
24 | 23 | ||
25 | int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block); | 24 | int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block); |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c index 27fb1af7a77..5f570806143 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c +++ b/drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c | |||
@@ -219,13 +219,11 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
219 | ((priv->base.ram.size & 0x000000ff) << 32); | 219 | ((priv->base.ram.size & 0x000000ff) << 32); |
220 | 220 | ||
221 | tags = nv_rd32(priv, 0x100320); | 221 | tags = nv_rd32(priv, 0x100320); |
222 | if (tags) { | 222 | ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1); |
223 | ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1); | 223 | if (ret) |
224 | if (ret) | 224 | return ret; |
225 | return ret; | ||
226 | 225 | ||
227 | nv_debug(priv, "%d compression tags\n", tags); | 226 | nv_debug(priv, "%d compression tags\n", tags); |
228 | } | ||
229 | 227 | ||
230 | size = (priv->base.ram.size >> 12) - rsvd_head - rsvd_tail; | 228 | size = (priv->base.ram.size >> 12) - rsvd_head - rsvd_tail; |
231 | switch (device->chipset) { | 229 | switch (device->chipset) { |
diff --git a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c index 3d2c88310f9..dbfc2abf0cf 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/i2c/base.c | |||
@@ -292,7 +292,7 @@ nouveau_i2c_ctor(struct nouveau_object *parent, struct nouveau_object *engine, | |||
292 | case DCB_I2C_NVIO_BIT: | 292 | case DCB_I2C_NVIO_BIT: |
293 | port->drive = info.drive & 0x0f; | 293 | port->drive = info.drive & 0x0f; |
294 | if (device->card_type < NV_D0) { | 294 | if (device->card_type < NV_D0) { |
295 | if (info.drive >= ARRAY_SIZE(nv50_i2c_port)) | 295 | if (port->drive >= ARRAY_SIZE(nv50_i2c_port)) |
296 | break; | 296 | break; |
297 | port->drive = nv50_i2c_port[port->drive]; | 297 | port->drive = nv50_i2c_port[port->drive]; |
298 | port->sense = port->drive; | 298 | port->sense = port->drive; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index d2f8ffeed74..86124b131f4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c | |||
@@ -290,6 +290,7 @@ nouveau_display_create(struct drm_device *dev) | |||
290 | struct nouveau_drm *drm = nouveau_drm(dev); | 290 | struct nouveau_drm *drm = nouveau_drm(dev); |
291 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); | 291 | struct nouveau_disp *pdisp = nouveau_disp(drm->device); |
292 | struct nouveau_display *disp; | 292 | struct nouveau_display *disp; |
293 | u32 pclass = dev->pdev->class >> 8; | ||
293 | int ret, gen; | 294 | int ret, gen; |
294 | 295 | ||
295 | disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); | 296 | disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL); |
@@ -360,23 +361,27 @@ nouveau_display_create(struct drm_device *dev) | |||
360 | drm_kms_helper_poll_init(dev); | 361 | drm_kms_helper_poll_init(dev); |
361 | drm_kms_helper_poll_disable(dev); | 362 | drm_kms_helper_poll_disable(dev); |
362 | 363 | ||
363 | if (nv_device(drm->device)->card_type < NV_50) | 364 | if (nouveau_modeset == 1 || |
364 | ret = nv04_display_create(dev); | 365 | (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) { |
365 | else | 366 | if (nv_device(drm->device)->card_type < NV_50) |
366 | if (nv_device(drm->device)->card_type < NV_D0) | 367 | ret = nv04_display_create(dev); |
367 | ret = nv50_display_create(dev); | 368 | else |
368 | else | 369 | if (nv_device(drm->device)->card_type < NV_D0) |
369 | ret = nvd0_display_create(dev); | 370 | ret = nv50_display_create(dev); |
370 | if (ret) | 371 | else |
371 | goto disp_create_err; | 372 | ret = nvd0_display_create(dev); |
372 | |||
373 | if (dev->mode_config.num_crtc) { | ||
374 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); | ||
375 | if (ret) | 373 | if (ret) |
376 | goto vblank_err; | 374 | goto disp_create_err; |
375 | |||
376 | if (dev->mode_config.num_crtc) { | ||
377 | ret = drm_vblank_init(dev, dev->mode_config.num_crtc); | ||
378 | if (ret) | ||
379 | goto vblank_err; | ||
380 | } | ||
381 | |||
382 | nouveau_backlight_init(dev); | ||
377 | } | 383 | } |
378 | 384 | ||
379 | nouveau_backlight_init(dev); | ||
380 | return 0; | 385 | return 0; |
381 | 386 | ||
382 | vblank_err: | 387 | vblank_err: |
@@ -395,7 +400,8 @@ nouveau_display_destroy(struct drm_device *dev) | |||
395 | nouveau_backlight_exit(dev); | 400 | nouveau_backlight_exit(dev); |
396 | drm_vblank_cleanup(dev); | 401 | drm_vblank_cleanup(dev); |
397 | 402 | ||
398 | disp->dtor(dev); | 403 | if (disp->dtor) |
404 | disp->dtor(dev); | ||
399 | 405 | ||
400 | drm_kms_helper_poll_fini(dev); | 406 | drm_kms_helper_poll_fini(dev); |
401 | drm_mode_config_cleanup(dev); | 407 | drm_mode_config_cleanup(dev); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index ccae8c26ae2..0910125cbbc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -63,8 +63,9 @@ MODULE_PARM_DESC(noaccel, "disable kernel/abi16 acceleration"); | |||
63 | static int nouveau_noaccel = 0; | 63 | static int nouveau_noaccel = 0; |
64 | module_param_named(noaccel, nouveau_noaccel, int, 0400); | 64 | module_param_named(noaccel, nouveau_noaccel, int, 0400); |
65 | 65 | ||
66 | MODULE_PARM_DESC(modeset, "enable driver"); | 66 | MODULE_PARM_DESC(modeset, "enable driver (default: auto, " |
67 | static int nouveau_modeset = -1; | 67 | "0 = disabled, 1 = enabled, 2 = headless)"); |
68 | int nouveau_modeset = -1; | ||
68 | module_param_named(modeset, nouveau_modeset, int, 0400); | 69 | module_param_named(modeset, nouveau_modeset, int, 0400); |
69 | 70 | ||
70 | static struct drm_driver driver; | 71 | static struct drm_driver driver; |
@@ -363,7 +364,8 @@ nouveau_drm_unload(struct drm_device *dev) | |||
363 | 364 | ||
364 | nouveau_pm_fini(dev); | 365 | nouveau_pm_fini(dev); |
365 | 366 | ||
366 | nouveau_display_fini(dev); | 367 | if (dev->mode_config.num_crtc) |
368 | nouveau_display_fini(dev); | ||
367 | nouveau_display_destroy(dev); | 369 | nouveau_display_destroy(dev); |
368 | 370 | ||
369 | nouveau_irq_fini(dev); | 371 | nouveau_irq_fini(dev); |
@@ -403,13 +405,15 @@ nouveau_drm_suspend(struct pci_dev *pdev, pm_message_t pm_state) | |||
403 | pm_state.event == PM_EVENT_PRETHAW) | 405 | pm_state.event == PM_EVENT_PRETHAW) |
404 | return 0; | 406 | return 0; |
405 | 407 | ||
406 | NV_INFO(drm, "suspending fbcon...\n"); | 408 | if (dev->mode_config.num_crtc) { |
407 | nouveau_fbcon_set_suspend(dev, 1); | 409 | NV_INFO(drm, "suspending fbcon...\n"); |
410 | nouveau_fbcon_set_suspend(dev, 1); | ||
408 | 411 | ||
409 | NV_INFO(drm, "suspending display...\n"); | 412 | NV_INFO(drm, "suspending display...\n"); |
410 | ret = nouveau_display_suspend(dev); | 413 | ret = nouveau_display_suspend(dev); |
411 | if (ret) | 414 | if (ret) |
412 | return ret; | 415 | return ret; |
416 | } | ||
413 | 417 | ||
414 | NV_INFO(drm, "evicting buffers...\n"); | 418 | NV_INFO(drm, "evicting buffers...\n"); |
415 | ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); | 419 | ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM); |
@@ -445,8 +449,10 @@ fail_client: | |||
445 | nouveau_client_init(&cli->base); | 449 | nouveau_client_init(&cli->base); |
446 | } | 450 | } |
447 | 451 | ||
448 | NV_INFO(drm, "resuming display...\n"); | 452 | if (dev->mode_config.num_crtc) { |
449 | nouveau_display_resume(dev); | 453 | NV_INFO(drm, "resuming display...\n"); |
454 | nouveau_display_resume(dev); | ||
455 | } | ||
450 | return ret; | 456 | return ret; |
451 | } | 457 | } |
452 | 458 | ||
@@ -486,8 +492,10 @@ nouveau_drm_resume(struct pci_dev *pdev) | |||
486 | nouveau_irq_postinstall(dev); | 492 | nouveau_irq_postinstall(dev); |
487 | nouveau_pm_resume(dev); | 493 | nouveau_pm_resume(dev); |
488 | 494 | ||
489 | NV_INFO(drm, "resuming display...\n"); | 495 | if (dev->mode_config.num_crtc) { |
490 | nouveau_display_resume(dev); | 496 | NV_INFO(drm, "resuming display...\n"); |
497 | nouveau_display_resume(dev); | ||
498 | } | ||
491 | return 0; | 499 | return 0; |
492 | } | 500 | } |
493 | 501 | ||
@@ -662,9 +670,7 @@ nouveau_drm_init(void) | |||
662 | #ifdef CONFIG_VGA_CONSOLE | 670 | #ifdef CONFIG_VGA_CONSOLE |
663 | if (vgacon_text_force()) | 671 | if (vgacon_text_force()) |
664 | nouveau_modeset = 0; | 672 | nouveau_modeset = 0; |
665 | else | ||
666 | #endif | 673 | #endif |
667 | nouveau_modeset = 1; | ||
668 | } | 674 | } |
669 | 675 | ||
670 | if (!nouveau_modeset) | 676 | if (!nouveau_modeset) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h index 81947121754..a1016992708 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.h +++ b/drivers/gpu/drm/nouveau/nouveau_drm.h | |||
@@ -141,4 +141,6 @@ int nouveau_drm_resume(struct pci_dev *); | |||
141 | nv_info((cli), fmt, ##args); \ | 141 | nv_info((cli), fmt, ##args); \ |
142 | } while (0) | 142 | } while (0) |
143 | 143 | ||
144 | extern int nouveau_modeset; | ||
145 | |||
144 | #endif | 146 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nouveau_irq.c b/drivers/gpu/drm/nouveau/nouveau_irq.c index 9ca8afdb554..1d8cb506a28 100644 --- a/drivers/gpu/drm/nouveau/nouveau_irq.c +++ b/drivers/gpu/drm/nouveau/nouveau_irq.c | |||
@@ -61,13 +61,15 @@ nouveau_irq_handler(DRM_IRQ_ARGS) | |||
61 | 61 | ||
62 | nv_subdev(pmc)->intr(nv_subdev(pmc)); | 62 | nv_subdev(pmc)->intr(nv_subdev(pmc)); |
63 | 63 | ||
64 | if (device->card_type >= NV_D0) { | 64 | if (dev->mode_config.num_crtc) { |
65 | if (nv_rd32(device, 0x000100) & 0x04000000) | 65 | if (device->card_type >= NV_D0) { |
66 | nvd0_display_intr(dev); | 66 | if (nv_rd32(device, 0x000100) & 0x04000000) |
67 | } else | 67 | nvd0_display_intr(dev); |
68 | if (device->card_type >= NV_50) { | 68 | } else |
69 | if (nv_rd32(device, 0x000100) & 0x04000000) | 69 | if (device->card_type >= NV_50) { |
70 | nv50_display_intr(dev); | 70 | if (nv_rd32(device, 0x000100) & 0x04000000) |
71 | nv50_display_intr(dev); | ||
72 | } | ||
71 | } | 73 | } |
72 | 74 | ||
73 | return IRQ_HANDLED; | 75 | return IRQ_HANDLED; |
diff --git a/drivers/gpu/drm/nouveau/nv04_dac.c b/drivers/gpu/drm/nouveau/nv04_dac.c index 347a3bd78d0..64f7020fb60 100644 --- a/drivers/gpu/drm/nouveau/nv04_dac.c +++ b/drivers/gpu/drm/nouveau/nv04_dac.c | |||
@@ -220,7 +220,7 @@ out: | |||
220 | NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode); | 220 | NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode); |
221 | 221 | ||
222 | if (blue == 0x18) { | 222 | if (blue == 0x18) { |
223 | NV_INFO(drm, "Load detected on head A\n"); | 223 | NV_DEBUG(drm, "Load detected on head A\n"); |
224 | return connector_status_connected; | 224 | return connector_status_connected; |
225 | } | 225 | } |
226 | 226 | ||
@@ -338,8 +338,8 @@ nv17_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) | |||
338 | 338 | ||
339 | if (nv17_dac_sample_load(encoder) & | 339 | if (nv17_dac_sample_load(encoder) & |
340 | NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) { | 340 | NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) { |
341 | NV_INFO(drm, "Load detected on output %c\n", | 341 | NV_DEBUG(drm, "Load detected on output %c\n", |
342 | '@' + ffs(dcb->or)); | 342 | '@' + ffs(dcb->or)); |
343 | return connector_status_connected; | 343 | return connector_status_connected; |
344 | } else { | 344 | } else { |
345 | return connector_status_disconnected; | 345 | return connector_status_disconnected; |
@@ -413,9 +413,9 @@ static void nv04_dac_commit(struct drm_encoder *encoder) | |||
413 | 413 | ||
414 | helper->dpms(encoder, DRM_MODE_DPMS_ON); | 414 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
415 | 415 | ||
416 | NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", | 416 | NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", |
417 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), | 417 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), |
418 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); | 418 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); |
419 | } | 419 | } |
420 | 420 | ||
421 | void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable) | 421 | void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable) |
@@ -461,8 +461,8 @@ static void nv04_dac_dpms(struct drm_encoder *encoder, int mode) | |||
461 | return; | 461 | return; |
462 | nv_encoder->last_dpms = mode; | 462 | nv_encoder->last_dpms = mode; |
463 | 463 | ||
464 | NV_INFO(drm, "Setting dpms mode %d on vga encoder (output %d)\n", | 464 | NV_DEBUG(drm, "Setting dpms mode %d on vga encoder (output %d)\n", |
465 | mode, nv_encoder->dcb->index); | 465 | mode, nv_encoder->dcb->index); |
466 | 466 | ||
467 | nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON); | 467 | nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON); |
468 | } | 468 | } |
diff --git a/drivers/gpu/drm/nouveau/nv04_dfp.c b/drivers/gpu/drm/nouveau/nv04_dfp.c index da55d7642c8..184cdf80676 100644 --- a/drivers/gpu/drm/nouveau/nv04_dfp.c +++ b/drivers/gpu/drm/nouveau/nv04_dfp.c | |||
@@ -476,9 +476,9 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) | |||
476 | 476 | ||
477 | helper->dpms(encoder, DRM_MODE_DPMS_ON); | 477 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
478 | 478 | ||
479 | NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", | 479 | NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", |
480 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), | 480 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), |
481 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); | 481 | nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); |
482 | } | 482 | } |
483 | 483 | ||
484 | static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) | 484 | static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode) |
@@ -520,8 +520,8 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) | |||
520 | return; | 520 | return; |
521 | nv_encoder->last_dpms = mode; | 521 | nv_encoder->last_dpms = mode; |
522 | 522 | ||
523 | NV_INFO(drm, "Setting dpms mode %d on lvds encoder (output %d)\n", | 523 | NV_DEBUG(drm, "Setting dpms mode %d on lvds encoder (output %d)\n", |
524 | mode, nv_encoder->dcb->index); | 524 | mode, nv_encoder->dcb->index); |
525 | 525 | ||
526 | if (was_powersaving && is_powersaving_dpms(mode)) | 526 | if (was_powersaving && is_powersaving_dpms(mode)) |
527 | return; | 527 | return; |
@@ -565,8 +565,8 @@ static void nv04_tmds_dpms(struct drm_encoder *encoder, int mode) | |||
565 | return; | 565 | return; |
566 | nv_encoder->last_dpms = mode; | 566 | nv_encoder->last_dpms = mode; |
567 | 567 | ||
568 | NV_INFO(drm, "Setting dpms mode %d on tmds encoder (output %d)\n", | 568 | NV_DEBUG(drm, "Setting dpms mode %d on tmds encoder (output %d)\n", |
569 | mode, nv_encoder->dcb->index); | 569 | mode, nv_encoder->dcb->index); |
570 | 570 | ||
571 | nv04_dfp_update_backlight(encoder, mode); | 571 | nv04_dfp_update_backlight(encoder, mode); |
572 | nv04_dfp_update_fp_control(encoder, mode); | 572 | nv04_dfp_update_fp_control(encoder, mode); |
diff --git a/drivers/gpu/drm/nouveau/nv04_tv.c b/drivers/gpu/drm/nouveau/nv04_tv.c index 099fbeda6e2..62e826a139b 100644 --- a/drivers/gpu/drm/nouveau/nv04_tv.c +++ b/drivers/gpu/drm/nouveau/nv04_tv.c | |||
@@ -75,8 +75,8 @@ static void nv04_tv_dpms(struct drm_encoder *encoder, int mode) | |||
75 | struct nv04_mode_state *state = &nv04_display(dev)->mode_reg; | 75 | struct nv04_mode_state *state = &nv04_display(dev)->mode_reg; |
76 | uint8_t crtc1A; | 76 | uint8_t crtc1A; |
77 | 77 | ||
78 | NV_INFO(drm, "Setting dpms mode %d on TV encoder (output %d)\n", | 78 | NV_DEBUG(drm, "Setting dpms mode %d on TV encoder (output %d)\n", |
79 | mode, nv_encoder->dcb->index); | 79 | mode, nv_encoder->dcb->index); |
80 | 80 | ||
81 | state->pllsel &= ~(PLLSEL_TV_CRTC1_MASK | PLLSEL_TV_CRTC2_MASK); | 81 | state->pllsel &= ~(PLLSEL_TV_CRTC1_MASK | PLLSEL_TV_CRTC2_MASK); |
82 | 82 | ||
@@ -167,9 +167,8 @@ static void nv04_tv_commit(struct drm_encoder *encoder) | |||
167 | 167 | ||
168 | helper->dpms(encoder, DRM_MODE_DPMS_ON); | 168 | helper->dpms(encoder, DRM_MODE_DPMS_ON); |
169 | 169 | ||
170 | NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n", | 170 | NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n", |
171 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, | 171 | drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, '@' + ffs(nv_encoder->dcb->or)); |
172 | '@' + ffs(nv_encoder->dcb->or)); | ||
173 | } | 172 | } |
174 | 173 | ||
175 | static void nv04_tv_destroy(struct drm_encoder *encoder) | 174 | static void nv04_tv_destroy(struct drm_encoder *encoder) |
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c index 30271b64191..95e6318b626 100644 --- a/drivers/gpu/drm/radeon/evergreen_cs.c +++ b/drivers/gpu/drm/radeon/evergreen_cs.c | |||
@@ -264,7 +264,7 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p, | |||
264 | /* macro tile width & height */ | 264 | /* macro tile width & height */ |
265 | palign = (8 * surf->bankw * track->npipes) * surf->mtilea; | 265 | palign = (8 * surf->bankw * track->npipes) * surf->mtilea; |
266 | halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea; | 266 | halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea; |
267 | mtileb = (palign / 8) * (halign / 8) * tileb;; | 267 | mtileb = (palign / 8) * (halign / 8) * tileb; |
268 | mtile_pr = surf->nbx / palign; | 268 | mtile_pr = surf->nbx / palign; |
269 | mtile_ps = (mtile_pr * surf->nby) / halign; | 269 | mtile_ps = (mtile_pr * surf->nby) / halign; |
270 | surf->layer_size = mtile_ps * mtileb * slice_pt; | 270 | surf->layer_size = mtile_ps * mtileb * slice_pt; |
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c index 37f6a907aea..15f5ded65e0 100644 --- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c +++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c | |||
@@ -352,9 +352,9 @@ static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) | |||
352 | } | 352 | } |
353 | 353 | ||
354 | /** | 354 | /** |
355 | * radeon_atpx_switchto - switch to the requested GPU | 355 | * radeon_atpx_power_state - power down/up the requested GPU |
356 | * | 356 | * |
357 | * @id: GPU to switch to | 357 | * @id: GPU to power down/up |
358 | * @state: requested power state (0 = off, 1 = on) | 358 | * @state: requested power state (0 = off, 1 = on) |
359 | * | 359 | * |
360 | * Execute the necessary ATPX function to power down/up the discrete GPU | 360 | * Execute the necessary ATPX function to power down/up the discrete GPU |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index 67cfc1795ec..b884c362a8c 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -941,7 +941,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
941 | struct drm_mode_object *obj; | 941 | struct drm_mode_object *obj; |
942 | int i; | 942 | int i; |
943 | enum drm_connector_status ret = connector_status_disconnected; | 943 | enum drm_connector_status ret = connector_status_disconnected; |
944 | bool dret = false; | 944 | bool dret = false, broken_edid = false; |
945 | 945 | ||
946 | if (!force && radeon_check_hpd_status_unchanged(connector)) | 946 | if (!force && radeon_check_hpd_status_unchanged(connector)) |
947 | return connector->status; | 947 | return connector->status; |
@@ -965,6 +965,9 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
965 | ret = connector_status_disconnected; | 965 | ret = connector_status_disconnected; |
966 | DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector)); | 966 | DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector)); |
967 | radeon_connector->ddc_bus = NULL; | 967 | radeon_connector->ddc_bus = NULL; |
968 | } else { | ||
969 | ret = connector_status_connected; | ||
970 | broken_edid = true; /* defer use_digital to later */ | ||
968 | } | 971 | } |
969 | } else { | 972 | } else { |
970 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); | 973 | radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL); |
@@ -1047,13 +1050,24 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) | |||
1047 | 1050 | ||
1048 | encoder_funcs = encoder->helper_private; | 1051 | encoder_funcs = encoder->helper_private; |
1049 | if (encoder_funcs->detect) { | 1052 | if (encoder_funcs->detect) { |
1050 | if (ret != connector_status_connected) { | 1053 | if (!broken_edid) { |
1051 | ret = encoder_funcs->detect(encoder, connector); | 1054 | if (ret != connector_status_connected) { |
1052 | if (ret == connector_status_connected) { | 1055 | /* deal with analog monitors without DDC */ |
1053 | radeon_connector->use_digital = false; | 1056 | ret = encoder_funcs->detect(encoder, connector); |
1057 | if (ret == connector_status_connected) { | ||
1058 | radeon_connector->use_digital = false; | ||
1059 | } | ||
1060 | if (ret != connector_status_disconnected) | ||
1061 | radeon_connector->detected_by_load = true; | ||
1054 | } | 1062 | } |
1055 | if (ret != connector_status_disconnected) | 1063 | } else { |
1056 | radeon_connector->detected_by_load = true; | 1064 | enum drm_connector_status lret; |
1065 | /* assume digital unless load detected otherwise */ | ||
1066 | radeon_connector->use_digital = true; | ||
1067 | lret = encoder_funcs->detect(encoder, connector); | ||
1068 | DRM_DEBUG_KMS("load_detect %x returned: %x\n",encoder->encoder_type,lret); | ||
1069 | if (lret == connector_status_connected) | ||
1070 | radeon_connector->use_digital = false; | ||
1057 | } | 1071 | } |
1058 | break; | 1072 | break; |
1059 | } | 1073 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index 5677a424b58..6857cb4efb7 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
@@ -295,6 +295,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
295 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); | 295 | struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); |
296 | struct drm_device *dev = crtc->dev; | 296 | struct drm_device *dev = crtc->dev; |
297 | struct radeon_device *rdev = dev->dev_private; | 297 | struct radeon_device *rdev = dev->dev_private; |
298 | uint32_t crtc_ext_cntl = 0; | ||
298 | uint32_t mask; | 299 | uint32_t mask; |
299 | 300 | ||
300 | if (radeon_crtc->crtc_id) | 301 | if (radeon_crtc->crtc_id) |
@@ -307,6 +308,16 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
307 | RADEON_CRTC_VSYNC_DIS | | 308 | RADEON_CRTC_VSYNC_DIS | |
308 | RADEON_CRTC_HSYNC_DIS); | 309 | RADEON_CRTC_HSYNC_DIS); |
309 | 310 | ||
311 | /* | ||
312 | * On all dual CRTC GPUs this bit controls the CRTC of the primary DAC. | ||
313 | * Therefore it is set in the DAC DMPS function. | ||
314 | * This is different for GPU's with a single CRTC but a primary and a | ||
315 | * TV DAC: here it controls the single CRTC no matter where it is | ||
316 | * routed. Therefore we set it here. | ||
317 | */ | ||
318 | if (rdev->flags & RADEON_SINGLE_CRTC) | ||
319 | crtc_ext_cntl = RADEON_CRTC_CRT_ON; | ||
320 | |||
310 | switch (mode) { | 321 | switch (mode) { |
311 | case DRM_MODE_DPMS_ON: | 322 | case DRM_MODE_DPMS_ON: |
312 | radeon_crtc->enabled = true; | 323 | radeon_crtc->enabled = true; |
@@ -317,7 +328,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
317 | else { | 328 | else { |
318 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN | | 329 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN | |
319 | RADEON_CRTC_DISP_REQ_EN_B)); | 330 | RADEON_CRTC_DISP_REQ_EN_B)); |
320 | WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask); | 331 | WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl)); |
321 | } | 332 | } |
322 | drm_vblank_post_modeset(dev, radeon_crtc->crtc_id); | 333 | drm_vblank_post_modeset(dev, radeon_crtc->crtc_id); |
323 | radeon_crtc_load_lut(crtc); | 334 | radeon_crtc_load_lut(crtc); |
@@ -331,7 +342,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
331 | else { | 342 | else { |
332 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN | | 343 | WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN | |
333 | RADEON_CRTC_DISP_REQ_EN_B)); | 344 | RADEON_CRTC_DISP_REQ_EN_B)); |
334 | WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~mask); | 345 | WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~(mask | crtc_ext_cntl)); |
335 | } | 346 | } |
336 | radeon_crtc->enabled = false; | 347 | radeon_crtc->enabled = false; |
337 | /* adjust pm to dpms changes AFTER disabling crtcs */ | 348 | /* adjust pm to dpms changes AFTER disabling crtcs */ |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 0063df9d166..f5ba2241dac 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -537,7 +537,9 @@ static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode | |||
537 | break; | 537 | break; |
538 | } | 538 | } |
539 | 539 | ||
540 | WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl); | 540 | /* handled in radeon_crtc_dpms() */ |
541 | if (!(rdev->flags & RADEON_SINGLE_CRTC)) | ||
542 | WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl); | ||
541 | WREG32(RADEON_DAC_CNTL, dac_cntl); | 543 | WREG32(RADEON_DAC_CNTL, dac_cntl); |
542 | WREG32(RADEON_DAC_MACRO_CNTL, dac_macro_cntl); | 544 | WREG32(RADEON_DAC_MACRO_CNTL, dac_macro_cntl); |
543 | 545 | ||
@@ -662,6 +664,8 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc | |||
662 | 664 | ||
663 | if (ASIC_IS_R300(rdev)) | 665 | if (ASIC_IS_R300(rdev)) |
664 | tmp |= (0x1b6 << RADEON_DAC_FORCE_DATA_SHIFT); | 666 | tmp |= (0x1b6 << RADEON_DAC_FORCE_DATA_SHIFT); |
667 | else if (ASIC_IS_RV100(rdev)) | ||
668 | tmp |= (0x1ac << RADEON_DAC_FORCE_DATA_SHIFT); | ||
665 | else | 669 | else |
666 | tmp |= (0x180 << RADEON_DAC_FORCE_DATA_SHIFT); | 670 | tmp |= (0x180 << RADEON_DAC_FORCE_DATA_SHIFT); |
667 | 671 | ||
@@ -671,6 +675,7 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc | |||
671 | tmp |= RADEON_DAC_RANGE_CNTL_PS2 | RADEON_DAC_CMP_EN; | 675 | tmp |= RADEON_DAC_RANGE_CNTL_PS2 | RADEON_DAC_CMP_EN; |
672 | WREG32(RADEON_DAC_CNTL, tmp); | 676 | WREG32(RADEON_DAC_CNTL, tmp); |
673 | 677 | ||
678 | tmp = dac_macro_cntl; | ||
674 | tmp &= ~(RADEON_DAC_PDWN_R | | 679 | tmp &= ~(RADEON_DAC_PDWN_R | |
675 | RADEON_DAC_PDWN_G | | 680 | RADEON_DAC_PDWN_G | |
676 | RADEON_DAC_PDWN_B); | 681 | RADEON_DAC_PDWN_B); |
@@ -1092,7 +1097,8 @@ static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode) | |||
1092 | } else { | 1097 | } else { |
1093 | if (is_tv) | 1098 | if (is_tv) |
1094 | WREG32(RADEON_TV_MASTER_CNTL, tv_master_cntl); | 1099 | WREG32(RADEON_TV_MASTER_CNTL, tv_master_cntl); |
1095 | else | 1100 | /* handled in radeon_crtc_dpms() */ |
1101 | else if (!(rdev->flags & RADEON_SINGLE_CRTC)) | ||
1096 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); | 1102 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); |
1097 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); | 1103 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); |
1098 | } | 1104 | } |
@@ -1416,13 +1422,104 @@ static bool radeon_legacy_tv_detect(struct drm_encoder *encoder, | |||
1416 | return found; | 1422 | return found; |
1417 | } | 1423 | } |
1418 | 1424 | ||
1425 | static bool radeon_legacy_ext_dac_detect(struct drm_encoder *encoder, | ||
1426 | struct drm_connector *connector) | ||
1427 | { | ||
1428 | struct drm_device *dev = encoder->dev; | ||
1429 | struct radeon_device *rdev = dev->dev_private; | ||
1430 | uint32_t gpio_monid, fp2_gen_cntl, disp_output_cntl, crtc2_gen_cntl; | ||
1431 | uint32_t disp_lin_trans_grph_a, disp_lin_trans_grph_b, disp_lin_trans_grph_c; | ||
1432 | uint32_t disp_lin_trans_grph_d, disp_lin_trans_grph_e, disp_lin_trans_grph_f; | ||
1433 | uint32_t tmp, crtc2_h_total_disp, crtc2_v_total_disp; | ||
1434 | uint32_t crtc2_h_sync_strt_wid, crtc2_v_sync_strt_wid; | ||
1435 | bool found = false; | ||
1436 | int i; | ||
1437 | |||
1438 | /* save the regs we need */ | ||
1439 | gpio_monid = RREG32(RADEON_GPIO_MONID); | ||
1440 | fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL); | ||
1441 | disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL); | ||
1442 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); | ||
1443 | disp_lin_trans_grph_a = RREG32(RADEON_DISP_LIN_TRANS_GRPH_A); | ||
1444 | disp_lin_trans_grph_b = RREG32(RADEON_DISP_LIN_TRANS_GRPH_B); | ||
1445 | disp_lin_trans_grph_c = RREG32(RADEON_DISP_LIN_TRANS_GRPH_C); | ||
1446 | disp_lin_trans_grph_d = RREG32(RADEON_DISP_LIN_TRANS_GRPH_D); | ||
1447 | disp_lin_trans_grph_e = RREG32(RADEON_DISP_LIN_TRANS_GRPH_E); | ||
1448 | disp_lin_trans_grph_f = RREG32(RADEON_DISP_LIN_TRANS_GRPH_F); | ||
1449 | crtc2_h_total_disp = RREG32(RADEON_CRTC2_H_TOTAL_DISP); | ||
1450 | crtc2_v_total_disp = RREG32(RADEON_CRTC2_V_TOTAL_DISP); | ||
1451 | crtc2_h_sync_strt_wid = RREG32(RADEON_CRTC2_H_SYNC_STRT_WID); | ||
1452 | crtc2_v_sync_strt_wid = RREG32(RADEON_CRTC2_V_SYNC_STRT_WID); | ||
1453 | |||
1454 | tmp = RREG32(RADEON_GPIO_MONID); | ||
1455 | tmp &= ~RADEON_GPIO_A_0; | ||
1456 | WREG32(RADEON_GPIO_MONID, tmp); | ||
1457 | |||
1458 | WREG32(RADEON_FP2_GEN_CNTL, (RADEON_FP2_ON | | ||
1459 | RADEON_FP2_PANEL_FORMAT | | ||
1460 | R200_FP2_SOURCE_SEL_TRANS_UNIT | | ||
1461 | RADEON_FP2_DVO_EN | | ||
1462 | R200_FP2_DVO_RATE_SEL_SDR)); | ||
1463 | |||
1464 | WREG32(RADEON_DISP_OUTPUT_CNTL, (RADEON_DISP_DAC_SOURCE_RMX | | ||
1465 | RADEON_DISP_TRANS_MATRIX_GRAPHICS)); | ||
1466 | |||
1467 | WREG32(RADEON_CRTC2_GEN_CNTL, (RADEON_CRTC2_EN | | ||
1468 | RADEON_CRTC2_DISP_REQ_EN_B)); | ||
1469 | |||
1470 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_A, 0x00000000); | ||
1471 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_B, 0x000003f0); | ||
1472 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_C, 0x00000000); | ||
1473 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_D, 0x000003f0); | ||
1474 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_E, 0x00000000); | ||
1475 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_F, 0x000003f0); | ||
1476 | |||
1477 | WREG32(RADEON_CRTC2_H_TOTAL_DISP, 0x01000008); | ||
1478 | WREG32(RADEON_CRTC2_H_SYNC_STRT_WID, 0x00000800); | ||
1479 | WREG32(RADEON_CRTC2_V_TOTAL_DISP, 0x00080001); | ||
1480 | WREG32(RADEON_CRTC2_V_SYNC_STRT_WID, 0x00000080); | ||
1481 | |||
1482 | for (i = 0; i < 200; i++) { | ||
1483 | tmp = RREG32(RADEON_GPIO_MONID); | ||
1484 | if (tmp & RADEON_GPIO_Y_0) | ||
1485 | found = true; | ||
1486 | |||
1487 | if (found) | ||
1488 | break; | ||
1489 | |||
1490 | if (!drm_can_sleep()) | ||
1491 | mdelay(1); | ||
1492 | else | ||
1493 | msleep(1); | ||
1494 | } | ||
1495 | |||
1496 | /* restore the regs we used */ | ||
1497 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_A, disp_lin_trans_grph_a); | ||
1498 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_B, disp_lin_trans_grph_b); | ||
1499 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_C, disp_lin_trans_grph_c); | ||
1500 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_D, disp_lin_trans_grph_d); | ||
1501 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_E, disp_lin_trans_grph_e); | ||
1502 | WREG32(RADEON_DISP_LIN_TRANS_GRPH_F, disp_lin_trans_grph_f); | ||
1503 | WREG32(RADEON_CRTC2_H_TOTAL_DISP, crtc2_h_total_disp); | ||
1504 | WREG32(RADEON_CRTC2_V_TOTAL_DISP, crtc2_v_total_disp); | ||
1505 | WREG32(RADEON_CRTC2_H_SYNC_STRT_WID, crtc2_h_sync_strt_wid); | ||
1506 | WREG32(RADEON_CRTC2_V_SYNC_STRT_WID, crtc2_v_sync_strt_wid); | ||
1507 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); | ||
1508 | WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); | ||
1509 | WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl); | ||
1510 | WREG32(RADEON_GPIO_MONID, gpio_monid); | ||
1511 | |||
1512 | return found; | ||
1513 | } | ||
1514 | |||
1419 | static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder *encoder, | 1515 | static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder *encoder, |
1420 | struct drm_connector *connector) | 1516 | struct drm_connector *connector) |
1421 | { | 1517 | { |
1422 | struct drm_device *dev = encoder->dev; | 1518 | struct drm_device *dev = encoder->dev; |
1423 | struct radeon_device *rdev = dev->dev_private; | 1519 | struct radeon_device *rdev = dev->dev_private; |
1424 | uint32_t crtc2_gen_cntl, tv_dac_cntl, dac_cntl2, dac_ext_cntl; | 1520 | uint32_t crtc2_gen_cntl = 0, tv_dac_cntl, dac_cntl2, dac_ext_cntl; |
1425 | uint32_t disp_hw_debug, disp_output_cntl, gpiopad_a, pixclks_cntl, tmp; | 1521 | uint32_t gpiopad_a = 0, pixclks_cntl, tmp; |
1522 | uint32_t disp_output_cntl = 0, disp_hw_debug = 0, crtc_ext_cntl = 0; | ||
1426 | enum drm_connector_status found = connector_status_disconnected; | 1523 | enum drm_connector_status found = connector_status_disconnected; |
1427 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1524 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1428 | struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; | 1525 | struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; |
@@ -1459,12 +1556,27 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1459 | return connector_status_disconnected; | 1556 | return connector_status_disconnected; |
1460 | } | 1557 | } |
1461 | 1558 | ||
1559 | /* R200 uses an external DAC for secondary DAC */ | ||
1560 | if (rdev->family == CHIP_R200) { | ||
1561 | if (radeon_legacy_ext_dac_detect(encoder, connector)) | ||
1562 | found = connector_status_connected; | ||
1563 | return found; | ||
1564 | } | ||
1565 | |||
1462 | /* save the regs we need */ | 1566 | /* save the regs we need */ |
1463 | pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL); | 1567 | pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL); |
1464 | gpiopad_a = ASIC_IS_R300(rdev) ? RREG32(RADEON_GPIOPAD_A) : 0; | 1568 | |
1465 | disp_output_cntl = ASIC_IS_R300(rdev) ? RREG32(RADEON_DISP_OUTPUT_CNTL) : 0; | 1569 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
1466 | disp_hw_debug = ASIC_IS_R300(rdev) ? 0 : RREG32(RADEON_DISP_HW_DEBUG); | 1570 | crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL); |
1467 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); | 1571 | } else { |
1572 | if (ASIC_IS_R300(rdev)) { | ||
1573 | gpiopad_a = RREG32(RADEON_GPIOPAD_A); | ||
1574 | disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL); | ||
1575 | } else { | ||
1576 | disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG); | ||
1577 | } | ||
1578 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); | ||
1579 | } | ||
1468 | tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL); | 1580 | tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL); |
1469 | dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL); | 1581 | dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL); |
1470 | dac_cntl2 = RREG32(RADEON_DAC_CNTL2); | 1582 | dac_cntl2 = RREG32(RADEON_DAC_CNTL2); |
@@ -1473,22 +1585,24 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1473 | | RADEON_PIX2CLK_DAC_ALWAYS_ONb); | 1585 | | RADEON_PIX2CLK_DAC_ALWAYS_ONb); |
1474 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); | 1586 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); |
1475 | 1587 | ||
1476 | if (ASIC_IS_R300(rdev)) | 1588 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
1477 | WREG32_P(RADEON_GPIOPAD_A, 1, ~1); | 1589 | tmp = crtc_ext_cntl | RADEON_CRTC_CRT_ON; |
1478 | 1590 | WREG32(RADEON_CRTC_EXT_CNTL, tmp); | |
1479 | tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK; | ||
1480 | tmp |= RADEON_CRTC2_CRT2_ON | | ||
1481 | (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT); | ||
1482 | |||
1483 | WREG32(RADEON_CRTC2_GEN_CNTL, tmp); | ||
1484 | |||
1485 | if (ASIC_IS_R300(rdev)) { | ||
1486 | tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK; | ||
1487 | tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2; | ||
1488 | WREG32(RADEON_DISP_OUTPUT_CNTL, tmp); | ||
1489 | } else { | 1591 | } else { |
1490 | tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL; | 1592 | tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK; |
1491 | WREG32(RADEON_DISP_HW_DEBUG, tmp); | 1593 | tmp |= RADEON_CRTC2_CRT2_ON | |
1594 | (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT); | ||
1595 | WREG32(RADEON_CRTC2_GEN_CNTL, tmp); | ||
1596 | |||
1597 | if (ASIC_IS_R300(rdev)) { | ||
1598 | WREG32_P(RADEON_GPIOPAD_A, 1, ~1); | ||
1599 | tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK; | ||
1600 | tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2; | ||
1601 | WREG32(RADEON_DISP_OUTPUT_CNTL, tmp); | ||
1602 | } else { | ||
1603 | tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL; | ||
1604 | WREG32(RADEON_DISP_HW_DEBUG, tmp); | ||
1605 | } | ||
1492 | } | 1606 | } |
1493 | 1607 | ||
1494 | tmp = RADEON_TV_DAC_NBLANK | | 1608 | tmp = RADEON_TV_DAC_NBLANK | |
@@ -1530,14 +1644,19 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1530 | WREG32(RADEON_DAC_CNTL2, dac_cntl2); | 1644 | WREG32(RADEON_DAC_CNTL2, dac_cntl2); |
1531 | WREG32(RADEON_DAC_EXT_CNTL, dac_ext_cntl); | 1645 | WREG32(RADEON_DAC_EXT_CNTL, dac_ext_cntl); |
1532 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); | 1646 | WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); |
1533 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); | ||
1534 | 1647 | ||
1535 | if (ASIC_IS_R300(rdev)) { | 1648 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
1536 | WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); | 1649 | WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl); |
1537 | WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1); | ||
1538 | } else { | 1650 | } else { |
1539 | WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug); | 1651 | WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl); |
1652 | if (ASIC_IS_R300(rdev)) { | ||
1653 | WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); | ||
1654 | WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1); | ||
1655 | } else { | ||
1656 | WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug); | ||
1657 | } | ||
1540 | } | 1658 | } |
1659 | |||
1541 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); | 1660 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); |
1542 | 1661 | ||
1543 | return found; | 1662 | return found; |
diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h index fccd361f7b5..87aa5f5d3c8 100644 --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h | |||
@@ -104,7 +104,7 @@ udl_fb_user_fb_create(struct drm_device *dev, | |||
104 | 104 | ||
105 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, | 105 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, |
106 | const char *front, char **urb_buf_ptr, | 106 | const char *front, char **urb_buf_ptr, |
107 | u32 byte_offset, u32 byte_width, | 107 | u32 byte_offset, u32 device_byte_offset, u32 byte_width, |
108 | int *ident_ptr, int *sent_ptr); | 108 | int *ident_ptr, int *sent_ptr); |
109 | 109 | ||
110 | int udl_dumb_create(struct drm_file *file_priv, | 110 | int udl_dumb_create(struct drm_file *file_priv, |
diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.c index 69a2b16f42a..d4ab3beaada 100644 --- a/drivers/gpu/drm/udl/udl_fb.c +++ b/drivers/gpu/drm/udl/udl_fb.c | |||
@@ -114,9 +114,10 @@ static void udlfb_dpy_deferred_io(struct fb_info *info, | |||
114 | list_for_each_entry(cur, &fbdefio->pagelist, lru) { | 114 | list_for_each_entry(cur, &fbdefio->pagelist, lru) { |
115 | 115 | ||
116 | if (udl_render_hline(dev, (ufbdev->ufb.base.bits_per_pixel / 8), | 116 | if (udl_render_hline(dev, (ufbdev->ufb.base.bits_per_pixel / 8), |
117 | &urb, (char *) info->fix.smem_start, | 117 | &urb, (char *) info->fix.smem_start, |
118 | &cmd, cur->index << PAGE_SHIFT, | 118 | &cmd, cur->index << PAGE_SHIFT, |
119 | PAGE_SIZE, &bytes_identical, &bytes_sent)) | 119 | cur->index << PAGE_SHIFT, |
120 | PAGE_SIZE, &bytes_identical, &bytes_sent)) | ||
120 | goto error; | 121 | goto error; |
121 | bytes_rendered += PAGE_SIZE; | 122 | bytes_rendered += PAGE_SIZE; |
122 | } | 123 | } |
@@ -187,10 +188,11 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, | |||
187 | for (i = y; i < y + height ; i++) { | 188 | for (i = y; i < y + height ; i++) { |
188 | const int line_offset = fb->base.pitches[0] * i; | 189 | const int line_offset = fb->base.pitches[0] * i; |
189 | const int byte_offset = line_offset + (x * bpp); | 190 | const int byte_offset = line_offset + (x * bpp); |
190 | 191 | const int dev_byte_offset = (fb->base.width * bpp * i) + (x * bpp); | |
191 | if (udl_render_hline(dev, bpp, &urb, | 192 | if (udl_render_hline(dev, bpp, &urb, |
192 | (char *) fb->obj->vmapping, | 193 | (char *) fb->obj->vmapping, |
193 | &cmd, byte_offset, width * bpp, | 194 | &cmd, byte_offset, dev_byte_offset, |
195 | width * bpp, | ||
194 | &bytes_identical, &bytes_sent)) | 196 | &bytes_identical, &bytes_sent)) |
195 | goto error; | 197 | goto error; |
196 | } | 198 | } |
diff --git a/drivers/gpu/drm/udl/udl_transfer.c b/drivers/gpu/drm/udl/udl_transfer.c index dc095526ffb..142fee5f983 100644 --- a/drivers/gpu/drm/udl/udl_transfer.c +++ b/drivers/gpu/drm/udl/udl_transfer.c | |||
@@ -213,11 +213,12 @@ static void udl_compress_hline16( | |||
213 | */ | 213 | */ |
214 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, | 214 | int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr, |
215 | const char *front, char **urb_buf_ptr, | 215 | const char *front, char **urb_buf_ptr, |
216 | u32 byte_offset, u32 byte_width, | 216 | u32 byte_offset, u32 device_byte_offset, |
217 | u32 byte_width, | ||
217 | int *ident_ptr, int *sent_ptr) | 218 | int *ident_ptr, int *sent_ptr) |
218 | { | 219 | { |
219 | const u8 *line_start, *line_end, *next_pixel; | 220 | const u8 *line_start, *line_end, *next_pixel; |
220 | u32 base16 = 0 + (byte_offset / bpp) * 2; | 221 | u32 base16 = 0 + (device_byte_offset / bpp) * 2; |
221 | struct urb *urb = *urb_ptr; | 222 | struct urb *urb = *urb_ptr; |
222 | u8 *cmd = *urb_buf_ptr; | 223 | u8 *cmd = *urb_buf_ptr; |
223 | u8 *cmd_end = (u8 *) urb->transfer_buffer + urb->transfer_buffer_length; | 224 | u8 *cmd_end = (u8 *) urb->transfer_buffer + urb->transfer_buffer_length; |
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index 06ebdbb6ea0..fd7722aecf7 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
@@ -522,6 +522,12 @@ static const struct hid_device_id apple_devices[] = { | |||
522 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | 522 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, |
523 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | 523 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), |
524 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | 524 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, |
525 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), | ||
526 | .driver_data = APPLE_HAS_FN }, | ||
527 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), | ||
528 | .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD }, | ||
529 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), | ||
530 | .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS }, | ||
525 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), | 531 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI), |
526 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, | 532 | .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN }, |
527 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), | 533 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO), |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index bd3971bf31b..f4109fd657f 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1532,6 +1532,9 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1532 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | 1532 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, |
1533 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | 1533 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, |
1534 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | 1534 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, |
1535 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, | ||
1536 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, | ||
1537 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, | ||
1535 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, | 1538 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) }, |
1536 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, | 1539 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) }, |
1537 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, | 1540 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, |
@@ -2139,6 +2142,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { | |||
2139 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, | 2142 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) }, |
2140 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, | 2143 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) }, |
2141 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, | 2144 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) }, |
2145 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) }, | ||
2146 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) }, | ||
2147 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) }, | ||
2142 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 2148 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
2143 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 2149 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
2144 | { } | 2150 | { } |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 269b50912a4..9d7a42857ea 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -118,6 +118,9 @@ | |||
118 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 | 118 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252 |
119 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 | 119 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253 |
120 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 | 120 | #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254 |
121 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259 | ||
122 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a | ||
123 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b | ||
121 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 | 124 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249 |
122 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a | 125 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a |
123 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b | 126 | #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b |
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c index 3acdcfcc17d..f676c01bb47 100644 --- a/drivers/hid/hid-microsoft.c +++ b/drivers/hid/hid-microsoft.c | |||
@@ -28,22 +28,30 @@ | |||
28 | #define MS_RDESC 0x08 | 28 | #define MS_RDESC 0x08 |
29 | #define MS_NOGET 0x10 | 29 | #define MS_NOGET 0x10 |
30 | #define MS_DUPLICATE_USAGES 0x20 | 30 | #define MS_DUPLICATE_USAGES 0x20 |
31 | #define MS_RDESC_3K 0x40 | ||
31 | 32 | ||
32 | /* | ||
33 | * Microsoft Wireless Desktop Receiver (Model 1028) has | ||
34 | * 'Usage Min/Max' where it ought to have 'Physical Min/Max' | ||
35 | */ | ||
36 | static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, | 33 | static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, |
37 | unsigned int *rsize) | 34 | unsigned int *rsize) |
38 | { | 35 | { |
39 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); | 36 | unsigned long quirks = (unsigned long)hid_get_drvdata(hdev); |
40 | 37 | ||
38 | /* | ||
39 | * Microsoft Wireless Desktop Receiver (Model 1028) has | ||
40 | * 'Usage Min/Max' where it ought to have 'Physical Min/Max' | ||
41 | */ | ||
41 | if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 && | 42 | if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 && |
42 | rdesc[559] == 0x29) { | 43 | rdesc[559] == 0x29) { |
43 | hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n"); | 44 | hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n"); |
44 | rdesc[557] = 0x35; | 45 | rdesc[557] = 0x35; |
45 | rdesc[559] = 0x45; | 46 | rdesc[559] = 0x45; |
46 | } | 47 | } |
48 | /* the same as above (s/usage/physical/) */ | ||
49 | if ((quirks & MS_RDESC_3K) && *rsize == 106 && | ||
50 | !memcmp((char []){ 0x19, 0x00, 0x29, 0xff }, | ||
51 | &rdesc[94], 4)) { | ||
52 | rdesc[94] = 0x35; | ||
53 | rdesc[96] = 0x45; | ||
54 | } | ||
47 | return rdesc; | 55 | return rdesc; |
48 | } | 56 | } |
49 | 57 | ||
@@ -192,7 +200,7 @@ static const struct hid_device_id ms_devices[] = { | |||
192 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), | 200 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), |
193 | .driver_data = MS_PRESENTER }, | 201 | .driver_data = MS_PRESENTER }, |
194 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K), | 202 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K), |
195 | .driver_data = MS_ERGONOMY }, | 203 | .driver_data = MS_ERGONOMY | MS_RDESC_3K }, |
196 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0), | 204 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0), |
197 | .driver_data = MS_NOGET }, | 205 | .driver_data = MS_NOGET }, |
198 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), | 206 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), |
diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index 3eb02b94fc8..7867d69f0ef 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c | |||
@@ -210,8 +210,7 @@ static struct mt_class mt_classes[] = { | |||
210 | }, | 210 | }, |
211 | { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, | 211 | { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS, |
212 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | | 212 | .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP | |
213 | MT_QUIRK_SLOT_IS_CONTACTNUMBER, | 213 | MT_QUIRK_SLOT_IS_CONTACTNUMBER |
214 | .maxcontacts = 10 | ||
215 | }, | 214 | }, |
216 | 215 | ||
217 | { .name = MT_CLS_FLATFROG, | 216 | { .name = MT_CLS_FLATFROG, |
@@ -421,11 +420,11 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
421 | * contact max are global to the report */ | 420 | * contact max are global to the report */ |
422 | td->last_field_index = field->index; | 421 | td->last_field_index = field->index; |
423 | return -1; | 422 | return -1; |
424 | } | ||
425 | case HID_DG_TOUCH: | 423 | case HID_DG_TOUCH: |
426 | /* Legacy devices use TIPSWITCH and not TOUCH. | 424 | /* Legacy devices use TIPSWITCH and not TOUCH. |
427 | * Let's just ignore this field. */ | 425 | * Let's just ignore this field. */ |
428 | return -1; | 426 | return -1; |
427 | } | ||
429 | /* let hid-input decide for the others */ | 428 | /* let hid-input decide for the others */ |
430 | return 0; | 429 | return 0; |
431 | 430 | ||
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 68ad7d25551..4f411040738 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * fam15h_power.c - AMD Family 15h processor power monitoring | 2 | * fam15h_power.c - AMD Family 15h processor power monitoring |
3 | * | 3 | * |
4 | * Copyright (c) 2011 Advanced Micro Devices, Inc. | 4 | * Copyright (c) 2011 Advanced Micro Devices, Inc. |
5 | * Author: Andreas Herrmann <andreas.herrmann3@amd.com> | 5 | * Author: Andreas Herrmann <herrmann.der.user@googlemail.com> |
6 | * | 6 | * |
7 | * | 7 | * |
8 | * This driver is free software; you can redistribute it and/or | 8 | * This driver is free software; you can redistribute it and/or |
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/processor.h> | 28 | #include <asm/processor.h> |
29 | 29 | ||
30 | MODULE_DESCRIPTION("AMD Family 15h CPU processor power monitor"); | 30 | MODULE_DESCRIPTION("AMD Family 15h CPU processor power monitor"); |
31 | MODULE_AUTHOR("Andreas Herrmann <andreas.herrmann3@amd.com>"); | 31 | MODULE_AUTHOR("Andreas Herrmann <herrmann.der.user@googlemail.com>"); |
32 | MODULE_LICENSE("GPL"); | 32 | MODULE_LICENSE("GPL"); |
33 | 33 | ||
34 | /* D18F3 */ | 34 | /* D18F3 */ |
diff --git a/drivers/hwmon/gpio-fan.c b/drivers/hwmon/gpio-fan.c index 36509ae3208..1381a2e3bbd 100644 --- a/drivers/hwmon/gpio-fan.c +++ b/drivers/hwmon/gpio-fan.c | |||
@@ -630,7 +630,9 @@ static struct platform_driver gpio_fan_driver = { | |||
630 | .driver = { | 630 | .driver = { |
631 | .name = "gpio-fan", | 631 | .name = "gpio-fan", |
632 | .pm = GPIO_FAN_PM, | 632 | .pm = GPIO_FAN_PM, |
633 | #ifdef CONFIG_OF_GPIO | ||
633 | .of_match_table = of_match_ptr(of_gpio_fan_match), | 634 | .of_match_table = of_match_ptr(of_gpio_fan_match), |
635 | #endif | ||
634 | }, | 636 | }, |
635 | }; | 637 | }; |
636 | 638 | ||
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index beee6b2d361..1722f50f247 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile | |||
@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o | |||
8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o | 8 | obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o |
9 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o | 9 | obj-$(CONFIG_I2C_MUX) += i2c-mux.o |
10 | obj-y += algos/ busses/ muxes/ | 10 | obj-y += algos/ busses/ muxes/ |
11 | obj-$(CONFIG_I2C_STUB) += i2c-stub.o | ||
11 | 12 | ||
12 | ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG | 13 | ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG |
13 | CFLAGS_i2c-core.o := -Wno-deprecated-declarations | 14 | CFLAGS_i2c-core.o := -Wno-deprecated-declarations |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 65dd599a026..e9df4612b7e 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -81,7 +81,6 @@ config I2C_I801 | |||
81 | tristate "Intel 82801 (ICH/PCH)" | 81 | tristate "Intel 82801 (ICH/PCH)" |
82 | depends on PCI | 82 | depends on PCI |
83 | select CHECK_SIGNATURE if X86 && DMI | 83 | select CHECK_SIGNATURE if X86 && DMI |
84 | select GPIOLIB if I2C_MUX | ||
85 | help | 84 | help |
86 | If you say yes to this option, support will be included for the Intel | 85 | If you say yes to this option, support will be included for the Intel |
87 | 801 family of mainboard I2C interfaces. Specifically, the following | 86 | 801 family of mainboard I2C interfaces. Specifically, the following |
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 2d33d62952c..395b516ffa0 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -85,7 +85,6 @@ obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o | |||
85 | obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o | 85 | obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o |
86 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o | 86 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o |
87 | obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o | 87 | obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o |
88 | obj-$(CONFIG_I2C_STUB) += i2c-stub.o | ||
89 | obj-$(CONFIG_SCx200_ACB) += scx200_acb.o | 88 | obj-$(CONFIG_SCx200_ACB) += scx200_acb.o |
90 | obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o | 89 | obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o |
91 | 90 | ||
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 37793156bd9..6abc00d5988 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -82,7 +82,8 @@ | |||
82 | #include <linux/wait.h> | 82 | #include <linux/wait.h> |
83 | #include <linux/err.h> | 83 | #include <linux/err.h> |
84 | 84 | ||
85 | #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE | 85 | #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ |
86 | defined CONFIG_DMI | ||
86 | #include <linux/gpio.h> | 87 | #include <linux/gpio.h> |
87 | #include <linux/i2c-mux-gpio.h> | 88 | #include <linux/i2c-mux-gpio.h> |
88 | #include <linux/platform_device.h> | 89 | #include <linux/platform_device.h> |
@@ -192,7 +193,8 @@ struct i801_priv { | |||
192 | int len; | 193 | int len; |
193 | u8 *data; | 194 | u8 *data; |
194 | 195 | ||
195 | #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE | 196 | #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ |
197 | defined CONFIG_DMI | ||
196 | const struct i801_mux_config *mux_drvdata; | 198 | const struct i801_mux_config *mux_drvdata; |
197 | struct platform_device *mux_pdev; | 199 | struct platform_device *mux_pdev; |
198 | #endif | 200 | #endif |
@@ -921,7 +923,8 @@ static void __init input_apanel_init(void) {} | |||
921 | static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} | 923 | static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {} |
922 | #endif /* CONFIG_X86 && CONFIG_DMI */ | 924 | #endif /* CONFIG_X86 && CONFIG_DMI */ |
923 | 925 | ||
924 | #if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE | 926 | #if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \ |
927 | defined CONFIG_DMI | ||
925 | static struct i801_mux_config i801_mux_config_asus_z8_d12 = { | 928 | static struct i801_mux_config i801_mux_config_asus_z8_d12 = { |
926 | .gpio_chip = "gpio_ich", | 929 | .gpio_chip = "gpio_ich", |
927 | .values = { 0x02, 0x03 }, | 930 | .values = { 0x02, 0x03 }, |
@@ -1059,7 +1062,7 @@ static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv) | |||
1059 | 1062 | ||
1060 | id = dmi_first_match(mux_dmi_table); | 1063 | id = dmi_first_match(mux_dmi_table); |
1061 | if (id) { | 1064 | if (id) { |
1062 | /* Remove from branch classes from trunk */ | 1065 | /* Remove branch classes from trunk */ |
1063 | mux_config = id->driver_data; | 1066 | mux_config = id->driver_data; |
1064 | for (i = 0; i < mux_config->n_values; i++) | 1067 | for (i = 0; i < mux_config->n_values; i++) |
1065 | class &= ~mux_config->classes[i]; | 1068 | class &= ~mux_config->classes[i]; |
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 1f58197062c..286ca191782 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Freescale MXS I2C bus driver | 2 | * Freescale MXS I2C bus driver |
3 | * | 3 | * |
4 | * Copyright (C) 2011 Wolfram Sang, Pengutronix e.K. | 4 | * Copyright (C) 2011-2012 Wolfram Sang, Pengutronix e.K. |
5 | * | 5 | * |
6 | * based on a (non-working) driver which was: | 6 | * based on a (non-working) driver which was: |
7 | * | 7 | * |
@@ -35,10 +35,6 @@ | |||
35 | 35 | ||
36 | #define DRIVER_NAME "mxs-i2c" | 36 | #define DRIVER_NAME "mxs-i2c" |
37 | 37 | ||
38 | static bool use_pioqueue; | ||
39 | module_param(use_pioqueue, bool, 0); | ||
40 | MODULE_PARM_DESC(use_pioqueue, "Use PIOQUEUE mode for transfer instead of DMA"); | ||
41 | |||
42 | #define MXS_I2C_CTRL0 (0x00) | 38 | #define MXS_I2C_CTRL0 (0x00) |
43 | #define MXS_I2C_CTRL0_SET (0x04) | 39 | #define MXS_I2C_CTRL0_SET (0x04) |
44 | 40 | ||
@@ -75,23 +71,6 @@ MODULE_PARM_DESC(use_pioqueue, "Use PIOQUEUE mode for transfer instead of DMA"); | |||
75 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | \ | 71 | MXS_I2C_CTRL1_SLAVE_STOP_IRQ | \ |
76 | MXS_I2C_CTRL1_SLAVE_IRQ) | 72 | MXS_I2C_CTRL1_SLAVE_IRQ) |
77 | 73 | ||
78 | #define MXS_I2C_QUEUECTRL (0x60) | ||
79 | #define MXS_I2C_QUEUECTRL_SET (0x64) | ||
80 | #define MXS_I2C_QUEUECTRL_CLR (0x68) | ||
81 | |||
82 | #define MXS_I2C_QUEUECTRL_QUEUE_RUN 0x20 | ||
83 | #define MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE 0x04 | ||
84 | |||
85 | #define MXS_I2C_QUEUESTAT (0x70) | ||
86 | #define MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY 0x00002000 | ||
87 | #define MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK 0x0000001F | ||
88 | |||
89 | #define MXS_I2C_QUEUECMD (0x80) | ||
90 | |||
91 | #define MXS_I2C_QUEUEDATA (0x90) | ||
92 | |||
93 | #define MXS_I2C_DATA (0xa0) | ||
94 | |||
95 | 74 | ||
96 | #define MXS_CMD_I2C_SELECT (MXS_I2C_CTRL0_RETAIN_CLOCK | \ | 75 | #define MXS_CMD_I2C_SELECT (MXS_I2C_CTRL0_RETAIN_CLOCK | \ |
97 | MXS_I2C_CTRL0_PRE_SEND_START | \ | 76 | MXS_I2C_CTRL0_PRE_SEND_START | \ |
@@ -153,7 +132,6 @@ struct mxs_i2c_dev { | |||
153 | const struct mxs_i2c_speed_config *speed; | 132 | const struct mxs_i2c_speed_config *speed; |
154 | 133 | ||
155 | /* DMA support components */ | 134 | /* DMA support components */ |
156 | bool dma_mode; | ||
157 | int dma_channel; | 135 | int dma_channel; |
158 | struct dma_chan *dmach; | 136 | struct dma_chan *dmach; |
159 | struct mxs_dma_data dma_data; | 137 | struct mxs_dma_data dma_data; |
@@ -172,99 +150,6 @@ static void mxs_i2c_reset(struct mxs_i2c_dev *i2c) | |||
172 | writel(i2c->speed->timing2, i2c->regs + MXS_I2C_TIMING2); | 150 | writel(i2c->speed->timing2, i2c->regs + MXS_I2C_TIMING2); |
173 | 151 | ||
174 | writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET); | 152 | writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET); |
175 | if (i2c->dma_mode) | ||
176 | writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE, | ||
177 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
178 | else | ||
179 | writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE, | ||
180 | i2c->regs + MXS_I2C_QUEUECTRL_SET); | ||
181 | } | ||
182 | |||
183 | static void mxs_i2c_pioq_setup_read(struct mxs_i2c_dev *i2c, u8 addr, int len, | ||
184 | int flags) | ||
185 | { | ||
186 | u32 data; | ||
187 | |||
188 | writel(MXS_CMD_I2C_SELECT, i2c->regs + MXS_I2C_QUEUECMD); | ||
189 | |||
190 | data = (addr << 1) | I2C_SMBUS_READ; | ||
191 | writel(data, i2c->regs + MXS_I2C_DATA); | ||
192 | |||
193 | data = MXS_CMD_I2C_READ | MXS_I2C_CTRL0_XFER_COUNT(len) | flags; | ||
194 | writel(data, i2c->regs + MXS_I2C_QUEUECMD); | ||
195 | } | ||
196 | |||
197 | static void mxs_i2c_pioq_setup_write(struct mxs_i2c_dev *i2c, | ||
198 | u8 addr, u8 *buf, int len, int flags) | ||
199 | { | ||
200 | u32 data; | ||
201 | int i, shifts_left; | ||
202 | |||
203 | data = MXS_CMD_I2C_WRITE | MXS_I2C_CTRL0_XFER_COUNT(len + 1) | flags; | ||
204 | writel(data, i2c->regs + MXS_I2C_QUEUECMD); | ||
205 | |||
206 | /* | ||
207 | * We have to copy the slave address (u8) and buffer (arbitrary number | ||
208 | * of u8) into the data register (u32). To achieve that, the u8 are put | ||
209 | * into the MSBs of 'data' which is then shifted for the next u8. When | ||
210 | * appropriate, 'data' is written to MXS_I2C_DATA. So, the first u32 | ||
211 | * looks like this: | ||
212 | * | ||
213 | * 3 2 1 0 | ||
214 | * 10987654|32109876|54321098|76543210 | ||
215 | * --------+--------+--------+-------- | ||
216 | * buffer+2|buffer+1|buffer+0|slave_addr | ||
217 | */ | ||
218 | |||
219 | data = ((addr << 1) | I2C_SMBUS_WRITE) << 24; | ||
220 | |||
221 | for (i = 0; i < len; i++) { | ||
222 | data >>= 8; | ||
223 | data |= buf[i] << 24; | ||
224 | if ((i & 3) == 2) | ||
225 | writel(data, i2c->regs + MXS_I2C_DATA); | ||
226 | } | ||
227 | |||
228 | /* Write out the remaining bytes if any */ | ||
229 | shifts_left = 24 - (i & 3) * 8; | ||
230 | if (shifts_left) | ||
231 | writel(data >> shifts_left, i2c->regs + MXS_I2C_DATA); | ||
232 | } | ||
233 | |||
234 | /* | ||
235 | * TODO: should be replaceable with a waitqueue and RD_QUEUE_IRQ (setting the | ||
236 | * rd_threshold to 1). Couldn't get this to work, though. | ||
237 | */ | ||
238 | static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c) | ||
239 | { | ||
240 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); | ||
241 | |||
242 | while (readl(i2c->regs + MXS_I2C_QUEUESTAT) | ||
243 | & MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY) { | ||
244 | if (time_after(jiffies, timeout)) | ||
245 | return -ETIMEDOUT; | ||
246 | cond_resched(); | ||
247 | } | ||
248 | |||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len) | ||
253 | { | ||
254 | u32 uninitialized_var(data); | ||
255 | int i; | ||
256 | |||
257 | for (i = 0; i < len; i++) { | ||
258 | if ((i & 3) == 0) { | ||
259 | if (mxs_i2c_wait_for_data(i2c)) | ||
260 | return -ETIMEDOUT; | ||
261 | data = readl(i2c->regs + MXS_I2C_QUEUEDATA); | ||
262 | } | ||
263 | buf[i] = data & 0xff; | ||
264 | data >>= 8; | ||
265 | } | ||
266 | |||
267 | return 0; | ||
268 | } | 153 | } |
269 | 154 | ||
270 | static void mxs_i2c_dma_finish(struct mxs_i2c_dev *i2c) | 155 | static void mxs_i2c_dma_finish(struct mxs_i2c_dev *i2c) |
@@ -432,39 +317,17 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
432 | init_completion(&i2c->cmd_complete); | 317 | init_completion(&i2c->cmd_complete); |
433 | i2c->cmd_err = 0; | 318 | i2c->cmd_err = 0; |
434 | 319 | ||
435 | if (i2c->dma_mode) { | 320 | ret = mxs_i2c_dma_setup_xfer(adap, msg, flags); |
436 | ret = mxs_i2c_dma_setup_xfer(adap, msg, flags); | 321 | if (ret) |
437 | if (ret) | 322 | return ret; |
438 | return ret; | ||
439 | } else { | ||
440 | if (msg->flags & I2C_M_RD) { | ||
441 | mxs_i2c_pioq_setup_read(i2c, msg->addr, | ||
442 | msg->len, flags); | ||
443 | } else { | ||
444 | mxs_i2c_pioq_setup_write(i2c, msg->addr, msg->buf, | ||
445 | msg->len, flags); | ||
446 | } | ||
447 | |||
448 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
449 | i2c->regs + MXS_I2C_QUEUECTRL_SET); | ||
450 | } | ||
451 | 323 | ||
452 | ret = wait_for_completion_timeout(&i2c->cmd_complete, | 324 | ret = wait_for_completion_timeout(&i2c->cmd_complete, |
453 | msecs_to_jiffies(1000)); | 325 | msecs_to_jiffies(1000)); |
454 | if (ret == 0) | 326 | if (ret == 0) |
455 | goto timeout; | 327 | goto timeout; |
456 | 328 | ||
457 | if (!i2c->dma_mode && !i2c->cmd_err && (msg->flags & I2C_M_RD)) { | ||
458 | ret = mxs_i2c_finish_read(i2c, msg->buf, msg->len); | ||
459 | if (ret) | ||
460 | goto timeout; | ||
461 | } | ||
462 | |||
463 | if (i2c->cmd_err == -ENXIO) | 329 | if (i2c->cmd_err == -ENXIO) |
464 | mxs_i2c_reset(i2c); | 330 | mxs_i2c_reset(i2c); |
465 | else | ||
466 | writel(MXS_I2C_QUEUECTRL_QUEUE_RUN, | ||
467 | i2c->regs + MXS_I2C_QUEUECTRL_CLR); | ||
468 | 331 | ||
469 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); | 332 | dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err); |
470 | 333 | ||
@@ -472,8 +335,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
472 | 335 | ||
473 | timeout: | 336 | timeout: |
474 | dev_dbg(i2c->dev, "Timeout!\n"); | 337 | dev_dbg(i2c->dev, "Timeout!\n"); |
475 | if (i2c->dma_mode) | 338 | mxs_i2c_dma_finish(i2c); |
476 | mxs_i2c_dma_finish(i2c); | ||
477 | mxs_i2c_reset(i2c); | 339 | mxs_i2c_reset(i2c); |
478 | return -ETIMEDOUT; | 340 | return -ETIMEDOUT; |
479 | } | 341 | } |
@@ -502,7 +364,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) | |||
502 | { | 364 | { |
503 | struct mxs_i2c_dev *i2c = dev_id; | 365 | struct mxs_i2c_dev *i2c = dev_id; |
504 | u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK; | 366 | u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK; |
505 | bool is_last_cmd; | ||
506 | 367 | ||
507 | if (!stat) | 368 | if (!stat) |
508 | return IRQ_NONE; | 369 | return IRQ_NONE; |
@@ -515,14 +376,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) | |||
515 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ | 376 | /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */ |
516 | i2c->cmd_err = -EIO; | 377 | i2c->cmd_err = -EIO; |
517 | 378 | ||
518 | if (!i2c->dma_mode) { | ||
519 | is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) & | ||
520 | MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0; | ||
521 | |||
522 | if (is_last_cmd || i2c->cmd_err) | ||
523 | complete(&i2c->cmd_complete); | ||
524 | } | ||
525 | |||
526 | writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR); | 379 | writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR); |
527 | 380 | ||
528 | return IRQ_HANDLED; | 381 | return IRQ_HANDLED; |
@@ -556,23 +409,14 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c) | |||
556 | int ret; | 409 | int ret; |
557 | 410 | ||
558 | /* | 411 | /* |
559 | * The MXS I2C DMA mode is prefered and enabled by default. | ||
560 | * The PIO mode is still supported, but should be used only | ||
561 | * for debuging purposes etc. | ||
562 | */ | ||
563 | i2c->dma_mode = !use_pioqueue; | ||
564 | if (!i2c->dma_mode) | ||
565 | dev_info(dev, "Using PIOQUEUE mode for I2C transfers!\n"); | ||
566 | |||
567 | /* | ||
568 | * TODO: This is a temporary solution and should be changed | 412 | * TODO: This is a temporary solution and should be changed |
569 | * to use generic DMA binding later when the helpers get in. | 413 | * to use generic DMA binding later when the helpers get in. |
570 | */ | 414 | */ |
571 | ret = of_property_read_u32(node, "fsl,i2c-dma-channel", | 415 | ret = of_property_read_u32(node, "fsl,i2c-dma-channel", |
572 | &i2c->dma_channel); | 416 | &i2c->dma_channel); |
573 | if (ret) { | 417 | if (ret) { |
574 | dev_warn(dev, "Failed to get DMA channel, using PIOQUEUE!\n"); | 418 | dev_err(dev, "Failed to get DMA channel!\n"); |
575 | i2c->dma_mode = 0; | 419 | return -ENODEV; |
576 | } | 420 | } |
577 | 421 | ||
578 | ret = of_property_read_u32(node, "clock-frequency", &speed); | 422 | ret = of_property_read_u32(node, "clock-frequency", &speed); |
@@ -634,15 +478,13 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev) | |||
634 | } | 478 | } |
635 | 479 | ||
636 | /* Setup the DMA */ | 480 | /* Setup the DMA */ |
637 | if (i2c->dma_mode) { | 481 | dma_cap_zero(mask); |
638 | dma_cap_zero(mask); | 482 | dma_cap_set(DMA_SLAVE, mask); |
639 | dma_cap_set(DMA_SLAVE, mask); | 483 | i2c->dma_data.chan_irq = dmairq; |
640 | i2c->dma_data.chan_irq = dmairq; | 484 | i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c); |
641 | i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c); | 485 | if (!i2c->dmach) { |
642 | if (!i2c->dmach) { | 486 | dev_err(dev, "Failed to request dma\n"); |
643 | dev_err(dev, "Failed to request dma\n"); | 487 | return -ENODEV; |
644 | return -ENODEV; | ||
645 | } | ||
646 | } | 488 | } |
647 | 489 | ||
648 | platform_set_drvdata(pdev, i2c); | 490 | platform_set_drvdata(pdev, i2c); |
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 698d7acb0f0..02c3115a2df 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c | |||
@@ -644,7 +644,11 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
644 | 644 | ||
645 | pm_runtime_get_sync(&dev->adev->dev); | 645 | pm_runtime_get_sync(&dev->adev->dev); |
646 | 646 | ||
647 | clk_enable(dev->clk); | 647 | status = clk_prepare_enable(dev->clk); |
648 | if (status) { | ||
649 | dev_err(&dev->adev->dev, "can't prepare_enable clock\n"); | ||
650 | goto out_clk; | ||
651 | } | ||
648 | 652 | ||
649 | status = init_hw(dev); | 653 | status = init_hw(dev); |
650 | if (status) | 654 | if (status) |
@@ -671,7 +675,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
671 | } | 675 | } |
672 | 676 | ||
673 | out: | 677 | out: |
674 | clk_disable(dev->clk); | 678 | clk_disable_unprepare(dev->clk); |
679 | out_clk: | ||
675 | pm_runtime_put_sync(&dev->adev->dev); | 680 | pm_runtime_put_sync(&dev->adev->dev); |
676 | 681 | ||
677 | dev->busy = false; | 682 | dev->busy = false; |
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index f981ac4e678..dcea77bf6f5 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c | |||
@@ -742,7 +742,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev) | |||
742 | } | 742 | } |
743 | 743 | ||
744 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, | 744 | ret = devm_request_irq(&pdev->dev, i2c_dev->irq, |
745 | tegra_i2c_isr, 0, pdev->name, i2c_dev); | 745 | tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev); |
746 | if (ret) { | 746 | if (ret) { |
747 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); | 747 | dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq); |
748 | return ret; | 748 | return ret; |
diff --git a/drivers/i2c/busses/i2c-stub.c b/drivers/i2c/i2c-stub.c index b1b3447942c..d0a9c590c3c 100644 --- a/drivers/i2c/busses/i2c-stub.c +++ b/drivers/i2c/i2c-stub.c | |||
@@ -2,7 +2,7 @@ | |||
2 | i2c-stub.c - I2C/SMBus chip emulator | 2 | i2c-stub.c - I2C/SMBus chip emulator |
3 | 3 | ||
4 | Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com> | 4 | Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com> |
5 | Copyright (C) 2007 Jean Delvare <khali@linux-fr.org> | 5 | Copyright (C) 2007, 2012 Jean Delvare <khali@linux-fr.org> |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
@@ -51,8 +51,8 @@ struct stub_chip { | |||
51 | static struct stub_chip *stub_chips; | 51 | static struct stub_chip *stub_chips; |
52 | 52 | ||
53 | /* Return negative errno on error. */ | 53 | /* Return negative errno on error. */ |
54 | static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | 54 | static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags, |
55 | char read_write, u8 command, int size, union i2c_smbus_data * data) | 55 | char read_write, u8 command, int size, union i2c_smbus_data *data) |
56 | { | 56 | { |
57 | s32 ret; | 57 | s32 ret; |
58 | int i, len; | 58 | int i, len; |
@@ -78,14 +78,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
78 | case I2C_SMBUS_BYTE: | 78 | case I2C_SMBUS_BYTE: |
79 | if (read_write == I2C_SMBUS_WRITE) { | 79 | if (read_write == I2C_SMBUS_WRITE) { |
80 | chip->pointer = command; | 80 | chip->pointer = command; |
81 | dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, " | 81 | dev_dbg(&adap->dev, |
82 | "wrote 0x%02x.\n", | 82 | "smbus byte - addr 0x%02x, wrote 0x%02x.\n", |
83 | addr, command); | 83 | addr, command); |
84 | } else { | 84 | } else { |
85 | data->byte = chip->words[chip->pointer++] & 0xff; | 85 | data->byte = chip->words[chip->pointer++] & 0xff; |
86 | dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, " | 86 | dev_dbg(&adap->dev, |
87 | "read 0x%02x.\n", | 87 | "smbus byte - addr 0x%02x, read 0x%02x.\n", |
88 | addr, data->byte); | 88 | addr, data->byte); |
89 | } | 89 | } |
90 | 90 | ||
91 | ret = 0; | 91 | ret = 0; |
@@ -95,14 +95,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
95 | if (read_write == I2C_SMBUS_WRITE) { | 95 | if (read_write == I2C_SMBUS_WRITE) { |
96 | chip->words[command] &= 0xff00; | 96 | chip->words[command] &= 0xff00; |
97 | chip->words[command] |= data->byte; | 97 | chip->words[command] |= data->byte; |
98 | dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " | 98 | dev_dbg(&adap->dev, |
99 | "wrote 0x%02x at 0x%02x.\n", | 99 | "smbus byte data - addr 0x%02x, wrote 0x%02x at 0x%02x.\n", |
100 | addr, data->byte, command); | 100 | addr, data->byte, command); |
101 | } else { | 101 | } else { |
102 | data->byte = chip->words[command] & 0xff; | 102 | data->byte = chip->words[command] & 0xff; |
103 | dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, " | 103 | dev_dbg(&adap->dev, |
104 | "read 0x%02x at 0x%02x.\n", | 104 | "smbus byte data - addr 0x%02x, read 0x%02x at 0x%02x.\n", |
105 | addr, data->byte, command); | 105 | addr, data->byte, command); |
106 | } | 106 | } |
107 | chip->pointer = command + 1; | 107 | chip->pointer = command + 1; |
108 | 108 | ||
@@ -112,14 +112,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
112 | case I2C_SMBUS_WORD_DATA: | 112 | case I2C_SMBUS_WORD_DATA: |
113 | if (read_write == I2C_SMBUS_WRITE) { | 113 | if (read_write == I2C_SMBUS_WRITE) { |
114 | chip->words[command] = data->word; | 114 | chip->words[command] = data->word; |
115 | dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, " | 115 | dev_dbg(&adap->dev, |
116 | "wrote 0x%04x at 0x%02x.\n", | 116 | "smbus word data - addr 0x%02x, wrote 0x%04x at 0x%02x.\n", |
117 | addr, data->word, command); | 117 | addr, data->word, command); |
118 | } else { | 118 | } else { |
119 | data->word = chip->words[command]; | 119 | data->word = chip->words[command]; |
120 | dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, " | 120 | dev_dbg(&adap->dev, |
121 | "read 0x%04x at 0x%02x.\n", | 121 | "smbus word data - addr 0x%02x, read 0x%04x at 0x%02x.\n", |
122 | addr, data->word, command); | 122 | addr, data->word, command); |
123 | } | 123 | } |
124 | 124 | ||
125 | ret = 0; | 125 | ret = 0; |
@@ -132,17 +132,17 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
132 | chip->words[command + i] &= 0xff00; | 132 | chip->words[command + i] &= 0xff00; |
133 | chip->words[command + i] |= data->block[1 + i]; | 133 | chip->words[command + i] |= data->block[1 + i]; |
134 | } | 134 | } |
135 | dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, " | 135 | dev_dbg(&adap->dev, |
136 | "wrote %d bytes at 0x%02x.\n", | 136 | "i2c block data - addr 0x%02x, wrote %d bytes at 0x%02x.\n", |
137 | addr, len, command); | 137 | addr, len, command); |
138 | } else { | 138 | } else { |
139 | for (i = 0; i < len; i++) { | 139 | for (i = 0; i < len; i++) { |
140 | data->block[1 + i] = | 140 | data->block[1 + i] = |
141 | chip->words[command + i] & 0xff; | 141 | chip->words[command + i] & 0xff; |
142 | } | 142 | } |
143 | dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, " | 143 | dev_dbg(&adap->dev, |
144 | "read %d bytes at 0x%02x.\n", | 144 | "i2c block data - addr 0x%02x, read %d bytes at 0x%02x.\n", |
145 | addr, len, command); | 145 | addr, len, command); |
146 | } | 146 | } |
147 | 147 | ||
148 | ret = 0; | 148 | ret = 0; |
@@ -179,25 +179,24 @@ static int __init i2c_stub_init(void) | |||
179 | int i, ret; | 179 | int i, ret; |
180 | 180 | ||
181 | if (!chip_addr[0]) { | 181 | if (!chip_addr[0]) { |
182 | printk(KERN_ERR "i2c-stub: Please specify a chip address\n"); | 182 | pr_err("i2c-stub: Please specify a chip address\n"); |
183 | return -ENODEV; | 183 | return -ENODEV; |
184 | } | 184 | } |
185 | 185 | ||
186 | for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) { | 186 | for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) { |
187 | if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) { | 187 | if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) { |
188 | printk(KERN_ERR "i2c-stub: Invalid chip address " | 188 | pr_err("i2c-stub: Invalid chip address 0x%02x\n", |
189 | "0x%02x\n", chip_addr[i]); | 189 | chip_addr[i]); |
190 | return -EINVAL; | 190 | return -EINVAL; |
191 | } | 191 | } |
192 | 192 | ||
193 | printk(KERN_INFO "i2c-stub: Virtual chip at 0x%02x\n", | 193 | pr_info("i2c-stub: Virtual chip at 0x%02x\n", chip_addr[i]); |
194 | chip_addr[i]); | ||
195 | } | 194 | } |
196 | 195 | ||
197 | /* Allocate memory for all chips at once */ | 196 | /* Allocate memory for all chips at once */ |
198 | stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL); | 197 | stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL); |
199 | if (!stub_chips) { | 198 | if (!stub_chips) { |
200 | printk(KERN_ERR "i2c-stub: Out of memory\n"); | 199 | pr_err("i2c-stub: Out of memory\n"); |
201 | return -ENOMEM; | 200 | return -ENOMEM; |
202 | } | 201 | } |
203 | 202 | ||
@@ -219,4 +218,3 @@ MODULE_LICENSE("GPL"); | |||
219 | 218 | ||
220 | module_init(i2c_stub_init); | 219 | module_init(i2c_stub_init); |
221 | module_exit(i2c_stub_exit); | 220 | module_exit(i2c_stub_exit); |
222 | |||
diff --git a/drivers/input/gameport/emu10k1-gp.c b/drivers/input/gameport/emu10k1-gp.c index daceafe7ee7..fa7a95c1da0 100644 --- a/drivers/input/gameport/emu10k1-gp.c +++ b/drivers/input/gameport/emu10k1-gp.c | |||
@@ -57,7 +57,7 @@ static const struct pci_device_id emu_tbl[] = { | |||
57 | 57 | ||
58 | MODULE_DEVICE_TABLE(pci, emu_tbl); | 58 | MODULE_DEVICE_TABLE(pci, emu_tbl); |
59 | 59 | ||
60 | static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | 60 | static int emu_probe(struct pci_dev *pdev, const struct pci_device_id *ent) |
61 | { | 61 | { |
62 | struct emu *emu; | 62 | struct emu *emu; |
63 | struct gameport *port; | 63 | struct gameport *port; |
@@ -107,7 +107,7 @@ static int __devinit emu_probe(struct pci_dev *pdev, const struct pci_device_id | |||
107 | return error; | 107 | return error; |
108 | } | 108 | } |
109 | 109 | ||
110 | static void __devexit emu_remove(struct pci_dev *pdev) | 110 | static void emu_remove(struct pci_dev *pdev) |
111 | { | 111 | { |
112 | struct emu *emu = pci_get_drvdata(pdev); | 112 | struct emu *emu = pci_get_drvdata(pdev); |
113 | 113 | ||
@@ -122,7 +122,7 @@ static struct pci_driver emu_driver = { | |||
122 | .name = "Emu10k1_gameport", | 122 | .name = "Emu10k1_gameport", |
123 | .id_table = emu_tbl, | 123 | .id_table = emu_tbl, |
124 | .probe = emu_probe, | 124 | .probe = emu_probe, |
125 | .remove = __devexit_p(emu_remove), | 125 | .remove = emu_remove, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | module_pci_driver(emu_driver); | 128 | module_pci_driver(emu_driver); |
diff --git a/drivers/input/gameport/fm801-gp.c b/drivers/input/gameport/fm801-gp.c index 48ad3829ff2..ae912d3aee4 100644 --- a/drivers/input/gameport/fm801-gp.c +++ b/drivers/input/gameport/fm801-gp.c | |||
@@ -78,7 +78,7 @@ static int fm801_gp_open(struct gameport *gameport, int mode) | |||
78 | return 0; | 78 | return 0; |
79 | } | 79 | } |
80 | 80 | ||
81 | static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device_id *id) | 81 | static int fm801_gp_probe(struct pci_dev *pci, const struct pci_device_id *id) |
82 | { | 82 | { |
83 | struct fm801_gp *gp; | 83 | struct fm801_gp *gp; |
84 | struct gameport *port; | 84 | struct gameport *port; |
@@ -129,7 +129,7 @@ static int __devinit fm801_gp_probe(struct pci_dev *pci, const struct pci_device | |||
129 | return error; | 129 | return error; |
130 | } | 130 | } |
131 | 131 | ||
132 | static void __devexit fm801_gp_remove(struct pci_dev *pci) | 132 | static void fm801_gp_remove(struct pci_dev *pci) |
133 | { | 133 | { |
134 | struct fm801_gp *gp = pci_get_drvdata(pci); | 134 | struct fm801_gp *gp = pci_get_drvdata(pci); |
135 | 135 | ||
@@ -150,7 +150,7 @@ static struct pci_driver fm801_gp_driver = { | |||
150 | .name = "FM801_gameport", | 150 | .name = "FM801_gameport", |
151 | .id_table = fm801_gp_id_table, | 151 | .id_table = fm801_gp_id_table, |
152 | .probe = fm801_gp_probe, | 152 | .probe = fm801_gp_probe, |
153 | .remove = __devexit_p(fm801_gp_remove), | 153 | .remove = fm801_gp_remove, |
154 | }; | 154 | }; |
155 | 155 | ||
156 | module_pci_driver(fm801_gp_driver); | 156 | module_pci_driver(fm801_gp_driver); |
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index 1abbc170d8b..c2f436ce7f5 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c | |||
@@ -194,7 +194,7 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) | |||
194 | if (!mt) | 194 | if (!mt) |
195 | return; | 195 | return; |
196 | 196 | ||
197 | oldest = 0; | 197 | oldest = NULL; |
198 | oldid = mt->trkid; | 198 | oldid = mt->trkid; |
199 | count = 0; | 199 | count = 0; |
200 | 200 | ||
diff --git a/drivers/input/input.c b/drivers/input/input.c index 53a0ddee787..ce01332f7b3 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -534,8 +534,11 @@ EXPORT_SYMBOL(input_grab_device); | |||
534 | static void __input_release_device(struct input_handle *handle) | 534 | static void __input_release_device(struct input_handle *handle) |
535 | { | 535 | { |
536 | struct input_dev *dev = handle->dev; | 536 | struct input_dev *dev = handle->dev; |
537 | struct input_handle *grabber; | ||
537 | 538 | ||
538 | if (dev->grab == handle) { | 539 | grabber = rcu_dereference_protected(dev->grab, |
540 | lockdep_is_held(&dev->mutex)); | ||
541 | if (grabber == handle) { | ||
539 | rcu_assign_pointer(dev->grab, NULL); | 542 | rcu_assign_pointer(dev->grab, NULL); |
540 | /* Make sure input_pass_event() notices that grab is gone */ | 543 | /* Make sure input_pass_event() notices that grab is gone */ |
541 | synchronize_rcu(); | 544 | synchronize_rcu(); |
@@ -1723,7 +1726,7 @@ EXPORT_SYMBOL_GPL(input_class); | |||
1723 | /** | 1726 | /** |
1724 | * input_allocate_device - allocate memory for new input device | 1727 | * input_allocate_device - allocate memory for new input device |
1725 | * | 1728 | * |
1726 | * Returns prepared struct input_dev or NULL. | 1729 | * Returns prepared struct input_dev or %NULL. |
1727 | * | 1730 | * |
1728 | * NOTE: Use input_free_device() to free devices that have not been | 1731 | * NOTE: Use input_free_device() to free devices that have not been |
1729 | * registered; input_unregister_device() should be used for already | 1732 | * registered; input_unregister_device() should be used for already |
@@ -1750,6 +1753,70 @@ struct input_dev *input_allocate_device(void) | |||
1750 | } | 1753 | } |
1751 | EXPORT_SYMBOL(input_allocate_device); | 1754 | EXPORT_SYMBOL(input_allocate_device); |
1752 | 1755 | ||
1756 | struct input_devres { | ||
1757 | struct input_dev *input; | ||
1758 | }; | ||
1759 | |||
1760 | static int devm_input_device_match(struct device *dev, void *res, void *data) | ||
1761 | { | ||
1762 | struct input_devres *devres = res; | ||
1763 | |||
1764 | return devres->input == data; | ||
1765 | } | ||
1766 | |||
1767 | static void devm_input_device_release(struct device *dev, void *res) | ||
1768 | { | ||
1769 | struct input_devres *devres = res; | ||
1770 | struct input_dev *input = devres->input; | ||
1771 | |||
1772 | dev_dbg(dev, "%s: dropping reference to %s\n", | ||
1773 | __func__, dev_name(&input->dev)); | ||
1774 | input_put_device(input); | ||
1775 | } | ||
1776 | |||
1777 | /** | ||
1778 | * devm_input_allocate_device - allocate managed input device | ||
1779 | * @dev: device owning the input device being created | ||
1780 | * | ||
1781 | * Returns prepared struct input_dev or %NULL. | ||
1782 | * | ||
1783 | * Managed input devices do not need to be explicitly unregistered or | ||
1784 | * freed as it will be done automatically when owner device unbinds from | ||
1785 | * its driver (or binding fails). Once managed input device is allocated, | ||
1786 | * it is ready to be set up and registered in the same fashion as regular | ||
1787 | * input device. There are no special devm_input_device_[un]register() | ||
1788 | * variants, regular ones work with both managed and unmanaged devices. | ||
1789 | * | ||
1790 | * NOTE: the owner device is set up as parent of input device and users | ||
1791 | * should not override it. | ||
1792 | */ | ||
1793 | |||
1794 | struct input_dev *devm_input_allocate_device(struct device *dev) | ||
1795 | { | ||
1796 | struct input_dev *input; | ||
1797 | struct input_devres *devres; | ||
1798 | |||
1799 | devres = devres_alloc(devm_input_device_release, | ||
1800 | sizeof(struct input_devres), GFP_KERNEL); | ||
1801 | if (!devres) | ||
1802 | return NULL; | ||
1803 | |||
1804 | input = input_allocate_device(); | ||
1805 | if (!input) { | ||
1806 | devres_free(devres); | ||
1807 | return NULL; | ||
1808 | } | ||
1809 | |||
1810 | input->dev.parent = dev; | ||
1811 | input->devres_managed = true; | ||
1812 | |||
1813 | devres->input = input; | ||
1814 | devres_add(dev, devres); | ||
1815 | |||
1816 | return input; | ||
1817 | } | ||
1818 | EXPORT_SYMBOL(devm_input_allocate_device); | ||
1819 | |||
1753 | /** | 1820 | /** |
1754 | * input_free_device - free memory occupied by input_dev structure | 1821 | * input_free_device - free memory occupied by input_dev structure |
1755 | * @dev: input device to free | 1822 | * @dev: input device to free |
@@ -1766,8 +1833,14 @@ EXPORT_SYMBOL(input_allocate_device); | |||
1766 | */ | 1833 | */ |
1767 | void input_free_device(struct input_dev *dev) | 1834 | void input_free_device(struct input_dev *dev) |
1768 | { | 1835 | { |
1769 | if (dev) | 1836 | if (dev) { |
1837 | if (dev->devres_managed) | ||
1838 | WARN_ON(devres_destroy(dev->dev.parent, | ||
1839 | devm_input_device_release, | ||
1840 | devm_input_device_match, | ||
1841 | dev)); | ||
1770 | input_put_device(dev); | 1842 | input_put_device(dev); |
1843 | } | ||
1771 | } | 1844 | } |
1772 | EXPORT_SYMBOL(input_free_device); | 1845 | EXPORT_SYMBOL(input_free_device); |
1773 | 1846 | ||
@@ -1888,6 +1961,38 @@ static void input_cleanse_bitmasks(struct input_dev *dev) | |||
1888 | INPUT_CLEANSE_BITMASK(dev, SW, sw); | 1961 | INPUT_CLEANSE_BITMASK(dev, SW, sw); |
1889 | } | 1962 | } |
1890 | 1963 | ||
1964 | static void __input_unregister_device(struct input_dev *dev) | ||
1965 | { | ||
1966 | struct input_handle *handle, *next; | ||
1967 | |||
1968 | input_disconnect_device(dev); | ||
1969 | |||
1970 | mutex_lock(&input_mutex); | ||
1971 | |||
1972 | list_for_each_entry_safe(handle, next, &dev->h_list, d_node) | ||
1973 | handle->handler->disconnect(handle); | ||
1974 | WARN_ON(!list_empty(&dev->h_list)); | ||
1975 | |||
1976 | del_timer_sync(&dev->timer); | ||
1977 | list_del_init(&dev->node); | ||
1978 | |||
1979 | input_wakeup_procfs_readers(); | ||
1980 | |||
1981 | mutex_unlock(&input_mutex); | ||
1982 | |||
1983 | device_del(&dev->dev); | ||
1984 | } | ||
1985 | |||
1986 | static void devm_input_device_unregister(struct device *dev, void *res) | ||
1987 | { | ||
1988 | struct input_devres *devres = res; | ||
1989 | struct input_dev *input = devres->input; | ||
1990 | |||
1991 | dev_dbg(dev, "%s: unregistering device %s\n", | ||
1992 | __func__, dev_name(&input->dev)); | ||
1993 | __input_unregister_device(input); | ||
1994 | } | ||
1995 | |||
1891 | /** | 1996 | /** |
1892 | * input_register_device - register device with input core | 1997 | * input_register_device - register device with input core |
1893 | * @dev: device to be registered | 1998 | * @dev: device to be registered |
@@ -1903,11 +2008,21 @@ static void input_cleanse_bitmasks(struct input_dev *dev) | |||
1903 | int input_register_device(struct input_dev *dev) | 2008 | int input_register_device(struct input_dev *dev) |
1904 | { | 2009 | { |
1905 | static atomic_t input_no = ATOMIC_INIT(0); | 2010 | static atomic_t input_no = ATOMIC_INIT(0); |
2011 | struct input_devres *devres = NULL; | ||
1906 | struct input_handler *handler; | 2012 | struct input_handler *handler; |
1907 | unsigned int packet_size; | 2013 | unsigned int packet_size; |
1908 | const char *path; | 2014 | const char *path; |
1909 | int error; | 2015 | int error; |
1910 | 2016 | ||
2017 | if (dev->devres_managed) { | ||
2018 | devres = devres_alloc(devm_input_device_unregister, | ||
2019 | sizeof(struct input_devres), GFP_KERNEL); | ||
2020 | if (!devres) | ||
2021 | return -ENOMEM; | ||
2022 | |||
2023 | devres->input = dev; | ||
2024 | } | ||
2025 | |||
1911 | /* Every input device generates EV_SYN/SYN_REPORT events. */ | 2026 | /* Every input device generates EV_SYN/SYN_REPORT events. */ |
1912 | __set_bit(EV_SYN, dev->evbit); | 2027 | __set_bit(EV_SYN, dev->evbit); |
1913 | 2028 | ||
@@ -1923,8 +2038,10 @@ int input_register_device(struct input_dev *dev) | |||
1923 | 2038 | ||
1924 | dev->max_vals = max(dev->hint_events_per_packet, packet_size) + 2; | 2039 | dev->max_vals = max(dev->hint_events_per_packet, packet_size) + 2; |
1925 | dev->vals = kcalloc(dev->max_vals, sizeof(*dev->vals), GFP_KERNEL); | 2040 | dev->vals = kcalloc(dev->max_vals, sizeof(*dev->vals), GFP_KERNEL); |
1926 | if (!dev->vals) | 2041 | if (!dev->vals) { |
1927 | return -ENOMEM; | 2042 | error = -ENOMEM; |
2043 | goto err_devres_free; | ||
2044 | } | ||
1928 | 2045 | ||
1929 | /* | 2046 | /* |
1930 | * If delay and period are pre-set by the driver, then autorepeating | 2047 | * If delay and period are pre-set by the driver, then autorepeating |
@@ -1949,7 +2066,7 @@ int input_register_device(struct input_dev *dev) | |||
1949 | 2066 | ||
1950 | error = device_add(&dev->dev); | 2067 | error = device_add(&dev->dev); |
1951 | if (error) | 2068 | if (error) |
1952 | return error; | 2069 | goto err_free_vals; |
1953 | 2070 | ||
1954 | path = kobject_get_path(&dev->dev.kobj, GFP_KERNEL); | 2071 | path = kobject_get_path(&dev->dev.kobj, GFP_KERNEL); |
1955 | pr_info("%s as %s\n", | 2072 | pr_info("%s as %s\n", |
@@ -1958,10 +2075,8 @@ int input_register_device(struct input_dev *dev) | |||
1958 | kfree(path); | 2075 | kfree(path); |
1959 | 2076 | ||
1960 | error = mutex_lock_interruptible(&input_mutex); | 2077 | error = mutex_lock_interruptible(&input_mutex); |
1961 | if (error) { | 2078 | if (error) |
1962 | device_del(&dev->dev); | 2079 | goto err_device_del; |
1963 | return error; | ||
1964 | } | ||
1965 | 2080 | ||
1966 | list_add_tail(&dev->node, &input_dev_list); | 2081 | list_add_tail(&dev->node, &input_dev_list); |
1967 | 2082 | ||
@@ -1972,7 +2087,21 @@ int input_register_device(struct input_dev *dev) | |||
1972 | 2087 | ||
1973 | mutex_unlock(&input_mutex); | 2088 | mutex_unlock(&input_mutex); |
1974 | 2089 | ||
2090 | if (dev->devres_managed) { | ||
2091 | dev_dbg(dev->dev.parent, "%s: registering %s with devres.\n", | ||
2092 | __func__, dev_name(&dev->dev)); | ||
2093 | devres_add(dev->dev.parent, devres); | ||
2094 | } | ||
1975 | return 0; | 2095 | return 0; |
2096 | |||
2097 | err_device_del: | ||
2098 | device_del(&dev->dev); | ||
2099 | err_free_vals: | ||
2100 | kfree(dev->vals); | ||
2101 | dev->vals = NULL; | ||
2102 | err_devres_free: | ||
2103 | devres_free(devres); | ||
2104 | return error; | ||
1976 | } | 2105 | } |
1977 | EXPORT_SYMBOL(input_register_device); | 2106 | EXPORT_SYMBOL(input_register_device); |
1978 | 2107 | ||
@@ -1985,24 +2114,20 @@ EXPORT_SYMBOL(input_register_device); | |||
1985 | */ | 2114 | */ |
1986 | void input_unregister_device(struct input_dev *dev) | 2115 | void input_unregister_device(struct input_dev *dev) |
1987 | { | 2116 | { |
1988 | struct input_handle *handle, *next; | 2117 | if (dev->devres_managed) { |
1989 | 2118 | WARN_ON(devres_destroy(dev->dev.parent, | |
1990 | input_disconnect_device(dev); | 2119 | devm_input_device_unregister, |
1991 | 2120 | devm_input_device_match, | |
1992 | mutex_lock(&input_mutex); | 2121 | dev)); |
1993 | 2122 | __input_unregister_device(dev); | |
1994 | list_for_each_entry_safe(handle, next, &dev->h_list, d_node) | 2123 | /* |
1995 | handle->handler->disconnect(handle); | 2124 | * We do not do input_put_device() here because it will be done |
1996 | WARN_ON(!list_empty(&dev->h_list)); | 2125 | * when 2nd devres fires up. |
1997 | 2126 | */ | |
1998 | del_timer_sync(&dev->timer); | 2127 | } else { |
1999 | list_del_init(&dev->node); | 2128 | __input_unregister_device(dev); |
2000 | 2129 | input_put_device(dev); | |
2001 | input_wakeup_procfs_readers(); | 2130 | } |
2002 | |||
2003 | mutex_unlock(&input_mutex); | ||
2004 | |||
2005 | device_unregister(&dev->dev); | ||
2006 | } | 2131 | } |
2007 | EXPORT_SYMBOL(input_unregister_device); | 2132 | EXPORT_SYMBOL(input_unregister_device); |
2008 | 2133 | ||
diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index c96653b5886..121cd63d333 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c | |||
@@ -85,7 +85,10 @@ static int as5011_i2c_write(struct i2c_client *client, | |||
85 | { | 85 | { |
86 | uint8_t data[2] = { aregaddr, avalue }; | 86 | uint8_t data[2] = { aregaddr, avalue }; |
87 | struct i2c_msg msg = { | 87 | struct i2c_msg msg = { |
88 | client->addr, I2C_M_IGNORE_NAK, 2, (uint8_t *)data | 88 | .addr = client->addr, |
89 | .flags = I2C_M_IGNORE_NAK, | ||
90 | .len = 2, | ||
91 | .buf = (uint8_t *)data | ||
89 | }; | 92 | }; |
90 | int error; | 93 | int error; |
91 | 94 | ||
@@ -98,8 +101,18 @@ static int as5011_i2c_read(struct i2c_client *client, | |||
98 | { | 101 | { |
99 | uint8_t data[2] = { aregaddr }; | 102 | uint8_t data[2] = { aregaddr }; |
100 | struct i2c_msg msg_set[2] = { | 103 | struct i2c_msg msg_set[2] = { |
101 | { client->addr, I2C_M_REV_DIR_ADDR, 1, (uint8_t *)data }, | 104 | { |
102 | { client->addr, I2C_M_RD | I2C_M_NOSTART, 1, (uint8_t *)data } | 105 | .addr = client->addr, |
106 | .flags = I2C_M_REV_DIR_ADDR, | ||
107 | .len = 1, | ||
108 | .buf = (uint8_t *)data | ||
109 | }, | ||
110 | { | ||
111 | .addr = client->addr, | ||
112 | .flags = I2C_M_RD | I2C_M_NOSTART, | ||
113 | .len = 1, | ||
114 | .buf = (uint8_t *)data | ||
115 | } | ||
103 | }; | 116 | }; |
104 | int error; | 117 | int error; |
105 | 118 | ||
@@ -144,7 +157,7 @@ out: | |||
144 | return IRQ_HANDLED; | 157 | return IRQ_HANDLED; |
145 | } | 158 | } |
146 | 159 | ||
147 | static int __devinit as5011_configure_chip(struct as5011_device *as5011, | 160 | static int as5011_configure_chip(struct as5011_device *as5011, |
148 | const struct as5011_platform_data *plat_dat) | 161 | const struct as5011_platform_data *plat_dat) |
149 | { | 162 | { |
150 | struct i2c_client *client = as5011->i2c_client; | 163 | struct i2c_client *client = as5011->i2c_client; |
@@ -212,8 +225,8 @@ static int __devinit as5011_configure_chip(struct as5011_device *as5011, | |||
212 | return 0; | 225 | return 0; |
213 | } | 226 | } |
214 | 227 | ||
215 | static int __devinit as5011_probe(struct i2c_client *client, | 228 | static int as5011_probe(struct i2c_client *client, |
216 | const struct i2c_device_id *id) | 229 | const struct i2c_device_id *id) |
217 | { | 230 | { |
218 | const struct as5011_platform_data *plat_data; | 231 | const struct as5011_platform_data *plat_data; |
219 | struct as5011_device *as5011; | 232 | struct as5011_device *as5011; |
@@ -328,7 +341,7 @@ err_free_mem: | |||
328 | return error; | 341 | return error; |
329 | } | 342 | } |
330 | 343 | ||
331 | static int __devexit as5011_remove(struct i2c_client *client) | 344 | static int as5011_remove(struct i2c_client *client) |
332 | { | 345 | { |
333 | struct as5011_device *as5011 = i2c_get_clientdata(client); | 346 | struct as5011_device *as5011 = i2c_get_clientdata(client); |
334 | 347 | ||
@@ -353,7 +366,7 @@ static struct i2c_driver as5011_driver = { | |||
353 | .name = "as5011", | 366 | .name = "as5011", |
354 | }, | 367 | }, |
355 | .probe = as5011_probe, | 368 | .probe = as5011_probe, |
356 | .remove = __devexit_p(as5011_remove), | 369 | .remove = as5011_remove, |
357 | .id_table = as5011_id, | 370 | .id_table = as5011_id, |
358 | }; | 371 | }; |
359 | 372 | ||
diff --git a/drivers/input/joystick/maplecontrol.c b/drivers/input/joystick/maplecontrol.c index 77cfde571bd..59c10ec5a2a 100644 --- a/drivers/input/joystick/maplecontrol.c +++ b/drivers/input/joystick/maplecontrol.c | |||
@@ -78,7 +78,7 @@ static void dc_pad_close(struct input_dev *dev) | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /* allow the controller to be used */ | 80 | /* allow the controller to be used */ |
81 | static int __devinit probe_maple_controller(struct device *dev) | 81 | static int probe_maple_controller(struct device *dev) |
82 | { | 82 | { |
83 | static const short btn_bit[32] = { | 83 | static const short btn_bit[32] = { |
84 | BTN_C, BTN_B, BTN_A, BTN_START, -1, -1, -1, -1, | 84 | BTN_C, BTN_B, BTN_A, BTN_START, -1, -1, -1, -1, |
@@ -157,7 +157,7 @@ fail: | |||
157 | return error; | 157 | return error; |
158 | } | 158 | } |
159 | 159 | ||
160 | static int __devexit remove_maple_controller(struct device *dev) | 160 | static int remove_maple_controller(struct device *dev) |
161 | { | 161 | { |
162 | struct maple_device *mdev = to_maple_dev(dev); | 162 | struct maple_device *mdev = to_maple_dev(dev); |
163 | struct dc_pad *pad = maple_get_drvdata(mdev); | 163 | struct dc_pad *pad = maple_get_drvdata(mdev); |
@@ -175,7 +175,7 @@ static struct maple_driver dc_pad_driver = { | |||
175 | .drv = { | 175 | .drv = { |
176 | .name = "Dreamcast_controller", | 176 | .name = "Dreamcast_controller", |
177 | .probe = probe_maple_controller, | 177 | .probe = probe_maple_controller, |
178 | .remove = __devexit_p(remove_maple_controller), | 178 | .remove = remove_maple_controller, |
179 | }, | 179 | }, |
180 | }; | 180 | }; |
181 | 181 | ||
diff --git a/drivers/input/joystick/walkera0701.c b/drivers/input/joystick/walkera0701.c index 4dfa1eed4b7..f8f892b076e 100644 --- a/drivers/input/joystick/walkera0701.c +++ b/drivers/input/joystick/walkera0701.c | |||
@@ -196,6 +196,7 @@ static void walkera0701_close(struct input_dev *dev) | |||
196 | struct walkera_dev *w = input_get_drvdata(dev); | 196 | struct walkera_dev *w = input_get_drvdata(dev); |
197 | 197 | ||
198 | parport_disable_irq(w->parport); | 198 | parport_disable_irq(w->parport); |
199 | hrtimer_cancel(&w->timer); | ||
199 | } | 200 | } |
200 | 201 | ||
201 | static int walkera0701_connect(struct walkera_dev *w, int parport) | 202 | static int walkera0701_connect(struct walkera_dev *w, int parport) |
@@ -224,6 +225,9 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) | |||
224 | if (parport_claim(w->pardevice)) | 225 | if (parport_claim(w->pardevice)) |
225 | goto init_err1; | 226 | goto init_err1; |
226 | 227 | ||
228 | hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
229 | w->timer.function = timer_handler; | ||
230 | |||
227 | w->input_dev = input_allocate_device(); | 231 | w->input_dev = input_allocate_device(); |
228 | if (!w->input_dev) | 232 | if (!w->input_dev) |
229 | goto init_err2; | 233 | goto init_err2; |
@@ -254,8 +258,6 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) | |||
254 | if (err) | 258 | if (err) |
255 | goto init_err3; | 259 | goto init_err3; |
256 | 260 | ||
257 | hrtimer_init(&w->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
258 | w->timer.function = timer_handler; | ||
259 | return 0; | 261 | return 0; |
260 | 262 | ||
261 | init_err3: | 263 | init_err3: |
@@ -271,7 +273,6 @@ static int walkera0701_connect(struct walkera_dev *w, int parport) | |||
271 | 273 | ||
272 | static void walkera0701_disconnect(struct walkera_dev *w) | 274 | static void walkera0701_disconnect(struct walkera_dev *w) |
273 | { | 275 | { |
274 | hrtimer_cancel(&w->timer); | ||
275 | input_unregister_device(w->input_dev); | 276 | input_unregister_device(w->input_dev); |
276 | parport_release(w->pardevice); | 277 | parport_release(w->pardevice); |
277 | parport_unregister_device(w->pardevice); | 278 | parport_unregister_device(w->pardevice); |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index de0874054e9..48309641b1b 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -134,7 +134,7 @@ config KEYBOARD_QT1070 | |||
134 | 134 | ||
135 | config KEYBOARD_QT2160 | 135 | config KEYBOARD_QT2160 |
136 | tristate "Atmel AT42QT2160 Touch Sensor Chip" | 136 | tristate "Atmel AT42QT2160 Touch Sensor Chip" |
137 | depends on I2C && EXPERIMENTAL | 137 | depends on I2C |
138 | help | 138 | help |
139 | If you say yes here you get support for Atmel AT42QT2160 Touch | 139 | If you say yes here you get support for Atmel AT42QT2160 Touch |
140 | Sensor chip as a keyboard input. | 140 | Sensor chip as a keyboard input. |
diff --git a/drivers/input/keyboard/adp5520-keys.c b/drivers/input/keyboard/adp5520-keys.c index e9e8674dfda..ef26b17fb15 100644 --- a/drivers/input/keyboard/adp5520-keys.c +++ b/drivers/input/keyboard/adp5520-keys.c | |||
@@ -69,7 +69,7 @@ static int adp5520_keys_notifier(struct notifier_block *nb, | |||
69 | return 0; | 69 | return 0; |
70 | } | 70 | } |
71 | 71 | ||
72 | static int __devinit adp5520_keys_probe(struct platform_device *pdev) | 72 | static int adp5520_keys_probe(struct platform_device *pdev) |
73 | { | 73 | { |
74 | struct adp5520_keys_platform_data *pdata = pdev->dev.platform_data; | 74 | struct adp5520_keys_platform_data *pdata = pdev->dev.platform_data; |
75 | struct input_dev *input; | 75 | struct input_dev *input; |
@@ -182,7 +182,7 @@ err: | |||
182 | return ret; | 182 | return ret; |
183 | } | 183 | } |
184 | 184 | ||
185 | static int __devexit adp5520_keys_remove(struct platform_device *pdev) | 185 | static int adp5520_keys_remove(struct platform_device *pdev) |
186 | { | 186 | { |
187 | struct adp5520_keys *dev = platform_get_drvdata(pdev); | 187 | struct adp5520_keys *dev = platform_get_drvdata(pdev); |
188 | 188 | ||
@@ -200,7 +200,7 @@ static struct platform_driver adp5520_keys_driver = { | |||
200 | .owner = THIS_MODULE, | 200 | .owner = THIS_MODULE, |
201 | }, | 201 | }, |
202 | .probe = adp5520_keys_probe, | 202 | .probe = adp5520_keys_probe, |
203 | .remove = __devexit_p(adp5520_keys_remove), | 203 | .remove = adp5520_keys_remove, |
204 | }; | 204 | }; |
205 | module_platform_driver(adp5520_keys_driver); | 205 | module_platform_driver(adp5520_keys_driver); |
206 | 206 | ||
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c index b083bf10f13..dbd2047f164 100644 --- a/drivers/input/keyboard/adp5588-keys.c +++ b/drivers/input/keyboard/adp5588-keys.c | |||
@@ -145,7 +145,7 @@ static int adp5588_gpio_direction_output(struct gpio_chip *chip, | |||
145 | return ret; | 145 | return ret; |
146 | } | 146 | } |
147 | 147 | ||
148 | static int __devinit adp5588_build_gpiomap(struct adp5588_kpad *kpad, | 148 | static int adp5588_build_gpiomap(struct adp5588_kpad *kpad, |
149 | const struct adp5588_kpad_platform_data *pdata) | 149 | const struct adp5588_kpad_platform_data *pdata) |
150 | { | 150 | { |
151 | bool pin_used[ADP5588_MAXGPIO]; | 151 | bool pin_used[ADP5588_MAXGPIO]; |
@@ -170,7 +170,7 @@ static int __devinit adp5588_build_gpiomap(struct adp5588_kpad *kpad, | |||
170 | return n_unused; | 170 | return n_unused; |
171 | } | 171 | } |
172 | 172 | ||
173 | static int __devinit adp5588_gpio_add(struct adp5588_kpad *kpad) | 173 | static int adp5588_gpio_add(struct adp5588_kpad *kpad) |
174 | { | 174 | { |
175 | struct device *dev = &kpad->client->dev; | 175 | struct device *dev = &kpad->client->dev; |
176 | const struct adp5588_kpad_platform_data *pdata = dev->platform_data; | 176 | const struct adp5588_kpad_platform_data *pdata = dev->platform_data; |
@@ -224,7 +224,7 @@ static int __devinit adp5588_gpio_add(struct adp5588_kpad *kpad) | |||
224 | return 0; | 224 | return 0; |
225 | } | 225 | } |
226 | 226 | ||
227 | static void __devexit adp5588_gpio_remove(struct adp5588_kpad *kpad) | 227 | static void adp5588_gpio_remove(struct adp5588_kpad *kpad) |
228 | { | 228 | { |
229 | struct device *dev = &kpad->client->dev; | 229 | struct device *dev = &kpad->client->dev; |
230 | const struct adp5588_kpad_platform_data *pdata = dev->platform_data; | 230 | const struct adp5588_kpad_platform_data *pdata = dev->platform_data; |
@@ -319,7 +319,7 @@ static irqreturn_t adp5588_irq(int irq, void *handle) | |||
319 | return IRQ_HANDLED; | 319 | return IRQ_HANDLED; |
320 | } | 320 | } |
321 | 321 | ||
322 | static int __devinit adp5588_setup(struct i2c_client *client) | 322 | static int adp5588_setup(struct i2c_client *client) |
323 | { | 323 | { |
324 | const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data; | 324 | const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data; |
325 | const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data; | 325 | const struct adp5588_gpio_platform_data *gpio_data = pdata->gpio_data; |
@@ -382,7 +382,7 @@ static int __devinit adp5588_setup(struct i2c_client *client) | |||
382 | return 0; | 382 | return 0; |
383 | } | 383 | } |
384 | 384 | ||
385 | static void __devinit adp5588_report_switch_state(struct adp5588_kpad *kpad) | 385 | static void adp5588_report_switch_state(struct adp5588_kpad *kpad) |
386 | { | 386 | { |
387 | int gpi_stat1 = adp5588_read(kpad->client, GPIO_DAT_STAT1); | 387 | int gpi_stat1 = adp5588_read(kpad->client, GPIO_DAT_STAT1); |
388 | int gpi_stat2 = adp5588_read(kpad->client, GPIO_DAT_STAT2); | 388 | int gpi_stat2 = adp5588_read(kpad->client, GPIO_DAT_STAT2); |
@@ -420,8 +420,8 @@ static void __devinit adp5588_report_switch_state(struct adp5588_kpad *kpad) | |||
420 | } | 420 | } |
421 | 421 | ||
422 | 422 | ||
423 | static int __devinit adp5588_probe(struct i2c_client *client, | 423 | static int adp5588_probe(struct i2c_client *client, |
424 | const struct i2c_device_id *id) | 424 | const struct i2c_device_id *id) |
425 | { | 425 | { |
426 | struct adp5588_kpad *kpad; | 426 | struct adp5588_kpad *kpad; |
427 | const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data; | 427 | const struct adp5588_kpad_platform_data *pdata = client->dev.platform_data; |
@@ -587,7 +587,7 @@ static int __devinit adp5588_probe(struct i2c_client *client, | |||
587 | return error; | 587 | return error; |
588 | } | 588 | } |
589 | 589 | ||
590 | static int __devexit adp5588_remove(struct i2c_client *client) | 590 | static int adp5588_remove(struct i2c_client *client) |
591 | { | 591 | { |
592 | struct adp5588_kpad *kpad = i2c_get_clientdata(client); | 592 | struct adp5588_kpad *kpad = i2c_get_clientdata(client); |
593 | 593 | ||
@@ -650,7 +650,7 @@ static struct i2c_driver adp5588_driver = { | |||
650 | #endif | 650 | #endif |
651 | }, | 651 | }, |
652 | .probe = adp5588_probe, | 652 | .probe = adp5588_probe, |
653 | .remove = __devexit_p(adp5588_remove), | 653 | .remove = adp5588_remove, |
654 | .id_table = adp5588_id, | 654 | .id_table = adp5588_id, |
655 | }; | 655 | }; |
656 | 656 | ||
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 74e60321338..67d12b3427c 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c | |||
@@ -464,7 +464,7 @@ static int adp5589_gpio_direction_output(struct gpio_chip *chip, | |||
464 | return ret; | 464 | return ret; |
465 | } | 465 | } |
466 | 466 | ||
467 | static int __devinit adp5589_build_gpiomap(struct adp5589_kpad *kpad, | 467 | static int adp5589_build_gpiomap(struct adp5589_kpad *kpad, |
468 | const struct adp5589_kpad_platform_data *pdata) | 468 | const struct adp5589_kpad_platform_data *pdata) |
469 | { | 469 | { |
470 | bool pin_used[ADP5589_MAXGPIO]; | 470 | bool pin_used[ADP5589_MAXGPIO]; |
@@ -496,7 +496,7 @@ static int __devinit adp5589_build_gpiomap(struct adp5589_kpad *kpad, | |||
496 | return n_unused; | 496 | return n_unused; |
497 | } | 497 | } |
498 | 498 | ||
499 | static int __devinit adp5589_gpio_add(struct adp5589_kpad *kpad) | 499 | static int adp5589_gpio_add(struct adp5589_kpad *kpad) |
500 | { | 500 | { |
501 | struct device *dev = &kpad->client->dev; | 501 | struct device *dev = &kpad->client->dev; |
502 | const struct adp5589_kpad_platform_data *pdata = dev->platform_data; | 502 | const struct adp5589_kpad_platform_data *pdata = dev->platform_data; |
@@ -550,7 +550,7 @@ static int __devinit adp5589_gpio_add(struct adp5589_kpad *kpad) | |||
550 | return 0; | 550 | return 0; |
551 | } | 551 | } |
552 | 552 | ||
553 | static void __devexit adp5589_gpio_remove(struct adp5589_kpad *kpad) | 553 | static void adp5589_gpio_remove(struct adp5589_kpad *kpad) |
554 | { | 554 | { |
555 | struct device *dev = &kpad->client->dev; | 555 | struct device *dev = &kpad->client->dev; |
556 | const struct adp5589_kpad_platform_data *pdata = dev->platform_data; | 556 | const struct adp5589_kpad_platform_data *pdata = dev->platform_data; |
@@ -641,8 +641,7 @@ static irqreturn_t adp5589_irq(int irq, void *handle) | |||
641 | return IRQ_HANDLED; | 641 | return IRQ_HANDLED; |
642 | } | 642 | } |
643 | 643 | ||
644 | static int __devinit adp5589_get_evcode(struct adp5589_kpad *kpad, | 644 | static int adp5589_get_evcode(struct adp5589_kpad *kpad, unsigned short key) |
645 | unsigned short key) | ||
646 | { | 645 | { |
647 | int i; | 646 | int i; |
648 | 647 | ||
@@ -655,7 +654,7 @@ static int __devinit adp5589_get_evcode(struct adp5589_kpad *kpad, | |||
655 | return -EINVAL; | 654 | return -EINVAL; |
656 | } | 655 | } |
657 | 656 | ||
658 | static int __devinit adp5589_setup(struct adp5589_kpad *kpad) | 657 | static int adp5589_setup(struct adp5589_kpad *kpad) |
659 | { | 658 | { |
660 | struct i2c_client *client = kpad->client; | 659 | struct i2c_client *client = kpad->client; |
661 | const struct adp5589_kpad_platform_data *pdata = | 660 | const struct adp5589_kpad_platform_data *pdata = |
@@ -820,7 +819,7 @@ static int __devinit adp5589_setup(struct adp5589_kpad *kpad) | |||
820 | return 0; | 819 | return 0; |
821 | } | 820 | } |
822 | 821 | ||
823 | static void __devinit adp5589_report_switch_state(struct adp5589_kpad *kpad) | 822 | static void adp5589_report_switch_state(struct adp5589_kpad *kpad) |
824 | { | 823 | { |
825 | int gpi_stat_tmp, pin_loc; | 824 | int gpi_stat_tmp, pin_loc; |
826 | int i; | 825 | int i; |
@@ -860,8 +859,8 @@ static void __devinit adp5589_report_switch_state(struct adp5589_kpad *kpad) | |||
860 | input_sync(kpad->input); | 859 | input_sync(kpad->input); |
861 | } | 860 | } |
862 | 861 | ||
863 | static int __devinit adp5589_probe(struct i2c_client *client, | 862 | static int adp5589_probe(struct i2c_client *client, |
864 | const struct i2c_device_id *id) | 863 | const struct i2c_device_id *id) |
865 | { | 864 | { |
866 | struct adp5589_kpad *kpad; | 865 | struct adp5589_kpad *kpad; |
867 | const struct adp5589_kpad_platform_data *pdata = | 866 | const struct adp5589_kpad_platform_data *pdata = |
@@ -1045,7 +1044,7 @@ err_free_mem: | |||
1045 | return error; | 1044 | return error; |
1046 | } | 1045 | } |
1047 | 1046 | ||
1048 | static int __devexit adp5589_remove(struct i2c_client *client) | 1047 | static int adp5589_remove(struct i2c_client *client) |
1049 | { | 1048 | { |
1050 | struct adp5589_kpad *kpad = i2c_get_clientdata(client); | 1049 | struct adp5589_kpad *kpad = i2c_get_clientdata(client); |
1051 | 1050 | ||
@@ -1104,7 +1103,7 @@ static struct i2c_driver adp5589_driver = { | |||
1104 | .pm = &adp5589_dev_pm_ops, | 1103 | .pm = &adp5589_dev_pm_ops, |
1105 | }, | 1104 | }, |
1106 | .probe = adp5589_probe, | 1105 | .probe = adp5589_probe, |
1107 | .remove = __devexit_p(adp5589_remove), | 1106 | .remove = adp5589_remove, |
1108 | .id_table = adp5589_id, | 1107 | .id_table = adp5589_id, |
1109 | }; | 1108 | }; |
1110 | 1109 | ||
diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c index 8eb9116e0a5..20b9fa91fb9 100644 --- a/drivers/input/keyboard/bf54x-keys.c +++ b/drivers/input/keyboard/bf54x-keys.c | |||
@@ -177,7 +177,7 @@ static irqreturn_t bfin_kpad_isr(int irq, void *dev_id) | |||
177 | return IRQ_HANDLED; | 177 | return IRQ_HANDLED; |
178 | } | 178 | } |
179 | 179 | ||
180 | static int __devinit bfin_kpad_probe(struct platform_device *pdev) | 180 | static int bfin_kpad_probe(struct platform_device *pdev) |
181 | { | 181 | { |
182 | struct bf54x_kpad *bf54x_kpad; | 182 | struct bf54x_kpad *bf54x_kpad; |
183 | struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data; | 183 | struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data; |
@@ -331,7 +331,7 @@ out: | |||
331 | return error; | 331 | return error; |
332 | } | 332 | } |
333 | 333 | ||
334 | static int __devexit bfin_kpad_remove(struct platform_device *pdev) | 334 | static int bfin_kpad_remove(struct platform_device *pdev) |
335 | { | 335 | { |
336 | struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data; | 336 | struct bfin_kpad_platform_data *pdata = pdev->dev.platform_data; |
337 | struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev); | 337 | struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev); |
@@ -390,7 +390,7 @@ static struct platform_driver bfin_kpad_device_driver = { | |||
390 | .owner = THIS_MODULE, | 390 | .owner = THIS_MODULE, |
391 | }, | 391 | }, |
392 | .probe = bfin_kpad_probe, | 392 | .probe = bfin_kpad_probe, |
393 | .remove = __devexit_p(bfin_kpad_remove), | 393 | .remove = bfin_kpad_remove, |
394 | .suspend = bfin_kpad_suspend, | 394 | .suspend = bfin_kpad_suspend, |
395 | .resume = bfin_kpad_resume, | 395 | .resume = bfin_kpad_resume, |
396 | }; | 396 | }; |
diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c index d5bacbb479b..4e4e453ea15 100644 --- a/drivers/input/keyboard/davinci_keyscan.c +++ b/drivers/input/keyboard/davinci_keyscan.c | |||
@@ -303,7 +303,7 @@ fail1: | |||
303 | return error; | 303 | return error; |
304 | } | 304 | } |
305 | 305 | ||
306 | static int __devexit davinci_ks_remove(struct platform_device *pdev) | 306 | static int davinci_ks_remove(struct platform_device *pdev) |
307 | { | 307 | { |
308 | struct davinci_ks *davinci_ks = platform_get_drvdata(pdev); | 308 | struct davinci_ks *davinci_ks = platform_get_drvdata(pdev); |
309 | 309 | ||
@@ -326,7 +326,7 @@ static struct platform_driver davinci_ks_driver = { | |||
326 | .name = "davinci_keyscan", | 326 | .name = "davinci_keyscan", |
327 | .owner = THIS_MODULE, | 327 | .owner = THIS_MODULE, |
328 | }, | 328 | }, |
329 | .remove = __devexit_p(davinci_ks_remove), | 329 | .remove = davinci_ks_remove, |
330 | }; | 330 | }; |
331 | 331 | ||
332 | static int __init davinci_ks_init(void) | 332 | static int __init davinci_ks_init(void) |
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c index 7363402de8d..9857e8fd098 100644 --- a/drivers/input/keyboard/ep93xx_keypad.c +++ b/drivers/input/keyboard/ep93xx_keypad.c | |||
@@ -232,7 +232,7 @@ static int ep93xx_keypad_resume(struct device *dev) | |||
232 | static SIMPLE_DEV_PM_OPS(ep93xx_keypad_pm_ops, | 232 | static SIMPLE_DEV_PM_OPS(ep93xx_keypad_pm_ops, |
233 | ep93xx_keypad_suspend, ep93xx_keypad_resume); | 233 | ep93xx_keypad_suspend, ep93xx_keypad_resume); |
234 | 234 | ||
235 | static int __devinit ep93xx_keypad_probe(struct platform_device *pdev) | 235 | static int ep93xx_keypad_probe(struct platform_device *pdev) |
236 | { | 236 | { |
237 | struct ep93xx_keypad *keypad; | 237 | struct ep93xx_keypad *keypad; |
238 | const struct matrix_keymap_data *keymap_data; | 238 | const struct matrix_keymap_data *keymap_data; |
@@ -346,7 +346,7 @@ failed_free: | |||
346 | return err; | 346 | return err; |
347 | } | 347 | } |
348 | 348 | ||
349 | static int __devexit ep93xx_keypad_remove(struct platform_device *pdev) | 349 | static int ep93xx_keypad_remove(struct platform_device *pdev) |
350 | { | 350 | { |
351 | struct ep93xx_keypad *keypad = platform_get_drvdata(pdev); | 351 | struct ep93xx_keypad *keypad = platform_get_drvdata(pdev); |
352 | struct resource *res; | 352 | struct resource *res; |
@@ -380,7 +380,7 @@ static struct platform_driver ep93xx_keypad_driver = { | |||
380 | .pm = &ep93xx_keypad_pm_ops, | 380 | .pm = &ep93xx_keypad_pm_ops, |
381 | }, | 381 | }, |
382 | .probe = ep93xx_keypad_probe, | 382 | .probe = ep93xx_keypad_probe, |
383 | .remove = __devexit_p(ep93xx_keypad_remove), | 383 | .remove = ep93xx_keypad_remove, |
384 | }; | 384 | }; |
385 | module_platform_driver(ep93xx_keypad_driver); | 385 | module_platform_driver(ep93xx_keypad_driver); |
386 | 386 | ||
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 6a68041c261..d327f5a2bb0 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -423,10 +423,10 @@ out: | |||
423 | return IRQ_HANDLED; | 423 | return IRQ_HANDLED; |
424 | } | 424 | } |
425 | 425 | ||
426 | static int __devinit gpio_keys_setup_key(struct platform_device *pdev, | 426 | static int gpio_keys_setup_key(struct platform_device *pdev, |
427 | struct input_dev *input, | 427 | struct input_dev *input, |
428 | struct gpio_button_data *bdata, | 428 | struct gpio_button_data *bdata, |
429 | const struct gpio_keys_button *button) | 429 | const struct gpio_keys_button *button) |
430 | { | 430 | { |
431 | const char *desc = button->desc ? button->desc : "gpio_keys"; | 431 | const char *desc = button->desc ? button->desc : "gpio_keys"; |
432 | struct device *dev = &pdev->dev; | 432 | struct device *dev = &pdev->dev; |
@@ -440,21 +440,13 @@ static int __devinit gpio_keys_setup_key(struct platform_device *pdev, | |||
440 | 440 | ||
441 | if (gpio_is_valid(button->gpio)) { | 441 | if (gpio_is_valid(button->gpio)) { |
442 | 442 | ||
443 | error = gpio_request(button->gpio, desc); | 443 | error = gpio_request_one(button->gpio, GPIOF_IN, desc); |
444 | if (error < 0) { | 444 | if (error < 0) { |
445 | dev_err(dev, "Failed to request GPIO %d, error %d\n", | 445 | dev_err(dev, "Failed to request GPIO %d, error %d\n", |
446 | button->gpio, error); | 446 | button->gpio, error); |
447 | return error; | 447 | return error; |
448 | } | 448 | } |
449 | 449 | ||
450 | error = gpio_direction_input(button->gpio); | ||
451 | if (error < 0) { | ||
452 | dev_err(dev, | ||
453 | "Failed to configure direction for GPIO %d, error %d\n", | ||
454 | button->gpio, error); | ||
455 | goto fail; | ||
456 | } | ||
457 | |||
458 | if (button->debounce_interval) { | 450 | if (button->debounce_interval) { |
459 | error = gpio_set_debounce(button->gpio, | 451 | error = gpio_set_debounce(button->gpio, |
460 | button->debounce_interval * 1000); | 452 | button->debounce_interval * 1000); |
@@ -526,12 +518,35 @@ fail: | |||
526 | return error; | 518 | return error; |
527 | } | 519 | } |
528 | 520 | ||
521 | static void gpio_keys_report_state(struct gpio_keys_drvdata *ddata) | ||
522 | { | ||
523 | struct input_dev *input = ddata->input; | ||
524 | int i; | ||
525 | |||
526 | for (i = 0; i < ddata->pdata->nbuttons; i++) { | ||
527 | struct gpio_button_data *bdata = &ddata->data[i]; | ||
528 | if (gpio_is_valid(bdata->button->gpio)) | ||
529 | gpio_keys_gpio_report_event(bdata); | ||
530 | } | ||
531 | input_sync(input); | ||
532 | } | ||
533 | |||
529 | static int gpio_keys_open(struct input_dev *input) | 534 | static int gpio_keys_open(struct input_dev *input) |
530 | { | 535 | { |
531 | struct gpio_keys_drvdata *ddata = input_get_drvdata(input); | 536 | struct gpio_keys_drvdata *ddata = input_get_drvdata(input); |
532 | const struct gpio_keys_platform_data *pdata = ddata->pdata; | 537 | const struct gpio_keys_platform_data *pdata = ddata->pdata; |
538 | int error; | ||
539 | |||
540 | if (pdata->enable) { | ||
541 | error = pdata->enable(input->dev.parent); | ||
542 | if (error) | ||
543 | return error; | ||
544 | } | ||
545 | |||
546 | /* Report current state of buttons that are connected to GPIOs */ | ||
547 | gpio_keys_report_state(ddata); | ||
533 | 548 | ||
534 | return pdata->enable ? pdata->enable(input->dev.parent) : 0; | 549 | return 0; |
535 | } | 550 | } |
536 | 551 | ||
537 | static void gpio_keys_close(struct input_dev *input) | 552 | static void gpio_keys_close(struct input_dev *input) |
@@ -551,7 +566,7 @@ static void gpio_keys_close(struct input_dev *input) | |||
551 | /* | 566 | /* |
552 | * Translate OpenFirmware node properties into platform_data | 567 | * Translate OpenFirmware node properties into platform_data |
553 | */ | 568 | */ |
554 | static struct gpio_keys_platform_data * __devinit | 569 | static struct gpio_keys_platform_data * |
555 | gpio_keys_get_devtree_pdata(struct device *dev) | 570 | gpio_keys_get_devtree_pdata(struct device *dev) |
556 | { | 571 | { |
557 | struct device_node *node, *pp; | 572 | struct device_node *node, *pp; |
@@ -658,7 +673,7 @@ static void gpio_remove_key(struct gpio_button_data *bdata) | |||
658 | gpio_free(bdata->button->gpio); | 673 | gpio_free(bdata->button->gpio); |
659 | } | 674 | } |
660 | 675 | ||
661 | static int __devinit gpio_keys_probe(struct platform_device *pdev) | 676 | static int gpio_keys_probe(struct platform_device *pdev) |
662 | { | 677 | { |
663 | struct device *dev = &pdev->dev; | 678 | struct device *dev = &pdev->dev; |
664 | const struct gpio_keys_platform_data *pdata = dev_get_platdata(dev); | 679 | const struct gpio_keys_platform_data *pdata = dev_get_platdata(dev); |
@@ -731,14 +746,6 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
731 | goto fail3; | 746 | goto fail3; |
732 | } | 747 | } |
733 | 748 | ||
734 | /* get current state of buttons that are connected to GPIOs */ | ||
735 | for (i = 0; i < pdata->nbuttons; i++) { | ||
736 | struct gpio_button_data *bdata = &ddata->data[i]; | ||
737 | if (gpio_is_valid(bdata->button->gpio)) | ||
738 | gpio_keys_gpio_report_event(bdata); | ||
739 | } | ||
740 | input_sync(input); | ||
741 | |||
742 | device_init_wakeup(&pdev->dev, wakeup); | 749 | device_init_wakeup(&pdev->dev, wakeup); |
743 | 750 | ||
744 | return 0; | 751 | return 0; |
@@ -760,7 +767,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
760 | return error; | 767 | return error; |
761 | } | 768 | } |
762 | 769 | ||
763 | static int __devexit gpio_keys_remove(struct platform_device *pdev) | 770 | static int gpio_keys_remove(struct platform_device *pdev) |
764 | { | 771 | { |
765 | struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); | 772 | struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); |
766 | struct input_dev *input = ddata->input; | 773 | struct input_dev *input = ddata->input; |
@@ -788,6 +795,7 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev) | |||
788 | static int gpio_keys_suspend(struct device *dev) | 795 | static int gpio_keys_suspend(struct device *dev) |
789 | { | 796 | { |
790 | struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); | 797 | struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); |
798 | struct input_dev *input = ddata->input; | ||
791 | int i; | 799 | int i; |
792 | 800 | ||
793 | if (device_may_wakeup(dev)) { | 801 | if (device_may_wakeup(dev)) { |
@@ -796,6 +804,11 @@ static int gpio_keys_suspend(struct device *dev) | |||
796 | if (bdata->button->wakeup) | 804 | if (bdata->button->wakeup) |
797 | enable_irq_wake(bdata->irq); | 805 | enable_irq_wake(bdata->irq); |
798 | } | 806 | } |
807 | } else { | ||
808 | mutex_lock(&input->mutex); | ||
809 | if (input->users) | ||
810 | gpio_keys_close(input); | ||
811 | mutex_unlock(&input->mutex); | ||
799 | } | 812 | } |
800 | 813 | ||
801 | return 0; | 814 | return 0; |
@@ -804,18 +817,27 @@ static int gpio_keys_suspend(struct device *dev) | |||
804 | static int gpio_keys_resume(struct device *dev) | 817 | static int gpio_keys_resume(struct device *dev) |
805 | { | 818 | { |
806 | struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); | 819 | struct gpio_keys_drvdata *ddata = dev_get_drvdata(dev); |
820 | struct input_dev *input = ddata->input; | ||
821 | int error = 0; | ||
807 | int i; | 822 | int i; |
808 | 823 | ||
809 | for (i = 0; i < ddata->pdata->nbuttons; i++) { | 824 | if (device_may_wakeup(dev)) { |
810 | struct gpio_button_data *bdata = &ddata->data[i]; | 825 | for (i = 0; i < ddata->pdata->nbuttons; i++) { |
811 | if (bdata->button->wakeup && device_may_wakeup(dev)) | 826 | struct gpio_button_data *bdata = &ddata->data[i]; |
812 | disable_irq_wake(bdata->irq); | 827 | if (bdata->button->wakeup) |
813 | 828 | disable_irq_wake(bdata->irq); | |
814 | if (gpio_is_valid(bdata->button->gpio)) | 829 | } |
815 | gpio_keys_gpio_report_event(bdata); | 830 | } else { |
831 | mutex_lock(&input->mutex); | ||
832 | if (input->users) | ||
833 | error = gpio_keys_open(input); | ||
834 | mutex_unlock(&input->mutex); | ||
816 | } | 835 | } |
817 | input_sync(ddata->input); | ||
818 | 836 | ||
837 | if (error) | ||
838 | return error; | ||
839 | |||
840 | gpio_keys_report_state(ddata); | ||
819 | return 0; | 841 | return 0; |
820 | } | 842 | } |
821 | #endif | 843 | #endif |
@@ -824,7 +846,7 @@ static SIMPLE_DEV_PM_OPS(gpio_keys_pm_ops, gpio_keys_suspend, gpio_keys_resume); | |||
824 | 846 | ||
825 | static struct platform_driver gpio_keys_device_driver = { | 847 | static struct platform_driver gpio_keys_device_driver = { |
826 | .probe = gpio_keys_probe, | 848 | .probe = gpio_keys_probe, |
827 | .remove = __devexit_p(gpio_keys_remove), | 849 | .remove = gpio_keys_remove, |
828 | .driver = { | 850 | .driver = { |
829 | .name = "gpio-keys", | 851 | .name = "gpio-keys", |
830 | .owner = THIS_MODULE, | 852 | .owner = THIS_MODULE, |
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c index f2142de789e..f686fd97055 100644 --- a/drivers/input/keyboard/gpio_keys_polled.c +++ b/drivers/input/keyboard/gpio_keys_polled.c | |||
@@ -103,8 +103,7 @@ static void gpio_keys_polled_close(struct input_polled_dev *dev) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | #ifdef CONFIG_OF | 105 | #ifdef CONFIG_OF |
106 | static struct gpio_keys_platform_data * __devinit | 106 | static struct gpio_keys_platform_data *gpio_keys_polled_get_devtree_pdata(struct device *dev) |
107 | gpio_keys_polled_get_devtree_pdata(struct device *dev) | ||
108 | { | 107 | { |
109 | struct device_node *node, *pp; | 108 | struct device_node *node, *pp; |
110 | struct gpio_keys_platform_data *pdata; | 109 | struct gpio_keys_platform_data *pdata; |
@@ -196,7 +195,7 @@ gpio_keys_polled_get_devtree_pdata(struct device *dev) | |||
196 | } | 195 | } |
197 | #endif | 196 | #endif |
198 | 197 | ||
199 | static int __devinit gpio_keys_polled_probe(struct platform_device *pdev) | 198 | static int gpio_keys_polled_probe(struct platform_device *pdev) |
200 | { | 199 | { |
201 | struct device *dev = &pdev->dev; | 200 | struct device *dev = &pdev->dev; |
202 | const struct gpio_keys_platform_data *pdata = dev_get_platdata(dev); | 201 | const struct gpio_keys_platform_data *pdata = dev_get_platdata(dev); |
@@ -246,7 +245,6 @@ static int __devinit gpio_keys_polled_probe(struct platform_device *pdev) | |||
246 | 245 | ||
247 | input = poll_dev->input; | 246 | input = poll_dev->input; |
248 | 247 | ||
249 | input->evbit[0] = BIT(EV_KEY); | ||
250 | input->name = pdev->name; | 248 | input->name = pdev->name; |
251 | input->phys = DRV_NAME"/input0"; | 249 | input->phys = DRV_NAME"/input0"; |
252 | input->dev.parent = &pdev->dev; | 250 | input->dev.parent = &pdev->dev; |
@@ -256,6 +254,10 @@ static int __devinit gpio_keys_polled_probe(struct platform_device *pdev) | |||
256 | input->id.product = 0x0001; | 254 | input->id.product = 0x0001; |
257 | input->id.version = 0x0100; | 255 | input->id.version = 0x0100; |
258 | 256 | ||
257 | __set_bit(EV_KEY, input->evbit); | ||
258 | if (pdata->rep) | ||
259 | __set_bit(EV_REP, input->evbit); | ||
260 | |||
259 | for (i = 0; i < pdata->nbuttons; i++) { | 261 | for (i = 0; i < pdata->nbuttons; i++) { |
260 | struct gpio_keys_button *button = &pdata->buttons[i]; | 262 | struct gpio_keys_button *button = &pdata->buttons[i]; |
261 | struct gpio_keys_button_data *bdata = &bdev->data[i]; | 263 | struct gpio_keys_button_data *bdata = &bdev->data[i]; |
@@ -268,22 +270,14 @@ static int __devinit gpio_keys_polled_probe(struct platform_device *pdev) | |||
268 | goto err_free_gpio; | 270 | goto err_free_gpio; |
269 | } | 271 | } |
270 | 272 | ||
271 | error = gpio_request(gpio, | 273 | error = gpio_request_one(gpio, GPIOF_IN, |
272 | button->desc ? button->desc : DRV_NAME); | 274 | button->desc ?: DRV_NAME); |
273 | if (error) { | 275 | if (error) { |
274 | dev_err(dev, "unable to claim gpio %u, err=%d\n", | 276 | dev_err(dev, "unable to claim gpio %u, err=%d\n", |
275 | gpio, error); | 277 | gpio, error); |
276 | goto err_free_gpio; | 278 | goto err_free_gpio; |
277 | } | 279 | } |
278 | 280 | ||
279 | error = gpio_direction_input(gpio); | ||
280 | if (error) { | ||
281 | dev_err(dev, | ||
282 | "unable to set direction on gpio %u, err=%d\n", | ||
283 | gpio, error); | ||
284 | goto err_free_gpio; | ||
285 | } | ||
286 | |||
287 | bdata->can_sleep = gpio_cansleep(gpio); | 281 | bdata->can_sleep = gpio_cansleep(gpio); |
288 | bdata->last_state = -1; | 282 | bdata->last_state = -1; |
289 | bdata->threshold = DIV_ROUND_UP(button->debounce_interval, | 283 | bdata->threshold = DIV_ROUND_UP(button->debounce_interval, |
@@ -329,7 +323,7 @@ err_free_pdata: | |||
329 | return error; | 323 | return error; |
330 | } | 324 | } |
331 | 325 | ||
332 | static int __devexit gpio_keys_polled_remove(struct platform_device *pdev) | 326 | static int gpio_keys_polled_remove(struct platform_device *pdev) |
333 | { | 327 | { |
334 | struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev); | 328 | struct gpio_keys_polled_dev *bdev = platform_get_drvdata(pdev); |
335 | const struct gpio_keys_platform_data *pdata = bdev->pdata; | 329 | const struct gpio_keys_platform_data *pdata = bdev->pdata; |
@@ -357,7 +351,7 @@ static int __devexit gpio_keys_polled_remove(struct platform_device *pdev) | |||
357 | 351 | ||
358 | static struct platform_driver gpio_keys_polled_driver = { | 352 | static struct platform_driver gpio_keys_polled_driver = { |
359 | .probe = gpio_keys_polled_probe, | 353 | .probe = gpio_keys_polled_probe, |
360 | .remove = __devexit_p(gpio_keys_polled_remove), | 354 | .remove = gpio_keys_polled_remove, |
361 | .driver = { | 355 | .driver = { |
362 | .name = DRV_NAME, | 356 | .name = DRV_NAME, |
363 | .owner = THIS_MODULE, | 357 | .owner = THIS_MODULE, |
diff --git a/drivers/input/keyboard/hilkbd.c b/drivers/input/keyboard/hilkbd.c index 5f72440b50c..198dc07a1be 100644 --- a/drivers/input/keyboard/hilkbd.c +++ b/drivers/input/keyboard/hilkbd.c | |||
@@ -200,7 +200,7 @@ static void hil_do(unsigned char cmd, unsigned char *data, unsigned int len) | |||
200 | 200 | ||
201 | 201 | ||
202 | /* initialize HIL */ | 202 | /* initialize HIL */ |
203 | static int __devinit hil_keyb_init(void) | 203 | static int hil_keyb_init(void) |
204 | { | 204 | { |
205 | unsigned char c; | 205 | unsigned char c; |
206 | unsigned int i, kbid; | 206 | unsigned int i, kbid; |
@@ -286,7 +286,7 @@ err1: | |||
286 | return err; | 286 | return err; |
287 | } | 287 | } |
288 | 288 | ||
289 | static void __devexit hil_keyb_exit(void) | 289 | static void hil_keyb_exit(void) |
290 | { | 290 | { |
291 | if (HIL_IRQ) | 291 | if (HIL_IRQ) |
292 | free_irq(HIL_IRQ, hil_dev.dev_id); | 292 | free_irq(HIL_IRQ, hil_dev.dev_id); |
@@ -299,7 +299,7 @@ static void __devexit hil_keyb_exit(void) | |||
299 | } | 299 | } |
300 | 300 | ||
301 | #if defined(CONFIG_PARISC) | 301 | #if defined(CONFIG_PARISC) |
302 | static int __devinit hil_probe_chip(struct parisc_device *dev) | 302 | static int hil_probe_chip(struct parisc_device *dev) |
303 | { | 303 | { |
304 | /* Only allow one HIL keyboard */ | 304 | /* Only allow one HIL keyboard */ |
305 | if (hil_dev.dev) | 305 | if (hil_dev.dev) |
@@ -320,7 +320,7 @@ static int __devinit hil_probe_chip(struct parisc_device *dev) | |||
320 | return hil_keyb_init(); | 320 | return hil_keyb_init(); |
321 | } | 321 | } |
322 | 322 | ||
323 | static int __devexit hil_remove_chip(struct parisc_device *dev) | 323 | static int hil_remove_chip(struct parisc_device *dev) |
324 | { | 324 | { |
325 | hil_keyb_exit(); | 325 | hil_keyb_exit(); |
326 | 326 | ||
@@ -341,7 +341,7 @@ static struct parisc_driver hil_driver = { | |||
341 | .name = "hil", | 341 | .name = "hil", |
342 | .id_table = hil_tbl, | 342 | .id_table = hil_tbl, |
343 | .probe = hil_probe_chip, | 343 | .probe = hil_probe_chip, |
344 | .remove = __devexit_p(hil_remove_chip), | 344 | .remove = hil_remove_chip, |
345 | }; | 345 | }; |
346 | 346 | ||
347 | static int __init hil_init(void) | 347 | static int __init hil_init(void) |
diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index cdc252612c0..6d150e3e1f5 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c | |||
@@ -362,7 +362,8 @@ static void imx_keypad_inhibit(struct imx_keypad *keypad) | |||
362 | writew(reg_val, keypad->mmio_base + KPSR); | 362 | writew(reg_val, keypad->mmio_base + KPSR); |
363 | 363 | ||
364 | /* Colums as open drain and disable all rows */ | 364 | /* Colums as open drain and disable all rows */ |
365 | writew(0xff00, keypad->mmio_base + KPCR); | 365 | reg_val = (keypad->cols_en_mask & 0xff) << 8; |
366 | writew(reg_val, keypad->mmio_base + KPCR); | ||
366 | } | 367 | } |
367 | 368 | ||
368 | static void imx_keypad_close(struct input_dev *dev) | 369 | static void imx_keypad_close(struct input_dev *dev) |
@@ -413,7 +414,7 @@ open_err: | |||
413 | return -EIO; | 414 | return -EIO; |
414 | } | 415 | } |
415 | 416 | ||
416 | static int __devinit imx_keypad_probe(struct platform_device *pdev) | 417 | static int imx_keypad_probe(struct platform_device *pdev) |
417 | { | 418 | { |
418 | const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data; | 419 | const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data; |
419 | struct imx_keypad *keypad; | 420 | struct imx_keypad *keypad; |
@@ -554,7 +555,7 @@ failed_rel_mem: | |||
554 | return error; | 555 | return error; |
555 | } | 556 | } |
556 | 557 | ||
557 | static int __devexit imx_keypad_remove(struct platform_device *pdev) | 558 | static int imx_keypad_remove(struct platform_device *pdev) |
558 | { | 559 | { |
559 | struct imx_keypad *keypad = platform_get_drvdata(pdev); | 560 | struct imx_keypad *keypad = platform_get_drvdata(pdev); |
560 | struct resource *res; | 561 | struct resource *res; |
@@ -632,7 +633,7 @@ static struct platform_driver imx_keypad_driver = { | |||
632 | .pm = &imx_kbd_pm_ops, | 633 | .pm = &imx_kbd_pm_ops, |
633 | }, | 634 | }, |
634 | .probe = imx_keypad_probe, | 635 | .probe = imx_keypad_probe, |
635 | .remove = __devexit_p(imx_keypad_remove), | 636 | .remove = imx_keypad_remove, |
636 | }; | 637 | }; |
637 | module_platform_driver(imx_keypad_driver); | 638 | module_platform_driver(imx_keypad_driver); |
638 | 639 | ||
diff --git a/drivers/input/keyboard/jornada680_kbd.c b/drivers/input/keyboard/jornada680_kbd.c index 24f3ea01c4d..74e75a6e8de 100644 --- a/drivers/input/keyboard/jornada680_kbd.c +++ b/drivers/input/keyboard/jornada680_kbd.c | |||
@@ -179,7 +179,7 @@ static void jornadakbd680_poll(struct input_polled_dev *dev) | |||
179 | memcpy(jornadakbd->old_scan, jornadakbd->new_scan, JORNADA_SCAN_SIZE); | 179 | memcpy(jornadakbd->old_scan, jornadakbd->new_scan, JORNADA_SCAN_SIZE); |
180 | } | 180 | } |
181 | 181 | ||
182 | static int __devinit jornada680kbd_probe(struct platform_device *pdev) | 182 | static int jornada680kbd_probe(struct platform_device *pdev) |
183 | { | 183 | { |
184 | struct jornadakbd *jornadakbd; | 184 | struct jornadakbd *jornadakbd; |
185 | struct input_polled_dev *poll_dev; | 185 | struct input_polled_dev *poll_dev; |
@@ -240,7 +240,7 @@ static int __devinit jornada680kbd_probe(struct platform_device *pdev) | |||
240 | 240 | ||
241 | } | 241 | } |
242 | 242 | ||
243 | static int __devexit jornada680kbd_remove(struct platform_device *pdev) | 243 | static int jornada680kbd_remove(struct platform_device *pdev) |
244 | { | 244 | { |
245 | struct jornadakbd *jornadakbd = platform_get_drvdata(pdev); | 245 | struct jornadakbd *jornadakbd = platform_get_drvdata(pdev); |
246 | 246 | ||
@@ -258,7 +258,7 @@ static struct platform_driver jornada680kbd_driver = { | |||
258 | .owner = THIS_MODULE, | 258 | .owner = THIS_MODULE, |
259 | }, | 259 | }, |
260 | .probe = jornada680kbd_probe, | 260 | .probe = jornada680kbd_probe, |
261 | .remove = __devexit_p(jornada680kbd_remove), | 261 | .remove = jornada680kbd_remove, |
262 | }; | 262 | }; |
263 | module_platform_driver(jornada680kbd_driver); | 263 | module_platform_driver(jornada680kbd_driver); |
264 | 264 | ||
diff --git a/drivers/input/keyboard/jornada720_kbd.c b/drivers/input/keyboard/jornada720_kbd.c index 9d639fa1afb..5ceef636df2 100644 --- a/drivers/input/keyboard/jornada720_kbd.c +++ b/drivers/input/keyboard/jornada720_kbd.c | |||
@@ -94,7 +94,7 @@ static irqreturn_t jornada720_kbd_interrupt(int irq, void *dev_id) | |||
94 | return IRQ_HANDLED; | 94 | return IRQ_HANDLED; |
95 | }; | 95 | }; |
96 | 96 | ||
97 | static int __devinit jornada720_kbd_probe(struct platform_device *pdev) | 97 | static int jornada720_kbd_probe(struct platform_device *pdev) |
98 | { | 98 | { |
99 | struct jornadakbd *jornadakbd; | 99 | struct jornadakbd *jornadakbd; |
100 | struct input_dev *input_dev; | 100 | struct input_dev *input_dev; |
@@ -152,7 +152,7 @@ static int __devinit jornada720_kbd_probe(struct platform_device *pdev) | |||
152 | return err; | 152 | return err; |
153 | }; | 153 | }; |
154 | 154 | ||
155 | static int __devexit jornada720_kbd_remove(struct platform_device *pdev) | 155 | static int jornada720_kbd_remove(struct platform_device *pdev) |
156 | { | 156 | { |
157 | struct jornadakbd *jornadakbd = platform_get_drvdata(pdev); | 157 | struct jornadakbd *jornadakbd = platform_get_drvdata(pdev); |
158 | 158 | ||
@@ -173,6 +173,6 @@ static struct platform_driver jornada720_kbd_driver = { | |||
173 | .owner = THIS_MODULE, | 173 | .owner = THIS_MODULE, |
174 | }, | 174 | }, |
175 | .probe = jornada720_kbd_probe, | 175 | .probe = jornada720_kbd_probe, |
176 | .remove = __devexit_p(jornada720_kbd_remove), | 176 | .remove = jornada720_kbd_remove, |
177 | }; | 177 | }; |
178 | module_platform_driver(jornada720_kbd_driver); | 178 | module_platform_driver(jornada720_kbd_driver); |
diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c index 39ac2787e27..93c81266213 100644 --- a/drivers/input/keyboard/lm8323.c +++ b/drivers/input/keyboard/lm8323.c | |||
@@ -624,7 +624,7 @@ static ssize_t lm8323_set_disable(struct device *dev, | |||
624 | } | 624 | } |
625 | static DEVICE_ATTR(disable_kp, 0644, lm8323_show_disable, lm8323_set_disable); | 625 | static DEVICE_ATTR(disable_kp, 0644, lm8323_show_disable, lm8323_set_disable); |
626 | 626 | ||
627 | static int __devinit lm8323_probe(struct i2c_client *client, | 627 | static int lm8323_probe(struct i2c_client *client, |
628 | const struct i2c_device_id *id) | 628 | const struct i2c_device_id *id) |
629 | { | 629 | { |
630 | struct lm8323_platform_data *pdata = client->dev.platform_data; | 630 | struct lm8323_platform_data *pdata = client->dev.platform_data; |
@@ -764,7 +764,7 @@ fail1: | |||
764 | return err; | 764 | return err; |
765 | } | 765 | } |
766 | 766 | ||
767 | static int __devexit lm8323_remove(struct i2c_client *client) | 767 | static int lm8323_remove(struct i2c_client *client) |
768 | { | 768 | { |
769 | struct lm8323_chip *lm = i2c_get_clientdata(client); | 769 | struct lm8323_chip *lm = i2c_get_clientdata(client); |
770 | int i; | 770 | int i; |
@@ -846,7 +846,7 @@ static struct i2c_driver lm8323_i2c_driver = { | |||
846 | .pm = &lm8323_pm_ops, | 846 | .pm = &lm8323_pm_ops, |
847 | }, | 847 | }, |
848 | .probe = lm8323_probe, | 848 | .probe = lm8323_probe, |
849 | .remove = __devexit_p(lm8323_remove), | 849 | .remove = lm8323_remove, |
850 | .id_table = lm8323_id, | 850 | .id_table = lm8323_id, |
851 | }; | 851 | }; |
852 | MODULE_DEVICE_TABLE(i2c, lm8323_id); | 852 | MODULE_DEVICE_TABLE(i2c, lm8323_id); |
diff --git a/drivers/input/keyboard/lm8333.c b/drivers/input/keyboard/lm8333.c index 081fd9effa8..5a8ca35dc9a 100644 --- a/drivers/input/keyboard/lm8333.c +++ b/drivers/input/keyboard/lm8333.c | |||
@@ -128,7 +128,7 @@ static irqreturn_t lm8333_irq_thread(int irq, void *data) | |||
128 | return IRQ_HANDLED; | 128 | return IRQ_HANDLED; |
129 | } | 129 | } |
130 | 130 | ||
131 | static int __devinit lm8333_probe(struct i2c_client *client, | 131 | static int lm8333_probe(struct i2c_client *client, |
132 | const struct i2c_device_id *id) | 132 | const struct i2c_device_id *id) |
133 | { | 133 | { |
134 | const struct lm8333_platform_data *pdata = client->dev.platform_data; | 134 | const struct lm8333_platform_data *pdata = client->dev.platform_data; |
@@ -202,7 +202,7 @@ static int __devinit lm8333_probe(struct i2c_client *client, | |||
202 | return err; | 202 | return err; |
203 | } | 203 | } |
204 | 204 | ||
205 | static int __devexit lm8333_remove(struct i2c_client *client) | 205 | static int lm8333_remove(struct i2c_client *client) |
206 | { | 206 | { |
207 | struct lm8333 *lm8333 = i2c_get_clientdata(client); | 207 | struct lm8333 *lm8333 = i2c_get_clientdata(client); |
208 | 208 | ||
@@ -225,7 +225,7 @@ static struct i2c_driver lm8333_driver = { | |||
225 | .owner = THIS_MODULE, | 225 | .owner = THIS_MODULE, |
226 | }, | 226 | }, |
227 | .probe = lm8333_probe, | 227 | .probe = lm8333_probe, |
228 | .remove = __devexit_p(lm8333_remove), | 228 | .remove = lm8333_remove, |
229 | .id_table = lm8333_id, | 229 | .id_table = lm8333_id, |
230 | }; | 230 | }; |
231 | module_i2c_driver(lm8333_driver); | 231 | module_i2c_driver(lm8333_driver); |
diff --git a/drivers/input/keyboard/locomokbd.c b/drivers/input/keyboard/locomokbd.c index b1ab29861e1..c94d610b9d7 100644 --- a/drivers/input/keyboard/locomokbd.c +++ b/drivers/input/keyboard/locomokbd.c | |||
@@ -46,7 +46,7 @@ MODULE_LICENSE("GPL"); | |||
46 | #define KEY_CENTER KEY_F15 | 46 | #define KEY_CENTER KEY_F15 |
47 | 47 | ||
48 | static const unsigned char | 48 | static const unsigned char |
49 | locomokbd_keycode[LOCOMOKBD_NUMKEYS] __devinitconst = { | 49 | locomokbd_keycode[LOCOMOKBD_NUMKEYS] = { |
50 | 0, KEY_ESC, KEY_ACTIVITY, 0, 0, 0, 0, 0, 0, 0, /* 0 - 9 */ | 50 | 0, KEY_ESC, KEY_ACTIVITY, 0, 0, 0, 0, 0, 0, 0, /* 0 - 9 */ |
51 | 0, 0, 0, 0, 0, 0, 0, KEY_MENU, KEY_HOME, KEY_CONTACT, /* 10 - 19 */ | 51 | 0, 0, 0, 0, 0, 0, 0, KEY_MENU, KEY_HOME, KEY_CONTACT, /* 10 - 19 */ |
52 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 29 */ | 52 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 20 - 29 */ |
@@ -236,7 +236,7 @@ static void locomokbd_close(struct input_dev *dev) | |||
236 | locomo_writel(r, locomokbd->base + LOCOMO_KIC); | 236 | locomo_writel(r, locomokbd->base + LOCOMO_KIC); |
237 | } | 237 | } |
238 | 238 | ||
239 | static int __devinit locomokbd_probe(struct locomo_dev *dev) | 239 | static int locomokbd_probe(struct locomo_dev *dev) |
240 | { | 240 | { |
241 | struct locomokbd *locomokbd; | 241 | struct locomokbd *locomokbd; |
242 | struct input_dev *input_dev; | 242 | struct input_dev *input_dev; |
@@ -321,7 +321,7 @@ static int __devinit locomokbd_probe(struct locomo_dev *dev) | |||
321 | return err; | 321 | return err; |
322 | } | 322 | } |
323 | 323 | ||
324 | static int __devexit locomokbd_remove(struct locomo_dev *dev) | 324 | static int locomokbd_remove(struct locomo_dev *dev) |
325 | { | 325 | { |
326 | struct locomokbd *locomokbd = locomo_get_drvdata(dev); | 326 | struct locomokbd *locomokbd = locomo_get_drvdata(dev); |
327 | 327 | ||
@@ -345,7 +345,7 @@ static struct locomo_driver keyboard_driver = { | |||
345 | }, | 345 | }, |
346 | .devid = LOCOMO_DEVID_KEYBOARD, | 346 | .devid = LOCOMO_DEVID_KEYBOARD, |
347 | .probe = locomokbd_probe, | 347 | .probe = locomokbd_probe, |
348 | .remove = __devexit_p(locomokbd_remove), | 348 | .remove = locomokbd_remove, |
349 | }; | 349 | }; |
350 | 350 | ||
351 | static int __init locomokbd_init(void) | 351 | static int __init locomokbd_init(void) |
diff --git a/drivers/input/keyboard/lpc32xx-keys.c b/drivers/input/keyboard/lpc32xx-keys.c index dd786c8a758..1b8add6cfb9 100644 --- a/drivers/input/keyboard/lpc32xx-keys.c +++ b/drivers/input/keyboard/lpc32xx-keys.c | |||
@@ -139,7 +139,7 @@ static void lpc32xx_kscan_close(struct input_dev *dev) | |||
139 | clk_disable_unprepare(kscandat->clk); | 139 | clk_disable_unprepare(kscandat->clk); |
140 | } | 140 | } |
141 | 141 | ||
142 | static int __devinit lpc32xx_parse_dt(struct device *dev, | 142 | static int lpc32xx_parse_dt(struct device *dev, |
143 | struct lpc32xx_kscan_drv *kscandat) | 143 | struct lpc32xx_kscan_drv *kscandat) |
144 | { | 144 | { |
145 | struct device_node *np = dev->of_node; | 145 | struct device_node *np = dev->of_node; |
@@ -166,7 +166,7 @@ static int __devinit lpc32xx_parse_dt(struct device *dev, | |||
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | 168 | ||
169 | static int __devinit lpc32xx_kscan_probe(struct platform_device *pdev) | 169 | static int lpc32xx_kscan_probe(struct platform_device *pdev) |
170 | { | 170 | { |
171 | struct lpc32xx_kscan_drv *kscandat; | 171 | struct lpc32xx_kscan_drv *kscandat; |
172 | struct input_dev *input; | 172 | struct input_dev *input; |
@@ -310,7 +310,7 @@ err_free_mem: | |||
310 | return error; | 310 | return error; |
311 | } | 311 | } |
312 | 312 | ||
313 | static int __devexit lpc32xx_kscan_remove(struct platform_device *pdev) | 313 | static int lpc32xx_kscan_remove(struct platform_device *pdev) |
314 | { | 314 | { |
315 | struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev); | 315 | struct lpc32xx_kscan_drv *kscandat = platform_get_drvdata(pdev); |
316 | 316 | ||
@@ -377,7 +377,7 @@ MODULE_DEVICE_TABLE(of, lpc32xx_kscan_match); | |||
377 | 377 | ||
378 | static struct platform_driver lpc32xx_kscan_driver = { | 378 | static struct platform_driver lpc32xx_kscan_driver = { |
379 | .probe = lpc32xx_kscan_probe, | 379 | .probe = lpc32xx_kscan_probe, |
380 | .remove = __devexit_p(lpc32xx_kscan_remove), | 380 | .remove = lpc32xx_kscan_remove, |
381 | .driver = { | 381 | .driver = { |
382 | .name = DRV_NAME, | 382 | .name = DRV_NAME, |
383 | .owner = THIS_MODULE, | 383 | .owner = THIS_MODULE, |
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 18b72372028..f4ff0dda759 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c | |||
@@ -23,6 +23,9 @@ | |||
23 | #include <linux/gpio.h> | 23 | #include <linux/gpio.h> |
24 | #include <linux/input/matrix_keypad.h> | 24 | #include <linux/input/matrix_keypad.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/of.h> | ||
27 | #include <linux/of_gpio.h> | ||
28 | #include <linux/of_platform.h> | ||
26 | 29 | ||
27 | struct matrix_keypad { | 30 | struct matrix_keypad { |
28 | const struct matrix_keypad_platform_data *pdata; | 31 | const struct matrix_keypad_platform_data *pdata; |
@@ -37,8 +40,6 @@ struct matrix_keypad { | |||
37 | bool scan_pending; | 40 | bool scan_pending; |
38 | bool stopped; | 41 | bool stopped; |
39 | bool gpio_all_disabled; | 42 | bool gpio_all_disabled; |
40 | |||
41 | unsigned short keycodes[]; | ||
42 | }; | 43 | }; |
43 | 44 | ||
44 | /* | 45 | /* |
@@ -118,6 +119,7 @@ static void matrix_keypad_scan(struct work_struct *work) | |||
118 | struct matrix_keypad *keypad = | 119 | struct matrix_keypad *keypad = |
119 | container_of(work, struct matrix_keypad, work.work); | 120 | container_of(work, struct matrix_keypad, work.work); |
120 | struct input_dev *input_dev = keypad->input_dev; | 121 | struct input_dev *input_dev = keypad->input_dev; |
122 | const unsigned short *keycodes = input_dev->keycode; | ||
121 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | 123 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; |
122 | uint32_t new_state[MATRIX_MAX_COLS]; | 124 | uint32_t new_state[MATRIX_MAX_COLS]; |
123 | int row, col, code; | 125 | int row, col, code; |
@@ -153,7 +155,7 @@ static void matrix_keypad_scan(struct work_struct *work) | |||
153 | code = MATRIX_SCAN_CODE(row, col, keypad->row_shift); | 155 | code = MATRIX_SCAN_CODE(row, col, keypad->row_shift); |
154 | input_event(input_dev, EV_MSC, MSC_SCAN, code); | 156 | input_event(input_dev, EV_MSC, MSC_SCAN, code); |
155 | input_report_key(input_dev, | 157 | input_report_key(input_dev, |
156 | keypad->keycodes[code], | 158 | keycodes[code], |
157 | new_state[col] & (1 << row)); | 159 | new_state[col] & (1 << row)); |
158 | } | 160 | } |
159 | } | 161 | } |
@@ -299,8 +301,8 @@ static int matrix_keypad_resume(struct device *dev) | |||
299 | static SIMPLE_DEV_PM_OPS(matrix_keypad_pm_ops, | 301 | static SIMPLE_DEV_PM_OPS(matrix_keypad_pm_ops, |
300 | matrix_keypad_suspend, matrix_keypad_resume); | 302 | matrix_keypad_suspend, matrix_keypad_resume); |
301 | 303 | ||
302 | static int __devinit matrix_keypad_init_gpio(struct platform_device *pdev, | 304 | static int matrix_keypad_init_gpio(struct platform_device *pdev, |
303 | struct matrix_keypad *keypad) | 305 | struct matrix_keypad *keypad) |
304 | { | 306 | { |
305 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | 307 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; |
306 | int i, err; | 308 | int i, err; |
@@ -394,33 +396,95 @@ static void matrix_keypad_free_gpio(struct matrix_keypad *keypad) | |||
394 | gpio_free(pdata->col_gpios[i]); | 396 | gpio_free(pdata->col_gpios[i]); |
395 | } | 397 | } |
396 | 398 | ||
397 | static int __devinit matrix_keypad_probe(struct platform_device *pdev) | 399 | #ifdef CONFIG_OF |
400 | static struct matrix_keypad_platform_data * | ||
401 | matrix_keypad_parse_dt(struct device *dev) | ||
402 | { | ||
403 | struct matrix_keypad_platform_data *pdata; | ||
404 | struct device_node *np = dev->of_node; | ||
405 | unsigned int *gpios; | ||
406 | int i; | ||
407 | |||
408 | if (!np) { | ||
409 | dev_err(dev, "device lacks DT data\n"); | ||
410 | return ERR_PTR(-ENODEV); | ||
411 | } | ||
412 | |||
413 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | ||
414 | if (!pdata) { | ||
415 | dev_err(dev, "could not allocate memory for platform data\n"); | ||
416 | return ERR_PTR(-ENOMEM); | ||
417 | } | ||
418 | |||
419 | pdata->num_row_gpios = of_gpio_named_count(np, "row-gpios"); | ||
420 | pdata->num_col_gpios = of_gpio_named_count(np, "col-gpios"); | ||
421 | if (!pdata->num_row_gpios || !pdata->num_col_gpios) { | ||
422 | dev_err(dev, "number of keypad rows/columns not specified\n"); | ||
423 | return ERR_PTR(-EINVAL); | ||
424 | } | ||
425 | |||
426 | if (of_get_property(np, "linux,no-autorepeat", NULL)) | ||
427 | pdata->no_autorepeat = true; | ||
428 | if (of_get_property(np, "linux,wakeup", NULL)) | ||
429 | pdata->wakeup = true; | ||
430 | if (of_get_property(np, "gpio-activelow", NULL)) | ||
431 | pdata->active_low = true; | ||
432 | |||
433 | of_property_read_u32(np, "debounce-delay-ms", &pdata->debounce_ms); | ||
434 | of_property_read_u32(np, "col-scan-delay-us", | ||
435 | &pdata->col_scan_delay_us); | ||
436 | |||
437 | gpios = devm_kzalloc(dev, | ||
438 | sizeof(unsigned int) * | ||
439 | (pdata->num_row_gpios + pdata->num_col_gpios), | ||
440 | GFP_KERNEL); | ||
441 | if (!gpios) { | ||
442 | dev_err(dev, "could not allocate memory for gpios\n"); | ||
443 | return ERR_PTR(-ENOMEM); | ||
444 | } | ||
445 | |||
446 | for (i = 0; i < pdata->num_row_gpios; i++) | ||
447 | gpios[i] = of_get_named_gpio(np, "row-gpios", i); | ||
448 | |||
449 | for (i = 0; i < pdata->num_col_gpios; i++) | ||
450 | gpios[pdata->num_row_gpios + i] = | ||
451 | of_get_named_gpio(np, "col-gpios", i); | ||
452 | |||
453 | pdata->row_gpios = gpios; | ||
454 | pdata->col_gpios = &gpios[pdata->num_row_gpios]; | ||
455 | |||
456 | return pdata; | ||
457 | } | ||
458 | #else | ||
459 | static inline struct matrix_keypad_platform_data * | ||
460 | matrix_keypad_parse_dt(struct device *dev) | ||
461 | { | ||
462 | dev_err(dev, "no platform data defined\n"); | ||
463 | |||
464 | return ERR_PTR(-EINVAL); | ||
465 | } | ||
466 | #endif | ||
467 | |||
468 | static int matrix_keypad_probe(struct platform_device *pdev) | ||
398 | { | 469 | { |
399 | const struct matrix_keypad_platform_data *pdata; | 470 | const struct matrix_keypad_platform_data *pdata; |
400 | const struct matrix_keymap_data *keymap_data; | ||
401 | struct matrix_keypad *keypad; | 471 | struct matrix_keypad *keypad; |
402 | struct input_dev *input_dev; | 472 | struct input_dev *input_dev; |
403 | unsigned int row_shift; | ||
404 | size_t keymap_size; | ||
405 | int err; | 473 | int err; |
406 | 474 | ||
407 | pdata = pdev->dev.platform_data; | 475 | pdata = dev_get_platdata(&pdev->dev); |
408 | if (!pdata) { | 476 | if (!pdata) { |
409 | dev_err(&pdev->dev, "no platform data defined\n"); | 477 | pdata = matrix_keypad_parse_dt(&pdev->dev); |
410 | return -EINVAL; | 478 | if (IS_ERR(pdata)) { |
411 | } | 479 | dev_err(&pdev->dev, "no platform data defined\n"); |
412 | 480 | return PTR_ERR(pdata); | |
413 | keymap_data = pdata->keymap_data; | 481 | } |
414 | if (!keymap_data) { | 482 | } else if (!pdata->keymap_data) { |
415 | dev_err(&pdev->dev, "no keymap data defined\n"); | 483 | dev_err(&pdev->dev, "no keymap data defined\n"); |
416 | return -EINVAL; | 484 | return -EINVAL; |
417 | } | 485 | } |
418 | 486 | ||
419 | row_shift = get_count_order(pdata->num_col_gpios); | 487 | keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL); |
420 | keymap_size = (pdata->num_row_gpios << row_shift) * | ||
421 | sizeof(keypad->keycodes[0]); | ||
422 | keypad = kzalloc(sizeof(struct matrix_keypad) + keymap_size, | ||
423 | GFP_KERNEL); | ||
424 | input_dev = input_allocate_device(); | 488 | input_dev = input_allocate_device(); |
425 | if (!keypad || !input_dev) { | 489 | if (!keypad || !input_dev) { |
426 | err = -ENOMEM; | 490 | err = -ENOMEM; |
@@ -429,7 +493,7 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev) | |||
429 | 493 | ||
430 | keypad->input_dev = input_dev; | 494 | keypad->input_dev = input_dev; |
431 | keypad->pdata = pdata; | 495 | keypad->pdata = pdata; |
432 | keypad->row_shift = row_shift; | 496 | keypad->row_shift = get_count_order(pdata->num_col_gpios); |
433 | keypad->stopped = true; | 497 | keypad->stopped = true; |
434 | INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan); | 498 | INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan); |
435 | spin_lock_init(&keypad->lock); | 499 | spin_lock_init(&keypad->lock); |
@@ -440,12 +504,14 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev) | |||
440 | input_dev->open = matrix_keypad_start; | 504 | input_dev->open = matrix_keypad_start; |
441 | input_dev->close = matrix_keypad_stop; | 505 | input_dev->close = matrix_keypad_stop; |
442 | 506 | ||
443 | err = matrix_keypad_build_keymap(keymap_data, NULL, | 507 | err = matrix_keypad_build_keymap(pdata->keymap_data, NULL, |
444 | pdata->num_row_gpios, | 508 | pdata->num_row_gpios, |
445 | pdata->num_col_gpios, | 509 | pdata->num_col_gpios, |
446 | keypad->keycodes, input_dev); | 510 | NULL, input_dev); |
447 | if (err) | 511 | if (err) { |
512 | dev_err(&pdev->dev, "failed to build keymap\n"); | ||
448 | goto err_free_mem; | 513 | goto err_free_mem; |
514 | } | ||
449 | 515 | ||
450 | if (!pdata->no_autorepeat) | 516 | if (!pdata->no_autorepeat) |
451 | __set_bit(EV_REP, input_dev->evbit); | 517 | __set_bit(EV_REP, input_dev->evbit); |
@@ -473,7 +539,7 @@ err_free_mem: | |||
473 | return err; | 539 | return err; |
474 | } | 540 | } |
475 | 541 | ||
476 | static int __devexit matrix_keypad_remove(struct platform_device *pdev) | 542 | static int matrix_keypad_remove(struct platform_device *pdev) |
477 | { | 543 | { |
478 | struct matrix_keypad *keypad = platform_get_drvdata(pdev); | 544 | struct matrix_keypad *keypad = platform_get_drvdata(pdev); |
479 | 545 | ||
@@ -488,13 +554,22 @@ static int __devexit matrix_keypad_remove(struct platform_device *pdev) | |||
488 | return 0; | 554 | return 0; |
489 | } | 555 | } |
490 | 556 | ||
557 | #ifdef CONFIG_OF | ||
558 | static const struct of_device_id matrix_keypad_dt_match[] = { | ||
559 | { .compatible = "gpio-matrix-keypad" }, | ||
560 | { } | ||
561 | }; | ||
562 | MODULE_DEVICE_TABLE(of, matrix_keypad_dt_match); | ||
563 | #endif | ||
564 | |||
491 | static struct platform_driver matrix_keypad_driver = { | 565 | static struct platform_driver matrix_keypad_driver = { |
492 | .probe = matrix_keypad_probe, | 566 | .probe = matrix_keypad_probe, |
493 | .remove = __devexit_p(matrix_keypad_remove), | 567 | .remove = matrix_keypad_remove, |
494 | .driver = { | 568 | .driver = { |
495 | .name = "matrix-keypad", | 569 | .name = "matrix-keypad", |
496 | .owner = THIS_MODULE, | 570 | .owner = THIS_MODULE, |
497 | .pm = &matrix_keypad_pm_ops, | 571 | .pm = &matrix_keypad_pm_ops, |
572 | .of_match_table = of_match_ptr(matrix_keypad_dt_match), | ||
498 | }, | 573 | }, |
499 | }; | 574 | }; |
500 | module_platform_driver(matrix_keypad_driver); | 575 | module_platform_driver(matrix_keypad_driver); |
diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c index 8edada8ae71..7c7af2b01e6 100644 --- a/drivers/input/keyboard/max7359_keypad.c +++ b/drivers/input/keyboard/max7359_keypad.c | |||
@@ -179,7 +179,7 @@ static void max7359_initialize(struct i2c_client *client) | |||
179 | max7359_fall_deepsleep(client); | 179 | max7359_fall_deepsleep(client); |
180 | } | 180 | } |
181 | 181 | ||
182 | static int __devinit max7359_probe(struct i2c_client *client, | 182 | static int max7359_probe(struct i2c_client *client, |
183 | const struct i2c_device_id *id) | 183 | const struct i2c_device_id *id) |
184 | { | 184 | { |
185 | const struct matrix_keymap_data *keymap_data = client->dev.platform_data; | 185 | const struct matrix_keymap_data *keymap_data = client->dev.platform_data; |
@@ -260,7 +260,7 @@ failed_free_mem: | |||
260 | return error; | 260 | return error; |
261 | } | 261 | } |
262 | 262 | ||
263 | static int __devexit max7359_remove(struct i2c_client *client) | 263 | static int max7359_remove(struct i2c_client *client) |
264 | { | 264 | { |
265 | struct max7359_keypad *keypad = i2c_get_clientdata(client); | 265 | struct max7359_keypad *keypad = i2c_get_clientdata(client); |
266 | 266 | ||
@@ -312,7 +312,7 @@ static struct i2c_driver max7359_i2c_driver = { | |||
312 | .pm = &max7359_pm, | 312 | .pm = &max7359_pm, |
313 | }, | 313 | }, |
314 | .probe = max7359_probe, | 314 | .probe = max7359_probe, |
315 | .remove = __devexit_p(max7359_remove), | 315 | .remove = max7359_remove, |
316 | .id_table = max7359_ids, | 316 | .id_table = max7359_ids, |
317 | }; | 317 | }; |
318 | 318 | ||
diff --git a/drivers/input/keyboard/mcs_touchkey.c b/drivers/input/keyboard/mcs_touchkey.c index 0d77f6c8495..7c236f9c6a5 100644 --- a/drivers/input/keyboard/mcs_touchkey.c +++ b/drivers/input/keyboard/mcs_touchkey.c | |||
@@ -97,7 +97,7 @@ static irqreturn_t mcs_touchkey_interrupt(int irq, void *dev_id) | |||
97 | return IRQ_HANDLED; | 97 | return IRQ_HANDLED; |
98 | } | 98 | } |
99 | 99 | ||
100 | static int __devinit mcs_touchkey_probe(struct i2c_client *client, | 100 | static int mcs_touchkey_probe(struct i2c_client *client, |
101 | const struct i2c_device_id *id) | 101 | const struct i2c_device_id *id) |
102 | { | 102 | { |
103 | const struct mcs_platform_data *pdata; | 103 | const struct mcs_platform_data *pdata; |
@@ -200,7 +200,7 @@ err_free_mem: | |||
200 | return error; | 200 | return error; |
201 | } | 201 | } |
202 | 202 | ||
203 | static int __devexit mcs_touchkey_remove(struct i2c_client *client) | 203 | static int mcs_touchkey_remove(struct i2c_client *client) |
204 | { | 204 | { |
205 | struct mcs_touchkey_data *data = i2c_get_clientdata(client); | 205 | struct mcs_touchkey_data *data = i2c_get_clientdata(client); |
206 | 206 | ||
@@ -270,7 +270,7 @@ static struct i2c_driver mcs_touchkey_driver = { | |||
270 | .pm = &mcs_touchkey_pm_ops, | 270 | .pm = &mcs_touchkey_pm_ops, |
271 | }, | 271 | }, |
272 | .probe = mcs_touchkey_probe, | 272 | .probe = mcs_touchkey_probe, |
273 | .remove = __devexit_p(mcs_touchkey_remove), | 273 | .remove = mcs_touchkey_remove, |
274 | .shutdown = mcs_touchkey_shutdown, | 274 | .shutdown = mcs_touchkey_shutdown, |
275 | .id_table = mcs_touchkey_id, | 275 | .id_table = mcs_touchkey_id, |
276 | }; | 276 | }; |
diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c index 7613f1cac95..f7f3e9a9fd3 100644 --- a/drivers/input/keyboard/mpr121_touchkey.c +++ b/drivers/input/keyboard/mpr121_touchkey.c | |||
@@ -71,7 +71,7 @@ struct mpr121_init_register { | |||
71 | u8 val; | 71 | u8 val; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | static const struct mpr121_init_register init_reg_table[] __devinitconst = { | 74 | static const struct mpr121_init_register init_reg_table[] = { |
75 | { MHD_RISING_ADDR, 0x1 }, | 75 | { MHD_RISING_ADDR, 0x1 }, |
76 | { NHD_RISING_ADDR, 0x1 }, | 76 | { NHD_RISING_ADDR, 0x1 }, |
77 | { MHD_FALLING_ADDR, 0x1 }, | 77 | { MHD_FALLING_ADDR, 0x1 }, |
@@ -123,7 +123,7 @@ out: | |||
123 | return IRQ_HANDLED; | 123 | return IRQ_HANDLED; |
124 | } | 124 | } |
125 | 125 | ||
126 | static int __devinit mpr121_phys_init(const struct mpr121_platform_data *pdata, | 126 | static int mpr121_phys_init(const struct mpr121_platform_data *pdata, |
127 | struct mpr121_touchkey *mpr121, | 127 | struct mpr121_touchkey *mpr121, |
128 | struct i2c_client *client) | 128 | struct i2c_client *client) |
129 | { | 129 | { |
@@ -185,8 +185,8 @@ err_i2c_write: | |||
185 | return ret; | 185 | return ret; |
186 | } | 186 | } |
187 | 187 | ||
188 | static int __devinit mpr_touchkey_probe(struct i2c_client *client, | 188 | static int mpr_touchkey_probe(struct i2c_client *client, |
189 | const struct i2c_device_id *id) | 189 | const struct i2c_device_id *id) |
190 | { | 190 | { |
191 | const struct mpr121_platform_data *pdata = client->dev.platform_data; | 191 | const struct mpr121_platform_data *pdata = client->dev.platform_data; |
192 | struct mpr121_touchkey *mpr121; | 192 | struct mpr121_touchkey *mpr121; |
@@ -272,7 +272,7 @@ err_free_mem: | |||
272 | return error; | 272 | return error; |
273 | } | 273 | } |
274 | 274 | ||
275 | static int __devexit mpr_touchkey_remove(struct i2c_client *client) | 275 | static int mpr_touchkey_remove(struct i2c_client *client) |
276 | { | 276 | { |
277 | struct mpr121_touchkey *mpr121 = i2c_get_clientdata(client); | 277 | struct mpr121_touchkey *mpr121 = i2c_get_clientdata(client); |
278 | 278 | ||
@@ -327,7 +327,7 @@ static struct i2c_driver mpr_touchkey_driver = { | |||
327 | }, | 327 | }, |
328 | .id_table = mpr121_id, | 328 | .id_table = mpr121_id, |
329 | .probe = mpr_touchkey_probe, | 329 | .probe = mpr_touchkey_probe, |
330 | .remove = __devexit_p(mpr_touchkey_remove), | 330 | .remove = mpr_touchkey_remove, |
331 | }; | 331 | }; |
332 | 332 | ||
333 | module_i2c_driver(mpr_touchkey_driver); | 333 | module_i2c_driver(mpr_touchkey_driver); |
diff --git a/drivers/input/keyboard/nomadik-ske-keypad.c b/drivers/input/keyboard/nomadik-ske-keypad.c index 49f5fa64e0b..0e6a8151fee 100644 --- a/drivers/input/keyboard/nomadik-ske-keypad.c +++ b/drivers/input/keyboard/nomadik-ske-keypad.c | |||
@@ -67,6 +67,7 @@ struct ske_keypad { | |||
67 | const struct ske_keypad_platform_data *board; | 67 | const struct ske_keypad_platform_data *board; |
68 | unsigned short keymap[SKE_KPD_NUM_ROWS * SKE_KPD_NUM_COLS]; | 68 | unsigned short keymap[SKE_KPD_NUM_ROWS * SKE_KPD_NUM_COLS]; |
69 | struct clk *clk; | 69 | struct clk *clk; |
70 | struct clk *pclk; | ||
70 | spinlock_t ske_keypad_lock; | 71 | spinlock_t ske_keypad_lock; |
71 | }; | 72 | }; |
72 | 73 | ||
@@ -271,11 +272,18 @@ static int __init ske_keypad_probe(struct platform_device *pdev) | |||
271 | goto err_free_mem_region; | 272 | goto err_free_mem_region; |
272 | } | 273 | } |
273 | 274 | ||
275 | keypad->pclk = clk_get(&pdev->dev, "apb_pclk"); | ||
276 | if (IS_ERR(keypad->pclk)) { | ||
277 | dev_err(&pdev->dev, "failed to get pclk\n"); | ||
278 | error = PTR_ERR(keypad->pclk); | ||
279 | goto err_iounmap; | ||
280 | } | ||
281 | |||
274 | keypad->clk = clk_get(&pdev->dev, NULL); | 282 | keypad->clk = clk_get(&pdev->dev, NULL); |
275 | if (IS_ERR(keypad->clk)) { | 283 | if (IS_ERR(keypad->clk)) { |
276 | dev_err(&pdev->dev, "failed to get clk\n"); | 284 | dev_err(&pdev->dev, "failed to get clk\n"); |
277 | error = PTR_ERR(keypad->clk); | 285 | error = PTR_ERR(keypad->clk); |
278 | goto err_iounmap; | 286 | goto err_pclk; |
279 | } | 287 | } |
280 | 288 | ||
281 | input->id.bustype = BUS_HOST; | 289 | input->id.bustype = BUS_HOST; |
@@ -287,14 +295,25 @@ static int __init ske_keypad_probe(struct platform_device *pdev) | |||
287 | keypad->keymap, input); | 295 | keypad->keymap, input); |
288 | if (error) { | 296 | if (error) { |
289 | dev_err(&pdev->dev, "Failed to build keymap\n"); | 297 | dev_err(&pdev->dev, "Failed to build keymap\n"); |
290 | goto err_iounmap; | 298 | goto err_clk; |
291 | } | 299 | } |
292 | 300 | ||
293 | input_set_capability(input, EV_MSC, MSC_SCAN); | 301 | input_set_capability(input, EV_MSC, MSC_SCAN); |
294 | if (!plat->no_autorepeat) | 302 | if (!plat->no_autorepeat) |
295 | __set_bit(EV_REP, input->evbit); | 303 | __set_bit(EV_REP, input->evbit); |
296 | 304 | ||
297 | clk_enable(keypad->clk); | 305 | error = clk_prepare_enable(keypad->pclk); |
306 | if (error) { | ||
307 | dev_err(&pdev->dev, "Failed to prepare/enable pclk\n"); | ||
308 | goto err_clk; | ||
309 | } | ||
310 | |||
311 | error = clk_prepare_enable(keypad->clk); | ||
312 | if (error) { | ||
313 | dev_err(&pdev->dev, "Failed to prepare/enable clk\n"); | ||
314 | goto err_pclk_disable; | ||
315 | } | ||
316 | |||
298 | 317 | ||
299 | /* go through board initialization helpers */ | 318 | /* go through board initialization helpers */ |
300 | if (keypad->board->init) | 319 | if (keypad->board->init) |
@@ -330,8 +349,13 @@ static int __init ske_keypad_probe(struct platform_device *pdev) | |||
330 | err_free_irq: | 349 | err_free_irq: |
331 | free_irq(keypad->irq, keypad); | 350 | free_irq(keypad->irq, keypad); |
332 | err_clk_disable: | 351 | err_clk_disable: |
333 | clk_disable(keypad->clk); | 352 | clk_disable_unprepare(keypad->clk); |
353 | err_pclk_disable: | ||
354 | clk_disable_unprepare(keypad->pclk); | ||
355 | err_clk: | ||
334 | clk_put(keypad->clk); | 356 | clk_put(keypad->clk); |
357 | err_pclk: | ||
358 | clk_put(keypad->pclk); | ||
335 | err_iounmap: | 359 | err_iounmap: |
336 | iounmap(keypad->reg_base); | 360 | iounmap(keypad->reg_base); |
337 | err_free_mem_region: | 361 | err_free_mem_region: |
@@ -342,7 +366,7 @@ err_free_mem: | |||
342 | return error; | 366 | return error; |
343 | } | 367 | } |
344 | 368 | ||
345 | static int __devexit ske_keypad_remove(struct platform_device *pdev) | 369 | static int ske_keypad_remove(struct platform_device *pdev) |
346 | { | 370 | { |
347 | struct ske_keypad *keypad = platform_get_drvdata(pdev); | 371 | struct ske_keypad *keypad = platform_get_drvdata(pdev); |
348 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 372 | struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -351,7 +375,7 @@ static int __devexit ske_keypad_remove(struct platform_device *pdev) | |||
351 | 375 | ||
352 | input_unregister_device(keypad->input); | 376 | input_unregister_device(keypad->input); |
353 | 377 | ||
354 | clk_disable(keypad->clk); | 378 | clk_disable_unprepare(keypad->clk); |
355 | clk_put(keypad->clk); | 379 | clk_put(keypad->clk); |
356 | 380 | ||
357 | if (keypad->board->exit) | 381 | if (keypad->board->exit) |
@@ -403,7 +427,7 @@ static struct platform_driver ske_keypad_driver = { | |||
403 | .owner = THIS_MODULE, | 427 | .owner = THIS_MODULE, |
404 | .pm = &ske_keypad_dev_pm_ops, | 428 | .pm = &ske_keypad_dev_pm_ops, |
405 | }, | 429 | }, |
406 | .remove = __devexit_p(ske_keypad_remove), | 430 | .remove = ske_keypad_remove, |
407 | }; | 431 | }; |
408 | 432 | ||
409 | static int __init ske_keypad_init(void) | 433 | static int __init ske_keypad_init(void) |
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index 4a5fcc8026f..d0d5226d9cd 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c | |||
@@ -244,7 +244,7 @@ static int omap_kp_resume(struct platform_device *dev) | |||
244 | #define omap_kp_resume NULL | 244 | #define omap_kp_resume NULL |
245 | #endif | 245 | #endif |
246 | 246 | ||
247 | static int __devinit omap_kp_probe(struct platform_device *pdev) | 247 | static int omap_kp_probe(struct platform_device *pdev) |
248 | { | 248 | { |
249 | struct omap_kp *omap_kp; | 249 | struct omap_kp *omap_kp; |
250 | struct input_dev *input_dev; | 250 | struct input_dev *input_dev; |
@@ -357,7 +357,7 @@ err2: | |||
357 | return -EINVAL; | 357 | return -EINVAL; |
358 | } | 358 | } |
359 | 359 | ||
360 | static int __devexit omap_kp_remove(struct platform_device *pdev) | 360 | static int omap_kp_remove(struct platform_device *pdev) |
361 | { | 361 | { |
362 | struct omap_kp *omap_kp = platform_get_drvdata(pdev); | 362 | struct omap_kp *omap_kp = platform_get_drvdata(pdev); |
363 | 363 | ||
@@ -379,7 +379,7 @@ static int __devexit omap_kp_remove(struct platform_device *pdev) | |||
379 | 379 | ||
380 | static struct platform_driver omap_kp_driver = { | 380 | static struct platform_driver omap_kp_driver = { |
381 | .probe = omap_kp_probe, | 381 | .probe = omap_kp_probe, |
382 | .remove = __devexit_p(omap_kp_remove), | 382 | .remove = omap_kp_remove, |
383 | .suspend = omap_kp_suspend, | 383 | .suspend = omap_kp_suspend, |
384 | .resume = omap_kp_resume, | 384 | .resume = omap_kp_resume, |
385 | .driver = { | 385 | .driver = { |
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c index c05f98c4141..e25b022692c 100644 --- a/drivers/input/keyboard/omap4-keypad.c +++ b/drivers/input/keyboard/omap4-keypad.c | |||
@@ -211,8 +211,8 @@ static void omap4_keypad_close(struct input_dev *input) | |||
211 | } | 211 | } |
212 | 212 | ||
213 | #ifdef CONFIG_OF | 213 | #ifdef CONFIG_OF |
214 | static int __devinit omap4_keypad_parse_dt(struct device *dev, | 214 | static int omap4_keypad_parse_dt(struct device *dev, |
215 | struct omap4_keypad *keypad_data) | 215 | struct omap4_keypad *keypad_data) |
216 | { | 216 | { |
217 | struct device_node *np = dev->of_node; | 217 | struct device_node *np = dev->of_node; |
218 | 218 | ||
@@ -241,7 +241,7 @@ static inline int omap4_keypad_parse_dt(struct device *dev, | |||
241 | } | 241 | } |
242 | #endif | 242 | #endif |
243 | 243 | ||
244 | static int __devinit omap4_keypad_probe(struct platform_device *pdev) | 244 | static int omap4_keypad_probe(struct platform_device *pdev) |
245 | { | 245 | { |
246 | const struct omap4_keypad_platform_data *pdata = | 246 | const struct omap4_keypad_platform_data *pdata = |
247 | dev_get_platdata(&pdev->dev); | 247 | dev_get_platdata(&pdev->dev); |
@@ -406,7 +406,7 @@ err_free_keypad: | |||
406 | return error; | 406 | return error; |
407 | } | 407 | } |
408 | 408 | ||
409 | static int __devexit omap4_keypad_remove(struct platform_device *pdev) | 409 | static int omap4_keypad_remove(struct platform_device *pdev) |
410 | { | 410 | { |
411 | struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); | 411 | struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); |
412 | struct resource *res; | 412 | struct resource *res; |
@@ -440,7 +440,7 @@ MODULE_DEVICE_TABLE(of, omap_keypad_dt_match); | |||
440 | 440 | ||
441 | static struct platform_driver omap4_keypad_driver = { | 441 | static struct platform_driver omap4_keypad_driver = { |
442 | .probe = omap4_keypad_probe, | 442 | .probe = omap4_keypad_probe, |
443 | .remove = __devexit_p(omap4_keypad_remove), | 443 | .remove = omap4_keypad_remove, |
444 | .driver = { | 444 | .driver = { |
445 | .name = "omap4-keypad", | 445 | .name = "omap4-keypad", |
446 | .owner = THIS_MODULE, | 446 | .owner = THIS_MODULE, |
diff --git a/drivers/input/keyboard/opencores-kbd.c b/drivers/input/keyboard/opencores-kbd.c index abe728c7b88..7ac5f174c6f 100644 --- a/drivers/input/keyboard/opencores-kbd.c +++ b/drivers/input/keyboard/opencores-kbd.c | |||
@@ -37,7 +37,7 @@ static irqreturn_t opencores_kbd_isr(int irq, void *dev_id) | |||
37 | return IRQ_HANDLED; | 37 | return IRQ_HANDLED; |
38 | } | 38 | } |
39 | 39 | ||
40 | static int __devinit opencores_kbd_probe(struct platform_device *pdev) | 40 | static int opencores_kbd_probe(struct platform_device *pdev) |
41 | { | 41 | { |
42 | struct input_dev *input; | 42 | struct input_dev *input; |
43 | struct opencores_kbd *opencores_kbd; | 43 | struct opencores_kbd *opencores_kbd; |
@@ -139,7 +139,7 @@ static int __devinit opencores_kbd_probe(struct platform_device *pdev) | |||
139 | return error; | 139 | return error; |
140 | } | 140 | } |
141 | 141 | ||
142 | static int __devexit opencores_kbd_remove(struct platform_device *pdev) | 142 | static int opencores_kbd_remove(struct platform_device *pdev) |
143 | { | 143 | { |
144 | struct opencores_kbd *opencores_kbd = platform_get_drvdata(pdev); | 144 | struct opencores_kbd *opencores_kbd = platform_get_drvdata(pdev); |
145 | 145 | ||
@@ -158,7 +158,7 @@ static int __devexit opencores_kbd_remove(struct platform_device *pdev) | |||
158 | 158 | ||
159 | static struct platform_driver opencores_kbd_device_driver = { | 159 | static struct platform_driver opencores_kbd_device_driver = { |
160 | .probe = opencores_kbd_probe, | 160 | .probe = opencores_kbd_probe, |
161 | .remove = __devexit_p(opencores_kbd_remove), | 161 | .remove = opencores_kbd_remove, |
162 | .driver = { | 162 | .driver = { |
163 | .name = "opencores-kbd", | 163 | .name = "opencores-kbd", |
164 | }, | 164 | }, |
diff --git a/drivers/input/keyboard/pmic8xxx-keypad.c b/drivers/input/keyboard/pmic8xxx-keypad.c index 52c34657d30..74339e139d4 100644 --- a/drivers/input/keyboard/pmic8xxx-keypad.c +++ b/drivers/input/keyboard/pmic8xxx-keypad.c | |||
@@ -397,7 +397,7 @@ static irqreturn_t pmic8xxx_kp_irq(int irq, void *data) | |||
397 | return IRQ_HANDLED; | 397 | return IRQ_HANDLED; |
398 | } | 398 | } |
399 | 399 | ||
400 | static int __devinit pmic8xxx_kpd_init(struct pmic8xxx_kp *kp) | 400 | static int pmic8xxx_kpd_init(struct pmic8xxx_kp *kp) |
401 | { | 401 | { |
402 | int bits, rc, cycles; | 402 | int bits, rc, cycles; |
403 | u8 scan_val = 0, ctrl_val = 0; | 403 | u8 scan_val = 0, ctrl_val = 0; |
@@ -447,7 +447,7 @@ static int __devinit pmic8xxx_kpd_init(struct pmic8xxx_kp *kp) | |||
447 | 447 | ||
448 | } | 448 | } |
449 | 449 | ||
450 | static int __devinit pmic8xxx_kp_config_gpio(int gpio_start, int num_gpios, | 450 | static int pmic8xxx_kp_config_gpio(int gpio_start, int num_gpios, |
451 | struct pmic8xxx_kp *kp, struct pm_gpio *gpio_config) | 451 | struct pmic8xxx_kp *kp, struct pm_gpio *gpio_config) |
452 | { | 452 | { |
453 | int rc, i; | 453 | int rc, i; |
@@ -518,7 +518,7 @@ static void pmic8xxx_kp_close(struct input_dev *dev) | |||
518 | * - set irq edge type. | 518 | * - set irq edge type. |
519 | * - enable the keypad controller. | 519 | * - enable the keypad controller. |
520 | */ | 520 | */ |
521 | static int __devinit pmic8xxx_kp_probe(struct platform_device *pdev) | 521 | static int pmic8xxx_kp_probe(struct platform_device *pdev) |
522 | { | 522 | { |
523 | const struct pm8xxx_keypad_platform_data *pdata = | 523 | const struct pm8xxx_keypad_platform_data *pdata = |
524 | dev_get_platdata(&pdev->dev); | 524 | dev_get_platdata(&pdev->dev); |
@@ -712,7 +712,7 @@ err_alloc_device: | |||
712 | return rc; | 712 | return rc; |
713 | } | 713 | } |
714 | 714 | ||
715 | static int __devexit pmic8xxx_kp_remove(struct platform_device *pdev) | 715 | static int pmic8xxx_kp_remove(struct platform_device *pdev) |
716 | { | 716 | { |
717 | struct pmic8xxx_kp *kp = platform_get_drvdata(pdev); | 717 | struct pmic8xxx_kp *kp = platform_get_drvdata(pdev); |
718 | 718 | ||
@@ -773,7 +773,7 @@ static SIMPLE_DEV_PM_OPS(pm8xxx_kp_pm_ops, | |||
773 | 773 | ||
774 | static struct platform_driver pmic8xxx_kp_driver = { | 774 | static struct platform_driver pmic8xxx_kp_driver = { |
775 | .probe = pmic8xxx_kp_probe, | 775 | .probe = pmic8xxx_kp_probe, |
776 | .remove = __devexit_p(pmic8xxx_kp_remove), | 776 | .remove = pmic8xxx_kp_remove, |
777 | .driver = { | 777 | .driver = { |
778 | .name = PM8XXX_KEYPAD_DEV_NAME, | 778 | .name = PM8XXX_KEYPAD_DEV_NAME, |
779 | .owner = THIS_MODULE, | 779 | .owner = THIS_MODULE, |
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index cad9d5dd597..5330d8fbf6c 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -482,7 +482,7 @@ static const struct dev_pm_ops pxa27x_keypad_pm_ops = { | |||
482 | }; | 482 | }; |
483 | #endif | 483 | #endif |
484 | 484 | ||
485 | static int __devinit pxa27x_keypad_probe(struct platform_device *pdev) | 485 | static int pxa27x_keypad_probe(struct platform_device *pdev) |
486 | { | 486 | { |
487 | struct pxa27x_keypad_platform_data *pdata = pdev->dev.platform_data; | 487 | struct pxa27x_keypad_platform_data *pdata = pdev->dev.platform_data; |
488 | struct pxa27x_keypad *keypad; | 488 | struct pxa27x_keypad *keypad; |
@@ -595,7 +595,7 @@ failed_free: | |||
595 | return error; | 595 | return error; |
596 | } | 596 | } |
597 | 597 | ||
598 | static int __devexit pxa27x_keypad_remove(struct platform_device *pdev) | 598 | static int pxa27x_keypad_remove(struct platform_device *pdev) |
599 | { | 599 | { |
600 | struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); | 600 | struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); |
601 | struct resource *res; | 601 | struct resource *res; |
@@ -620,7 +620,7 @@ MODULE_ALIAS("platform:pxa27x-keypad"); | |||
620 | 620 | ||
621 | static struct platform_driver pxa27x_keypad_driver = { | 621 | static struct platform_driver pxa27x_keypad_driver = { |
622 | .probe = pxa27x_keypad_probe, | 622 | .probe = pxa27x_keypad_probe, |
623 | .remove = __devexit_p(pxa27x_keypad_remove), | 623 | .remove = pxa27x_keypad_remove, |
624 | .driver = { | 624 | .driver = { |
625 | .name = "pxa27x-keypad", | 625 | .name = "pxa27x-keypad", |
626 | .owner = THIS_MODULE, | 626 | .owner = THIS_MODULE, |
diff --git a/drivers/input/keyboard/pxa930_rotary.c b/drivers/input/keyboard/pxa930_rotary.c index 41488f9add2..bcad95be73a 100644 --- a/drivers/input/keyboard/pxa930_rotary.c +++ b/drivers/input/keyboard/pxa930_rotary.c | |||
@@ -82,7 +82,7 @@ static void pxa930_rotary_close(struct input_dev *dev) | |||
82 | clear_sbcr(r); | 82 | clear_sbcr(r); |
83 | } | 83 | } |
84 | 84 | ||
85 | static int __devinit pxa930_rotary_probe(struct platform_device *pdev) | 85 | static int pxa930_rotary_probe(struct platform_device *pdev) |
86 | { | 86 | { |
87 | struct pxa930_rotary_platform_data *pdata = pdev->dev.platform_data; | 87 | struct pxa930_rotary_platform_data *pdata = pdev->dev.platform_data; |
88 | struct pxa930_rotary *r; | 88 | struct pxa930_rotary *r; |
@@ -174,7 +174,7 @@ failed_free: | |||
174 | return err; | 174 | return err; |
175 | } | 175 | } |
176 | 176 | ||
177 | static int __devexit pxa930_rotary_remove(struct platform_device *pdev) | 177 | static int pxa930_rotary_remove(struct platform_device *pdev) |
178 | { | 178 | { |
179 | struct pxa930_rotary *r = platform_get_drvdata(pdev); | 179 | struct pxa930_rotary *r = platform_get_drvdata(pdev); |
180 | 180 | ||
@@ -193,7 +193,7 @@ static struct platform_driver pxa930_rotary_driver = { | |||
193 | .owner = THIS_MODULE, | 193 | .owner = THIS_MODULE, |
194 | }, | 194 | }, |
195 | .probe = pxa930_rotary_probe, | 195 | .probe = pxa930_rotary_probe, |
196 | .remove = __devexit_p(pxa930_rotary_remove), | 196 | .remove = pxa930_rotary_remove, |
197 | }; | 197 | }; |
198 | module_platform_driver(pxa930_rotary_driver); | 198 | module_platform_driver(pxa930_rotary_driver); |
199 | 199 | ||
diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c index ca68f2992d7..42b773b3125 100644 --- a/drivers/input/keyboard/qt1070.c +++ b/drivers/input/keyboard/qt1070.c | |||
@@ -91,7 +91,7 @@ static int qt1070_write(struct i2c_client *client, u8 reg, u8 data) | |||
91 | return ret; | 91 | return ret; |
92 | } | 92 | } |
93 | 93 | ||
94 | static bool __devinit qt1070_identify(struct i2c_client *client) | 94 | static bool qt1070_identify(struct i2c_client *client) |
95 | { | 95 | { |
96 | int id, ver; | 96 | int id, ver; |
97 | 97 | ||
@@ -140,7 +140,7 @@ static irqreturn_t qt1070_interrupt(int irq, void *dev_id) | |||
140 | return IRQ_HANDLED; | 140 | return IRQ_HANDLED; |
141 | } | 141 | } |
142 | 142 | ||
143 | static int __devinit qt1070_probe(struct i2c_client *client, | 143 | static int qt1070_probe(struct i2c_client *client, |
144 | const struct i2c_device_id *id) | 144 | const struct i2c_device_id *id) |
145 | { | 145 | { |
146 | struct qt1070_data *data; | 146 | struct qt1070_data *data; |
@@ -230,7 +230,7 @@ err_free_mem: | |||
230 | return err; | 230 | return err; |
231 | } | 231 | } |
232 | 232 | ||
233 | static int __devexit qt1070_remove(struct i2c_client *client) | 233 | static int qt1070_remove(struct i2c_client *client) |
234 | { | 234 | { |
235 | struct qt1070_data *data = i2c_get_clientdata(client); | 235 | struct qt1070_data *data = i2c_get_clientdata(client); |
236 | 236 | ||
@@ -256,7 +256,7 @@ static struct i2c_driver qt1070_driver = { | |||
256 | }, | 256 | }, |
257 | .id_table = qt1070_id, | 257 | .id_table = qt1070_id, |
258 | .probe = qt1070_probe, | 258 | .probe = qt1070_probe, |
259 | .remove = __devexit_p(qt1070_remove), | 259 | .remove = qt1070_remove, |
260 | }; | 260 | }; |
261 | 261 | ||
262 | module_i2c_driver(qt1070_driver); | 262 | module_i2c_driver(qt1070_driver); |
diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c index 76b7d430d03..3dc2b0f27b0 100644 --- a/drivers/input/keyboard/qt2160.c +++ b/drivers/input/keyboard/qt2160.c | |||
@@ -183,7 +183,7 @@ static void qt2160_worker(struct work_struct *work) | |||
183 | qt2160_schedule_read(qt2160); | 183 | qt2160_schedule_read(qt2160); |
184 | } | 184 | } |
185 | 185 | ||
186 | static int __devinit qt2160_read(struct i2c_client *client, u8 reg) | 186 | static int qt2160_read(struct i2c_client *client, u8 reg) |
187 | { | 187 | { |
188 | int ret; | 188 | int ret; |
189 | 189 | ||
@@ -204,29 +204,20 @@ static int __devinit qt2160_read(struct i2c_client *client, u8 reg) | |||
204 | return ret; | 204 | return ret; |
205 | } | 205 | } |
206 | 206 | ||
207 | static int __devinit qt2160_write(struct i2c_client *client, u8 reg, u8 data) | 207 | static int qt2160_write(struct i2c_client *client, u8 reg, u8 data) |
208 | { | 208 | { |
209 | int error; | 209 | int ret; |
210 | |||
211 | error = i2c_smbus_write_byte(client, reg); | ||
212 | if (error) { | ||
213 | dev_err(&client->dev, | ||
214 | "couldn't send request. Returned %d\n", error); | ||
215 | return error; | ||
216 | } | ||
217 | 210 | ||
218 | error = i2c_smbus_write_byte(client, data); | 211 | ret = i2c_smbus_write_byte_data(client, reg, data); |
219 | if (error) { | 212 | if (ret < 0) |
220 | dev_err(&client->dev, | 213 | dev_err(&client->dev, |
221 | "couldn't write data. Returned %d\n", error); | 214 | "couldn't write data. Returned %d\n", ret); |
222 | return error; | ||
223 | } | ||
224 | 215 | ||
225 | return error; | 216 | return ret; |
226 | } | 217 | } |
227 | 218 | ||
228 | 219 | ||
229 | static bool __devinit qt2160_identify(struct i2c_client *client) | 220 | static bool qt2160_identify(struct i2c_client *client) |
230 | { | 221 | { |
231 | int id, ver, rev; | 222 | int id, ver, rev; |
232 | 223 | ||
@@ -257,7 +248,7 @@ static bool __devinit qt2160_identify(struct i2c_client *client) | |||
257 | return true; | 248 | return true; |
258 | } | 249 | } |
259 | 250 | ||
260 | static int __devinit qt2160_probe(struct i2c_client *client, | 251 | static int qt2160_probe(struct i2c_client *client, |
261 | const struct i2c_device_id *id) | 252 | const struct i2c_device_id *id) |
262 | { | 253 | { |
263 | struct qt2160_data *qt2160; | 254 | struct qt2160_data *qt2160; |
@@ -344,7 +335,7 @@ err_free_mem: | |||
344 | return error; | 335 | return error; |
345 | } | 336 | } |
346 | 337 | ||
347 | static int __devexit qt2160_remove(struct i2c_client *client) | 338 | static int qt2160_remove(struct i2c_client *client) |
348 | { | 339 | { |
349 | struct qt2160_data *qt2160 = i2c_get_clientdata(client); | 340 | struct qt2160_data *qt2160 = i2c_get_clientdata(client); |
350 | 341 | ||
@@ -375,7 +366,7 @@ static struct i2c_driver qt2160_driver = { | |||
375 | 366 | ||
376 | .id_table = qt2160_idtable, | 367 | .id_table = qt2160_idtable, |
377 | .probe = qt2160_probe, | 368 | .probe = qt2160_probe, |
378 | .remove = __devexit_p(qt2160_remove), | 369 | .remove = qt2160_remove, |
379 | }; | 370 | }; |
380 | 371 | ||
381 | module_i2c_driver(qt2160_driver); | 372 | module_i2c_driver(qt2160_driver); |
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 9d7a111486f..22e357b5102 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c | |||
@@ -309,7 +309,7 @@ static void samsung_keypad_parse_dt_gpio(struct device *dev, | |||
309 | struct samsung_keypad *keypad) | 309 | struct samsung_keypad *keypad) |
310 | { | 310 | { |
311 | struct device_node *np = dev->of_node; | 311 | struct device_node *np = dev->of_node; |
312 | int gpio, ret, row, col; | 312 | int gpio, error, row, col; |
313 | 313 | ||
314 | for (row = 0; row < keypad->rows; row++) { | 314 | for (row = 0; row < keypad->rows; row++) { |
315 | gpio = of_get_named_gpio(np, "row-gpios", row); | 315 | gpio = of_get_named_gpio(np, "row-gpios", row); |
@@ -320,10 +320,11 @@ static void samsung_keypad_parse_dt_gpio(struct device *dev, | |||
320 | continue; | 320 | continue; |
321 | } | 321 | } |
322 | 322 | ||
323 | ret = gpio_request(gpio, "keypad-row"); | 323 | error = devm_gpio_request(dev, gpio, "keypad-row"); |
324 | if (ret) | 324 | if (error) |
325 | dev_err(dev, "keypad row[%d] gpio request failed\n", | 325 | dev_err(dev, |
326 | row); | 326 | "keypad row[%d] gpio request failed: %d\n", |
327 | row, error); | ||
327 | } | 328 | } |
328 | 329 | ||
329 | for (col = 0; col < keypad->cols; col++) { | 330 | for (col = 0; col < keypad->cols; col++) { |
@@ -335,38 +336,22 @@ static void samsung_keypad_parse_dt_gpio(struct device *dev, | |||
335 | continue; | 336 | continue; |
336 | } | 337 | } |
337 | 338 | ||
338 | ret = gpio_request(gpio, "keypad-col"); | 339 | error = devm_gpio_request(dev, gpio, "keypad-col"); |
339 | if (ret) | 340 | if (error) |
340 | dev_err(dev, "keypad column[%d] gpio request failed\n", | 341 | dev_err(dev, |
341 | col); | 342 | "keypad column[%d] gpio request failed: %d\n", |
343 | col, error); | ||
342 | } | 344 | } |
343 | } | 345 | } |
344 | |||
345 | static void samsung_keypad_dt_gpio_free(struct samsung_keypad *keypad) | ||
346 | { | ||
347 | int cnt; | ||
348 | |||
349 | for (cnt = 0; cnt < keypad->rows; cnt++) | ||
350 | if (gpio_is_valid(keypad->row_gpios[cnt])) | ||
351 | gpio_free(keypad->row_gpios[cnt]); | ||
352 | |||
353 | for (cnt = 0; cnt < keypad->cols; cnt++) | ||
354 | if (gpio_is_valid(keypad->col_gpios[cnt])) | ||
355 | gpio_free(keypad->col_gpios[cnt]); | ||
356 | } | ||
357 | #else | 346 | #else |
358 | static | 347 | static |
359 | struct samsung_keypad_platdata *samsung_keypad_parse_dt(struct device *dev) | 348 | struct samsung_keypad_platdata *samsung_keypad_parse_dt(struct device *dev) |
360 | { | 349 | { |
361 | return NULL; | 350 | return NULL; |
362 | } | 351 | } |
363 | |||
364 | static void samsung_keypad_dt_gpio_free(struct samsung_keypad *keypad) | ||
365 | { | ||
366 | } | ||
367 | #endif | 352 | #endif |
368 | 353 | ||
369 | static int __devinit samsung_keypad_probe(struct platform_device *pdev) | 354 | static int samsung_keypad_probe(struct platform_device *pdev) |
370 | { | 355 | { |
371 | const struct samsung_keypad_platdata *pdata; | 356 | const struct samsung_keypad_platdata *pdata; |
372 | const struct matrix_keymap_data *keymap_data; | 357 | const struct matrix_keymap_data *keymap_data; |
@@ -405,36 +390,30 @@ static int __devinit samsung_keypad_probe(struct platform_device *pdev) | |||
405 | row_shift = get_count_order(pdata->cols); | 390 | row_shift = get_count_order(pdata->cols); |
406 | keymap_size = (pdata->rows << row_shift) * sizeof(keypad->keycodes[0]); | 391 | keymap_size = (pdata->rows << row_shift) * sizeof(keypad->keycodes[0]); |
407 | 392 | ||
408 | keypad = kzalloc(sizeof(*keypad) + keymap_size, GFP_KERNEL); | 393 | keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad) + keymap_size, |
409 | input_dev = input_allocate_device(); | 394 | GFP_KERNEL); |
410 | if (!keypad || !input_dev) { | 395 | input_dev = devm_input_allocate_device(&pdev->dev); |
411 | error = -ENOMEM; | 396 | if (!keypad || !input_dev) |
412 | goto err_free_mem; | 397 | return -ENOMEM; |
413 | } | ||
414 | 398 | ||
415 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 399 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
416 | if (!res) { | 400 | if (!res) |
417 | error = -ENODEV; | 401 | return -ENODEV; |
418 | goto err_free_mem; | ||
419 | } | ||
420 | 402 | ||
421 | keypad->base = ioremap(res->start, resource_size(res)); | 403 | keypad->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); |
422 | if (!keypad->base) { | 404 | if (!keypad->base) |
423 | error = -EBUSY; | 405 | return -EBUSY; |
424 | goto err_free_mem; | ||
425 | } | ||
426 | 406 | ||
427 | keypad->clk = clk_get(&pdev->dev, "keypad"); | 407 | keypad->clk = devm_clk_get(&pdev->dev, "keypad"); |
428 | if (IS_ERR(keypad->clk)) { | 408 | if (IS_ERR(keypad->clk)) { |
429 | dev_err(&pdev->dev, "failed to get keypad clk\n"); | 409 | dev_err(&pdev->dev, "failed to get keypad clk\n"); |
430 | error = PTR_ERR(keypad->clk); | 410 | return PTR_ERR(keypad->clk); |
431 | goto err_unmap_base; | ||
432 | } | 411 | } |
433 | 412 | ||
434 | error = clk_prepare(keypad->clk); | 413 | error = clk_prepare(keypad->clk); |
435 | if (error) { | 414 | if (error) { |
436 | dev_err(&pdev->dev, "keypad clock prepare failed\n"); | 415 | dev_err(&pdev->dev, "keypad clock prepare failed\n"); |
437 | goto err_put_clk; | 416 | return error; |
438 | } | 417 | } |
439 | 418 | ||
440 | keypad->input_dev = input_dev; | 419 | keypad->input_dev = input_dev; |
@@ -479,14 +458,15 @@ static int __devinit samsung_keypad_probe(struct platform_device *pdev) | |||
479 | keypad->irq = platform_get_irq(pdev, 0); | 458 | keypad->irq = platform_get_irq(pdev, 0); |
480 | if (keypad->irq < 0) { | 459 | if (keypad->irq < 0) { |
481 | error = keypad->irq; | 460 | error = keypad->irq; |
482 | goto err_put_clk; | 461 | goto err_unprepare_clk; |
483 | } | 462 | } |
484 | 463 | ||
485 | error = request_threaded_irq(keypad->irq, NULL, samsung_keypad_irq, | 464 | error = devm_request_threaded_irq(&pdev->dev, keypad->irq, NULL, |
486 | IRQF_ONESHOT, dev_name(&pdev->dev), keypad); | 465 | samsung_keypad_irq, IRQF_ONESHOT, |
466 | dev_name(&pdev->dev), keypad); | ||
487 | if (error) { | 467 | if (error) { |
488 | dev_err(&pdev->dev, "failed to register keypad interrupt\n"); | 468 | dev_err(&pdev->dev, "failed to register keypad interrupt\n"); |
489 | goto err_put_clk; | 469 | goto err_unprepare_clk; |
490 | } | 470 | } |
491 | 471 | ||
492 | device_init_wakeup(&pdev->dev, pdata->wakeup); | 472 | device_init_wakeup(&pdev->dev, pdata->wakeup); |
@@ -495,7 +475,7 @@ static int __devinit samsung_keypad_probe(struct platform_device *pdev) | |||
495 | 475 | ||
496 | error = input_register_device(keypad->input_dev); | 476 | error = input_register_device(keypad->input_dev); |
497 | if (error) | 477 | if (error) |
498 | goto err_free_irq; | 478 | goto err_disable_runtime_pm; |
499 | 479 | ||
500 | if (pdev->dev.of_node) { | 480 | if (pdev->dev.of_node) { |
501 | devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap); | 481 | devm_kfree(&pdev->dev, (void *)pdata->keymap_data->keymap); |
@@ -504,26 +484,16 @@ static int __devinit samsung_keypad_probe(struct platform_device *pdev) | |||
504 | } | 484 | } |
505 | return 0; | 485 | return 0; |
506 | 486 | ||
507 | err_free_irq: | 487 | err_disable_runtime_pm: |
508 | free_irq(keypad->irq, keypad); | ||
509 | pm_runtime_disable(&pdev->dev); | 488 | pm_runtime_disable(&pdev->dev); |
510 | device_init_wakeup(&pdev->dev, 0); | 489 | device_init_wakeup(&pdev->dev, 0); |
511 | platform_set_drvdata(pdev, NULL); | 490 | platform_set_drvdata(pdev, NULL); |
512 | err_unprepare_clk: | 491 | err_unprepare_clk: |
513 | clk_unprepare(keypad->clk); | 492 | clk_unprepare(keypad->clk); |
514 | err_put_clk: | ||
515 | clk_put(keypad->clk); | ||
516 | samsung_keypad_dt_gpio_free(keypad); | ||
517 | err_unmap_base: | ||
518 | iounmap(keypad->base); | ||
519 | err_free_mem: | ||
520 | input_free_device(input_dev); | ||
521 | kfree(keypad); | ||
522 | |||
523 | return error; | 493 | return error; |
524 | } | 494 | } |
525 | 495 | ||
526 | static int __devexit samsung_keypad_remove(struct platform_device *pdev) | 496 | static int samsung_keypad_remove(struct platform_device *pdev) |
527 | { | 497 | { |
528 | struct samsung_keypad *keypad = platform_get_drvdata(pdev); | 498 | struct samsung_keypad *keypad = platform_get_drvdata(pdev); |
529 | 499 | ||
@@ -533,18 +503,7 @@ static int __devexit samsung_keypad_remove(struct platform_device *pdev) | |||
533 | 503 | ||
534 | input_unregister_device(keypad->input_dev); | 504 | input_unregister_device(keypad->input_dev); |
535 | 505 | ||
536 | /* | ||
537 | * It is safe to free IRQ after unregistering device because | ||
538 | * samsung_keypad_close will shut off interrupts. | ||
539 | */ | ||
540 | free_irq(keypad->irq, keypad); | ||
541 | |||
542 | clk_unprepare(keypad->clk); | 506 | clk_unprepare(keypad->clk); |
543 | clk_put(keypad->clk); | ||
544 | samsung_keypad_dt_gpio_free(keypad); | ||
545 | |||
546 | iounmap(keypad->base); | ||
547 | kfree(keypad); | ||
548 | 507 | ||
549 | return 0; | 508 | return 0; |
550 | } | 509 | } |
@@ -685,7 +644,7 @@ MODULE_DEVICE_TABLE(platform, samsung_keypad_driver_ids); | |||
685 | 644 | ||
686 | static struct platform_driver samsung_keypad_driver = { | 645 | static struct platform_driver samsung_keypad_driver = { |
687 | .probe = samsung_keypad_probe, | 646 | .probe = samsung_keypad_probe, |
688 | .remove = __devexit_p(samsung_keypad_remove), | 647 | .remove = samsung_keypad_remove, |
689 | .driver = { | 648 | .driver = { |
690 | .name = "samsung-keypad", | 649 | .name = "samsung-keypad", |
691 | .owner = THIS_MODULE, | 650 | .owner = THIS_MODULE, |
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c index da54ad5db15..fdb9eb2df38 100644 --- a/drivers/input/keyboard/sh_keysc.c +++ b/drivers/input/keyboard/sh_keysc.c | |||
@@ -162,7 +162,7 @@ static irqreturn_t sh_keysc_isr(int irq, void *dev_id) | |||
162 | return IRQ_HANDLED; | 162 | return IRQ_HANDLED; |
163 | } | 163 | } |
164 | 164 | ||
165 | static int __devinit sh_keysc_probe(struct platform_device *pdev) | 165 | static int sh_keysc_probe(struct platform_device *pdev) |
166 | { | 166 | { |
167 | struct sh_keysc_priv *priv; | 167 | struct sh_keysc_priv *priv; |
168 | struct sh_keysc_info *pdata; | 168 | struct sh_keysc_info *pdata; |
@@ -272,7 +272,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
272 | return error; | 272 | return error; |
273 | } | 273 | } |
274 | 274 | ||
275 | static int __devexit sh_keysc_remove(struct platform_device *pdev) | 275 | static int sh_keysc_remove(struct platform_device *pdev) |
276 | { | 276 | { |
277 | struct sh_keysc_priv *priv = platform_get_drvdata(pdev); | 277 | struct sh_keysc_priv *priv = platform_get_drvdata(pdev); |
278 | 278 | ||
@@ -331,7 +331,7 @@ static SIMPLE_DEV_PM_OPS(sh_keysc_dev_pm_ops, | |||
331 | 331 | ||
332 | static struct platform_driver sh_keysc_device_driver = { | 332 | static struct platform_driver sh_keysc_device_driver = { |
333 | .probe = sh_keysc_probe, | 333 | .probe = sh_keysc_probe, |
334 | .remove = __devexit_p(sh_keysc_remove), | 334 | .remove = sh_keysc_remove, |
335 | .driver = { | 335 | .driver = { |
336 | .name = "sh_keysc", | 336 | .name = "sh_keysc", |
337 | .pm = &sh_keysc_dev_pm_ops, | 337 | .pm = &sh_keysc_dev_pm_ops, |
diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c index c7ca97f44bf..695d237417d 100644 --- a/drivers/input/keyboard/spear-keyboard.c +++ b/drivers/input/keyboard/spear-keyboard.c | |||
@@ -55,15 +55,15 @@ | |||
55 | 55 | ||
56 | struct spear_kbd { | 56 | struct spear_kbd { |
57 | struct input_dev *input; | 57 | struct input_dev *input; |
58 | struct resource *res; | ||
59 | void __iomem *io_base; | 58 | void __iomem *io_base; |
60 | struct clk *clk; | 59 | struct clk *clk; |
61 | unsigned int irq; | 60 | unsigned int irq; |
62 | unsigned int mode; | 61 | unsigned int mode; |
62 | unsigned int suspended_rate; | ||
63 | unsigned short last_key; | 63 | unsigned short last_key; |
64 | unsigned short keycodes[NUM_ROWS * NUM_COLS]; | 64 | unsigned short keycodes[NUM_ROWS * NUM_COLS]; |
65 | bool rep; | 65 | bool rep; |
66 | unsigned int suspended_rate; | 66 | bool irq_wake_enabled; |
67 | u32 mode_ctl_reg; | 67 | u32 mode_ctl_reg; |
68 | }; | 68 | }; |
69 | 69 | ||
@@ -146,7 +146,7 @@ static void spear_kbd_close(struct input_dev *dev) | |||
146 | } | 146 | } |
147 | 147 | ||
148 | #ifdef CONFIG_OF | 148 | #ifdef CONFIG_OF |
149 | static int __devinit spear_kbd_parse_dt(struct platform_device *pdev, | 149 | static int spear_kbd_parse_dt(struct platform_device *pdev, |
150 | struct spear_kbd *kbd) | 150 | struct spear_kbd *kbd) |
151 | { | 151 | { |
152 | struct device_node *np = pdev->dev.of_node; | 152 | struct device_node *np = pdev->dev.of_node; |
@@ -181,7 +181,7 @@ static inline int spear_kbd_parse_dt(struct platform_device *pdev, | |||
181 | } | 181 | } |
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | static int __devinit spear_kbd_probe(struct platform_device *pdev) | 184 | static int spear_kbd_probe(struct platform_device *pdev) |
185 | { | 185 | { |
186 | struct kbd_platform_data *pdata = dev_get_platdata(&pdev->dev); | 186 | struct kbd_platform_data *pdata = dev_get_platdata(&pdev->dev); |
187 | const struct matrix_keymap_data *keymap = pdata ? pdata->keymap : NULL; | 187 | const struct matrix_keymap_data *keymap = pdata ? pdata->keymap : NULL; |
@@ -203,12 +203,16 @@ static int __devinit spear_kbd_probe(struct platform_device *pdev) | |||
203 | return irq; | 203 | return irq; |
204 | } | 204 | } |
205 | 205 | ||
206 | kbd = kzalloc(sizeof(*kbd), GFP_KERNEL); | 206 | kbd = devm_kzalloc(&pdev->dev, sizeof(*kbd), GFP_KERNEL); |
207 | input_dev = input_allocate_device(); | 207 | if (!kbd) { |
208 | if (!kbd || !input_dev) { | 208 | dev_err(&pdev->dev, "not enough memory for driver data\n"); |
209 | dev_err(&pdev->dev, "out of memory\n"); | 209 | return -ENOMEM; |
210 | error = -ENOMEM; | 210 | } |
211 | goto err_free_mem; | 211 | |
212 | input_dev = devm_input_allocate_device(&pdev->dev); | ||
213 | if (!input_dev) { | ||
214 | dev_err(&pdev->dev, "unable to allocate input device\n"); | ||
215 | return -ENOMEM; | ||
212 | } | 216 | } |
213 | 217 | ||
214 | kbd->input = input_dev; | 218 | kbd->input = input_dev; |
@@ -217,37 +221,25 @@ static int __devinit spear_kbd_probe(struct platform_device *pdev) | |||
217 | if (!pdata) { | 221 | if (!pdata) { |
218 | error = spear_kbd_parse_dt(pdev, kbd); | 222 | error = spear_kbd_parse_dt(pdev, kbd); |
219 | if (error) | 223 | if (error) |
220 | goto err_free_mem; | 224 | return error; |
221 | } else { | 225 | } else { |
222 | kbd->mode = pdata->mode; | 226 | kbd->mode = pdata->mode; |
223 | kbd->rep = pdata->rep; | 227 | kbd->rep = pdata->rep; |
224 | kbd->suspended_rate = pdata->suspended_rate; | 228 | kbd->suspended_rate = pdata->suspended_rate; |
225 | } | 229 | } |
226 | 230 | ||
227 | kbd->res = request_mem_region(res->start, resource_size(res), | 231 | kbd->io_base = devm_request_and_ioremap(&pdev->dev, res); |
228 | pdev->name); | ||
229 | if (!kbd->res) { | ||
230 | dev_err(&pdev->dev, "keyboard region already claimed\n"); | ||
231 | error = -EBUSY; | ||
232 | goto err_free_mem; | ||
233 | } | ||
234 | |||
235 | kbd->io_base = ioremap(res->start, resource_size(res)); | ||
236 | if (!kbd->io_base) { | 232 | if (!kbd->io_base) { |
237 | dev_err(&pdev->dev, "ioremap failed for kbd_region\n"); | 233 | dev_err(&pdev->dev, "request-ioremap failed for kbd_region\n"); |
238 | error = -ENOMEM; | 234 | return -ENOMEM; |
239 | goto err_release_mem_region; | ||
240 | } | 235 | } |
241 | 236 | ||
242 | kbd->clk = clk_get(&pdev->dev, NULL); | 237 | kbd->clk = devm_clk_get(&pdev->dev, NULL); |
243 | if (IS_ERR(kbd->clk)) { | 238 | if (IS_ERR(kbd->clk)) |
244 | error = PTR_ERR(kbd->clk); | 239 | return PTR_ERR(kbd->clk); |
245 | goto err_iounmap; | ||
246 | } | ||
247 | 240 | ||
248 | input_dev->name = "Spear Keyboard"; | 241 | input_dev->name = "Spear Keyboard"; |
249 | input_dev->phys = "keyboard/input0"; | 242 | input_dev->phys = "keyboard/input0"; |
250 | input_dev->dev.parent = &pdev->dev; | ||
251 | input_dev->id.bustype = BUS_HOST; | 243 | input_dev->id.bustype = BUS_HOST; |
252 | input_dev->id.vendor = 0x0001; | 244 | input_dev->id.vendor = 0x0001; |
253 | input_dev->id.product = 0x0001; | 245 | input_dev->id.product = 0x0001; |
@@ -259,7 +251,7 @@ static int __devinit spear_kbd_probe(struct platform_device *pdev) | |||
259 | kbd->keycodes, input_dev); | 251 | kbd->keycodes, input_dev); |
260 | if (error) { | 252 | if (error) { |
261 | dev_err(&pdev->dev, "Failed to build keymap\n"); | 253 | dev_err(&pdev->dev, "Failed to build keymap\n"); |
262 | goto err_put_clk; | 254 | return error; |
263 | } | 255 | } |
264 | 256 | ||
265 | if (kbd->rep) | 257 | if (kbd->rep) |
@@ -268,48 +260,36 @@ static int __devinit spear_kbd_probe(struct platform_device *pdev) | |||
268 | 260 | ||
269 | input_set_drvdata(input_dev, kbd); | 261 | input_set_drvdata(input_dev, kbd); |
270 | 262 | ||
271 | error = request_irq(irq, spear_kbd_interrupt, 0, "keyboard", kbd); | 263 | error = devm_request_irq(&pdev->dev, irq, spear_kbd_interrupt, 0, |
264 | "keyboard", kbd); | ||
272 | if (error) { | 265 | if (error) { |
273 | dev_err(&pdev->dev, "request_irq fail\n"); | 266 | dev_err(&pdev->dev, "request_irq failed\n"); |
274 | goto err_put_clk; | 267 | return error; |
275 | } | 268 | } |
276 | 269 | ||
270 | error = clk_prepare(kbd->clk); | ||
271 | if (error) | ||
272 | return error; | ||
273 | |||
277 | error = input_register_device(input_dev); | 274 | error = input_register_device(input_dev); |
278 | if (error) { | 275 | if (error) { |
279 | dev_err(&pdev->dev, "Unable to register keyboard device\n"); | 276 | dev_err(&pdev->dev, "Unable to register keyboard device\n"); |
280 | goto err_free_irq; | 277 | clk_unprepare(kbd->clk); |
278 | return error; | ||
281 | } | 279 | } |
282 | 280 | ||
283 | device_init_wakeup(&pdev->dev, 1); | 281 | device_init_wakeup(&pdev->dev, 1); |
284 | platform_set_drvdata(pdev, kbd); | 282 | platform_set_drvdata(pdev, kbd); |
285 | 283 | ||
286 | return 0; | 284 | return 0; |
287 | |||
288 | err_free_irq: | ||
289 | free_irq(kbd->irq, kbd); | ||
290 | err_put_clk: | ||
291 | clk_put(kbd->clk); | ||
292 | err_iounmap: | ||
293 | iounmap(kbd->io_base); | ||
294 | err_release_mem_region: | ||
295 | release_mem_region(res->start, resource_size(res)); | ||
296 | err_free_mem: | ||
297 | input_free_device(input_dev); | ||
298 | kfree(kbd); | ||
299 | |||
300 | return error; | ||
301 | } | 285 | } |
302 | 286 | ||
303 | static int __devexit spear_kbd_remove(struct platform_device *pdev) | 287 | static int spear_kbd_remove(struct platform_device *pdev) |
304 | { | 288 | { |
305 | struct spear_kbd *kbd = platform_get_drvdata(pdev); | 289 | struct spear_kbd *kbd = platform_get_drvdata(pdev); |
306 | 290 | ||
307 | free_irq(kbd->irq, kbd); | ||
308 | input_unregister_device(kbd->input); | 291 | input_unregister_device(kbd->input); |
309 | clk_put(kbd->clk); | 292 | clk_unprepare(kbd->clk); |
310 | iounmap(kbd->io_base); | ||
311 | release_mem_region(kbd->res->start, resource_size(kbd->res)); | ||
312 | kfree(kbd); | ||
313 | 293 | ||
314 | device_init_wakeup(&pdev->dev, 0); | 294 | device_init_wakeup(&pdev->dev, 0); |
315 | platform_set_drvdata(pdev, NULL); | 295 | platform_set_drvdata(pdev, NULL); |
@@ -333,7 +313,8 @@ static int spear_kbd_suspend(struct device *dev) | |||
333 | mode_ctl_reg = readl_relaxed(kbd->io_base + MODE_CTL_REG); | 313 | mode_ctl_reg = readl_relaxed(kbd->io_base + MODE_CTL_REG); |
334 | 314 | ||
335 | if (device_may_wakeup(&pdev->dev)) { | 315 | if (device_may_wakeup(&pdev->dev)) { |
336 | enable_irq_wake(kbd->irq); | 316 | if (!enable_irq_wake(kbd->irq)) |
317 | kbd->irq_wake_enabled = true; | ||
337 | 318 | ||
338 | /* | 319 | /* |
339 | * reprogram the keyboard operating frequency as on some | 320 | * reprogram the keyboard operating frequency as on some |
@@ -379,7 +360,10 @@ static int spear_kbd_resume(struct device *dev) | |||
379 | mutex_lock(&input_dev->mutex); | 360 | mutex_lock(&input_dev->mutex); |
380 | 361 | ||
381 | if (device_may_wakeup(&pdev->dev)) { | 362 | if (device_may_wakeup(&pdev->dev)) { |
382 | disable_irq_wake(kbd->irq); | 363 | if (kbd->irq_wake_enabled) { |
364 | kbd->irq_wake_enabled = false; | ||
365 | disable_irq_wake(kbd->irq); | ||
366 | } | ||
383 | } else { | 367 | } else { |
384 | if (input_dev->users) | 368 | if (input_dev->users) |
385 | clk_enable(kbd->clk); | 369 | clk_enable(kbd->clk); |
@@ -407,7 +391,7 @@ MODULE_DEVICE_TABLE(of, spear_kbd_id_table); | |||
407 | 391 | ||
408 | static struct platform_driver spear_kbd_driver = { | 392 | static struct platform_driver spear_kbd_driver = { |
409 | .probe = spear_kbd_probe, | 393 | .probe = spear_kbd_probe, |
410 | .remove = __devexit_p(spear_kbd_remove), | 394 | .remove = spear_kbd_remove, |
411 | .driver = { | 395 | .driver = { |
412 | .name = "keyboard", | 396 | .name = "keyboard", |
413 | .owner = THIS_MODULE, | 397 | .owner = THIS_MODULE, |
diff --git a/drivers/input/keyboard/stmpe-keypad.c b/drivers/input/keyboard/stmpe-keypad.c index 470a8778dec..5cbec56f772 100644 --- a/drivers/input/keyboard/stmpe-keypad.c +++ b/drivers/input/keyboard/stmpe-keypad.c | |||
@@ -166,7 +166,7 @@ static irqreturn_t stmpe_keypad_irq(int irq, void *dev) | |||
166 | return IRQ_HANDLED; | 166 | return IRQ_HANDLED; |
167 | } | 167 | } |
168 | 168 | ||
169 | static int __devinit stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad) | 169 | static int stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad) |
170 | { | 170 | { |
171 | const struct stmpe_keypad_variant *variant = keypad->variant; | 171 | const struct stmpe_keypad_variant *variant = keypad->variant; |
172 | unsigned int col_gpios = variant->col_gpios; | 172 | unsigned int col_gpios = variant->col_gpios; |
@@ -207,7 +207,7 @@ static int __devinit stmpe_keypad_altfunc_init(struct stmpe_keypad *keypad) | |||
207 | return stmpe_set_altfunc(stmpe, pins, STMPE_BLOCK_KEYPAD); | 207 | return stmpe_set_altfunc(stmpe, pins, STMPE_BLOCK_KEYPAD); |
208 | } | 208 | } |
209 | 209 | ||
210 | static int __devinit stmpe_keypad_chip_init(struct stmpe_keypad *keypad) | 210 | static int stmpe_keypad_chip_init(struct stmpe_keypad *keypad) |
211 | { | 211 | { |
212 | const struct stmpe_keypad_platform_data *plat = keypad->plat; | 212 | const struct stmpe_keypad_platform_data *plat = keypad->plat; |
213 | const struct stmpe_keypad_variant *variant = keypad->variant; | 213 | const struct stmpe_keypad_variant *variant = keypad->variant; |
@@ -257,105 +257,131 @@ static int __devinit stmpe_keypad_chip_init(struct stmpe_keypad *keypad) | |||
257 | (plat->debounce_ms << 1)); | 257 | (plat->debounce_ms << 1)); |
258 | } | 258 | } |
259 | 259 | ||
260 | static int __devinit stmpe_keypad_probe(struct platform_device *pdev) | 260 | static void stmpe_keypad_fill_used_pins(struct stmpe_keypad *keypad) |
261 | { | 261 | { |
262 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); | 262 | int row, col; |
263 | |||
264 | for (row = 0; row < STMPE_KEYPAD_MAX_ROWS; row++) { | ||
265 | for (col = 0; col < STMPE_KEYPAD_MAX_COLS; col++) { | ||
266 | int code = MATRIX_SCAN_CODE(row, col, | ||
267 | STMPE_KEYPAD_ROW_SHIFT); | ||
268 | if (keypad->keymap[code] != KEY_RESERVED) { | ||
269 | keypad->rows |= 1 << row; | ||
270 | keypad->cols |= 1 << col; | ||
271 | } | ||
272 | } | ||
273 | } | ||
274 | } | ||
275 | |||
276 | #ifdef CONFIG_OF | ||
277 | static const struct stmpe_keypad_platform_data * | ||
278 | stmpe_keypad_of_probe(struct device *dev) | ||
279 | { | ||
280 | struct device_node *np = dev->of_node; | ||
263 | struct stmpe_keypad_platform_data *plat; | 281 | struct stmpe_keypad_platform_data *plat; |
282 | |||
283 | if (!np) | ||
284 | return ERR_PTR(-ENODEV); | ||
285 | |||
286 | plat = devm_kzalloc(dev, sizeof(*plat), GFP_KERNEL); | ||
287 | if (!plat) | ||
288 | return ERR_PTR(-ENOMEM); | ||
289 | |||
290 | of_property_read_u32(np, "debounce-interval", &plat->debounce_ms); | ||
291 | of_property_read_u32(np, "st,scan-count", &plat->scan_count); | ||
292 | |||
293 | plat->no_autorepeat = of_property_read_bool(np, "st,no-autorepeat"); | ||
294 | |||
295 | return plat; | ||
296 | } | ||
297 | #else | ||
298 | static inline const struct stmpe_keypad_platform_data * | ||
299 | stmpe_keypad_of_probe(struct device *dev) | ||
300 | { | ||
301 | return ERR_PTR(-EINVAL); | ||
302 | } | ||
303 | #endif | ||
304 | |||
305 | static int stmpe_keypad_probe(struct platform_device *pdev) | ||
306 | { | ||
307 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); | ||
308 | const struct stmpe_keypad_platform_data *plat; | ||
264 | struct stmpe_keypad *keypad; | 309 | struct stmpe_keypad *keypad; |
265 | struct input_dev *input; | 310 | struct input_dev *input; |
266 | int ret; | 311 | int error; |
267 | int irq; | 312 | int irq; |
268 | int i; | ||
269 | 313 | ||
270 | plat = stmpe->pdata->keypad; | 314 | plat = stmpe->pdata->keypad; |
271 | if (!plat) | 315 | if (!plat) { |
272 | return -ENODEV; | 316 | plat = stmpe_keypad_of_probe(&pdev->dev); |
317 | if (IS_ERR(plat)) | ||
318 | return PTR_ERR(plat); | ||
319 | } | ||
273 | 320 | ||
274 | irq = platform_get_irq(pdev, 0); | 321 | irq = platform_get_irq(pdev, 0); |
275 | if (irq < 0) | 322 | if (irq < 0) |
276 | return irq; | 323 | return irq; |
277 | 324 | ||
278 | keypad = kzalloc(sizeof(struct stmpe_keypad), GFP_KERNEL); | 325 | keypad = devm_kzalloc(&pdev->dev, sizeof(struct stmpe_keypad), |
326 | GFP_KERNEL); | ||
279 | if (!keypad) | 327 | if (!keypad) |
280 | return -ENOMEM; | 328 | return -ENOMEM; |
281 | 329 | ||
282 | input = input_allocate_device(); | 330 | input = devm_input_allocate_device(&pdev->dev); |
283 | if (!input) { | 331 | if (!input) |
284 | ret = -ENOMEM; | 332 | return -ENOMEM; |
285 | goto out_freekeypad; | ||
286 | } | ||
287 | 333 | ||
288 | input->name = "STMPE keypad"; | 334 | input->name = "STMPE keypad"; |
289 | input->id.bustype = BUS_I2C; | 335 | input->id.bustype = BUS_I2C; |
290 | input->dev.parent = &pdev->dev; | 336 | input->dev.parent = &pdev->dev; |
291 | 337 | ||
292 | ret = matrix_keypad_build_keymap(plat->keymap_data, NULL, | 338 | error = matrix_keypad_build_keymap(plat->keymap_data, NULL, |
293 | STMPE_KEYPAD_MAX_ROWS, | 339 | STMPE_KEYPAD_MAX_ROWS, |
294 | STMPE_KEYPAD_MAX_COLS, | 340 | STMPE_KEYPAD_MAX_COLS, |
295 | keypad->keymap, input); | 341 | keypad->keymap, input); |
296 | if (ret) | 342 | if (error) |
297 | goto out_freeinput; | 343 | return error; |
298 | 344 | ||
299 | input_set_capability(input, EV_MSC, MSC_SCAN); | 345 | input_set_capability(input, EV_MSC, MSC_SCAN); |
300 | if (!plat->no_autorepeat) | 346 | if (!plat->no_autorepeat) |
301 | __set_bit(EV_REP, input->evbit); | 347 | __set_bit(EV_REP, input->evbit); |
302 | 348 | ||
303 | for (i = 0; i < plat->keymap_data->keymap_size; i++) { | 349 | stmpe_keypad_fill_used_pins(keypad); |
304 | unsigned int key = plat->keymap_data->keymap[i]; | ||
305 | |||
306 | keypad->cols |= 1 << KEY_COL(key); | ||
307 | keypad->rows |= 1 << KEY_ROW(key); | ||
308 | } | ||
309 | 350 | ||
310 | keypad->stmpe = stmpe; | 351 | keypad->stmpe = stmpe; |
311 | keypad->plat = plat; | 352 | keypad->plat = plat; |
312 | keypad->input = input; | 353 | keypad->input = input; |
313 | keypad->variant = &stmpe_keypad_variants[stmpe->partnum]; | 354 | keypad->variant = &stmpe_keypad_variants[stmpe->partnum]; |
314 | 355 | ||
315 | ret = stmpe_keypad_chip_init(keypad); | 356 | error = stmpe_keypad_chip_init(keypad); |
316 | if (ret < 0) | 357 | if (error < 0) |
317 | goto out_freeinput; | 358 | return error; |
318 | 359 | ||
319 | ret = input_register_device(input); | 360 | error = devm_request_threaded_irq(&pdev->dev, irq, |
320 | if (ret) { | 361 | NULL, stmpe_keypad_irq, |
321 | dev_err(&pdev->dev, | 362 | IRQF_ONESHOT, "stmpe-keypad", keypad); |
322 | "unable to register input device: %d\n", ret); | 363 | if (error) { |
323 | goto out_freeinput; | 364 | dev_err(&pdev->dev, "unable to get irq: %d\n", error); |
365 | return error; | ||
324 | } | 366 | } |
325 | 367 | ||
326 | ret = request_threaded_irq(irq, NULL, stmpe_keypad_irq, IRQF_ONESHOT, | 368 | error = input_register_device(input); |
327 | "stmpe-keypad", keypad); | 369 | if (error) { |
328 | if (ret) { | 370 | dev_err(&pdev->dev, |
329 | dev_err(&pdev->dev, "unable to get irq: %d\n", ret); | 371 | "unable to register input device: %d\n", error); |
330 | goto out_unregisterinput; | 372 | return error; |
331 | } | 373 | } |
332 | 374 | ||
333 | platform_set_drvdata(pdev, keypad); | 375 | platform_set_drvdata(pdev, keypad); |
334 | 376 | ||
335 | return 0; | 377 | return 0; |
336 | |||
337 | out_unregisterinput: | ||
338 | input_unregister_device(input); | ||
339 | input = NULL; | ||
340 | out_freeinput: | ||
341 | input_free_device(input); | ||
342 | out_freekeypad: | ||
343 | kfree(keypad); | ||
344 | return ret; | ||
345 | } | 378 | } |
346 | 379 | ||
347 | static int __devexit stmpe_keypad_remove(struct platform_device *pdev) | 380 | static int stmpe_keypad_remove(struct platform_device *pdev) |
348 | { | 381 | { |
349 | struct stmpe_keypad *keypad = platform_get_drvdata(pdev); | 382 | struct stmpe_keypad *keypad = platform_get_drvdata(pdev); |
350 | struct stmpe *stmpe = keypad->stmpe; | ||
351 | int irq = platform_get_irq(pdev, 0); | ||
352 | |||
353 | stmpe_disable(stmpe, STMPE_BLOCK_KEYPAD); | ||
354 | 383 | ||
355 | free_irq(irq, keypad); | 384 | stmpe_disable(keypad->stmpe, STMPE_BLOCK_KEYPAD); |
356 | input_unregister_device(keypad->input); | ||
357 | platform_set_drvdata(pdev, NULL); | ||
358 | kfree(keypad); | ||
359 | 385 | ||
360 | return 0; | 386 | return 0; |
361 | } | 387 | } |
@@ -364,7 +390,7 @@ static struct platform_driver stmpe_keypad_driver = { | |||
364 | .driver.name = "stmpe-keypad", | 390 | .driver.name = "stmpe-keypad", |
365 | .driver.owner = THIS_MODULE, | 391 | .driver.owner = THIS_MODULE, |
366 | .probe = stmpe_keypad_probe, | 392 | .probe = stmpe_keypad_probe, |
367 | .remove = __devexit_p(stmpe_keypad_remove), | 393 | .remove = stmpe_keypad_remove, |
368 | }; | 394 | }; |
369 | module_platform_driver(stmpe_keypad_driver); | 395 | module_platform_driver(stmpe_keypad_driver); |
370 | 396 | ||
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c index 7d498e69850..2fb0d76a04c 100644 --- a/drivers/input/keyboard/tc3589x-keypad.c +++ b/drivers/input/keyboard/tc3589x-keypad.c | |||
@@ -299,7 +299,7 @@ static void tc3589x_keypad_close(struct input_dev *input) | |||
299 | tc3589x_keypad_disable(keypad); | 299 | tc3589x_keypad_disable(keypad); |
300 | } | 300 | } |
301 | 301 | ||
302 | static int __devinit tc3589x_keypad_probe(struct platform_device *pdev) | 302 | static int tc3589x_keypad_probe(struct platform_device *pdev) |
303 | { | 303 | { |
304 | struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent); | 304 | struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent); |
305 | struct tc_keypad *keypad; | 305 | struct tc_keypad *keypad; |
@@ -382,7 +382,7 @@ err_free_mem: | |||
382 | return error; | 382 | return error; |
383 | } | 383 | } |
384 | 384 | ||
385 | static int __devexit tc3589x_keypad_remove(struct platform_device *pdev) | 385 | static int tc3589x_keypad_remove(struct platform_device *pdev) |
386 | { | 386 | { |
387 | struct tc_keypad *keypad = platform_get_drvdata(pdev); | 387 | struct tc_keypad *keypad = platform_get_drvdata(pdev); |
388 | int irq = platform_get_irq(pdev, 0); | 388 | int irq = platform_get_irq(pdev, 0); |
@@ -448,7 +448,7 @@ static struct platform_driver tc3589x_keypad_driver = { | |||
448 | .pm = &tc3589x_keypad_dev_pm_ops, | 448 | .pm = &tc3589x_keypad_dev_pm_ops, |
449 | }, | 449 | }, |
450 | .probe = tc3589x_keypad_probe, | 450 | .probe = tc3589x_keypad_probe, |
451 | .remove = __devexit_p(tc3589x_keypad_remove), | 451 | .remove = tc3589x_keypad_remove, |
452 | }; | 452 | }; |
453 | module_platform_driver(tc3589x_keypad_driver); | 453 | module_platform_driver(tc3589x_keypad_driver); |
454 | 454 | ||
diff --git a/drivers/input/keyboard/tca6416-keypad.c b/drivers/input/keyboard/tca6416-keypad.c index c355cdde8d2..bfc832c35a7 100644 --- a/drivers/input/keyboard/tca6416-keypad.c +++ b/drivers/input/keyboard/tca6416-keypad.c | |||
@@ -166,7 +166,7 @@ static void tca6416_keys_close(struct input_dev *dev) | |||
166 | disable_irq(chip->irqnum); | 166 | disable_irq(chip->irqnum); |
167 | } | 167 | } |
168 | 168 | ||
169 | static int __devinit tca6416_setup_registers(struct tca6416_keypad_chip *chip) | 169 | static int tca6416_setup_registers(struct tca6416_keypad_chip *chip) |
170 | { | 170 | { |
171 | int error; | 171 | int error; |
172 | 172 | ||
@@ -197,7 +197,7 @@ static int __devinit tca6416_setup_registers(struct tca6416_keypad_chip *chip) | |||
197 | return 0; | 197 | return 0; |
198 | } | 198 | } |
199 | 199 | ||
200 | static int __devinit tca6416_keypad_probe(struct i2c_client *client, | 200 | static int tca6416_keypad_probe(struct i2c_client *client, |
201 | const struct i2c_device_id *id) | 201 | const struct i2c_device_id *id) |
202 | { | 202 | { |
203 | struct tca6416_keys_platform_data *pdata; | 203 | struct tca6416_keys_platform_data *pdata; |
@@ -313,7 +313,7 @@ fail1: | |||
313 | return error; | 313 | return error; |
314 | } | 314 | } |
315 | 315 | ||
316 | static int __devexit tca6416_keypad_remove(struct i2c_client *client) | 316 | static int tca6416_keypad_remove(struct i2c_client *client) |
317 | { | 317 | { |
318 | struct tca6416_keypad_chip *chip = i2c_get_clientdata(client); | 318 | struct tca6416_keypad_chip *chip = i2c_get_clientdata(client); |
319 | 319 | ||
@@ -361,7 +361,7 @@ static struct i2c_driver tca6416_keypad_driver = { | |||
361 | .pm = &tca6416_keypad_dev_pm_ops, | 361 | .pm = &tca6416_keypad_dev_pm_ops, |
362 | }, | 362 | }, |
363 | .probe = tca6416_keypad_probe, | 363 | .probe = tca6416_keypad_probe, |
364 | .remove = __devexit_p(tca6416_keypad_remove), | 364 | .remove = tca6416_keypad_remove, |
365 | .id_table = tca6416_id, | 365 | .id_table = tca6416_id, |
366 | }; | 366 | }; |
367 | 367 | ||
diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c index 893869b29ed..50e9c5e195e 100644 --- a/drivers/input/keyboard/tca8418_keypad.c +++ b/drivers/input/keyboard/tca8418_keypad.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/i2c.h> | 35 | #include <linux/i2c.h> |
36 | #include <linux/input.h> | 36 | #include <linux/input.h> |
37 | #include <linux/input/tca8418_keypad.h> | 37 | #include <linux/input/tca8418_keypad.h> |
38 | #include <linux/of.h> | ||
38 | 39 | ||
39 | /* TCA8418 hardware limits */ | 40 | /* TCA8418 hardware limits */ |
40 | #define TCA8418_MAX_ROWS 8 | 41 | #define TCA8418_MAX_ROWS 8 |
@@ -109,25 +110,11 @@ | |||
109 | #define KEY_EVENT_CODE 0x7f | 110 | #define KEY_EVENT_CODE 0x7f |
110 | #define KEY_EVENT_VALUE 0x80 | 111 | #define KEY_EVENT_VALUE 0x80 |
111 | 112 | ||
112 | |||
113 | static const struct i2c_device_id tca8418_id[] = { | ||
114 | { TCA8418_NAME, 8418, }, | ||
115 | { } | ||
116 | }; | ||
117 | MODULE_DEVICE_TABLE(i2c, tca8418_id); | ||
118 | |||
119 | struct tca8418_keypad { | 113 | struct tca8418_keypad { |
120 | unsigned int rows; | ||
121 | unsigned int cols; | ||
122 | unsigned int keypad_mask; /* Mask for keypad col/rol regs */ | ||
123 | unsigned int irq; | ||
124 | unsigned int row_shift; | ||
125 | |||
126 | struct i2c_client *client; | 114 | struct i2c_client *client; |
127 | struct input_dev *input; | 115 | struct input_dev *input; |
128 | 116 | ||
129 | /* Flexible array member, must be at end of struct */ | 117 | unsigned int row_shift; |
130 | unsigned short keymap[]; | ||
131 | }; | 118 | }; |
132 | 119 | ||
133 | /* | 120 | /* |
@@ -172,6 +159,8 @@ static int tca8418_read_byte(struct tca8418_keypad *keypad_data, | |||
172 | 159 | ||
173 | static void tca8418_read_keypad(struct tca8418_keypad *keypad_data) | 160 | static void tca8418_read_keypad(struct tca8418_keypad *keypad_data) |
174 | { | 161 | { |
162 | struct input_dev *input = keypad_data->input; | ||
163 | unsigned short *keymap = input->keycode; | ||
175 | int error, col, row; | 164 | int error, col, row; |
176 | u8 reg, state, code; | 165 | u8 reg, state, code; |
177 | 166 | ||
@@ -190,9 +179,8 @@ static void tca8418_read_keypad(struct tca8418_keypad *keypad_data) | |||
190 | col = (col) ? col - 1 : TCA8418_MAX_COLS - 1; | 179 | col = (col) ? col - 1 : TCA8418_MAX_COLS - 1; |
191 | 180 | ||
192 | code = MATRIX_SCAN_CODE(row, col, keypad_data->row_shift); | 181 | code = MATRIX_SCAN_CODE(row, col, keypad_data->row_shift); |
193 | input_event(keypad_data->input, EV_MSC, MSC_SCAN, code); | 182 | input_event(input, EV_MSC, MSC_SCAN, code); |
194 | input_report_key(keypad_data->input, | 183 | input_report_key(input, keymap[code], state); |
195 | keypad_data->keymap[code], state); | ||
196 | 184 | ||
197 | /* Read for next loop */ | 185 | /* Read for next loop */ |
198 | error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, ®); | 186 | error = tca8418_read_byte(keypad_data, REG_KEY_EVENT_A, ®); |
@@ -202,7 +190,7 @@ static void tca8418_read_keypad(struct tca8418_keypad *keypad_data) | |||
202 | dev_err(&keypad_data->client->dev, | 190 | dev_err(&keypad_data->client->dev, |
203 | "unable to read REG_KEY_EVENT_A\n"); | 191 | "unable to read REG_KEY_EVENT_A\n"); |
204 | 192 | ||
205 | input_sync(keypad_data->input); | 193 | input_sync(input); |
206 | } | 194 | } |
207 | 195 | ||
208 | /* | 196 | /* |
@@ -218,16 +206,18 @@ static irqreturn_t tca8418_irq_handler(int irq, void *dev_id) | |||
218 | if (error) { | 206 | if (error) { |
219 | dev_err(&keypad_data->client->dev, | 207 | dev_err(&keypad_data->client->dev, |
220 | "unable to read REG_INT_STAT\n"); | 208 | "unable to read REG_INT_STAT\n"); |
221 | goto exit; | 209 | return IRQ_NONE; |
222 | } | 210 | } |
223 | 211 | ||
212 | if (!reg) | ||
213 | return IRQ_NONE; | ||
214 | |||
224 | if (reg & INT_STAT_OVR_FLOW_INT) | 215 | if (reg & INT_STAT_OVR_FLOW_INT) |
225 | dev_warn(&keypad_data->client->dev, "overflow occurred\n"); | 216 | dev_warn(&keypad_data->client->dev, "overflow occurred\n"); |
226 | 217 | ||
227 | if (reg & INT_STAT_K_INT) | 218 | if (reg & INT_STAT_K_INT) |
228 | tca8418_read_keypad(keypad_data); | 219 | tca8418_read_keypad(keypad_data); |
229 | 220 | ||
230 | exit: | ||
231 | /* Clear all interrupts, even IRQs we didn't check (GPI, CAD, LCK) */ | 221 | /* Clear all interrupts, even IRQs we didn't check (GPI, CAD, LCK) */ |
232 | reg = 0xff; | 222 | reg = 0xff; |
233 | error = tca8418_write_byte(keypad_data, REG_INT_STAT, reg); | 223 | error = tca8418_write_byte(keypad_data, REG_INT_STAT, reg); |
@@ -241,7 +231,8 @@ exit: | |||
241 | /* | 231 | /* |
242 | * Configure the TCA8418 for keypad operation | 232 | * Configure the TCA8418 for keypad operation |
243 | */ | 233 | */ |
244 | static int __devinit tca8418_configure(struct tca8418_keypad *keypad_data) | 234 | static int tca8418_configure(struct tca8418_keypad *keypad_data, |
235 | u32 rows, u32 cols) | ||
245 | { | 236 | { |
246 | int reg, error; | 237 | int reg, error; |
247 | 238 | ||
@@ -253,9 +244,8 @@ static int __devinit tca8418_configure(struct tca8418_keypad *keypad_data) | |||
253 | 244 | ||
254 | 245 | ||
255 | /* Assemble a mask for row and column registers */ | 246 | /* Assemble a mask for row and column registers */ |
256 | reg = ~(~0 << keypad_data->rows); | 247 | reg = ~(~0 << rows); |
257 | reg += (~(~0 << keypad_data->cols)) << 8; | 248 | reg += (~(~0 << cols)) << 8; |
258 | keypad_data->keypad_mask = reg; | ||
259 | 249 | ||
260 | /* Set registers to keypad mode */ | 250 | /* Set registers to keypad mode */ |
261 | error |= tca8418_write_byte(keypad_data, REG_KP_GPIO1, reg); | 251 | error |= tca8418_write_byte(keypad_data, REG_KP_GPIO1, reg); |
@@ -270,145 +260,144 @@ static int __devinit tca8418_configure(struct tca8418_keypad *keypad_data) | |||
270 | return error; | 260 | return error; |
271 | } | 261 | } |
272 | 262 | ||
273 | static int __devinit tca8418_keypad_probe(struct i2c_client *client, | 263 | static int tca8418_keypad_probe(struct i2c_client *client, |
274 | const struct i2c_device_id *id) | 264 | const struct i2c_device_id *id) |
275 | { | 265 | { |
266 | struct device *dev = &client->dev; | ||
276 | const struct tca8418_keypad_platform_data *pdata = | 267 | const struct tca8418_keypad_platform_data *pdata = |
277 | client->dev.platform_data; | 268 | dev_get_platdata(dev); |
278 | struct tca8418_keypad *keypad_data; | 269 | struct tca8418_keypad *keypad_data; |
279 | struct input_dev *input; | 270 | struct input_dev *input; |
271 | const struct matrix_keymap_data *keymap_data = NULL; | ||
272 | u32 rows = 0, cols = 0; | ||
273 | bool rep = false; | ||
274 | bool irq_is_gpio = false; | ||
275 | int irq; | ||
280 | int error, row_shift, max_keys; | 276 | int error, row_shift, max_keys; |
281 | 277 | ||
282 | /* Copy the platform data */ | 278 | /* Copy the platform data */ |
283 | if (!pdata) { | 279 | if (pdata) { |
284 | dev_dbg(&client->dev, "no platform data\n"); | 280 | if (!pdata->keymap_data) { |
285 | return -EINVAL; | 281 | dev_err(dev, "no keymap data defined\n"); |
286 | } | 282 | return -EINVAL; |
287 | 283 | } | |
288 | if (!pdata->keymap_data) { | 284 | keymap_data = pdata->keymap_data; |
289 | dev_err(&client->dev, "no keymap data defined\n"); | 285 | rows = pdata->rows; |
290 | return -EINVAL; | 286 | cols = pdata->cols; |
287 | rep = pdata->rep; | ||
288 | irq_is_gpio = pdata->irq_is_gpio; | ||
289 | } else { | ||
290 | struct device_node *np = dev->of_node; | ||
291 | of_property_read_u32(np, "keypad,num-rows", &rows); | ||
292 | of_property_read_u32(np, "keypad,num-columns", &cols); | ||
293 | rep = of_property_read_bool(np, "keypad,autorepeat"); | ||
291 | } | 294 | } |
292 | 295 | ||
293 | if (!pdata->rows || pdata->rows > TCA8418_MAX_ROWS) { | 296 | if (!rows || rows > TCA8418_MAX_ROWS) { |
294 | dev_err(&client->dev, "invalid rows\n"); | 297 | dev_err(dev, "invalid rows\n"); |
295 | return -EINVAL; | 298 | return -EINVAL; |
296 | } | 299 | } |
297 | 300 | ||
298 | if (!pdata->cols || pdata->cols > TCA8418_MAX_COLS) { | 301 | if (!cols || cols > TCA8418_MAX_COLS) { |
299 | dev_err(&client->dev, "invalid columns\n"); | 302 | dev_err(dev, "invalid columns\n"); |
300 | return -EINVAL; | 303 | return -EINVAL; |
301 | } | 304 | } |
302 | 305 | ||
303 | /* Check i2c driver capabilities */ | 306 | /* Check i2c driver capabilities */ |
304 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE)) { | 307 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE)) { |
305 | dev_err(&client->dev, "%s adapter not supported\n", | 308 | dev_err(dev, "%s adapter not supported\n", |
306 | dev_driver_string(&client->adapter->dev)); | 309 | dev_driver_string(&client->adapter->dev)); |
307 | return -ENODEV; | 310 | return -ENODEV; |
308 | } | 311 | } |
309 | 312 | ||
310 | row_shift = get_count_order(pdata->cols); | 313 | row_shift = get_count_order(cols); |
311 | max_keys = pdata->rows << row_shift; | 314 | max_keys = rows << row_shift; |
312 | 315 | ||
313 | /* Allocate memory for keypad_data, keymap and input device */ | 316 | /* Allocate memory for keypad_data and input device */ |
314 | keypad_data = kzalloc(sizeof(*keypad_data) + | 317 | keypad_data = devm_kzalloc(dev, sizeof(*keypad_data), GFP_KERNEL); |
315 | max_keys * sizeof(keypad_data->keymap[0]), GFP_KERNEL); | ||
316 | if (!keypad_data) | 318 | if (!keypad_data) |
317 | return -ENOMEM; | 319 | return -ENOMEM; |
318 | 320 | ||
319 | keypad_data->rows = pdata->rows; | ||
320 | keypad_data->cols = pdata->cols; | ||
321 | keypad_data->client = client; | 321 | keypad_data->client = client; |
322 | keypad_data->row_shift = row_shift; | 322 | keypad_data->row_shift = row_shift; |
323 | 323 | ||
324 | /* Initialize the chip or fail if chip isn't present */ | 324 | /* Initialize the chip or fail if chip isn't present */ |
325 | error = tca8418_configure(keypad_data); | 325 | error = tca8418_configure(keypad_data, rows, cols); |
326 | if (error < 0) | 326 | if (error < 0) |
327 | goto fail1; | 327 | return error; |
328 | 328 | ||
329 | /* Configure input device */ | 329 | /* Configure input device */ |
330 | input = input_allocate_device(); | 330 | input = devm_input_allocate_device(dev); |
331 | if (!input) { | 331 | if (!input) |
332 | error = -ENOMEM; | 332 | return -ENOMEM; |
333 | goto fail1; | 333 | |
334 | } | ||
335 | keypad_data->input = input; | 334 | keypad_data->input = input; |
336 | 335 | ||
337 | input->name = client->name; | 336 | input->name = client->name; |
338 | input->dev.parent = &client->dev; | ||
339 | |||
340 | input->id.bustype = BUS_I2C; | 337 | input->id.bustype = BUS_I2C; |
341 | input->id.vendor = 0x0001; | 338 | input->id.vendor = 0x0001; |
342 | input->id.product = 0x001; | 339 | input->id.product = 0x001; |
343 | input->id.version = 0x0001; | 340 | input->id.version = 0x0001; |
344 | 341 | ||
345 | error = matrix_keypad_build_keymap(pdata->keymap_data, NULL, | 342 | error = matrix_keypad_build_keymap(keymap_data, NULL, rows, cols, |
346 | pdata->rows, pdata->cols, | 343 | NULL, input); |
347 | keypad_data->keymap, input); | ||
348 | if (error) { | 344 | if (error) { |
349 | dev_dbg(&client->dev, "Failed to build keymap\n"); | 345 | dev_err(dev, "Failed to build keymap\n"); |
350 | goto fail2; | 346 | return error; |
351 | } | 347 | } |
352 | 348 | ||
353 | if (pdata->rep) | 349 | if (rep) |
354 | __set_bit(EV_REP, input->evbit); | 350 | __set_bit(EV_REP, input->evbit); |
355 | input_set_capability(input, EV_MSC, MSC_SCAN); | 351 | input_set_capability(input, EV_MSC, MSC_SCAN); |
356 | 352 | ||
357 | input_set_drvdata(input, keypad_data); | 353 | input_set_drvdata(input, keypad_data); |
358 | 354 | ||
359 | if (pdata->irq_is_gpio) | 355 | irq = client->irq; |
360 | client->irq = gpio_to_irq(client->irq); | 356 | if (irq_is_gpio) |
357 | irq = gpio_to_irq(irq); | ||
361 | 358 | ||
362 | error = request_threaded_irq(client->irq, NULL, tca8418_irq_handler, | 359 | error = devm_request_threaded_irq(dev, irq, NULL, tca8418_irq_handler, |
363 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 360 | IRQF_TRIGGER_FALLING | |
364 | client->name, keypad_data); | 361 | IRQF_SHARED | |
362 | IRQF_ONESHOT, | ||
363 | client->name, keypad_data); | ||
365 | if (error) { | 364 | if (error) { |
366 | dev_dbg(&client->dev, | 365 | dev_err(dev, "Unable to claim irq %d; error %d\n", |
367 | "Unable to claim irq %d; error %d\n", | ||
368 | client->irq, error); | 366 | client->irq, error); |
369 | goto fail2; | 367 | return error; |
370 | } | 368 | } |
371 | 369 | ||
372 | error = input_register_device(input); | 370 | error = input_register_device(input); |
373 | if (error) { | 371 | if (error) { |
374 | dev_dbg(&client->dev, | 372 | dev_err(dev, "Unable to register input device, error: %d\n", |
375 | "Unable to register input device, error: %d\n", error); | 373 | error); |
376 | goto fail3; | 374 | return error; |
377 | } | 375 | } |
378 | 376 | ||
379 | i2c_set_clientdata(client, keypad_data); | ||
380 | return 0; | 377 | return 0; |
381 | |||
382 | fail3: | ||
383 | free_irq(client->irq, keypad_data); | ||
384 | fail2: | ||
385 | input_free_device(input); | ||
386 | fail1: | ||
387 | kfree(keypad_data); | ||
388 | return error; | ||
389 | } | 378 | } |
390 | 379 | ||
391 | static int __devexit tca8418_keypad_remove(struct i2c_client *client) | 380 | static const struct i2c_device_id tca8418_id[] = { |
392 | { | 381 | { TCA8418_NAME, 8418, }, |
393 | struct tca8418_keypad *keypad_data = i2c_get_clientdata(client); | 382 | { } |
394 | 383 | }; | |
395 | free_irq(keypad_data->client->irq, keypad_data); | 384 | MODULE_DEVICE_TABLE(i2c, tca8418_id); |
396 | |||
397 | input_unregister_device(keypad_data->input); | ||
398 | |||
399 | kfree(keypad_data); | ||
400 | |||
401 | return 0; | ||
402 | } | ||
403 | 385 | ||
386 | #ifdef CONFIG_OF | ||
387 | static const struct of_device_id tca8418_dt_ids[] __devinitconst = { | ||
388 | { .compatible = "ti,tca8418", }, | ||
389 | { } | ||
390 | }; | ||
391 | MODULE_DEVICE_TABLE(of, tca8418_dt_ids); | ||
392 | #endif | ||
404 | 393 | ||
405 | static struct i2c_driver tca8418_keypad_driver = { | 394 | static struct i2c_driver tca8418_keypad_driver = { |
406 | .driver = { | 395 | .driver = { |
407 | .name = TCA8418_NAME, | 396 | .name = TCA8418_NAME, |
408 | .owner = THIS_MODULE, | 397 | .owner = THIS_MODULE, |
398 | .of_match_table = of_match_ptr(tca8418_dt_ids), | ||
409 | }, | 399 | }, |
410 | .probe = tca8418_keypad_probe, | 400 | .probe = tca8418_keypad_probe, |
411 | .remove = __devexit_p(tca8418_keypad_remove), | ||
412 | .id_table = tca8418_id, | 401 | .id_table = tca8418_id, |
413 | }; | 402 | }; |
414 | 403 | ||
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index 5faaf2553e3..c76f96872d3 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -87,7 +87,7 @@ struct tegra_kbc { | |||
87 | struct clk *clk; | 87 | struct clk *clk; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | static const u32 tegra_kbc_default_keymap[] __devinitdata = { | 90 | static const u32 tegra_kbc_default_keymap[] = { |
91 | KEY(0, 2, KEY_W), | 91 | KEY(0, 2, KEY_W), |
92 | KEY(0, 3, KEY_S), | 92 | KEY(0, 3, KEY_S), |
93 | KEY(0, 4, KEY_A), | 93 | KEY(0, 4, KEY_A), |
@@ -223,7 +223,7 @@ static const u32 tegra_kbc_default_keymap[] __devinitdata = { | |||
223 | }; | 223 | }; |
224 | 224 | ||
225 | static const | 225 | static const |
226 | struct matrix_keymap_data tegra_kbc_default_keymap_data __devinitdata = { | 226 | struct matrix_keymap_data tegra_kbc_default_keymap_data = { |
227 | .keymap = tegra_kbc_default_keymap, | 227 | .keymap = tegra_kbc_default_keymap, |
228 | .keymap_size = ARRAY_SIZE(tegra_kbc_default_keymap), | 228 | .keymap_size = ARRAY_SIZE(tegra_kbc_default_keymap), |
229 | }; | 229 | }; |
@@ -573,7 +573,7 @@ static void tegra_kbc_close(struct input_dev *dev) | |||
573 | return tegra_kbc_stop(kbc); | 573 | return tegra_kbc_stop(kbc); |
574 | } | 574 | } |
575 | 575 | ||
576 | static bool __devinit | 576 | static bool |
577 | tegra_kbc_check_pin_cfg(const struct tegra_kbc_platform_data *pdata, | 577 | tegra_kbc_check_pin_cfg(const struct tegra_kbc_platform_data *pdata, |
578 | struct device *dev, unsigned int *num_rows) | 578 | struct device *dev, unsigned int *num_rows) |
579 | { | 579 | { |
@@ -619,7 +619,7 @@ tegra_kbc_check_pin_cfg(const struct tegra_kbc_platform_data *pdata, | |||
619 | } | 619 | } |
620 | 620 | ||
621 | #ifdef CONFIG_OF | 621 | #ifdef CONFIG_OF |
622 | static struct tegra_kbc_platform_data * __devinit tegra_kbc_dt_parse_pdata( | 622 | static struct tegra_kbc_platform_data *tegra_kbc_dt_parse_pdata( |
623 | struct platform_device *pdev) | 623 | struct platform_device *pdev) |
624 | { | 624 | { |
625 | struct tegra_kbc_platform_data *pdata; | 625 | struct tegra_kbc_platform_data *pdata; |
@@ -670,7 +670,7 @@ static inline struct tegra_kbc_platform_data *tegra_kbc_dt_parse_pdata( | |||
670 | } | 670 | } |
671 | #endif | 671 | #endif |
672 | 672 | ||
673 | static int __devinit tegra_kbd_setup_keymap(struct tegra_kbc *kbc) | 673 | static int tegra_kbd_setup_keymap(struct tegra_kbc *kbc) |
674 | { | 674 | { |
675 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; | 675 | const struct tegra_kbc_platform_data *pdata = kbc->pdata; |
676 | const struct matrix_keymap_data *keymap_data = pdata->keymap_data; | 676 | const struct matrix_keymap_data *keymap_data = pdata->keymap_data; |
@@ -697,7 +697,7 @@ static int __devinit tegra_kbd_setup_keymap(struct tegra_kbc *kbc) | |||
697 | return retval; | 697 | return retval; |
698 | } | 698 | } |
699 | 699 | ||
700 | static int __devinit tegra_kbc_probe(struct platform_device *pdev) | 700 | static int tegra_kbc_probe(struct platform_device *pdev) |
701 | { | 701 | { |
702 | const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; | 702 | const struct tegra_kbc_platform_data *pdata = pdev->dev.platform_data; |
703 | struct tegra_kbc *kbc; | 703 | struct tegra_kbc *kbc; |
@@ -838,7 +838,7 @@ err_free_pdata: | |||
838 | return err; | 838 | return err; |
839 | } | 839 | } |
840 | 840 | ||
841 | static int __devexit tegra_kbc_remove(struct platform_device *pdev) | 841 | static int tegra_kbc_remove(struct platform_device *pdev) |
842 | { | 842 | { |
843 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); | 843 | struct tegra_kbc *kbc = platform_get_drvdata(pdev); |
844 | struct resource *res; | 844 | struct resource *res; |
@@ -954,7 +954,7 @@ MODULE_DEVICE_TABLE(of, tegra_kbc_of_match); | |||
954 | 954 | ||
955 | static struct platform_driver tegra_kbc_driver = { | 955 | static struct platform_driver tegra_kbc_driver = { |
956 | .probe = tegra_kbc_probe, | 956 | .probe = tegra_kbc_probe, |
957 | .remove = __devexit_p(tegra_kbc_remove), | 957 | .remove = tegra_kbc_remove, |
958 | .driver = { | 958 | .driver = { |
959 | .name = "tegra-kbc", | 959 | .name = "tegra-kbc", |
960 | .owner = THIS_MODULE, | 960 | .owner = THIS_MODULE, |
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c index 4c34f21fbe2..ee163501129 100644 --- a/drivers/input/keyboard/tnetv107x-keypad.c +++ b/drivers/input/keyboard/tnetv107x-keypad.c | |||
@@ -153,7 +153,7 @@ static void keypad_stop(struct input_dev *dev) | |||
153 | clk_disable(kp->clk); | 153 | clk_disable(kp->clk); |
154 | } | 154 | } |
155 | 155 | ||
156 | static int __devinit keypad_probe(struct platform_device *pdev) | 156 | static int keypad_probe(struct platform_device *pdev) |
157 | { | 157 | { |
158 | const struct matrix_keypad_platform_data *pdata; | 158 | const struct matrix_keypad_platform_data *pdata; |
159 | const struct matrix_keymap_data *keymap_data; | 159 | const struct matrix_keymap_data *keymap_data; |
@@ -301,7 +301,7 @@ error_res: | |||
301 | return error; | 301 | return error; |
302 | } | 302 | } |
303 | 303 | ||
304 | static int __devexit keypad_remove(struct platform_device *pdev) | 304 | static int keypad_remove(struct platform_device *pdev) |
305 | { | 305 | { |
306 | struct keypad_data *kp = platform_get_drvdata(pdev); | 306 | struct keypad_data *kp = platform_get_drvdata(pdev); |
307 | 307 | ||
@@ -319,7 +319,7 @@ static int __devexit keypad_remove(struct platform_device *pdev) | |||
319 | 319 | ||
320 | static struct platform_driver keypad_driver = { | 320 | static struct platform_driver keypad_driver = { |
321 | .probe = keypad_probe, | 321 | .probe = keypad_probe, |
322 | .remove = __devexit_p(keypad_remove), | 322 | .remove = keypad_remove, |
323 | .driver.name = "tnetv107x-keypad", | 323 | .driver.name = "tnetv107x-keypad", |
324 | .driver.owner = THIS_MODULE, | 324 | .driver.owner = THIS_MODULE, |
325 | }; | 325 | }; |
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index a2c6f79aa10..04f84fd5717 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c | |||
@@ -271,7 +271,7 @@ static irqreturn_t do_kp_irq(int irq, void *_kp) | |||
271 | return IRQ_HANDLED; | 271 | return IRQ_HANDLED; |
272 | } | 272 | } |
273 | 273 | ||
274 | static int __devinit twl4030_kp_program(struct twl4030_keypad *kp) | 274 | static int twl4030_kp_program(struct twl4030_keypad *kp) |
275 | { | 275 | { |
276 | u8 reg; | 276 | u8 reg; |
277 | int i; | 277 | int i; |
@@ -328,7 +328,7 @@ static int __devinit twl4030_kp_program(struct twl4030_keypad *kp) | |||
328 | * Registers keypad device with input subsystem | 328 | * Registers keypad device with input subsystem |
329 | * and configures TWL4030 keypad registers | 329 | * and configures TWL4030 keypad registers |
330 | */ | 330 | */ |
331 | static int __devinit twl4030_kp_probe(struct platform_device *pdev) | 331 | static int twl4030_kp_probe(struct platform_device *pdev) |
332 | { | 332 | { |
333 | struct twl4030_keypad_data *pdata = pdev->dev.platform_data; | 333 | struct twl4030_keypad_data *pdata = pdev->dev.platform_data; |
334 | const struct matrix_keymap_data *keymap_data; | 334 | const struct matrix_keymap_data *keymap_data; |
@@ -432,7 +432,7 @@ err1: | |||
432 | return error; | 432 | return error; |
433 | } | 433 | } |
434 | 434 | ||
435 | static int __devexit twl4030_kp_remove(struct platform_device *pdev) | 435 | static int twl4030_kp_remove(struct platform_device *pdev) |
436 | { | 436 | { |
437 | struct twl4030_keypad *kp = platform_get_drvdata(pdev); | 437 | struct twl4030_keypad *kp = platform_get_drvdata(pdev); |
438 | 438 | ||
@@ -452,7 +452,7 @@ static int __devexit twl4030_kp_remove(struct platform_device *pdev) | |||
452 | 452 | ||
453 | static struct platform_driver twl4030_kp_driver = { | 453 | static struct platform_driver twl4030_kp_driver = { |
454 | .probe = twl4030_kp_probe, | 454 | .probe = twl4030_kp_probe, |
455 | .remove = __devexit_p(twl4030_kp_remove), | 455 | .remove = twl4030_kp_remove, |
456 | .driver = { | 456 | .driver = { |
457 | .name = "twl4030_keypad", | 457 | .name = "twl4030_keypad", |
458 | .owner = THIS_MODULE, | 458 | .owner = THIS_MODULE, |
diff --git a/drivers/input/keyboard/w90p910_keypad.c b/drivers/input/keyboard/w90p910_keypad.c index e0f6cd1ad0f..ee163bee8cc 100644 --- a/drivers/input/keyboard/w90p910_keypad.c +++ b/drivers/input/keyboard/w90p910_keypad.c | |||
@@ -118,7 +118,7 @@ static void w90p910_keypad_close(struct input_dev *dev) | |||
118 | clk_disable(keypad->clk); | 118 | clk_disable(keypad->clk); |
119 | } | 119 | } |
120 | 120 | ||
121 | static int __devinit w90p910_keypad_probe(struct platform_device *pdev) | 121 | static int w90p910_keypad_probe(struct platform_device *pdev) |
122 | { | 122 | { |
123 | const struct w90p910_keypad_platform_data *pdata = | 123 | const struct w90p910_keypad_platform_data *pdata = |
124 | pdev->dev.platform_data; | 124 | pdev->dev.platform_data; |
@@ -234,7 +234,7 @@ failed_free: | |||
234 | return error; | 234 | return error; |
235 | } | 235 | } |
236 | 236 | ||
237 | static int __devexit w90p910_keypad_remove(struct platform_device *pdev) | 237 | static int w90p910_keypad_remove(struct platform_device *pdev) |
238 | { | 238 | { |
239 | struct w90p910_keypad *keypad = platform_get_drvdata(pdev); | 239 | struct w90p910_keypad *keypad = platform_get_drvdata(pdev); |
240 | struct resource *res; | 240 | struct resource *res; |
@@ -257,7 +257,7 @@ static int __devexit w90p910_keypad_remove(struct platform_device *pdev) | |||
257 | 257 | ||
258 | static struct platform_driver w90p910_keypad_driver = { | 258 | static struct platform_driver w90p910_keypad_driver = { |
259 | .probe = w90p910_keypad_probe, | 259 | .probe = w90p910_keypad_probe, |
260 | .remove = __devexit_p(w90p910_keypad_remove), | 260 | .remove = w90p910_keypad_remove, |
261 | .driver = { | 261 | .driver = { |
262 | .name = "nuc900-kpi", | 262 | .name = "nuc900-kpi", |
263 | .owner = THIS_MODULE, | 263 | .owner = THIS_MODULE, |
diff --git a/drivers/input/matrix-keymap.c b/drivers/input/matrix-keymap.c index d88d9be1d1b..3ae496ea5fe 100644 --- a/drivers/input/matrix-keymap.c +++ b/drivers/input/matrix-keymap.c | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
21 | #include <linux/gfp.h> | ||
21 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
22 | #include <linux/types.h> | 23 | #include <linux/types.h> |
23 | #include <linux/input.h> | 24 | #include <linux/input.h> |
@@ -123,6 +124,11 @@ static int matrix_keypad_parse_of_keymap(const char *propname, | |||
123 | * it will attempt load the keymap from property specified by @keymap_name | 124 | * it will attempt load the keymap from property specified by @keymap_name |
124 | * argument (or "linux,keymap" if @keymap_name is %NULL). | 125 | * argument (or "linux,keymap" if @keymap_name is %NULL). |
125 | * | 126 | * |
127 | * If @keymap is %NULL the function will automatically allocate managed | ||
128 | * block of memory to store the keymap. This memory will be associated with | ||
129 | * the parent device and automatically freed when device unbinds from the | ||
130 | * driver. | ||
131 | * | ||
126 | * Callers are expected to set up input_dev->dev.parent before calling this | 132 | * Callers are expected to set up input_dev->dev.parent before calling this |
127 | * function. | 133 | * function. |
128 | */ | 134 | */ |
@@ -133,12 +139,27 @@ int matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data, | |||
133 | struct input_dev *input_dev) | 139 | struct input_dev *input_dev) |
134 | { | 140 | { |
135 | unsigned int row_shift = get_count_order(cols); | 141 | unsigned int row_shift = get_count_order(cols); |
142 | size_t max_keys = rows << row_shift; | ||
136 | int i; | 143 | int i; |
137 | int error; | 144 | int error; |
138 | 145 | ||
146 | if (WARN_ON(!input_dev->dev.parent)) | ||
147 | return -EINVAL; | ||
148 | |||
149 | if (!keymap) { | ||
150 | keymap = devm_kzalloc(input_dev->dev.parent, | ||
151 | max_keys * sizeof(*keymap), | ||
152 | GFP_KERNEL); | ||
153 | if (!keymap) { | ||
154 | dev_err(input_dev->dev.parent, | ||
155 | "Unable to allocate memory for keymap"); | ||
156 | return -ENOMEM; | ||
157 | } | ||
158 | } | ||
159 | |||
139 | input_dev->keycode = keymap; | 160 | input_dev->keycode = keymap; |
140 | input_dev->keycodesize = sizeof(*keymap); | 161 | input_dev->keycodesize = sizeof(*keymap); |
141 | input_dev->keycodemax = rows << row_shift; | 162 | input_dev->keycodemax = max_keys; |
142 | 163 | ||
143 | __set_bit(EV_KEY, input_dev->evbit); | 164 | __set_bit(EV_KEY, input_dev->evbit); |
144 | 165 | ||
diff --git a/drivers/input/misc/88pm80x_onkey.c b/drivers/input/misc/88pm80x_onkey.c index 7f26e7b6c22..ee43e5b7c88 100644 --- a/drivers/input/misc/88pm80x_onkey.c +++ b/drivers/input/misc/88pm80x_onkey.c | |||
@@ -62,7 +62,7 @@ static irqreturn_t pm80x_onkey_handler(int irq, void *data) | |||
62 | static SIMPLE_DEV_PM_OPS(pm80x_onkey_pm_ops, pm80x_dev_suspend, | 62 | static SIMPLE_DEV_PM_OPS(pm80x_onkey_pm_ops, pm80x_dev_suspend, |
63 | pm80x_dev_resume); | 63 | pm80x_dev_resume); |
64 | 64 | ||
65 | static int __devinit pm80x_onkey_probe(struct platform_device *pdev) | 65 | static int pm80x_onkey_probe(struct platform_device *pdev) |
66 | { | 66 | { |
67 | 67 | ||
68 | struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); | 68 | struct pm80x_chip *chip = dev_get_drvdata(pdev->dev.parent); |
@@ -139,7 +139,7 @@ out: | |||
139 | return err; | 139 | return err; |
140 | } | 140 | } |
141 | 141 | ||
142 | static int __devexit pm80x_onkey_remove(struct platform_device *pdev) | 142 | static int pm80x_onkey_remove(struct platform_device *pdev) |
143 | { | 143 | { |
144 | struct pm80x_onkey_info *info = platform_get_drvdata(pdev); | 144 | struct pm80x_onkey_info *info = platform_get_drvdata(pdev); |
145 | 145 | ||
@@ -157,7 +157,7 @@ static struct platform_driver pm80x_onkey_driver = { | |||
157 | .pm = &pm80x_onkey_pm_ops, | 157 | .pm = &pm80x_onkey_pm_ops, |
158 | }, | 158 | }, |
159 | .probe = pm80x_onkey_probe, | 159 | .probe = pm80x_onkey_probe, |
160 | .remove = __devexit_p(pm80x_onkey_remove), | 160 | .remove = pm80x_onkey_remove, |
161 | }; | 161 | }; |
162 | 162 | ||
163 | module_platform_driver(pm80x_onkey_driver); | 163 | module_platform_driver(pm80x_onkey_driver); |
diff --git a/drivers/input/misc/88pm860x_onkey.c b/drivers/input/misc/88pm860x_onkey.c index f9ce1835e4d..abd8453e521 100644 --- a/drivers/input/misc/88pm860x_onkey.c +++ b/drivers/input/misc/88pm860x_onkey.c | |||
@@ -56,7 +56,7 @@ static irqreturn_t pm860x_onkey_handler(int irq, void *data) | |||
56 | return IRQ_HANDLED; | 56 | return IRQ_HANDLED; |
57 | } | 57 | } |
58 | 58 | ||
59 | static int __devinit pm860x_onkey_probe(struct platform_device *pdev) | 59 | static int pm860x_onkey_probe(struct platform_device *pdev) |
60 | { | 60 | { |
61 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); | 61 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); |
62 | struct pm860x_onkey_info *info; | 62 | struct pm860x_onkey_info *info; |
@@ -121,7 +121,7 @@ out: | |||
121 | return ret; | 121 | return ret; |
122 | } | 122 | } |
123 | 123 | ||
124 | static int __devexit pm860x_onkey_remove(struct platform_device *pdev) | 124 | static int pm860x_onkey_remove(struct platform_device *pdev) |
125 | { | 125 | { |
126 | struct pm860x_onkey_info *info = platform_get_drvdata(pdev); | 126 | struct pm860x_onkey_info *info = platform_get_drvdata(pdev); |
127 | 127 | ||
@@ -161,7 +161,7 @@ static struct platform_driver pm860x_onkey_driver = { | |||
161 | .pm = &pm860x_onkey_pm_ops, | 161 | .pm = &pm860x_onkey_pm_ops, |
162 | }, | 162 | }, |
163 | .probe = pm860x_onkey_probe, | 163 | .probe = pm860x_onkey_probe, |
164 | .remove = __devexit_p(pm860x_onkey_remove), | 164 | .remove = pm860x_onkey_remove, |
165 | }; | 165 | }; |
166 | module_platform_driver(pm860x_onkey_driver); | 166 | module_platform_driver(pm860x_onkey_driver); |
167 | 167 | ||
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 7c0f1ecfdd7..2a1647ef561 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -290,8 +290,7 @@ config INPUT_ATI_REMOTE2 | |||
290 | called ati_remote2. | 290 | called ati_remote2. |
291 | 291 | ||
292 | config INPUT_KEYSPAN_REMOTE | 292 | config INPUT_KEYSPAN_REMOTE |
293 | tristate "Keyspan DMR USB remote control (EXPERIMENTAL)" | 293 | tristate "Keyspan DMR USB remote control" |
294 | depends on EXPERIMENTAL | ||
295 | depends on USB_ARCH_HAS_HCD | 294 | depends on USB_ARCH_HAS_HCD |
296 | select USB | 295 | select USB |
297 | help | 296 | help |
@@ -340,7 +339,6 @@ config INPUT_POWERMATE | |||
340 | 339 | ||
341 | config INPUT_YEALINK | 340 | config INPUT_YEALINK |
342 | tristate "Yealink usb-p1k voip phone" | 341 | tristate "Yealink usb-p1k voip phone" |
343 | depends on EXPERIMENTAL | ||
344 | depends on USB_ARCH_HAS_HCD | 342 | depends on USB_ARCH_HAS_HCD |
345 | select USB | 343 | select USB |
346 | help | 344 | help |
@@ -356,7 +354,6 @@ config INPUT_YEALINK | |||
356 | 354 | ||
357 | config INPUT_CM109 | 355 | config INPUT_CM109 |
358 | tristate "C-Media CM109 USB I/O Controller" | 356 | tristate "C-Media CM109 USB I/O Controller" |
359 | depends on EXPERIMENTAL | ||
360 | depends on USB_ARCH_HAS_HCD | 357 | depends on USB_ARCH_HAS_HCD |
361 | select USB | 358 | select USB |
362 | help | 359 | help |
@@ -367,6 +364,16 @@ config INPUT_CM109 | |||
367 | To compile this driver as a module, choose M here: the module will be | 364 | To compile this driver as a module, choose M here: the module will be |
368 | called cm109. | 365 | called cm109. |
369 | 366 | ||
367 | config INPUT_RETU_PWRBUTTON | ||
368 | tristate "Retu Power button Driver" | ||
369 | depends on MFD_RETU | ||
370 | help | ||
371 | Say Y here if you want to enable power key reporting via the | ||
372 | Retu chips found in Nokia Internet Tablets (770, N800, N810). | ||
373 | |||
374 | To compile this driver as a module, choose M here. The module will | ||
375 | be called retu-pwrbutton. | ||
376 | |||
370 | config INPUT_TWL4030_PWRBUTTON | 377 | config INPUT_TWL4030_PWRBUTTON |
371 | tristate "TWL4030 Power button Driver" | 378 | tristate "TWL4030 Power button Driver" |
372 | depends on TWL4030_CORE | 379 | depends on TWL4030_CORE |
@@ -434,7 +441,7 @@ config INPUT_PCF50633_PMU | |||
434 | 441 | ||
435 | config INPUT_PCF8574 | 442 | config INPUT_PCF8574 |
436 | tristate "PCF8574 Keypad input device" | 443 | tristate "PCF8574 Keypad input device" |
437 | depends on I2C && EXPERIMENTAL | 444 | depends on I2C |
438 | help | 445 | help |
439 | Say Y here if you want to support a keypad connected via I2C | 446 | Say Y here if you want to support a keypad connected via I2C |
440 | with a PCF8574. | 447 | with a PCF8574. |
@@ -444,7 +451,7 @@ config INPUT_PCF8574 | |||
444 | 451 | ||
445 | config INPUT_PWM_BEEPER | 452 | config INPUT_PWM_BEEPER |
446 | tristate "PWM beeper support" | 453 | tristate "PWM beeper support" |
447 | depends on HAVE_PWM | 454 | depends on HAVE_PWM || PWM |
448 | help | 455 | help |
449 | Say Y here to get support for PWM based beeper devices. | 456 | Say Y here to get support for PWM based beeper devices. |
450 | 457 | ||
@@ -486,6 +493,16 @@ config INPUT_DA9052_ONKEY | |||
486 | To compile this driver as a module, choose M here: the | 493 | To compile this driver as a module, choose M here: the |
487 | module will be called da9052_onkey. | 494 | module will be called da9052_onkey. |
488 | 495 | ||
496 | config INPUT_DA9055_ONKEY | ||
497 | tristate "Dialog Semiconductor DA9055 ONKEY" | ||
498 | depends on MFD_DA9055 | ||
499 | help | ||
500 | Support the ONKEY of DA9055 PMICs as an input device | ||
501 | reporting power button status. | ||
502 | |||
503 | To compile this driver as a module, choose M here: the module | ||
504 | will be called da9055_onkey. | ||
505 | |||
489 | config INPUT_DM355EVM | 506 | config INPUT_DM355EVM |
490 | tristate "TI DaVinci DM355 EVM Keypad and IR Remote" | 507 | tristate "TI DaVinci DM355 EVM Keypad and IR Remote" |
491 | depends on MFD_DM355EVM_MSP | 508 | depends on MFD_DM355EVM_MSP |
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 83fe6f5b77d..1f874afeea6 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile | |||
@@ -23,6 +23,7 @@ obj-$(CONFIG_INPUT_CMA3000) += cma3000_d0x.o | |||
23 | obj-$(CONFIG_INPUT_CMA3000_I2C) += cma3000_d0x_i2c.o | 23 | obj-$(CONFIG_INPUT_CMA3000_I2C) += cma3000_d0x_i2c.o |
24 | obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o | 24 | obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o |
25 | obj-$(CONFIG_INPUT_DA9052_ONKEY) += da9052_onkey.o | 25 | obj-$(CONFIG_INPUT_DA9052_ONKEY) += da9052_onkey.o |
26 | obj-$(CONFIG_INPUT_DA9055_ONKEY) += da9055_onkey.o | ||
26 | obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o | 27 | obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o |
27 | obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o | 28 | obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o |
28 | obj-$(CONFIG_INPUT_GPIO_TILT_POLLED) += gpio_tilt_polled.o | 29 | obj-$(CONFIG_INPUT_GPIO_TILT_POLLED) += gpio_tilt_polled.o |
@@ -45,6 +46,7 @@ obj-$(CONFIG_INPUT_PMIC8XXX_PWRKEY) += pmic8xxx-pwrkey.o | |||
45 | obj-$(CONFIG_INPUT_POWERMATE) += powermate.o | 46 | obj-$(CONFIG_INPUT_POWERMATE) += powermate.o |
46 | obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o | 47 | obj-$(CONFIG_INPUT_PWM_BEEPER) += pwm-beeper.o |
47 | obj-$(CONFIG_INPUT_RB532_BUTTON) += rb532_button.o | 48 | obj-$(CONFIG_INPUT_RB532_BUTTON) += rb532_button.o |
49 | obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o | ||
48 | obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o | 50 | obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o |
49 | obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o | 51 | obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o |
50 | obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o | 52 | obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o |
diff --git a/drivers/input/misc/ab8500-ponkey.c b/drivers/input/misc/ab8500-ponkey.c index 84ec691c05a..2f090b46e71 100644 --- a/drivers/input/misc/ab8500-ponkey.c +++ b/drivers/input/misc/ab8500-ponkey.c | |||
@@ -45,7 +45,7 @@ static irqreturn_t ab8500_ponkey_handler(int irq, void *data) | |||
45 | return IRQ_HANDLED; | 45 | return IRQ_HANDLED; |
46 | } | 46 | } |
47 | 47 | ||
48 | static int __devinit ab8500_ponkey_probe(struct platform_device *pdev) | 48 | static int ab8500_ponkey_probe(struct platform_device *pdev) |
49 | { | 49 | { |
50 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); | 50 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); |
51 | struct ab8500_ponkey *ponkey; | 51 | struct ab8500_ponkey *ponkey; |
@@ -118,7 +118,7 @@ err_free_mem: | |||
118 | return error; | 118 | return error; |
119 | } | 119 | } |
120 | 120 | ||
121 | static int __devexit ab8500_ponkey_remove(struct platform_device *pdev) | 121 | static int ab8500_ponkey_remove(struct platform_device *pdev) |
122 | { | 122 | { |
123 | struct ab8500_ponkey *ponkey = platform_get_drvdata(pdev); | 123 | struct ab8500_ponkey *ponkey = platform_get_drvdata(pdev); |
124 | 124 | ||
@@ -146,7 +146,7 @@ static struct platform_driver ab8500_ponkey_driver = { | |||
146 | .of_match_table = of_match_ptr(ab8500_ponkey_match), | 146 | .of_match_table = of_match_ptr(ab8500_ponkey_match), |
147 | }, | 147 | }, |
148 | .probe = ab8500_ponkey_probe, | 148 | .probe = ab8500_ponkey_probe, |
149 | .remove = __devexit_p(ab8500_ponkey_remove), | 149 | .remove = ab8500_ponkey_remove, |
150 | }; | 150 | }; |
151 | module_platform_driver(ab8500_ponkey_driver); | 151 | module_platform_driver(ab8500_ponkey_driver); |
152 | 152 | ||
diff --git a/drivers/input/misc/ad714x-i2c.c b/drivers/input/misc/ad714x-i2c.c index c8a79015472..29d2064c26f 100644 --- a/drivers/input/misc/ad714x-i2c.c +++ b/drivers/input/misc/ad714x-i2c.c | |||
@@ -72,7 +72,7 @@ static int ad714x_i2c_read(struct ad714x_chip *chip, | |||
72 | return 0; | 72 | return 0; |
73 | } | 73 | } |
74 | 74 | ||
75 | static int __devinit ad714x_i2c_probe(struct i2c_client *client, | 75 | static int ad714x_i2c_probe(struct i2c_client *client, |
76 | const struct i2c_device_id *id) | 76 | const struct i2c_device_id *id) |
77 | { | 77 | { |
78 | struct ad714x_chip *chip; | 78 | struct ad714x_chip *chip; |
@@ -87,7 +87,7 @@ static int __devinit ad714x_i2c_probe(struct i2c_client *client, | |||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | static int __devexit ad714x_i2c_remove(struct i2c_client *client) | 90 | static int ad714x_i2c_remove(struct i2c_client *client) |
91 | { | 91 | { |
92 | struct ad714x_chip *chip = i2c_get_clientdata(client); | 92 | struct ad714x_chip *chip = i2c_get_clientdata(client); |
93 | 93 | ||
@@ -112,7 +112,7 @@ static struct i2c_driver ad714x_i2c_driver = { | |||
112 | .pm = &ad714x_i2c_pm, | 112 | .pm = &ad714x_i2c_pm, |
113 | }, | 113 | }, |
114 | .probe = ad714x_i2c_probe, | 114 | .probe = ad714x_i2c_probe, |
115 | .remove = __devexit_p(ad714x_i2c_remove), | 115 | .remove = ad714x_i2c_remove, |
116 | .id_table = ad714x_id, | 116 | .id_table = ad714x_id, |
117 | }; | 117 | }; |
118 | 118 | ||
diff --git a/drivers/input/misc/ad714x-spi.c b/drivers/input/misc/ad714x-spi.c index 75f6136d608..bdccca42d13 100644 --- a/drivers/input/misc/ad714x-spi.c +++ b/drivers/input/misc/ad714x-spi.c | |||
@@ -83,7 +83,7 @@ static int ad714x_spi_write(struct ad714x_chip *chip, | |||
83 | return 0; | 83 | return 0; |
84 | } | 84 | } |
85 | 85 | ||
86 | static int __devinit ad714x_spi_probe(struct spi_device *spi) | 86 | static int ad714x_spi_probe(struct spi_device *spi) |
87 | { | 87 | { |
88 | struct ad714x_chip *chip; | 88 | struct ad714x_chip *chip; |
89 | int err; | 89 | int err; |
@@ -103,7 +103,7 @@ static int __devinit ad714x_spi_probe(struct spi_device *spi) | |||
103 | return 0; | 103 | return 0; |
104 | } | 104 | } |
105 | 105 | ||
106 | static int __devexit ad714x_spi_remove(struct spi_device *spi) | 106 | static int ad714x_spi_remove(struct spi_device *spi) |
107 | { | 107 | { |
108 | struct ad714x_chip *chip = spi_get_drvdata(spi); | 108 | struct ad714x_chip *chip = spi_get_drvdata(spi); |
109 | 109 | ||
@@ -120,7 +120,7 @@ static struct spi_driver ad714x_spi_driver = { | |||
120 | .pm = &ad714x_spi_pm, | 120 | .pm = &ad714x_spi_pm, |
121 | }, | 121 | }, |
122 | .probe = ad714x_spi_probe, | 122 | .probe = ad714x_spi_probe, |
123 | .remove = __devexit_p(ad714x_spi_remove), | 123 | .remove = ad714x_spi_remove, |
124 | }; | 124 | }; |
125 | 125 | ||
126 | module_spi_driver(ad714x_spi_driver); | 126 | module_spi_driver(ad714x_spi_driver); |
diff --git a/drivers/input/misc/adxl34x-i2c.c b/drivers/input/misc/adxl34x-i2c.c index dd1d1c145a7..535dda48cac 100644 --- a/drivers/input/misc/adxl34x-i2c.c +++ b/drivers/input/misc/adxl34x-i2c.c | |||
@@ -73,7 +73,7 @@ static const struct adxl34x_bus_ops adxl34x_i2c_bops = { | |||
73 | .read_block = adxl34x_i2c_read_block, | 73 | .read_block = adxl34x_i2c_read_block, |
74 | }; | 74 | }; |
75 | 75 | ||
76 | static int __devinit adxl34x_i2c_probe(struct i2c_client *client, | 76 | static int adxl34x_i2c_probe(struct i2c_client *client, |
77 | const struct i2c_device_id *id) | 77 | const struct i2c_device_id *id) |
78 | { | 78 | { |
79 | struct adxl34x *ac; | 79 | struct adxl34x *ac; |
@@ -98,7 +98,7 @@ static int __devinit adxl34x_i2c_probe(struct i2c_client *client, | |||
98 | return 0; | 98 | return 0; |
99 | } | 99 | } |
100 | 100 | ||
101 | static int __devexit adxl34x_i2c_remove(struct i2c_client *client) | 101 | static int adxl34x_i2c_remove(struct i2c_client *client) |
102 | { | 102 | { |
103 | struct adxl34x *ac = i2c_get_clientdata(client); | 103 | struct adxl34x *ac = i2c_get_clientdata(client); |
104 | 104 | ||
@@ -144,7 +144,7 @@ static struct i2c_driver adxl34x_driver = { | |||
144 | .pm = &adxl34x_i2c_pm, | 144 | .pm = &adxl34x_i2c_pm, |
145 | }, | 145 | }, |
146 | .probe = adxl34x_i2c_probe, | 146 | .probe = adxl34x_i2c_probe, |
147 | .remove = __devexit_p(adxl34x_i2c_remove), | 147 | .remove = adxl34x_i2c_remove, |
148 | .id_table = adxl34x_id, | 148 | .id_table = adxl34x_id, |
149 | }; | 149 | }; |
150 | 150 | ||
diff --git a/drivers/input/misc/adxl34x-spi.c b/drivers/input/misc/adxl34x-spi.c index 820a802a1e6..ad5f40d37e4 100644 --- a/drivers/input/misc/adxl34x-spi.c +++ b/drivers/input/misc/adxl34x-spi.c | |||
@@ -65,7 +65,7 @@ static const struct adxl34x_bus_ops adxl34x_spi_bops = { | |||
65 | .read_block = adxl34x_spi_read_block, | 65 | .read_block = adxl34x_spi_read_block, |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static int __devinit adxl34x_spi_probe(struct spi_device *spi) | 68 | static int adxl34x_spi_probe(struct spi_device *spi) |
69 | { | 69 | { |
70 | struct adxl34x *ac; | 70 | struct adxl34x *ac; |
71 | 71 | ||
@@ -87,7 +87,7 @@ static int __devinit adxl34x_spi_probe(struct spi_device *spi) | |||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | static int __devexit adxl34x_spi_remove(struct spi_device *spi) | 90 | static int adxl34x_spi_remove(struct spi_device *spi) |
91 | { | 91 | { |
92 | struct adxl34x *ac = dev_get_drvdata(&spi->dev); | 92 | struct adxl34x *ac = dev_get_drvdata(&spi->dev); |
93 | 93 | ||
@@ -126,7 +126,7 @@ static struct spi_driver adxl34x_driver = { | |||
126 | .pm = &adxl34x_spi_pm, | 126 | .pm = &adxl34x_spi_pm, |
127 | }, | 127 | }, |
128 | .probe = adxl34x_spi_probe, | 128 | .probe = adxl34x_spi_probe, |
129 | .remove = __devexit_p(adxl34x_spi_remove), | 129 | .remove = adxl34x_spi_remove, |
130 | }; | 130 | }; |
131 | 131 | ||
132 | module_spi_driver(adxl34x_driver); | 132 | module_spi_driver(adxl34x_driver); |
diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c index 1c4146fccfd..a6666e142a9 100644 --- a/drivers/input/misc/bfin_rotary.c +++ b/drivers/input/misc/bfin_rotary.c | |||
@@ -90,7 +90,7 @@ static irqreturn_t bfin_rotary_isr(int irq, void *dev_id) | |||
90 | return IRQ_HANDLED; | 90 | return IRQ_HANDLED; |
91 | } | 91 | } |
92 | 92 | ||
93 | static int __devinit bfin_rotary_probe(struct platform_device *pdev) | 93 | static int bfin_rotary_probe(struct platform_device *pdev) |
94 | { | 94 | { |
95 | struct bfin_rotary_platform_data *pdata = pdev->dev.platform_data; | 95 | struct bfin_rotary_platform_data *pdata = pdev->dev.platform_data; |
96 | struct bfin_rot *rotary; | 96 | struct bfin_rot *rotary; |
@@ -196,7 +196,7 @@ out1: | |||
196 | return error; | 196 | return error; |
197 | } | 197 | } |
198 | 198 | ||
199 | static int __devexit bfin_rotary_remove(struct platform_device *pdev) | 199 | static int bfin_rotary_remove(struct platform_device *pdev) |
200 | { | 200 | { |
201 | struct bfin_rot *rotary = platform_get_drvdata(pdev); | 201 | struct bfin_rot *rotary = platform_get_drvdata(pdev); |
202 | 202 | ||
@@ -255,7 +255,7 @@ static const struct dev_pm_ops bfin_rotary_pm_ops = { | |||
255 | 255 | ||
256 | static struct platform_driver bfin_rotary_device_driver = { | 256 | static struct platform_driver bfin_rotary_device_driver = { |
257 | .probe = bfin_rotary_probe, | 257 | .probe = bfin_rotary_probe, |
258 | .remove = __devexit_p(bfin_rotary_remove), | 258 | .remove = bfin_rotary_remove, |
259 | .driver = { | 259 | .driver = { |
260 | .name = "bfin-rotary", | 260 | .name = "bfin-rotary", |
261 | .owner = THIS_MODULE, | 261 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index e2f1e9f952b..08ffcabd722 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c | |||
@@ -158,7 +158,7 @@ struct bma150_data { | |||
158 | * are stated and verified by Bosch Sensortec where they are configured | 158 | * are stated and verified by Bosch Sensortec where they are configured |
159 | * to provide a generic sensitivity performance. | 159 | * to provide a generic sensitivity performance. |
160 | */ | 160 | */ |
161 | static struct bma150_cfg default_cfg __devinitdata = { | 161 | static struct bma150_cfg default_cfg = { |
162 | .any_motion_int = 1, | 162 | .any_motion_int = 1, |
163 | .hg_int = 1, | 163 | .hg_int = 1, |
164 | .lg_int = 1, | 164 | .lg_int = 1, |
@@ -224,7 +224,7 @@ static int bma150_set_mode(struct bma150_data *bma150, u8 mode) | |||
224 | return 0; | 224 | return 0; |
225 | } | 225 | } |
226 | 226 | ||
227 | static int __devinit bma150_soft_reset(struct bma150_data *bma150) | 227 | static int bma150_soft_reset(struct bma150_data *bma150) |
228 | { | 228 | { |
229 | int error; | 229 | int error; |
230 | 230 | ||
@@ -237,19 +237,19 @@ static int __devinit bma150_soft_reset(struct bma150_data *bma150) | |||
237 | return 0; | 237 | return 0; |
238 | } | 238 | } |
239 | 239 | ||
240 | static int __devinit bma150_set_range(struct bma150_data *bma150, u8 range) | 240 | static int bma150_set_range(struct bma150_data *bma150, u8 range) |
241 | { | 241 | { |
242 | return bma150_set_reg_bits(bma150->client, range, BMA150_RANGE_POS, | 242 | return bma150_set_reg_bits(bma150->client, range, BMA150_RANGE_POS, |
243 | BMA150_RANGE_MSK, BMA150_RANGE_REG); | 243 | BMA150_RANGE_MSK, BMA150_RANGE_REG); |
244 | } | 244 | } |
245 | 245 | ||
246 | static int __devinit bma150_set_bandwidth(struct bma150_data *bma150, u8 bw) | 246 | static int bma150_set_bandwidth(struct bma150_data *bma150, u8 bw) |
247 | { | 247 | { |
248 | return bma150_set_reg_bits(bma150->client, bw, BMA150_BANDWIDTH_POS, | 248 | return bma150_set_reg_bits(bma150->client, bw, BMA150_BANDWIDTH_POS, |
249 | BMA150_BANDWIDTH_MSK, BMA150_BANDWIDTH_REG); | 249 | BMA150_BANDWIDTH_MSK, BMA150_BANDWIDTH_REG); |
250 | } | 250 | } |
251 | 251 | ||
252 | static int __devinit bma150_set_low_g_interrupt(struct bma150_data *bma150, | 252 | static int bma150_set_low_g_interrupt(struct bma150_data *bma150, |
253 | u8 enable, u8 hyst, u8 dur, u8 thres) | 253 | u8 enable, u8 hyst, u8 dur, u8 thres) |
254 | { | 254 | { |
255 | int error; | 255 | int error; |
@@ -273,7 +273,7 @@ static int __devinit bma150_set_low_g_interrupt(struct bma150_data *bma150, | |||
273 | BMA150_LOW_G_EN_REG); | 273 | BMA150_LOW_G_EN_REG); |
274 | } | 274 | } |
275 | 275 | ||
276 | static int __devinit bma150_set_high_g_interrupt(struct bma150_data *bma150, | 276 | static int bma150_set_high_g_interrupt(struct bma150_data *bma150, |
277 | u8 enable, u8 hyst, u8 dur, u8 thres) | 277 | u8 enable, u8 hyst, u8 dur, u8 thres) |
278 | { | 278 | { |
279 | int error; | 279 | int error; |
@@ -300,7 +300,7 @@ static int __devinit bma150_set_high_g_interrupt(struct bma150_data *bma150, | |||
300 | } | 300 | } |
301 | 301 | ||
302 | 302 | ||
303 | static int __devinit bma150_set_any_motion_interrupt(struct bma150_data *bma150, | 303 | static int bma150_set_any_motion_interrupt(struct bma150_data *bma150, |
304 | u8 enable, u8 dur, u8 thres) | 304 | u8 enable, u8 dur, u8 thres) |
305 | { | 305 | { |
306 | int error; | 306 | int error; |
@@ -424,7 +424,7 @@ static void bma150_poll_close(struct input_polled_dev *ipoll_dev) | |||
424 | bma150_close(bma150); | 424 | bma150_close(bma150); |
425 | } | 425 | } |
426 | 426 | ||
427 | static int __devinit bma150_initialize(struct bma150_data *bma150, | 427 | static int bma150_initialize(struct bma150_data *bma150, |
428 | const struct bma150_cfg *cfg) | 428 | const struct bma150_cfg *cfg) |
429 | { | 429 | { |
430 | int error; | 430 | int error; |
@@ -465,7 +465,7 @@ static int __devinit bma150_initialize(struct bma150_data *bma150, | |||
465 | return bma150_set_mode(bma150, BMA150_MODE_SLEEP); | 465 | return bma150_set_mode(bma150, BMA150_MODE_SLEEP); |
466 | } | 466 | } |
467 | 467 | ||
468 | static void __devinit bma150_init_input_device(struct bma150_data *bma150, | 468 | static void bma150_init_input_device(struct bma150_data *bma150, |
469 | struct input_dev *idev) | 469 | struct input_dev *idev) |
470 | { | 470 | { |
471 | idev->name = BMA150_DRIVER; | 471 | idev->name = BMA150_DRIVER; |
@@ -479,7 +479,7 @@ static void __devinit bma150_init_input_device(struct bma150_data *bma150, | |||
479 | input_set_abs_params(idev, ABS_Z, ABSMIN_ACC_VAL, ABSMAX_ACC_VAL, 0, 0); | 479 | input_set_abs_params(idev, ABS_Z, ABSMIN_ACC_VAL, ABSMAX_ACC_VAL, 0, 0); |
480 | } | 480 | } |
481 | 481 | ||
482 | static int __devinit bma150_register_input_device(struct bma150_data *bma150) | 482 | static int bma150_register_input_device(struct bma150_data *bma150) |
483 | { | 483 | { |
484 | struct input_dev *idev; | 484 | struct input_dev *idev; |
485 | int error; | 485 | int error; |
@@ -504,7 +504,7 @@ static int __devinit bma150_register_input_device(struct bma150_data *bma150) | |||
504 | return 0; | 504 | return 0; |
505 | } | 505 | } |
506 | 506 | ||
507 | static int __devinit bma150_register_polled_device(struct bma150_data *bma150) | 507 | static int bma150_register_polled_device(struct bma150_data *bma150) |
508 | { | 508 | { |
509 | struct input_polled_dev *ipoll_dev; | 509 | struct input_polled_dev *ipoll_dev; |
510 | int error; | 510 | int error; |
@@ -535,7 +535,7 @@ static int __devinit bma150_register_polled_device(struct bma150_data *bma150) | |||
535 | return 0; | 535 | return 0; |
536 | } | 536 | } |
537 | 537 | ||
538 | static int __devinit bma150_probe(struct i2c_client *client, | 538 | static int bma150_probe(struct i2c_client *client, |
539 | const struct i2c_device_id *id) | 539 | const struct i2c_device_id *id) |
540 | { | 540 | { |
541 | const struct bma150_platform_data *pdata = client->dev.platform_data; | 541 | const struct bma150_platform_data *pdata = client->dev.platform_data; |
@@ -613,7 +613,7 @@ err_free_mem: | |||
613 | return error; | 613 | return error; |
614 | } | 614 | } |
615 | 615 | ||
616 | static int __devexit bma150_remove(struct i2c_client *client) | 616 | static int bma150_remove(struct i2c_client *client) |
617 | { | 617 | { |
618 | struct bma150_data *bma150 = i2c_get_clientdata(client); | 618 | struct bma150_data *bma150 = i2c_get_clientdata(client); |
619 | 619 | ||
@@ -670,7 +670,7 @@ static struct i2c_driver bma150_driver = { | |||
670 | .class = I2C_CLASS_HWMON, | 670 | .class = I2C_CLASS_HWMON, |
671 | .id_table = bma150_id, | 671 | .id_table = bma150_id, |
672 | .probe = bma150_probe, | 672 | .probe = bma150_probe, |
673 | .remove = __devexit_p(bma150_remove), | 673 | .remove = bma150_remove, |
674 | }; | 674 | }; |
675 | 675 | ||
676 | module_i2c_driver(bma150_driver); | 676 | module_i2c_driver(bma150_driver); |
diff --git a/drivers/input/misc/cma3000_d0x_i2c.c b/drivers/input/misc/cma3000_d0x_i2c.c index fe9b85f0779..4fdef98ceb5 100644 --- a/drivers/input/misc/cma3000_d0x_i2c.c +++ b/drivers/input/misc/cma3000_d0x_i2c.c | |||
@@ -55,7 +55,7 @@ static const struct cma3000_bus_ops cma3000_i2c_bops = { | |||
55 | .write = cma3000_i2c_set, | 55 | .write = cma3000_i2c_set, |
56 | }; | 56 | }; |
57 | 57 | ||
58 | static int __devinit cma3000_i2c_probe(struct i2c_client *client, | 58 | static int cma3000_i2c_probe(struct i2c_client *client, |
59 | const struct i2c_device_id *id) | 59 | const struct i2c_device_id *id) |
60 | { | 60 | { |
61 | struct cma3000_accl_data *data; | 61 | struct cma3000_accl_data *data; |
@@ -69,7 +69,7 @@ static int __devinit cma3000_i2c_probe(struct i2c_client *client, | |||
69 | return 0; | 69 | return 0; |
70 | } | 70 | } |
71 | 71 | ||
72 | static int __devexit cma3000_i2c_remove(struct i2c_client *client) | 72 | static int cma3000_i2c_remove(struct i2c_client *client) |
73 | { | 73 | { |
74 | struct cma3000_accl_data *data = i2c_get_clientdata(client); | 74 | struct cma3000_accl_data *data = i2c_get_clientdata(client); |
75 | 75 | ||
@@ -114,7 +114,7 @@ MODULE_DEVICE_TABLE(i2c, cma3000_i2c_id); | |||
114 | 114 | ||
115 | static struct i2c_driver cma3000_i2c_driver = { | 115 | static struct i2c_driver cma3000_i2c_driver = { |
116 | .probe = cma3000_i2c_probe, | 116 | .probe = cma3000_i2c_probe, |
117 | .remove = __devexit_p(cma3000_i2c_remove), | 117 | .remove = cma3000_i2c_remove, |
118 | .id_table = cma3000_i2c_id, | 118 | .id_table = cma3000_i2c_id, |
119 | .driver = { | 119 | .driver = { |
120 | .name = "cma3000_i2c_accl", | 120 | .name = "cma3000_i2c_accl", |
diff --git a/drivers/input/misc/cobalt_btns.c b/drivers/input/misc/cobalt_btns.c index 53e43d29514..4f77f87847e 100644 --- a/drivers/input/misc/cobalt_btns.c +++ b/drivers/input/misc/cobalt_btns.c | |||
@@ -73,7 +73,7 @@ static void handle_buttons(struct input_polled_dev *dev) | |||
73 | } | 73 | } |
74 | } | 74 | } |
75 | 75 | ||
76 | static int __devinit cobalt_buttons_probe(struct platform_device *pdev) | 76 | static int cobalt_buttons_probe(struct platform_device *pdev) |
77 | { | 77 | { |
78 | struct buttons_dev *bdev; | 78 | struct buttons_dev *bdev; |
79 | struct input_polled_dev *poll_dev; | 79 | struct input_polled_dev *poll_dev; |
@@ -135,7 +135,7 @@ static int __devinit cobalt_buttons_probe(struct platform_device *pdev) | |||
135 | return error; | 135 | return error; |
136 | } | 136 | } |
137 | 137 | ||
138 | static int __devexit cobalt_buttons_remove(struct platform_device *pdev) | 138 | static int cobalt_buttons_remove(struct platform_device *pdev) |
139 | { | 139 | { |
140 | struct device *dev = &pdev->dev; | 140 | struct device *dev = &pdev->dev; |
141 | struct buttons_dev *bdev = dev_get_drvdata(dev); | 141 | struct buttons_dev *bdev = dev_get_drvdata(dev); |
@@ -157,7 +157,7 @@ MODULE_ALIAS("platform:Cobalt buttons"); | |||
157 | 157 | ||
158 | static struct platform_driver cobalt_buttons_driver = { | 158 | static struct platform_driver cobalt_buttons_driver = { |
159 | .probe = cobalt_buttons_probe, | 159 | .probe = cobalt_buttons_probe, |
160 | .remove = __devexit_p(cobalt_buttons_remove), | 160 | .remove = cobalt_buttons_remove, |
161 | .driver = { | 161 | .driver = { |
162 | .name = "Cobalt buttons", | 162 | .name = "Cobalt buttons", |
163 | .owner = THIS_MODULE, | 163 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/da9052_onkey.c b/drivers/input/misc/da9052_onkey.c index 3c843cd725f..630c1ce4980 100644 --- a/drivers/input/misc/da9052_onkey.c +++ b/drivers/input/misc/da9052_onkey.c | |||
@@ -71,7 +71,7 @@ static irqreturn_t da9052_onkey_irq(int irq, void *data) | |||
71 | return IRQ_HANDLED; | 71 | return IRQ_HANDLED; |
72 | } | 72 | } |
73 | 73 | ||
74 | static int __devinit da9052_onkey_probe(struct platform_device *pdev) | 74 | static int da9052_onkey_probe(struct platform_device *pdev) |
75 | { | 75 | { |
76 | struct da9052 *da9052 = dev_get_drvdata(pdev->dev.parent); | 76 | struct da9052 *da9052 = dev_get_drvdata(pdev->dev.parent); |
77 | struct da9052_onkey *onkey; | 77 | struct da9052_onkey *onkey; |
@@ -141,7 +141,7 @@ err_free_mem: | |||
141 | return error; | 141 | return error; |
142 | } | 142 | } |
143 | 143 | ||
144 | static int __devexit da9052_onkey_remove(struct platform_device *pdev) | 144 | static int da9052_onkey_remove(struct platform_device *pdev) |
145 | { | 145 | { |
146 | struct da9052_onkey *onkey = platform_get_drvdata(pdev); | 146 | struct da9052_onkey *onkey = platform_get_drvdata(pdev); |
147 | 147 | ||
@@ -156,7 +156,7 @@ static int __devexit da9052_onkey_remove(struct platform_device *pdev) | |||
156 | 156 | ||
157 | static struct platform_driver da9052_onkey_driver = { | 157 | static struct platform_driver da9052_onkey_driver = { |
158 | .probe = da9052_onkey_probe, | 158 | .probe = da9052_onkey_probe, |
159 | .remove = __devexit_p(da9052_onkey_remove), | 159 | .remove = da9052_onkey_remove, |
160 | .driver = { | 160 | .driver = { |
161 | .name = "da9052-onkey", | 161 | .name = "da9052-onkey", |
162 | .owner = THIS_MODULE, | 162 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/da9055_onkey.c b/drivers/input/misc/da9055_onkey.c new file mode 100644 index 00000000000..ee6ae3a0017 --- /dev/null +++ b/drivers/input/misc/da9055_onkey.c | |||
@@ -0,0 +1,171 @@ | |||
1 | /* | ||
2 | * ON pin driver for Dialog DA9055 PMICs | ||
3 | * | ||
4 | * Copyright(c) 2012 Dialog Semiconductor Ltd. | ||
5 | * | ||
6 | * Author: David Dajun Chen <dchen@diasemi.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <linux/init.h> | ||
15 | #include <linux/input.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | #include <linux/mfd/da9055/core.h> | ||
20 | #include <linux/mfd/da9055/reg.h> | ||
21 | |||
22 | struct da9055_onkey { | ||
23 | struct da9055 *da9055; | ||
24 | struct input_dev *input; | ||
25 | struct delayed_work work; | ||
26 | }; | ||
27 | |||
28 | static void da9055_onkey_query(struct da9055_onkey *onkey) | ||
29 | { | ||
30 | int key_stat; | ||
31 | |||
32 | key_stat = da9055_reg_read(onkey->da9055, DA9055_REG_STATUS_A); | ||
33 | if (key_stat < 0) { | ||
34 | dev_err(onkey->da9055->dev, | ||
35 | "Failed to read onkey event %d\n", key_stat); | ||
36 | } else { | ||
37 | key_stat &= DA9055_NOKEY_STS; | ||
38 | /* | ||
39 | * Onkey status bit is cleared when onkey button is relased. | ||
40 | */ | ||
41 | if (!key_stat) { | ||
42 | input_report_key(onkey->input, KEY_POWER, 0); | ||
43 | input_sync(onkey->input); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * Interrupt is generated only when the ONKEY pin is asserted. | ||
49 | * Hence the deassertion of the pin is simulated through work queue. | ||
50 | */ | ||
51 | if (key_stat) | ||
52 | schedule_delayed_work(&onkey->work, msecs_to_jiffies(10)); | ||
53 | |||
54 | } | ||
55 | |||
56 | static void da9055_onkey_work(struct work_struct *work) | ||
57 | { | ||
58 | struct da9055_onkey *onkey = container_of(work, struct da9055_onkey, | ||
59 | work.work); | ||
60 | |||
61 | da9055_onkey_query(onkey); | ||
62 | } | ||
63 | |||
64 | static irqreturn_t da9055_onkey_irq(int irq, void *data) | ||
65 | { | ||
66 | struct da9055_onkey *onkey = data; | ||
67 | |||
68 | input_report_key(onkey->input, KEY_POWER, 1); | ||
69 | input_sync(onkey->input); | ||
70 | |||
71 | da9055_onkey_query(onkey); | ||
72 | |||
73 | return IRQ_HANDLED; | ||
74 | } | ||
75 | |||
76 | static int da9055_onkey_probe(struct platform_device *pdev) | ||
77 | { | ||
78 | struct da9055 *da9055 = dev_get_drvdata(pdev->dev.parent); | ||
79 | struct da9055_onkey *onkey; | ||
80 | struct input_dev *input_dev; | ||
81 | int irq, err; | ||
82 | |||
83 | irq = platform_get_irq_byname(pdev, "ONKEY"); | ||
84 | if (irq < 0) { | ||
85 | dev_err(&pdev->dev, | ||
86 | "Failed to get an IRQ for input device, %d\n", irq); | ||
87 | return -EINVAL; | ||
88 | } | ||
89 | |||
90 | onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL); | ||
91 | if (!onkey) { | ||
92 | dev_err(&pdev->dev, "Failed to allocate memory\n"); | ||
93 | return -ENOMEM; | ||
94 | } | ||
95 | |||
96 | input_dev = input_allocate_device(); | ||
97 | if (!input_dev) { | ||
98 | dev_err(&pdev->dev, "Failed to allocate memory\n"); | ||
99 | return -ENOMEM; | ||
100 | } | ||
101 | |||
102 | onkey->input = input_dev; | ||
103 | onkey->da9055 = da9055; | ||
104 | input_dev->name = "da9055-onkey"; | ||
105 | input_dev->phys = "da9055-onkey/input0"; | ||
106 | input_dev->dev.parent = &pdev->dev; | ||
107 | |||
108 | input_dev->evbit[0] = BIT_MASK(EV_KEY); | ||
109 | __set_bit(KEY_POWER, input_dev->keybit); | ||
110 | |||
111 | INIT_DELAYED_WORK(&onkey->work, da9055_onkey_work); | ||
112 | |||
113 | irq = regmap_irq_get_virq(da9055->irq_data, irq); | ||
114 | err = request_threaded_irq(irq, NULL, da9055_onkey_irq, | ||
115 | IRQF_TRIGGER_HIGH | IRQF_ONESHOT, | ||
116 | "ONKEY", onkey); | ||
117 | if (err < 0) { | ||
118 | dev_err(&pdev->dev, | ||
119 | "Failed to register ONKEY IRQ %d, error = %d\n", | ||
120 | irq, err); | ||
121 | goto err_free_input; | ||
122 | } | ||
123 | |||
124 | err = input_register_device(input_dev); | ||
125 | if (err) { | ||
126 | dev_err(&pdev->dev, "Unable to register input device, %d\n", | ||
127 | err); | ||
128 | goto err_free_irq; | ||
129 | } | ||
130 | |||
131 | platform_set_drvdata(pdev, onkey); | ||
132 | |||
133 | return 0; | ||
134 | |||
135 | err_free_irq: | ||
136 | free_irq(irq, onkey); | ||
137 | cancel_delayed_work_sync(&onkey->work); | ||
138 | err_free_input: | ||
139 | input_free_device(input_dev); | ||
140 | |||
141 | return err; | ||
142 | } | ||
143 | |||
144 | static int da9055_onkey_remove(struct platform_device *pdev) | ||
145 | { | ||
146 | struct da9055_onkey *onkey = platform_get_drvdata(pdev); | ||
147 | int irq = platform_get_irq_byname(pdev, "ONKEY"); | ||
148 | |||
149 | irq = regmap_irq_get_virq(onkey->da9055->irq_data, irq); | ||
150 | free_irq(irq, onkey); | ||
151 | cancel_delayed_work_sync(&onkey->work); | ||
152 | input_unregister_device(onkey->input); | ||
153 | |||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | static struct platform_driver da9055_onkey_driver = { | ||
158 | .probe = da9055_onkey_probe, | ||
159 | .remove = da9055_onkey_remove, | ||
160 | .driver = { | ||
161 | .name = "da9055-onkey", | ||
162 | .owner = THIS_MODULE, | ||
163 | }, | ||
164 | }; | ||
165 | |||
166 | module_platform_driver(da9055_onkey_driver); | ||
167 | |||
168 | MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>"); | ||
169 | MODULE_DESCRIPTION("Onkey driver for DA9055"); | ||
170 | MODULE_LICENSE("GPL"); | ||
171 | MODULE_ALIAS("platform:da9055-onkey"); | ||
diff --git a/drivers/input/misc/dm355evm_keys.c b/drivers/input/misc/dm355evm_keys.c index c1313d8535c..a309a5c0899 100644 --- a/drivers/input/misc/dm355evm_keys.c +++ b/drivers/input/misc/dm355evm_keys.c | |||
@@ -173,7 +173,7 @@ static irqreturn_t dm355evm_keys_irq(int irq, void *_keys) | |||
173 | 173 | ||
174 | /*----------------------------------------------------------------------*/ | 174 | /*----------------------------------------------------------------------*/ |
175 | 175 | ||
176 | static int __devinit dm355evm_keys_probe(struct platform_device *pdev) | 176 | static int dm355evm_keys_probe(struct platform_device *pdev) |
177 | { | 177 | { |
178 | struct dm355evm_keys *keys; | 178 | struct dm355evm_keys *keys; |
179 | struct input_dev *input; | 179 | struct input_dev *input; |
@@ -239,7 +239,7 @@ fail1: | |||
239 | return status; | 239 | return status; |
240 | } | 240 | } |
241 | 241 | ||
242 | static int __devexit dm355evm_keys_remove(struct platform_device *pdev) | 242 | static int dm355evm_keys_remove(struct platform_device *pdev) |
243 | { | 243 | { |
244 | struct dm355evm_keys *keys = platform_get_drvdata(pdev); | 244 | struct dm355evm_keys *keys = platform_get_drvdata(pdev); |
245 | 245 | ||
@@ -262,7 +262,7 @@ static int __devexit dm355evm_keys_remove(struct platform_device *pdev) | |||
262 | */ | 262 | */ |
263 | static struct platform_driver dm355evm_keys_driver = { | 263 | static struct platform_driver dm355evm_keys_driver = { |
264 | .probe = dm355evm_keys_probe, | 264 | .probe = dm355evm_keys_probe, |
265 | .remove = __devexit_p(dm355evm_keys_remove), | 265 | .remove = dm355evm_keys_remove, |
266 | .driver = { | 266 | .driver = { |
267 | .owner = THIS_MODULE, | 267 | .owner = THIS_MODULE, |
268 | .name = "dm355evm_keys", | 268 | .name = "dm355evm_keys", |
diff --git a/drivers/input/misc/gp2ap002a00f.c b/drivers/input/misc/gp2ap002a00f.c index b6664cfa340..fe30bd0fe4b 100644 --- a/drivers/input/misc/gp2ap002a00f.c +++ b/drivers/input/misc/gp2ap002a00f.c | |||
@@ -98,7 +98,7 @@ static void gp2a_device_close(struct input_dev *dev) | |||
98 | "unable to deactivate, err %d\n", error); | 98 | "unable to deactivate, err %d\n", error); |
99 | } | 99 | } |
100 | 100 | ||
101 | static int __devinit gp2a_initialize(struct gp2a_data *dt) | 101 | static int gp2a_initialize(struct gp2a_data *dt) |
102 | { | 102 | { |
103 | int error; | 103 | int error; |
104 | 104 | ||
@@ -122,7 +122,7 @@ static int __devinit gp2a_initialize(struct gp2a_data *dt) | |||
122 | return error; | 122 | return error; |
123 | } | 123 | } |
124 | 124 | ||
125 | static int __devinit gp2a_probe(struct i2c_client *client, | 125 | static int gp2a_probe(struct i2c_client *client, |
126 | const struct i2c_device_id *id) | 126 | const struct i2c_device_id *id) |
127 | { | 127 | { |
128 | const struct gp2a_platform_data *pdata = client->dev.platform_data; | 128 | const struct gp2a_platform_data *pdata = client->dev.platform_data; |
@@ -205,7 +205,7 @@ err_hw_shutdown: | |||
205 | return error; | 205 | return error; |
206 | } | 206 | } |
207 | 207 | ||
208 | static int __devexit gp2a_remove(struct i2c_client *client) | 208 | static int gp2a_remove(struct i2c_client *client) |
209 | { | 209 | { |
210 | struct gp2a_data *dt = i2c_get_clientdata(client); | 210 | struct gp2a_data *dt = i2c_get_clientdata(client); |
211 | const struct gp2a_platform_data *pdata = dt->pdata; | 211 | const struct gp2a_platform_data *pdata = dt->pdata; |
@@ -277,7 +277,7 @@ static struct i2c_driver gp2a_i2c_driver = { | |||
277 | .pm = &gp2a_pm, | 277 | .pm = &gp2a_pm, |
278 | }, | 278 | }, |
279 | .probe = gp2a_probe, | 279 | .probe = gp2a_probe, |
280 | .remove = __devexit_p(gp2a_remove), | 280 | .remove = gp2a_remove, |
281 | .id_table = gp2a_i2c_id, | 281 | .id_table = gp2a_i2c_id, |
282 | }; | 282 | }; |
283 | 283 | ||
diff --git a/drivers/input/misc/gpio_tilt_polled.c b/drivers/input/misc/gpio_tilt_polled.c index 277a0574c19..da05cca8b56 100644 --- a/drivers/input/misc/gpio_tilt_polled.c +++ b/drivers/input/misc/gpio_tilt_polled.c | |||
@@ -96,7 +96,7 @@ static void gpio_tilt_polled_close(struct input_polled_dev *dev) | |||
96 | pdata->disable(tdev->dev); | 96 | pdata->disable(tdev->dev); |
97 | } | 97 | } |
98 | 98 | ||
99 | static int __devinit gpio_tilt_polled_probe(struct platform_device *pdev) | 99 | static int gpio_tilt_polled_probe(struct platform_device *pdev) |
100 | { | 100 | { |
101 | const struct gpio_tilt_platform_data *pdata = pdev->dev.platform_data; | 101 | const struct gpio_tilt_platform_data *pdata = pdev->dev.platform_data; |
102 | struct device *dev = &pdev->dev; | 102 | struct device *dev = &pdev->dev; |
@@ -179,7 +179,7 @@ err_free_tdev: | |||
179 | return error; | 179 | return error; |
180 | } | 180 | } |
181 | 181 | ||
182 | static int __devexit gpio_tilt_polled_remove(struct platform_device *pdev) | 182 | static int gpio_tilt_polled_remove(struct platform_device *pdev) |
183 | { | 183 | { |
184 | struct gpio_tilt_polled_dev *tdev = platform_get_drvdata(pdev); | 184 | struct gpio_tilt_polled_dev *tdev = platform_get_drvdata(pdev); |
185 | const struct gpio_tilt_platform_data *pdata = tdev->pdata; | 185 | const struct gpio_tilt_platform_data *pdata = tdev->pdata; |
@@ -198,7 +198,7 @@ static int __devexit gpio_tilt_polled_remove(struct platform_device *pdev) | |||
198 | 198 | ||
199 | static struct platform_driver gpio_tilt_polled_driver = { | 199 | static struct platform_driver gpio_tilt_polled_driver = { |
200 | .probe = gpio_tilt_polled_probe, | 200 | .probe = gpio_tilt_polled_probe, |
201 | .remove = __devexit_p(gpio_tilt_polled_remove), | 201 | .remove = gpio_tilt_polled_remove, |
202 | .driver = { | 202 | .driver = { |
203 | .name = DRV_NAME, | 203 | .name = DRV_NAME, |
204 | .owner = THIS_MODULE, | 204 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/ixp4xx-beeper.c b/drivers/input/misc/ixp4xx-beeper.c index 50e28306830..6ab3decc86e 100644 --- a/drivers/input/misc/ixp4xx-beeper.c +++ b/drivers/input/misc/ixp4xx-beeper.c | |||
@@ -87,7 +87,7 @@ static irqreturn_t ixp4xx_spkr_interrupt(int irq, void *dev_id) | |||
87 | return IRQ_HANDLED; | 87 | return IRQ_HANDLED; |
88 | } | 88 | } |
89 | 89 | ||
90 | static int __devinit ixp4xx_spkr_probe(struct platform_device *dev) | 90 | static int ixp4xx_spkr_probe(struct platform_device *dev) |
91 | { | 91 | { |
92 | struct input_dev *input_dev; | 92 | struct input_dev *input_dev; |
93 | int err; | 93 | int err; |
@@ -132,7 +132,7 @@ static int __devinit ixp4xx_spkr_probe(struct platform_device *dev) | |||
132 | return err; | 132 | return err; |
133 | } | 133 | } |
134 | 134 | ||
135 | static int __devexit ixp4xx_spkr_remove(struct platform_device *dev) | 135 | static int ixp4xx_spkr_remove(struct platform_device *dev) |
136 | { | 136 | { |
137 | struct input_dev *input_dev = platform_get_drvdata(dev); | 137 | struct input_dev *input_dev = platform_get_drvdata(dev); |
138 | unsigned int pin = (unsigned int) input_get_drvdata(input_dev); | 138 | unsigned int pin = (unsigned int) input_get_drvdata(input_dev); |
@@ -165,7 +165,7 @@ static struct platform_driver ixp4xx_spkr_platform_driver = { | |||
165 | .owner = THIS_MODULE, | 165 | .owner = THIS_MODULE, |
166 | }, | 166 | }, |
167 | .probe = ixp4xx_spkr_probe, | 167 | .probe = ixp4xx_spkr_probe, |
168 | .remove = __devexit_p(ixp4xx_spkr_remove), | 168 | .remove = ixp4xx_spkr_remove, |
169 | .shutdown = ixp4xx_spkr_shutdown, | 169 | .shutdown = ixp4xx_spkr_shutdown, |
170 | }; | 170 | }; |
171 | module_platform_driver(ixp4xx_spkr_platform_driver); | 171 | module_platform_driver(ixp4xx_spkr_platform_driver); |
diff --git a/drivers/input/misc/kxtj9.c b/drivers/input/misc/kxtj9.c index f46139f19ff..a993b67a8a5 100644 --- a/drivers/input/misc/kxtj9.c +++ b/drivers/input/misc/kxtj9.c | |||
@@ -295,7 +295,7 @@ static void kxtj9_input_close(struct input_dev *dev) | |||
295 | kxtj9_disable(tj9); | 295 | kxtj9_disable(tj9); |
296 | } | 296 | } |
297 | 297 | ||
298 | static void __devinit kxtj9_init_input_device(struct kxtj9_data *tj9, | 298 | static void kxtj9_init_input_device(struct kxtj9_data *tj9, |
299 | struct input_dev *input_dev) | 299 | struct input_dev *input_dev) |
300 | { | 300 | { |
301 | __set_bit(EV_ABS, input_dev->evbit); | 301 | __set_bit(EV_ABS, input_dev->evbit); |
@@ -308,7 +308,7 @@ static void __devinit kxtj9_init_input_device(struct kxtj9_data *tj9, | |||
308 | input_dev->dev.parent = &tj9->client->dev; | 308 | input_dev->dev.parent = &tj9->client->dev; |
309 | } | 309 | } |
310 | 310 | ||
311 | static int __devinit kxtj9_setup_input_device(struct kxtj9_data *tj9) | 311 | static int kxtj9_setup_input_device(struct kxtj9_data *tj9) |
312 | { | 312 | { |
313 | struct input_dev *input_dev; | 313 | struct input_dev *input_dev; |
314 | int err; | 314 | int err; |
@@ -433,7 +433,7 @@ static void kxtj9_polled_input_close(struct input_polled_dev *dev) | |||
433 | kxtj9_disable(tj9); | 433 | kxtj9_disable(tj9); |
434 | } | 434 | } |
435 | 435 | ||
436 | static int __devinit kxtj9_setup_polled_device(struct kxtj9_data *tj9) | 436 | static int kxtj9_setup_polled_device(struct kxtj9_data *tj9) |
437 | { | 437 | { |
438 | int err; | 438 | int err; |
439 | struct input_polled_dev *poll_dev; | 439 | struct input_polled_dev *poll_dev; |
@@ -466,7 +466,7 @@ static int __devinit kxtj9_setup_polled_device(struct kxtj9_data *tj9) | |||
466 | return 0; | 466 | return 0; |
467 | } | 467 | } |
468 | 468 | ||
469 | static void __devexit kxtj9_teardown_polled_device(struct kxtj9_data *tj9) | 469 | static void kxtj9_teardown_polled_device(struct kxtj9_data *tj9) |
470 | { | 470 | { |
471 | input_unregister_polled_device(tj9->poll_dev); | 471 | input_unregister_polled_device(tj9->poll_dev); |
472 | input_free_polled_device(tj9->poll_dev); | 472 | input_free_polled_device(tj9->poll_dev); |
@@ -485,7 +485,7 @@ static inline void kxtj9_teardown_polled_device(struct kxtj9_data *tj9) | |||
485 | 485 | ||
486 | #endif | 486 | #endif |
487 | 487 | ||
488 | static int __devinit kxtj9_verify(struct kxtj9_data *tj9) | 488 | static int kxtj9_verify(struct kxtj9_data *tj9) |
489 | { | 489 | { |
490 | int retval; | 490 | int retval; |
491 | 491 | ||
@@ -506,7 +506,7 @@ out: | |||
506 | return retval; | 506 | return retval; |
507 | } | 507 | } |
508 | 508 | ||
509 | static int __devinit kxtj9_probe(struct i2c_client *client, | 509 | static int kxtj9_probe(struct i2c_client *client, |
510 | const struct i2c_device_id *id) | 510 | const struct i2c_device_id *id) |
511 | { | 511 | { |
512 | const struct kxtj9_platform_data *pdata = client->dev.platform_data; | 512 | const struct kxtj9_platform_data *pdata = client->dev.platform_data; |
@@ -594,7 +594,7 @@ err_free_mem: | |||
594 | return err; | 594 | return err; |
595 | } | 595 | } |
596 | 596 | ||
597 | static int __devexit kxtj9_remove(struct i2c_client *client) | 597 | static int kxtj9_remove(struct i2c_client *client) |
598 | { | 598 | { |
599 | struct kxtj9_data *tj9 = i2c_get_clientdata(client); | 599 | struct kxtj9_data *tj9 = i2c_get_clientdata(client); |
600 | 600 | ||
@@ -663,7 +663,7 @@ static struct i2c_driver kxtj9_driver = { | |||
663 | .pm = &kxtj9_pm_ops, | 663 | .pm = &kxtj9_pm_ops, |
664 | }, | 664 | }, |
665 | .probe = kxtj9_probe, | 665 | .probe = kxtj9_probe, |
666 | .remove = __devexit_p(kxtj9_remove), | 666 | .remove = kxtj9_remove, |
667 | .id_table = kxtj9_id, | 667 | .id_table = kxtj9_id, |
668 | }; | 668 | }; |
669 | 669 | ||
diff --git a/drivers/input/misc/m68kspkr.c b/drivers/input/misc/m68kspkr.c index 0c64d9bb718..b40ee4b47f4 100644 --- a/drivers/input/misc/m68kspkr.c +++ b/drivers/input/misc/m68kspkr.c | |||
@@ -48,7 +48,7 @@ static int m68kspkr_event(struct input_dev *dev, unsigned int type, unsigned int | |||
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | static int __devinit m68kspkr_probe(struct platform_device *dev) | 51 | static int m68kspkr_probe(struct platform_device *dev) |
52 | { | 52 | { |
53 | struct input_dev *input_dev; | 53 | struct input_dev *input_dev; |
54 | int err; | 54 | int err; |
@@ -80,7 +80,7 @@ static int __devinit m68kspkr_probe(struct platform_device *dev) | |||
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int __devexit m68kspkr_remove(struct platform_device *dev) | 83 | static int m68kspkr_remove(struct platform_device *dev) |
84 | { | 84 | { |
85 | struct input_dev *input_dev = platform_get_drvdata(dev); | 85 | struct input_dev *input_dev = platform_get_drvdata(dev); |
86 | 86 | ||
@@ -104,7 +104,7 @@ static struct platform_driver m68kspkr_platform_driver = { | |||
104 | .owner = THIS_MODULE, | 104 | .owner = THIS_MODULE, |
105 | }, | 105 | }, |
106 | .probe = m68kspkr_probe, | 106 | .probe = m68kspkr_probe, |
107 | .remove = __devexit_p(m68kspkr_remove), | 107 | .remove = m68kspkr_remove, |
108 | .shutdown = m68kspkr_shutdown, | 108 | .shutdown = m68kspkr_shutdown, |
109 | }; | 109 | }; |
110 | 110 | ||
diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c index 0a12b74140d..369a39de4ff 100644 --- a/drivers/input/misc/max8925_onkey.c +++ b/drivers/input/misc/max8925_onkey.c | |||
@@ -62,7 +62,7 @@ static irqreturn_t max8925_onkey_handler(int irq, void *data) | |||
62 | return IRQ_HANDLED; | 62 | return IRQ_HANDLED; |
63 | } | 63 | } |
64 | 64 | ||
65 | static int __devinit max8925_onkey_probe(struct platform_device *pdev) | 65 | static int max8925_onkey_probe(struct platform_device *pdev) |
66 | { | 66 | { |
67 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); | 67 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); |
68 | struct max8925_onkey_info *info; | 68 | struct max8925_onkey_info *info; |
@@ -141,7 +141,7 @@ err_free_mem: | |||
141 | return error; | 141 | return error; |
142 | } | 142 | } |
143 | 143 | ||
144 | static int __devexit max8925_onkey_remove(struct platform_device *pdev) | 144 | static int max8925_onkey_remove(struct platform_device *pdev) |
145 | { | 145 | { |
146 | struct max8925_onkey_info *info = platform_get_drvdata(pdev); | 146 | struct max8925_onkey_info *info = platform_get_drvdata(pdev); |
147 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); | 147 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); |
@@ -195,7 +195,7 @@ static struct platform_driver max8925_onkey_driver = { | |||
195 | .pm = &max8925_onkey_pm_ops, | 195 | .pm = &max8925_onkey_pm_ops, |
196 | }, | 196 | }, |
197 | .probe = max8925_onkey_probe, | 197 | .probe = max8925_onkey_probe, |
198 | .remove = __devexit_p(max8925_onkey_remove), | 198 | .remove = max8925_onkey_remove, |
199 | }; | 199 | }; |
200 | module_platform_driver(max8925_onkey_driver); | 200 | module_platform_driver(max8925_onkey_driver); |
201 | 201 | ||
diff --git a/drivers/input/misc/max8997_haptic.c b/drivers/input/misc/max8997_haptic.c index 05b7b8bfaf0..e973133212a 100644 --- a/drivers/input/misc/max8997_haptic.c +++ b/drivers/input/misc/max8997_haptic.c | |||
@@ -241,7 +241,7 @@ static void max8997_haptic_close(struct input_dev *dev) | |||
241 | max8997_haptic_disable(chip); | 241 | max8997_haptic_disable(chip); |
242 | } | 242 | } |
243 | 243 | ||
244 | static int __devinit max8997_haptic_probe(struct platform_device *pdev) | 244 | static int max8997_haptic_probe(struct platform_device *pdev) |
245 | { | 245 | { |
246 | struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 246 | struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
247 | const struct max8997_platform_data *pdata = | 247 | const struct max8997_platform_data *pdata = |
@@ -354,7 +354,7 @@ err_free_mem: | |||
354 | return error; | 354 | return error; |
355 | } | 355 | } |
356 | 356 | ||
357 | static int __devexit max8997_haptic_remove(struct platform_device *pdev) | 357 | static int max8997_haptic_remove(struct platform_device *pdev) |
358 | { | 358 | { |
359 | struct max8997_haptic *chip = platform_get_drvdata(pdev); | 359 | struct max8997_haptic *chip = platform_get_drvdata(pdev); |
360 | 360 | ||
@@ -396,7 +396,7 @@ static struct platform_driver max8997_haptic_driver = { | |||
396 | .pm = &max8997_haptic_pm_ops, | 396 | .pm = &max8997_haptic_pm_ops, |
397 | }, | 397 | }, |
398 | .probe = max8997_haptic_probe, | 398 | .probe = max8997_haptic_probe, |
399 | .remove = __devexit_p(max8997_haptic_remove), | 399 | .remove = max8997_haptic_remove, |
400 | .id_table = max8997_haptic_id, | 400 | .id_table = max8997_haptic_id, |
401 | }; | 401 | }; |
402 | module_platform_driver(max8997_haptic_driver); | 402 | module_platform_driver(max8997_haptic_driver); |
diff --git a/drivers/input/misc/mc13783-pwrbutton.c b/drivers/input/misc/mc13783-pwrbutton.c index 8428f1e8e83..0906ca593d5 100644 --- a/drivers/input/misc/mc13783-pwrbutton.c +++ b/drivers/input/misc/mc13783-pwrbutton.c | |||
@@ -89,7 +89,7 @@ static irqreturn_t button_irq(int irq, void *_priv) | |||
89 | return IRQ_HANDLED; | 89 | return IRQ_HANDLED; |
90 | } | 90 | } |
91 | 91 | ||
92 | static int __devinit mc13783_pwrbutton_probe(struct platform_device *pdev) | 92 | static int mc13783_pwrbutton_probe(struct platform_device *pdev) |
93 | { | 93 | { |
94 | const struct mc13xxx_buttons_platform_data *pdata; | 94 | const struct mc13xxx_buttons_platform_data *pdata; |
95 | struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent); | 95 | struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent); |
@@ -230,7 +230,7 @@ free_input_dev: | |||
230 | return err; | 230 | return err; |
231 | } | 231 | } |
232 | 232 | ||
233 | static int __devexit mc13783_pwrbutton_remove(struct platform_device *pdev) | 233 | static int mc13783_pwrbutton_remove(struct platform_device *pdev) |
234 | { | 234 | { |
235 | struct mc13783_pwrb *priv = platform_get_drvdata(pdev); | 235 | struct mc13783_pwrb *priv = platform_get_drvdata(pdev); |
236 | const struct mc13xxx_buttons_platform_data *pdata; | 236 | const struct mc13xxx_buttons_platform_data *pdata; |
@@ -257,7 +257,7 @@ static int __devexit mc13783_pwrbutton_remove(struct platform_device *pdev) | |||
257 | 257 | ||
258 | static struct platform_driver mc13783_pwrbutton_driver = { | 258 | static struct platform_driver mc13783_pwrbutton_driver = { |
259 | .probe = mc13783_pwrbutton_probe, | 259 | .probe = mc13783_pwrbutton_probe, |
260 | .remove = __devexit_p(mc13783_pwrbutton_remove), | 260 | .remove = mc13783_pwrbutton_remove, |
261 | .driver = { | 261 | .driver = { |
262 | .name = "mc13783-pwrbutton", | 262 | .name = "mc13783-pwrbutton", |
263 | .owner = THIS_MODULE, | 263 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/mma8450.c b/drivers/input/misc/mma8450.c index 873ebced544..480557f14f2 100644 --- a/drivers/input/misc/mma8450.c +++ b/drivers/input/misc/mma8450.c | |||
@@ -167,7 +167,7 @@ static void mma8450_close(struct input_polled_dev *dev) | |||
167 | /* | 167 | /* |
168 | * I2C init/probing/exit functions | 168 | * I2C init/probing/exit functions |
169 | */ | 169 | */ |
170 | static int __devinit mma8450_probe(struct i2c_client *c, | 170 | static int mma8450_probe(struct i2c_client *c, |
171 | const struct i2c_device_id *id) | 171 | const struct i2c_device_id *id) |
172 | { | 172 | { |
173 | struct input_polled_dev *idev; | 173 | struct input_polled_dev *idev; |
@@ -212,7 +212,7 @@ err_free_mem: | |||
212 | return err; | 212 | return err; |
213 | } | 213 | } |
214 | 214 | ||
215 | static int __devexit mma8450_remove(struct i2c_client *c) | 215 | static int mma8450_remove(struct i2c_client *c) |
216 | { | 216 | { |
217 | struct mma8450 *m = i2c_get_clientdata(c); | 217 | struct mma8450 *m = i2c_get_clientdata(c); |
218 | struct input_polled_dev *idev = m->idev; | 218 | struct input_polled_dev *idev = m->idev; |
@@ -243,7 +243,7 @@ static struct i2c_driver mma8450_driver = { | |||
243 | .of_match_table = mma8450_dt_ids, | 243 | .of_match_table = mma8450_dt_ids, |
244 | }, | 244 | }, |
245 | .probe = mma8450_probe, | 245 | .probe = mma8450_probe, |
246 | .remove = __devexit_p(mma8450_remove), | 246 | .remove = mma8450_remove, |
247 | .id_table = mma8450_id, | 247 | .id_table = mma8450_id, |
248 | }; | 248 | }; |
249 | 249 | ||
diff --git a/drivers/input/misc/mpu3050.c b/drivers/input/misc/mpu3050.c index 306f84c2d8f..dce0d95943c 100644 --- a/drivers/input/misc/mpu3050.c +++ b/drivers/input/misc/mpu3050.c | |||
@@ -257,7 +257,7 @@ static irqreturn_t mpu3050_interrupt_thread(int irq, void *data) | |||
257 | * | 257 | * |
258 | * Called during device probe; configures the sampling method. | 258 | * Called during device probe; configures the sampling method. |
259 | */ | 259 | */ |
260 | static int __devinit mpu3050_hw_init(struct mpu3050_sensor *sensor) | 260 | static int mpu3050_hw_init(struct mpu3050_sensor *sensor) |
261 | { | 261 | { |
262 | struct i2c_client *client = sensor->client; | 262 | struct i2c_client *client = sensor->client; |
263 | int ret; | 263 | int ret; |
@@ -306,7 +306,7 @@ static int __devinit mpu3050_hw_init(struct mpu3050_sensor *sensor) | |||
306 | * | 306 | * |
307 | * If present install the relevant sysfs interfaces and input device. | 307 | * If present install the relevant sysfs interfaces and input device. |
308 | */ | 308 | */ |
309 | static int __devinit mpu3050_probe(struct i2c_client *client, | 309 | static int mpu3050_probe(struct i2c_client *client, |
310 | const struct i2c_device_id *id) | 310 | const struct i2c_device_id *id) |
311 | { | 311 | { |
312 | struct mpu3050_sensor *sensor; | 312 | struct mpu3050_sensor *sensor; |
@@ -402,7 +402,7 @@ err_free_mem: | |||
402 | * | 402 | * |
403 | * Our sensor is going away, clean up the resources. | 403 | * Our sensor is going away, clean up the resources. |
404 | */ | 404 | */ |
405 | static int __devexit mpu3050_remove(struct i2c_client *client) | 405 | static int mpu3050_remove(struct i2c_client *client) |
406 | { | 406 | { |
407 | struct mpu3050_sensor *sensor = i2c_get_clientdata(client); | 407 | struct mpu3050_sensor *sensor = i2c_get_clientdata(client); |
408 | 408 | ||
@@ -471,7 +471,7 @@ static struct i2c_driver mpu3050_i2c_driver = { | |||
471 | .of_match_table = mpu3050_of_match, | 471 | .of_match_table = mpu3050_of_match, |
472 | }, | 472 | }, |
473 | .probe = mpu3050_probe, | 473 | .probe = mpu3050_probe, |
474 | .remove = __devexit_p(mpu3050_remove), | 474 | .remove = mpu3050_remove, |
475 | .id_table = mpu3050_ids, | 475 | .id_table = mpu3050_ids, |
476 | }; | 476 | }; |
477 | 477 | ||
diff --git a/drivers/input/misc/pcap_keys.c b/drivers/input/misc/pcap_keys.c index e09b4fe8191..40ac9a5adf8 100644 --- a/drivers/input/misc/pcap_keys.c +++ b/drivers/input/misc/pcap_keys.c | |||
@@ -48,7 +48,7 @@ static irqreturn_t pcap_keys_handler(int irq, void *_pcap_keys) | |||
48 | return IRQ_HANDLED; | 48 | return IRQ_HANDLED; |
49 | } | 49 | } |
50 | 50 | ||
51 | static int __devinit pcap_keys_probe(struct platform_device *pdev) | 51 | static int pcap_keys_probe(struct platform_device *pdev) |
52 | { | 52 | { |
53 | int err = -ENOMEM; | 53 | int err = -ENOMEM; |
54 | struct pcap_keys *pcap_keys; | 54 | struct pcap_keys *pcap_keys; |
@@ -104,7 +104,7 @@ fail: | |||
104 | return err; | 104 | return err; |
105 | } | 105 | } |
106 | 106 | ||
107 | static int __devexit pcap_keys_remove(struct platform_device *pdev) | 107 | static int pcap_keys_remove(struct platform_device *pdev) |
108 | { | 108 | { |
109 | struct pcap_keys *pcap_keys = platform_get_drvdata(pdev); | 109 | struct pcap_keys *pcap_keys = platform_get_drvdata(pdev); |
110 | 110 | ||
@@ -119,7 +119,7 @@ static int __devexit pcap_keys_remove(struct platform_device *pdev) | |||
119 | 119 | ||
120 | static struct platform_driver pcap_keys_device_driver = { | 120 | static struct platform_driver pcap_keys_device_driver = { |
121 | .probe = pcap_keys_probe, | 121 | .probe = pcap_keys_probe, |
122 | .remove = __devexit_p(pcap_keys_remove), | 122 | .remove = pcap_keys_remove, |
123 | .driver = { | 123 | .driver = { |
124 | .name = "pcap-keys", | 124 | .name = "pcap-keys", |
125 | .owner = THIS_MODULE, | 125 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/pcf50633-input.c b/drivers/input/misc/pcf50633-input.c index 53891de80b0..73b13ebabe5 100644 --- a/drivers/input/misc/pcf50633-input.c +++ b/drivers/input/misc/pcf50633-input.c | |||
@@ -53,7 +53,7 @@ pcf50633_input_irq(int irq, void *data) | |||
53 | input_sync(input->input_dev); | 53 | input_sync(input->input_dev); |
54 | } | 54 | } |
55 | 55 | ||
56 | static int __devinit pcf50633_input_probe(struct platform_device *pdev) | 56 | static int pcf50633_input_probe(struct platform_device *pdev) |
57 | { | 57 | { |
58 | struct pcf50633_input *input; | 58 | struct pcf50633_input *input; |
59 | struct input_dev *input_dev; | 59 | struct input_dev *input_dev; |
@@ -93,7 +93,7 @@ static int __devinit pcf50633_input_probe(struct platform_device *pdev) | |||
93 | return 0; | 93 | return 0; |
94 | } | 94 | } |
95 | 95 | ||
96 | static int __devexit pcf50633_input_remove(struct platform_device *pdev) | 96 | static int pcf50633_input_remove(struct platform_device *pdev) |
97 | { | 97 | { |
98 | struct pcf50633_input *input = platform_get_drvdata(pdev); | 98 | struct pcf50633_input *input = platform_get_drvdata(pdev); |
99 | 99 | ||
@@ -111,7 +111,7 @@ static struct platform_driver pcf50633_input_driver = { | |||
111 | .name = "pcf50633-input", | 111 | .name = "pcf50633-input", |
112 | }, | 112 | }, |
113 | .probe = pcf50633_input_probe, | 113 | .probe = pcf50633_input_probe, |
114 | .remove = __devexit_p(pcf50633_input_remove), | 114 | .remove = pcf50633_input_remove, |
115 | }; | 115 | }; |
116 | module_platform_driver(pcf50633_input_driver); | 116 | module_platform_driver(pcf50633_input_driver); |
117 | 117 | ||
diff --git a/drivers/input/misc/pcf8574_keypad.c b/drivers/input/misc/pcf8574_keypad.c index 544c6635abe..e37392976fd 100644 --- a/drivers/input/misc/pcf8574_keypad.c +++ b/drivers/input/misc/pcf8574_keypad.c | |||
@@ -82,7 +82,7 @@ static irqreturn_t pcf8574_kp_irq_handler(int irq, void *dev_id) | |||
82 | return IRQ_HANDLED; | 82 | return IRQ_HANDLED; |
83 | } | 83 | } |
84 | 84 | ||
85 | static int __devinit pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_id *id) | 85 | static int pcf8574_kp_probe(struct i2c_client *client, const struct i2c_device_id *id) |
86 | { | 86 | { |
87 | int i, ret; | 87 | int i, ret; |
88 | struct input_dev *idev; | 88 | struct input_dev *idev; |
@@ -156,7 +156,7 @@ static int __devinit pcf8574_kp_probe(struct i2c_client *client, const struct i2 | |||
156 | return ret; | 156 | return ret; |
157 | } | 157 | } |
158 | 158 | ||
159 | static int __devexit pcf8574_kp_remove(struct i2c_client *client) | 159 | static int pcf8574_kp_remove(struct i2c_client *client) |
160 | { | 160 | { |
161 | struct kp_data *lp = i2c_get_clientdata(client); | 161 | struct kp_data *lp = i2c_get_clientdata(client); |
162 | 162 | ||
@@ -212,7 +212,7 @@ static struct i2c_driver pcf8574_kp_driver = { | |||
212 | #endif | 212 | #endif |
213 | }, | 213 | }, |
214 | .probe = pcf8574_kp_probe, | 214 | .probe = pcf8574_kp_probe, |
215 | .remove = __devexit_p(pcf8574_kp_remove), | 215 | .remove = pcf8574_kp_remove, |
216 | .id_table = pcf8574_kp_id, | 216 | .id_table = pcf8574_kp_id, |
217 | }; | 217 | }; |
218 | 218 | ||
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c index b2484aa07f3..199db78acc4 100644 --- a/drivers/input/misc/pcspkr.c +++ b/drivers/input/misc/pcspkr.c | |||
@@ -63,7 +63,7 @@ static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int c | |||
63 | return 0; | 63 | return 0; |
64 | } | 64 | } |
65 | 65 | ||
66 | static int __devinit pcspkr_probe(struct platform_device *dev) | 66 | static int pcspkr_probe(struct platform_device *dev) |
67 | { | 67 | { |
68 | struct input_dev *pcspkr_dev; | 68 | struct input_dev *pcspkr_dev; |
69 | int err; | 69 | int err; |
@@ -95,7 +95,7 @@ static int __devinit pcspkr_probe(struct platform_device *dev) | |||
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | 97 | ||
98 | static int __devexit pcspkr_remove(struct platform_device *dev) | 98 | static int pcspkr_remove(struct platform_device *dev) |
99 | { | 99 | { |
100 | struct input_dev *pcspkr_dev = platform_get_drvdata(dev); | 100 | struct input_dev *pcspkr_dev = platform_get_drvdata(dev); |
101 | 101 | ||
@@ -131,7 +131,7 @@ static struct platform_driver pcspkr_platform_driver = { | |||
131 | .pm = &pcspkr_pm_ops, | 131 | .pm = &pcspkr_pm_ops, |
132 | }, | 132 | }, |
133 | .probe = pcspkr_probe, | 133 | .probe = pcspkr_probe, |
134 | .remove = __devexit_p(pcspkr_remove), | 134 | .remove = pcspkr_remove, |
135 | .shutdown = pcspkr_shutdown, | 135 | .shutdown = pcspkr_shutdown, |
136 | }; | 136 | }; |
137 | module_platform_driver(pcspkr_platform_driver); | 137 | module_platform_driver(pcspkr_platform_driver); |
diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c index dfbfb463ea5..a9da65e41c5 100644 --- a/drivers/input/misc/pm8xxx-vibrator.c +++ b/drivers/input/misc/pm8xxx-vibrator.c | |||
@@ -178,7 +178,7 @@ static int pm8xxx_vib_play_effect(struct input_dev *dev, void *data, | |||
178 | return 0; | 178 | return 0; |
179 | } | 179 | } |
180 | 180 | ||
181 | static int __devinit pm8xxx_vib_probe(struct platform_device *pdev) | 181 | static int pm8xxx_vib_probe(struct platform_device *pdev) |
182 | 182 | ||
183 | { | 183 | { |
184 | struct pm8xxx_vib *vib; | 184 | struct pm8xxx_vib *vib; |
@@ -242,7 +242,7 @@ err_free_mem: | |||
242 | return error; | 242 | return error; |
243 | } | 243 | } |
244 | 244 | ||
245 | static int __devexit pm8xxx_vib_remove(struct platform_device *pdev) | 245 | static int pm8xxx_vib_remove(struct platform_device *pdev) |
246 | { | 246 | { |
247 | struct pm8xxx_vib *vib = platform_get_drvdata(pdev); | 247 | struct pm8xxx_vib *vib = platform_get_drvdata(pdev); |
248 | 248 | ||
@@ -270,7 +270,7 @@ static SIMPLE_DEV_PM_OPS(pm8xxx_vib_pm_ops, pm8xxx_vib_suspend, NULL); | |||
270 | 270 | ||
271 | static struct platform_driver pm8xxx_vib_driver = { | 271 | static struct platform_driver pm8xxx_vib_driver = { |
272 | .probe = pm8xxx_vib_probe, | 272 | .probe = pm8xxx_vib_probe, |
273 | .remove = __devexit_p(pm8xxx_vib_remove), | 273 | .remove = pm8xxx_vib_remove, |
274 | .driver = { | 274 | .driver = { |
275 | .name = "pm8xxx-vib", | 275 | .name = "pm8xxx-vib", |
276 | .owner = THIS_MODULE, | 276 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/pmic8xxx-pwrkey.c b/drivers/input/misc/pmic8xxx-pwrkey.c index 0f83d0f1d01..4b811be7397 100644 --- a/drivers/input/misc/pmic8xxx-pwrkey.c +++ b/drivers/input/misc/pmic8xxx-pwrkey.c | |||
@@ -81,7 +81,7 @@ static int pmic8xxx_pwrkey_resume(struct device *dev) | |||
81 | static SIMPLE_DEV_PM_OPS(pm8xxx_pwr_key_pm_ops, | 81 | static SIMPLE_DEV_PM_OPS(pm8xxx_pwr_key_pm_ops, |
82 | pmic8xxx_pwrkey_suspend, pmic8xxx_pwrkey_resume); | 82 | pmic8xxx_pwrkey_suspend, pmic8xxx_pwrkey_resume); |
83 | 83 | ||
84 | static int __devinit pmic8xxx_pwrkey_probe(struct platform_device *pdev) | 84 | static int pmic8xxx_pwrkey_probe(struct platform_device *pdev) |
85 | { | 85 | { |
86 | struct input_dev *pwr; | 86 | struct input_dev *pwr; |
87 | int key_release_irq = platform_get_irq(pdev, 0); | 87 | int key_release_irq = platform_get_irq(pdev, 0); |
@@ -187,7 +187,7 @@ free_pwrkey: | |||
187 | return err; | 187 | return err; |
188 | } | 188 | } |
189 | 189 | ||
190 | static int __devexit pmic8xxx_pwrkey_remove(struct platform_device *pdev) | 190 | static int pmic8xxx_pwrkey_remove(struct platform_device *pdev) |
191 | { | 191 | { |
192 | struct pmic8xxx_pwrkey *pwrkey = platform_get_drvdata(pdev); | 192 | struct pmic8xxx_pwrkey *pwrkey = platform_get_drvdata(pdev); |
193 | int key_release_irq = platform_get_irq(pdev, 0); | 193 | int key_release_irq = platform_get_irq(pdev, 0); |
@@ -206,7 +206,7 @@ static int __devexit pmic8xxx_pwrkey_remove(struct platform_device *pdev) | |||
206 | 206 | ||
207 | static struct platform_driver pmic8xxx_pwrkey_driver = { | 207 | static struct platform_driver pmic8xxx_pwrkey_driver = { |
208 | .probe = pmic8xxx_pwrkey_probe, | 208 | .probe = pmic8xxx_pwrkey_probe, |
209 | .remove = __devexit_p(pmic8xxx_pwrkey_remove), | 209 | .remove = pmic8xxx_pwrkey_remove, |
210 | .driver = { | 210 | .driver = { |
211 | .name = PM8XXX_PWRKEY_DEV_NAME, | 211 | .name = PM8XXX_PWRKEY_DEV_NAME, |
212 | .owner = THIS_MODULE, | 212 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index fc84c8a5114..0808868461d 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c | |||
@@ -65,7 +65,7 @@ static int pwm_beeper_event(struct input_dev *input, | |||
65 | return 0; | 65 | return 0; |
66 | } | 66 | } |
67 | 67 | ||
68 | static int __devinit pwm_beeper_probe(struct platform_device *pdev) | 68 | static int pwm_beeper_probe(struct platform_device *pdev) |
69 | { | 69 | { |
70 | unsigned long pwm_id = (unsigned long)pdev->dev.platform_data; | 70 | unsigned long pwm_id = (unsigned long)pdev->dev.platform_data; |
71 | struct pwm_beeper *beeper; | 71 | struct pwm_beeper *beeper; |
@@ -75,7 +75,11 @@ static int __devinit pwm_beeper_probe(struct platform_device *pdev) | |||
75 | if (!beeper) | 75 | if (!beeper) |
76 | return -ENOMEM; | 76 | return -ENOMEM; |
77 | 77 | ||
78 | beeper->pwm = pwm_request(pwm_id, "pwm beeper"); | 78 | beeper->pwm = pwm_get(&pdev->dev, NULL); |
79 | if (IS_ERR(beeper->pwm)) { | ||
80 | dev_dbg(&pdev->dev, "unable to request PWM, trying legacy API\n"); | ||
81 | beeper->pwm = pwm_request(pwm_id, "pwm beeper"); | ||
82 | } | ||
79 | 83 | ||
80 | if (IS_ERR(beeper->pwm)) { | 84 | if (IS_ERR(beeper->pwm)) { |
81 | error = PTR_ERR(beeper->pwm); | 85 | error = PTR_ERR(beeper->pwm); |
@@ -125,7 +129,7 @@ err_free: | |||
125 | return error; | 129 | return error; |
126 | } | 130 | } |
127 | 131 | ||
128 | static int __devexit pwm_beeper_remove(struct platform_device *pdev) | 132 | static int pwm_beeper_remove(struct platform_device *pdev) |
129 | { | 133 | { |
130 | struct pwm_beeper *beeper = platform_get_drvdata(pdev); | 134 | struct pwm_beeper *beeper = platform_get_drvdata(pdev); |
131 | 135 | ||
@@ -171,13 +175,21 @@ static SIMPLE_DEV_PM_OPS(pwm_beeper_pm_ops, | |||
171 | #define PWM_BEEPER_PM_OPS NULL | 175 | #define PWM_BEEPER_PM_OPS NULL |
172 | #endif | 176 | #endif |
173 | 177 | ||
178 | #ifdef CONFIG_OF | ||
179 | static const struct of_device_id pwm_beeper_match[] = { | ||
180 | { .compatible = "pwm-beeper", }, | ||
181 | { }, | ||
182 | }; | ||
183 | #endif | ||
184 | |||
174 | static struct platform_driver pwm_beeper_driver = { | 185 | static struct platform_driver pwm_beeper_driver = { |
175 | .probe = pwm_beeper_probe, | 186 | .probe = pwm_beeper_probe, |
176 | .remove = __devexit_p(pwm_beeper_remove), | 187 | .remove = pwm_beeper_remove, |
177 | .driver = { | 188 | .driver = { |
178 | .name = "pwm-beeper", | 189 | .name = "pwm-beeper", |
179 | .owner = THIS_MODULE, | 190 | .owner = THIS_MODULE, |
180 | .pm = PWM_BEEPER_PM_OPS, | 191 | .pm = PWM_BEEPER_PM_OPS, |
192 | .of_match_table = of_match_ptr(pwm_beeper_match), | ||
181 | }, | 193 | }, |
182 | }; | 194 | }; |
183 | module_platform_driver(pwm_beeper_driver); | 195 | module_platform_driver(pwm_beeper_driver); |
diff --git a/drivers/input/misc/rb532_button.c b/drivers/input/misc/rb532_button.c index aeb02bcf723..fb4f8ac3343 100644 --- a/drivers/input/misc/rb532_button.c +++ b/drivers/input/misc/rb532_button.c | |||
@@ -51,7 +51,7 @@ static void rb532_button_poll(struct input_polled_dev *poll_dev) | |||
51 | input_sync(poll_dev->input); | 51 | input_sync(poll_dev->input); |
52 | } | 52 | } |
53 | 53 | ||
54 | static int __devinit rb532_button_probe(struct platform_device *pdev) | 54 | static int rb532_button_probe(struct platform_device *pdev) |
55 | { | 55 | { |
56 | struct input_polled_dev *poll_dev; | 56 | struct input_polled_dev *poll_dev; |
57 | int error; | 57 | int error; |
@@ -81,7 +81,7 @@ static int __devinit rb532_button_probe(struct platform_device *pdev) | |||
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | 83 | ||
84 | static int __devexit rb532_button_remove(struct platform_device *pdev) | 84 | static int rb532_button_remove(struct platform_device *pdev) |
85 | { | 85 | { |
86 | struct input_polled_dev *poll_dev = dev_get_drvdata(&pdev->dev); | 86 | struct input_polled_dev *poll_dev = dev_get_drvdata(&pdev->dev); |
87 | 87 | ||
@@ -94,7 +94,7 @@ static int __devexit rb532_button_remove(struct platform_device *pdev) | |||
94 | 94 | ||
95 | static struct platform_driver rb532_button_driver = { | 95 | static struct platform_driver rb532_button_driver = { |
96 | .probe = rb532_button_probe, | 96 | .probe = rb532_button_probe, |
97 | .remove = __devexit_p(rb532_button_remove), | 97 | .remove = rb532_button_remove, |
98 | .driver = { | 98 | .driver = { |
99 | .name = DRV_NAME, | 99 | .name = DRV_NAME, |
100 | .owner = THIS_MODULE, | 100 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/retu-pwrbutton.c b/drivers/input/misc/retu-pwrbutton.c new file mode 100644 index 00000000000..7ca09baa001 --- /dev/null +++ b/drivers/input/misc/retu-pwrbutton.c | |||
@@ -0,0 +1,99 @@ | |||
1 | /* | ||
2 | * Retu power button driver. | ||
3 | * | ||
4 | * Copyright (C) 2004-2010 Nokia Corporation | ||
5 | * | ||
6 | * Original code written by Ari Saastamoinen, Juha Yrjölä and Felipe Balbi. | ||
7 | * Rewritten by Aaro Koskinen. | ||
8 | * | ||
9 | * This file is subject to the terms and conditions of the GNU General | ||
10 | * Public License. See the file "COPYING" in the main directory of this | ||
11 | * archive for more details. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | */ | ||
18 | |||
19 | #include <linux/irq.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/slab.h> | ||
22 | #include <linux/errno.h> | ||
23 | #include <linux/input.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/mfd/retu.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | |||
30 | #define RETU_STATUS_PWRONX (1 << 5) | ||
31 | |||
32 | static irqreturn_t retu_pwrbutton_irq(int irq, void *_pwr) | ||
33 | { | ||
34 | struct input_dev *idev = _pwr; | ||
35 | struct retu_dev *rdev = input_get_drvdata(idev); | ||
36 | bool state; | ||
37 | |||
38 | state = !(retu_read(rdev, RETU_REG_STATUS) & RETU_STATUS_PWRONX); | ||
39 | input_report_key(idev, KEY_POWER, state); | ||
40 | input_sync(idev); | ||
41 | |||
42 | return IRQ_HANDLED; | ||
43 | } | ||
44 | |||
45 | static int retu_pwrbutton_probe(struct platform_device *pdev) | ||
46 | { | ||
47 | struct retu_dev *rdev = dev_get_drvdata(pdev->dev.parent); | ||
48 | struct input_dev *idev; | ||
49 | int irq; | ||
50 | int error; | ||
51 | |||
52 | irq = platform_get_irq(pdev, 0); | ||
53 | if (irq < 0) | ||
54 | return irq; | ||
55 | |||
56 | idev = devm_input_allocate_device(&pdev->dev); | ||
57 | if (!idev) | ||
58 | return -ENOMEM; | ||
59 | |||
60 | idev->name = "retu-pwrbutton"; | ||
61 | idev->dev.parent = &pdev->dev; | ||
62 | |||
63 | input_set_capability(idev, EV_KEY, KEY_POWER); | ||
64 | input_set_drvdata(idev, rdev); | ||
65 | |||
66 | error = devm_request_threaded_irq(&pdev->dev, irq, | ||
67 | NULL, retu_pwrbutton_irq, 0, | ||
68 | "retu-pwrbutton", idev); | ||
69 | if (error) | ||
70 | return error; | ||
71 | |||
72 | error = input_register_device(idev); | ||
73 | if (error) | ||
74 | return error; | ||
75 | |||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | static int retu_pwrbutton_remove(struct platform_device *pdev) | ||
80 | { | ||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | static struct platform_driver retu_pwrbutton_driver = { | ||
85 | .probe = retu_pwrbutton_probe, | ||
86 | .remove = retu_pwrbutton_remove, | ||
87 | .driver = { | ||
88 | .name = "retu-pwrbutton", | ||
89 | .owner = THIS_MODULE, | ||
90 | }, | ||
91 | }; | ||
92 | module_platform_driver(retu_pwrbutton_driver); | ||
93 | |||
94 | MODULE_ALIAS("platform:retu-pwrbutton"); | ||
95 | MODULE_DESCRIPTION("Retu Power Button"); | ||
96 | MODULE_AUTHOR("Ari Saastamoinen"); | ||
97 | MODULE_AUTHOR("Felipe Balbi"); | ||
98 | MODULE_AUTHOR("Aaro Koskinen <aaro.koskinen@iki.fi>"); | ||
99 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index 99a49e4968d..aff47b2c38f 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c | |||
@@ -149,8 +149,7 @@ static struct of_device_id rotary_encoder_of_match[] = { | |||
149 | }; | 149 | }; |
150 | MODULE_DEVICE_TABLE(of, rotary_encoder_of_match); | 150 | MODULE_DEVICE_TABLE(of, rotary_encoder_of_match); |
151 | 151 | ||
152 | static struct rotary_encoder_platform_data * __devinit | 152 | static struct rotary_encoder_platform_data *rotary_encoder_parse_dt(struct device *dev) |
153 | rotary_encoder_parse_dt(struct device *dev) | ||
154 | { | 153 | { |
155 | const struct of_device_id *of_id = | 154 | const struct of_device_id *of_id = |
156 | of_match_device(rotary_encoder_of_match, dev); | 155 | of_match_device(rotary_encoder_of_match, dev); |
@@ -192,7 +191,7 @@ rotary_encoder_parse_dt(struct device *dev) | |||
192 | } | 191 | } |
193 | #endif | 192 | #endif |
194 | 193 | ||
195 | static int __devinit rotary_encoder_probe(struct platform_device *pdev) | 194 | static int rotary_encoder_probe(struct platform_device *pdev) |
196 | { | 195 | { |
197 | struct device *dev = &pdev->dev; | 196 | struct device *dev = &pdev->dev; |
198 | const struct rotary_encoder_platform_data *pdata = dev_get_platdata(dev); | 197 | const struct rotary_encoder_platform_data *pdata = dev_get_platdata(dev); |
@@ -302,7 +301,7 @@ exit_free_mem: | |||
302 | return err; | 301 | return err; |
303 | } | 302 | } |
304 | 303 | ||
305 | static int __devexit rotary_encoder_remove(struct platform_device *pdev) | 304 | static int rotary_encoder_remove(struct platform_device *pdev) |
306 | { | 305 | { |
307 | struct rotary_encoder *encoder = platform_get_drvdata(pdev); | 306 | struct rotary_encoder *encoder = platform_get_drvdata(pdev); |
308 | const struct rotary_encoder_platform_data *pdata = encoder->pdata; | 307 | const struct rotary_encoder_platform_data *pdata = encoder->pdata; |
@@ -325,7 +324,7 @@ static int __devexit rotary_encoder_remove(struct platform_device *pdev) | |||
325 | 324 | ||
326 | static struct platform_driver rotary_encoder_driver = { | 325 | static struct platform_driver rotary_encoder_driver = { |
327 | .probe = rotary_encoder_probe, | 326 | .probe = rotary_encoder_probe, |
328 | .remove = __devexit_p(rotary_encoder_remove), | 327 | .remove = rotary_encoder_remove, |
329 | .driver = { | 328 | .driver = { |
330 | .name = DRV_NAME, | 329 | .name = DRV_NAME, |
331 | .owner = THIS_MODULE, | 330 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c index 5d9fd557119..ad6415ceaf5 100644 --- a/drivers/input/misc/sgi_btns.c +++ b/drivers/input/misc/sgi_btns.c | |||
@@ -91,7 +91,7 @@ static void handle_buttons(struct input_polled_dev *dev) | |||
91 | } | 91 | } |
92 | } | 92 | } |
93 | 93 | ||
94 | static int __devinit sgi_buttons_probe(struct platform_device *pdev) | 94 | static int sgi_buttons_probe(struct platform_device *pdev) |
95 | { | 95 | { |
96 | struct buttons_dev *bdev; | 96 | struct buttons_dev *bdev; |
97 | struct input_polled_dev *poll_dev; | 97 | struct input_polled_dev *poll_dev; |
@@ -143,7 +143,7 @@ static int __devinit sgi_buttons_probe(struct platform_device *pdev) | |||
143 | return error; | 143 | return error; |
144 | } | 144 | } |
145 | 145 | ||
146 | static int __devexit sgi_buttons_remove(struct platform_device *pdev) | 146 | static int sgi_buttons_remove(struct platform_device *pdev) |
147 | { | 147 | { |
148 | struct device *dev = &pdev->dev; | 148 | struct device *dev = &pdev->dev; |
149 | struct buttons_dev *bdev = dev_get_drvdata(dev); | 149 | struct buttons_dev *bdev = dev_get_drvdata(dev); |
@@ -158,7 +158,7 @@ static int __devexit sgi_buttons_remove(struct platform_device *pdev) | |||
158 | 158 | ||
159 | static struct platform_driver sgi_buttons_driver = { | 159 | static struct platform_driver sgi_buttons_driver = { |
160 | .probe = sgi_buttons_probe, | 160 | .probe = sgi_buttons_probe, |
161 | .remove = __devexit_p(sgi_buttons_remove), | 161 | .remove = sgi_buttons_remove, |
162 | .driver = { | 162 | .driver = { |
163 | .name = "sgibtns", | 163 | .name = "sgibtns", |
164 | .owner = THIS_MODULE, | 164 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index 0122f535157..a53586a7fbd 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c | |||
@@ -139,7 +139,7 @@ static int grover_spkr_event(struct input_dev *dev, unsigned int type, unsigned | |||
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
141 | 141 | ||
142 | static int __devinit sparcspkr_probe(struct device *dev) | 142 | static int sparcspkr_probe(struct device *dev) |
143 | { | 143 | { |
144 | struct sparcspkr_state *state = dev_get_drvdata(dev); | 144 | struct sparcspkr_state *state = dev_get_drvdata(dev); |
145 | struct input_dev *input_dev; | 145 | struct input_dev *input_dev; |
@@ -182,7 +182,7 @@ static void sparcspkr_shutdown(struct platform_device *dev) | |||
182 | state->event(input_dev, EV_SND, SND_BELL, 0); | 182 | state->event(input_dev, EV_SND, SND_BELL, 0); |
183 | } | 183 | } |
184 | 184 | ||
185 | static int __devinit bbc_beep_probe(struct platform_device *op) | 185 | static int bbc_beep_probe(struct platform_device *op) |
186 | { | 186 | { |
187 | struct sparcspkr_state *state; | 187 | struct sparcspkr_state *state; |
188 | struct bbc_beep_info *info; | 188 | struct bbc_beep_info *info; |
@@ -229,7 +229,7 @@ out_err: | |||
229 | return err; | 229 | return err; |
230 | } | 230 | } |
231 | 231 | ||
232 | static int __devexit bbc_remove(struct platform_device *op) | 232 | static int bbc_remove(struct platform_device *op) |
233 | { | 233 | { |
234 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); | 234 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); |
235 | struct input_dev *input_dev = state->input_dev; | 235 | struct input_dev *input_dev = state->input_dev; |
@@ -263,11 +263,11 @@ static struct platform_driver bbc_beep_driver = { | |||
263 | .of_match_table = bbc_beep_match, | 263 | .of_match_table = bbc_beep_match, |
264 | }, | 264 | }, |
265 | .probe = bbc_beep_probe, | 265 | .probe = bbc_beep_probe, |
266 | .remove = __devexit_p(bbc_remove), | 266 | .remove = bbc_remove, |
267 | .shutdown = sparcspkr_shutdown, | 267 | .shutdown = sparcspkr_shutdown, |
268 | }; | 268 | }; |
269 | 269 | ||
270 | static int __devinit grover_beep_probe(struct platform_device *op) | 270 | static int grover_beep_probe(struct platform_device *op) |
271 | { | 271 | { |
272 | struct sparcspkr_state *state; | 272 | struct sparcspkr_state *state; |
273 | struct grover_beep_info *info; | 273 | struct grover_beep_info *info; |
@@ -310,7 +310,7 @@ out_err: | |||
310 | return err; | 310 | return err; |
311 | } | 311 | } |
312 | 312 | ||
313 | static int __devexit grover_remove(struct platform_device *op) | 313 | static int grover_remove(struct platform_device *op) |
314 | { | 314 | { |
315 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); | 315 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); |
316 | struct grover_beep_info *info = &state->u.grover; | 316 | struct grover_beep_info *info = &state->u.grover; |
@@ -345,7 +345,7 @@ static struct platform_driver grover_beep_driver = { | |||
345 | .of_match_table = grover_beep_match, | 345 | .of_match_table = grover_beep_match, |
346 | }, | 346 | }, |
347 | .probe = grover_beep_probe, | 347 | .probe = grover_beep_probe, |
348 | .remove = __devexit_p(grover_remove), | 348 | .remove = grover_remove, |
349 | .shutdown = sparcspkr_shutdown, | 349 | .shutdown = sparcspkr_shutdown, |
350 | }; | 350 | }; |
351 | 351 | ||
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c index b3dd96d6448..27c2bc8aa89 100644 --- a/drivers/input/misc/twl4030-pwrbutton.c +++ b/drivers/input/misc/twl4030-pwrbutton.c | |||
@@ -39,8 +39,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr) | |||
39 | int err; | 39 | int err; |
40 | u8 value; | 40 | u8 value; |
41 | 41 | ||
42 | err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value, | 42 | err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, STS_HW_CONDITIONS); |
43 | STS_HW_CONDITIONS); | ||
44 | if (!err) { | 43 | if (!err) { |
45 | pm_wakeup_event(pwr->dev.parent, 0); | 44 | pm_wakeup_event(pwr->dev.parent, 0); |
46 | input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); | 45 | input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); |
diff --git a/drivers/input/misc/twl4030-vibra.c b/drivers/input/misc/twl4030-vibra.c index 2194a3c7236..78eb6b30580 100644 --- a/drivers/input/misc/twl4030-vibra.c +++ b/drivers/input/misc/twl4030-vibra.c | |||
@@ -207,7 +207,7 @@ static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata, | |||
207 | return false; | 207 | return false; |
208 | } | 208 | } |
209 | 209 | ||
210 | static int __devinit twl4030_vibra_probe(struct platform_device *pdev) | 210 | static int twl4030_vibra_probe(struct platform_device *pdev) |
211 | { | 211 | { |
212 | struct twl4030_vibra_data *pdata = pdev->dev.platform_data; | 212 | struct twl4030_vibra_data *pdata = pdev->dev.platform_data; |
213 | struct device_node *twl4030_core_node = pdev->dev.parent->of_node; | 213 | struct device_node *twl4030_core_node = pdev->dev.parent->of_node; |
@@ -269,7 +269,7 @@ err_kzalloc: | |||
269 | return ret; | 269 | return ret; |
270 | } | 270 | } |
271 | 271 | ||
272 | static int __devexit twl4030_vibra_remove(struct platform_device *pdev) | 272 | static int twl4030_vibra_remove(struct platform_device *pdev) |
273 | { | 273 | { |
274 | struct vibra_info *info = platform_get_drvdata(pdev); | 274 | struct vibra_info *info = platform_get_drvdata(pdev); |
275 | 275 | ||
@@ -283,7 +283,7 @@ static int __devexit twl4030_vibra_remove(struct platform_device *pdev) | |||
283 | 283 | ||
284 | static struct platform_driver twl4030_vibra_driver = { | 284 | static struct platform_driver twl4030_vibra_driver = { |
285 | .probe = twl4030_vibra_probe, | 285 | .probe = twl4030_vibra_probe, |
286 | .remove = __devexit_p(twl4030_vibra_remove), | 286 | .remove = twl4030_vibra_remove, |
287 | .driver = { | 287 | .driver = { |
288 | .name = "twl4030-vibra", | 288 | .name = "twl4030-vibra", |
289 | .owner = THIS_MODULE, | 289 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index c8a288ae1d5..71a28ee699f 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c | |||
@@ -255,7 +255,7 @@ static int twl6040_vibra_suspend(struct device *dev) | |||
255 | 255 | ||
256 | static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); | 256 | static SIMPLE_DEV_PM_OPS(twl6040_vibra_pm_ops, twl6040_vibra_suspend, NULL); |
257 | 257 | ||
258 | static int __devinit twl6040_vibra_probe(struct platform_device *pdev) | 258 | static int twl6040_vibra_probe(struct platform_device *pdev) |
259 | { | 259 | { |
260 | struct twl6040_vibra_data *pdata = pdev->dev.platform_data; | 260 | struct twl6040_vibra_data *pdata = pdev->dev.platform_data; |
261 | struct device *twl6040_core_dev = pdev->dev.parent; | 261 | struct device *twl6040_core_dev = pdev->dev.parent; |
@@ -418,7 +418,7 @@ err_kzalloc: | |||
418 | return ret; | 418 | return ret; |
419 | } | 419 | } |
420 | 420 | ||
421 | static int __devexit twl6040_vibra_remove(struct platform_device *pdev) | 421 | static int twl6040_vibra_remove(struct platform_device *pdev) |
422 | { | 422 | { |
423 | struct vibra_info *info = platform_get_drvdata(pdev); | 423 | struct vibra_info *info = platform_get_drvdata(pdev); |
424 | 424 | ||
@@ -433,7 +433,7 @@ static int __devexit twl6040_vibra_remove(struct platform_device *pdev) | |||
433 | 433 | ||
434 | static struct platform_driver twl6040_vibra_driver = { | 434 | static struct platform_driver twl6040_vibra_driver = { |
435 | .probe = twl6040_vibra_probe, | 435 | .probe = twl6040_vibra_probe, |
436 | .remove = __devexit_p(twl6040_vibra_remove), | 436 | .remove = twl6040_vibra_remove, |
437 | .driver = { | 437 | .driver = { |
438 | .name = "twl6040-vibra", | 438 | .name = "twl6040-vibra", |
439 | .owner = THIS_MODULE, | 439 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c index e2bdfd4bea7..56536f4b957 100644 --- a/drivers/input/misc/wistron_btns.c +++ b/drivers/input/misc/wistron_btns.c | |||
@@ -170,7 +170,7 @@ static u16 bios_pop_queue(void) | |||
170 | return regs.eax; | 170 | return regs.eax; |
171 | } | 171 | } |
172 | 172 | ||
173 | static void __devinit bios_attach(void) | 173 | static void bios_attach(void) |
174 | { | 174 | { |
175 | struct regs regs; | 175 | struct regs regs; |
176 | 176 | ||
@@ -190,7 +190,7 @@ static void bios_detach(void) | |||
190 | call_bios(®s); | 190 | call_bios(®s); |
191 | } | 191 | } |
192 | 192 | ||
193 | static u8 __devinit bios_get_cmos_address(void) | 193 | static u8 bios_get_cmos_address(void) |
194 | { | 194 | { |
195 | struct regs regs; | 195 | struct regs regs; |
196 | 196 | ||
@@ -202,7 +202,7 @@ static u8 __devinit bios_get_cmos_address(void) | |||
202 | return regs.ecx; | 202 | return regs.ecx; |
203 | } | 203 | } |
204 | 204 | ||
205 | static u16 __devinit bios_get_default_setting(u8 subsys) | 205 | static u16 bios_get_default_setting(u8 subsys) |
206 | { | 206 | { |
207 | struct regs regs; | 207 | struct regs regs; |
208 | 208 | ||
@@ -1052,7 +1052,7 @@ static struct led_classdev wistron_wifi_led = { | |||
1052 | .brightness_set = wistron_wifi_led_set, | 1052 | .brightness_set = wistron_wifi_led_set, |
1053 | }; | 1053 | }; |
1054 | 1054 | ||
1055 | static void __devinit wistron_led_init(struct device *parent) | 1055 | static void wistron_led_init(struct device *parent) |
1056 | { | 1056 | { |
1057 | if (leds_present & FE_WIFI_LED) { | 1057 | if (leds_present & FE_WIFI_LED) { |
1058 | u16 wifi = bios_get_default_setting(WIFI); | 1058 | u16 wifi = bios_get_default_setting(WIFI); |
@@ -1077,7 +1077,7 @@ static void __devinit wistron_led_init(struct device *parent) | |||
1077 | } | 1077 | } |
1078 | } | 1078 | } |
1079 | 1079 | ||
1080 | static void __devexit wistron_led_remove(void) | 1080 | static void wistron_led_remove(void) |
1081 | { | 1081 | { |
1082 | if (leds_present & FE_MAIL_LED) | 1082 | if (leds_present & FE_MAIL_LED) |
1083 | led_classdev_unregister(&wistron_mail_led); | 1083 | led_classdev_unregister(&wistron_mail_led); |
@@ -1168,7 +1168,7 @@ static void wistron_poll(struct input_polled_dev *dev) | |||
1168 | dev->poll_interval = POLL_INTERVAL_DEFAULT; | 1168 | dev->poll_interval = POLL_INTERVAL_DEFAULT; |
1169 | } | 1169 | } |
1170 | 1170 | ||
1171 | static int __devinit wistron_setup_keymap(struct input_dev *dev, | 1171 | static int wistron_setup_keymap(struct input_dev *dev, |
1172 | struct key_entry *entry) | 1172 | struct key_entry *entry) |
1173 | { | 1173 | { |
1174 | switch (entry->type) { | 1174 | switch (entry->type) { |
@@ -1199,7 +1199,7 @@ static int __devinit wistron_setup_keymap(struct input_dev *dev, | |||
1199 | return 0; | 1199 | return 0; |
1200 | } | 1200 | } |
1201 | 1201 | ||
1202 | static int __devinit setup_input_dev(void) | 1202 | static int setup_input_dev(void) |
1203 | { | 1203 | { |
1204 | struct input_dev *input_dev; | 1204 | struct input_dev *input_dev; |
1205 | int error; | 1205 | int error; |
@@ -1237,7 +1237,7 @@ static int __devinit setup_input_dev(void) | |||
1237 | 1237 | ||
1238 | /* Driver core */ | 1238 | /* Driver core */ |
1239 | 1239 | ||
1240 | static int __devinit wistron_probe(struct platform_device *dev) | 1240 | static int wistron_probe(struct platform_device *dev) |
1241 | { | 1241 | { |
1242 | int err; | 1242 | int err; |
1243 | 1243 | ||
@@ -1277,7 +1277,7 @@ static int __devinit wistron_probe(struct platform_device *dev) | |||
1277 | return 0; | 1277 | return 0; |
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | static int __devexit wistron_remove(struct platform_device *dev) | 1280 | static int wistron_remove(struct platform_device *dev) |
1281 | { | 1281 | { |
1282 | wistron_led_remove(); | 1282 | wistron_led_remove(); |
1283 | input_unregister_polled_device(wistron_idev); | 1283 | input_unregister_polled_device(wistron_idev); |
@@ -1334,7 +1334,7 @@ static struct platform_driver wistron_driver = { | |||
1334 | #endif | 1334 | #endif |
1335 | }, | 1335 | }, |
1336 | .probe = wistron_probe, | 1336 | .probe = wistron_probe, |
1337 | .remove = __devexit_p(wistron_remove), | 1337 | .remove = wistron_remove, |
1338 | }; | 1338 | }; |
1339 | 1339 | ||
1340 | static int __init wb_module_init(void) | 1340 | static int __init wb_module_init(void) |
diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c index 6790a812a1d..558767d8ebf 100644 --- a/drivers/input/misc/wm831x-on.c +++ b/drivers/input/misc/wm831x-on.c | |||
@@ -69,14 +69,15 @@ static irqreturn_t wm831x_on_irq(int irq, void *data) | |||
69 | return IRQ_HANDLED; | 69 | return IRQ_HANDLED; |
70 | } | 70 | } |
71 | 71 | ||
72 | static int __devinit wm831x_on_probe(struct platform_device *pdev) | 72 | static int wm831x_on_probe(struct platform_device *pdev) |
73 | { | 73 | { |
74 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); | 74 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); |
75 | struct wm831x_on *wm831x_on; | 75 | struct wm831x_on *wm831x_on; |
76 | int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); | 76 | int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); |
77 | int ret; | 77 | int ret; |
78 | 78 | ||
79 | wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL); | 79 | wm831x_on = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_on), |
80 | GFP_KERNEL); | ||
80 | if (!wm831x_on) { | 81 | if (!wm831x_on) { |
81 | dev_err(&pdev->dev, "Can't allocate data\n"); | 82 | dev_err(&pdev->dev, "Can't allocate data\n"); |
82 | return -ENOMEM; | 83 | return -ENOMEM; |
@@ -120,11 +121,10 @@ err_irq: | |||
120 | err_input_dev: | 121 | err_input_dev: |
121 | input_free_device(wm831x_on->dev); | 122 | input_free_device(wm831x_on->dev); |
122 | err: | 123 | err: |
123 | kfree(wm831x_on); | ||
124 | return ret; | 124 | return ret; |
125 | } | 125 | } |
126 | 126 | ||
127 | static int __devexit wm831x_on_remove(struct platform_device *pdev) | 127 | static int wm831x_on_remove(struct platform_device *pdev) |
128 | { | 128 | { |
129 | struct wm831x_on *wm831x_on = platform_get_drvdata(pdev); | 129 | struct wm831x_on *wm831x_on = platform_get_drvdata(pdev); |
130 | int irq = platform_get_irq(pdev, 0); | 130 | int irq = platform_get_irq(pdev, 0); |
@@ -132,14 +132,13 @@ static int __devexit wm831x_on_remove(struct platform_device *pdev) | |||
132 | free_irq(irq, wm831x_on); | 132 | free_irq(irq, wm831x_on); |
133 | cancel_delayed_work_sync(&wm831x_on->work); | 133 | cancel_delayed_work_sync(&wm831x_on->work); |
134 | input_unregister_device(wm831x_on->dev); | 134 | input_unregister_device(wm831x_on->dev); |
135 | kfree(wm831x_on); | ||
136 | 135 | ||
137 | return 0; | 136 | return 0; |
138 | } | 137 | } |
139 | 138 | ||
140 | static struct platform_driver wm831x_on_driver = { | 139 | static struct platform_driver wm831x_on_driver = { |
141 | .probe = wm831x_on_probe, | 140 | .probe = wm831x_on_probe, |
142 | .remove = __devexit_p(wm831x_on_remove), | 141 | .remove = wm831x_on_remove, |
143 | .driver = { | 142 | .driver = { |
144 | .name = "wm831x-on", | 143 | .name = "wm831x-on", |
145 | .owner = THIS_MODULE, | 144 | .owner = THIS_MODULE, |
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c index 02ca8680ea5..e21c1816a8f 100644 --- a/drivers/input/misc/xen-kbdfront.c +++ b/drivers/input/misc/xen-kbdfront.c | |||
@@ -104,7 +104,7 @@ static irqreturn_t input_handler(int rq, void *dev_id) | |||
104 | return IRQ_HANDLED; | 104 | return IRQ_HANDLED; |
105 | } | 105 | } |
106 | 106 | ||
107 | static int __devinit xenkbd_probe(struct xenbus_device *dev, | 107 | static int xenkbd_probe(struct xenbus_device *dev, |
108 | const struct xenbus_device_id *id) | 108 | const struct xenbus_device_id *id) |
109 | { | 109 | { |
110 | int ret, i, abs; | 110 | int ret, i, abs; |
@@ -311,7 +311,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, | |||
311 | case XenbusStateReconfiguring: | 311 | case XenbusStateReconfiguring: |
312 | case XenbusStateReconfigured: | 312 | case XenbusStateReconfigured: |
313 | case XenbusStateUnknown: | 313 | case XenbusStateUnknown: |
314 | case XenbusStateClosed: | ||
315 | break; | 314 | break; |
316 | 315 | ||
317 | case XenbusStateInitWait: | 316 | case XenbusStateInitWait: |
@@ -350,6 +349,10 @@ InitWait: | |||
350 | 349 | ||
351 | break; | 350 | break; |
352 | 351 | ||
352 | case XenbusStateClosed: | ||
353 | if (dev->state == XenbusStateClosed) | ||
354 | break; | ||
355 | /* Missed the backend's CLOSING state -- fallthrough */ | ||
353 | case XenbusStateClosing: | 356 | case XenbusStateClosing: |
354 | xenbus_frontend_closed(dev); | 357 | xenbus_frontend_closed(dev); |
355 | break; | 358 | break; |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index cf5af1f495e..e229fa3cad9 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -767,9 +767,8 @@ static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse) | |||
767 | psmouse->packet[5]) & 0x80) || | 767 | psmouse->packet[5]) & 0x80) || |
768 | (!alps_is_valid_first_byte(priv->i, psmouse->packet[6]))) { | 768 | (!alps_is_valid_first_byte(priv->i, psmouse->packet[6]))) { |
769 | psmouse_dbg(psmouse, | 769 | psmouse_dbg(psmouse, |
770 | "refusing packet %x %x %x %x (suspected interleaved ps/2)\n", | 770 | "refusing packet %4ph (suspected interleaved ps/2)\n", |
771 | psmouse->packet[3], psmouse->packet[4], | 771 | psmouse->packet + 3); |
772 | psmouse->packet[5], psmouse->packet[6]); | ||
773 | return PSMOUSE_BAD_DATA; | 772 | return PSMOUSE_BAD_DATA; |
774 | } | 773 | } |
775 | 774 | ||
@@ -831,9 +830,8 @@ static void alps_flush_packet(unsigned long data) | |||
831 | psmouse->packet[4] | | 830 | psmouse->packet[4] | |
832 | psmouse->packet[5]) & 0x80) { | 831 | psmouse->packet[5]) & 0x80) { |
833 | psmouse_dbg(psmouse, | 832 | psmouse_dbg(psmouse, |
834 | "refusing packet %x %x %x (suspected interleaved ps/2)\n", | 833 | "refusing packet %3ph (suspected interleaved ps/2)\n", |
835 | psmouse->packet[3], psmouse->packet[4], | 834 | psmouse->packet + 3); |
836 | psmouse->packet[5]); | ||
837 | } else { | 835 | } else { |
838 | alps_process_packet(psmouse); | 836 | alps_process_packet(psmouse); |
839 | } | 837 | } |
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c index 3a78f235fa3..2baff1b79a5 100644 --- a/drivers/input/mouse/bcm5974.c +++ b/drivers/input/mouse/bcm5974.c | |||
@@ -84,6 +84,10 @@ | |||
84 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 | 84 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262 |
85 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 | 85 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263 |
86 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 | 86 | #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264 |
87 | /* MacbookPro10,2 (unibody, October 2012) */ | ||
88 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259 | ||
89 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a | ||
90 | #define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b | ||
87 | 91 | ||
88 | #define BCM5974_DEVICE(prod) { \ | 92 | #define BCM5974_DEVICE(prod) { \ |
89 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ | 93 | .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \ |
@@ -137,6 +141,10 @@ static const struct usb_device_id bcm5974_table[] = { | |||
137 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), | 141 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI), |
138 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), | 142 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO), |
139 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), | 143 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS), |
144 | /* MacbookPro10,2 */ | ||
145 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI), | ||
146 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO), | ||
147 | BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS), | ||
140 | /* Terminating entry */ | 148 | /* Terminating entry */ |
141 | {} | 149 | {} |
142 | }; | 150 | }; |
@@ -379,6 +387,19 @@ static const struct bcm5974_config bcm5974_config_table[] = { | |||
379 | { SN_COORD, -150, 6730 }, | 387 | { SN_COORD, -150, 6730 }, |
380 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } | 388 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } |
381 | }, | 389 | }, |
390 | { | ||
391 | USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI, | ||
392 | USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO, | ||
393 | USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS, | ||
394 | HAS_INTEGRATED_BUTTON, | ||
395 | 0x84, sizeof(struct bt_data), | ||
396 | 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS, | ||
397 | { SN_PRESSURE, 0, 300 }, | ||
398 | { SN_WIDTH, 0, 2048 }, | ||
399 | { SN_COORD, -4750, 5280 }, | ||
400 | { SN_COORD, -150, 6730 }, | ||
401 | { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION } | ||
402 | }, | ||
382 | {} | 403 | {} |
383 | }; | 404 | }; |
384 | 405 | ||
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index 39fe9b737ca..532eaca4cc5 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c | |||
@@ -46,7 +46,7 @@ static void gpio_mouse_scan(struct input_polled_dev *dev) | |||
46 | input_sync(input); | 46 | input_sync(input); |
47 | } | 47 | } |
48 | 48 | ||
49 | static int __devinit gpio_mouse_probe(struct platform_device *pdev) | 49 | static int gpio_mouse_probe(struct platform_device *pdev) |
50 | { | 50 | { |
51 | struct gpio_mouse_platform_data *pdata = pdev->dev.platform_data; | 51 | struct gpio_mouse_platform_data *pdata = pdev->dev.platform_data; |
52 | struct input_polled_dev *input_poll; | 52 | struct input_polled_dev *input_poll; |
@@ -150,7 +150,7 @@ static int __devinit gpio_mouse_probe(struct platform_device *pdev) | |||
150 | return error; | 150 | return error; |
151 | } | 151 | } |
152 | 152 | ||
153 | static int __devexit gpio_mouse_remove(struct platform_device *pdev) | 153 | static int gpio_mouse_remove(struct platform_device *pdev) |
154 | { | 154 | { |
155 | struct input_polled_dev *input = platform_get_drvdata(pdev); | 155 | struct input_polled_dev *input = platform_get_drvdata(pdev); |
156 | struct gpio_mouse_platform_data *pdata = input->private; | 156 | struct gpio_mouse_platform_data *pdata = input->private; |
@@ -172,7 +172,7 @@ static int __devexit gpio_mouse_remove(struct platform_device *pdev) | |||
172 | 172 | ||
173 | static struct platform_driver gpio_mouse_device_driver = { | 173 | static struct platform_driver gpio_mouse_device_driver = { |
174 | .probe = gpio_mouse_probe, | 174 | .probe = gpio_mouse_probe, |
175 | .remove = __devexit_p(gpio_mouse_remove), | 175 | .remove = gpio_mouse_remove, |
176 | .driver = { | 176 | .driver = { |
177 | .name = "gpio_mouse", | 177 | .name = "gpio_mouse", |
178 | .owner = THIS_MODULE, | 178 | .owner = THIS_MODULE, |
diff --git a/drivers/input/mouse/maplemouse.c b/drivers/input/mouse/maplemouse.c index 5f278176eb9..0a60717b91c 100644 --- a/drivers/input/mouse/maplemouse.c +++ b/drivers/input/mouse/maplemouse.c | |||
@@ -64,7 +64,7 @@ static void dc_mouse_close(struct input_dev *dev) | |||
64 | } | 64 | } |
65 | 65 | ||
66 | /* allow the mouse to be used */ | 66 | /* allow the mouse to be used */ |
67 | static int __devinit probe_maple_mouse(struct device *dev) | 67 | static int probe_maple_mouse(struct device *dev) |
68 | { | 68 | { |
69 | struct maple_device *mdev = to_maple_dev(dev); | 69 | struct maple_device *mdev = to_maple_dev(dev); |
70 | struct maple_driver *mdrv = to_maple_driver(dev->driver); | 70 | struct maple_driver *mdrv = to_maple_driver(dev->driver); |
@@ -114,7 +114,7 @@ fail: | |||
114 | return error; | 114 | return error; |
115 | } | 115 | } |
116 | 116 | ||
117 | static int __devexit remove_maple_mouse(struct device *dev) | 117 | static int remove_maple_mouse(struct device *dev) |
118 | { | 118 | { |
119 | struct maple_device *mdev = to_maple_dev(dev); | 119 | struct maple_device *mdev = to_maple_dev(dev); |
120 | struct dc_mouse *mse = maple_get_drvdata(mdev); | 120 | struct dc_mouse *mse = maple_get_drvdata(mdev); |
@@ -132,7 +132,7 @@ static struct maple_driver dc_mouse_driver = { | |||
132 | .drv = { | 132 | .drv = { |
133 | .name = "Dreamcast_mouse", | 133 | .name = "Dreamcast_mouse", |
134 | .probe = probe_maple_mouse, | 134 | .probe = probe_maple_mouse, |
135 | .remove = __devexit_p(remove_maple_mouse), | 135 | .remove = remove_maple_mouse, |
136 | }, | 136 | }, |
137 | }; | 137 | }; |
138 | 138 | ||
diff --git a/drivers/input/mouse/navpoint.c b/drivers/input/mouse/navpoint.c index c29ae7654d5..8e1b98ea564 100644 --- a/drivers/input/mouse/navpoint.c +++ b/drivers/input/mouse/navpoint.c | |||
@@ -206,7 +206,7 @@ static void navpoint_close(struct input_dev *input) | |||
206 | navpoint_down(navpoint); | 206 | navpoint_down(navpoint); |
207 | } | 207 | } |
208 | 208 | ||
209 | static int __devinit navpoint_probe(struct platform_device *pdev) | 209 | static int navpoint_probe(struct platform_device *pdev) |
210 | { | 210 | { |
211 | const struct navpoint_platform_data *pdata = | 211 | const struct navpoint_platform_data *pdata = |
212 | dev_get_platdata(&pdev->dev); | 212 | dev_get_platdata(&pdev->dev); |
@@ -299,7 +299,7 @@ err_free_gpio: | |||
299 | return error; | 299 | return error; |
300 | } | 300 | } |
301 | 301 | ||
302 | static int __devexit navpoint_remove(struct platform_device *pdev) | 302 | static int navpoint_remove(struct platform_device *pdev) |
303 | { | 303 | { |
304 | const struct navpoint_platform_data *pdata = | 304 | const struct navpoint_platform_data *pdata = |
305 | dev_get_platdata(&pdev->dev); | 305 | dev_get_platdata(&pdev->dev); |
@@ -353,7 +353,7 @@ static SIMPLE_DEV_PM_OPS(navpoint_pm_ops, navpoint_suspend, navpoint_resume); | |||
353 | 353 | ||
354 | static struct platform_driver navpoint_driver = { | 354 | static struct platform_driver navpoint_driver = { |
355 | .probe = navpoint_probe, | 355 | .probe = navpoint_probe, |
356 | .remove = __devexit_p(navpoint_remove), | 356 | .remove = navpoint_remove, |
357 | .driver = { | 357 | .driver = { |
358 | .name = "navpoint", | 358 | .name = "navpoint", |
359 | .owner = THIS_MODULE, | 359 | .owner = THIS_MODULE, |
diff --git a/drivers/input/mouse/pxa930_trkball.c b/drivers/input/mouse/pxa930_trkball.c index 4fe055f2c53..0ecb9e7945e 100644 --- a/drivers/input/mouse/pxa930_trkball.c +++ b/drivers/input/mouse/pxa930_trkball.c | |||
@@ -143,7 +143,7 @@ static void pxa930_trkball_close(struct input_dev *dev) | |||
143 | pxa930_trkball_disable(trkball); | 143 | pxa930_trkball_disable(trkball); |
144 | } | 144 | } |
145 | 145 | ||
146 | static int __devinit pxa930_trkball_probe(struct platform_device *pdev) | 146 | static int pxa930_trkball_probe(struct platform_device *pdev) |
147 | { | 147 | { |
148 | struct pxa930_trkball *trkball; | 148 | struct pxa930_trkball *trkball; |
149 | struct input_dev *input; | 149 | struct input_dev *input; |
@@ -230,7 +230,7 @@ failed: | |||
230 | return error; | 230 | return error; |
231 | } | 231 | } |
232 | 232 | ||
233 | static int __devexit pxa930_trkball_remove(struct platform_device *pdev) | 233 | static int pxa930_trkball_remove(struct platform_device *pdev) |
234 | { | 234 | { |
235 | struct pxa930_trkball *trkball = platform_get_drvdata(pdev); | 235 | struct pxa930_trkball *trkball = platform_get_drvdata(pdev); |
236 | int irq = platform_get_irq(pdev, 0); | 236 | int irq = platform_get_irq(pdev, 0); |
@@ -248,7 +248,7 @@ static struct platform_driver pxa930_trkball_driver = { | |||
248 | .name = "pxa930-trkball", | 248 | .name = "pxa930-trkball", |
249 | }, | 249 | }, |
250 | .probe = pxa930_trkball_probe, | 250 | .probe = pxa930_trkball_probe, |
251 | .remove = __devexit_p(pxa930_trkball_remove), | 251 | .remove = pxa930_trkball_remove, |
252 | }; | 252 | }; |
253 | module_platform_driver(pxa930_trkball_driver); | 253 | module_platform_driver(pxa930_trkball_driver); |
254 | 254 | ||
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c index 063a174d3a8..ad822608f6e 100644 --- a/drivers/input/mouse/synaptics_i2c.c +++ b/drivers/input/mouse/synaptics_i2c.c | |||
@@ -535,7 +535,7 @@ static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *clien | |||
535 | return touch; | 535 | return touch; |
536 | } | 536 | } |
537 | 537 | ||
538 | static int __devinit synaptics_i2c_probe(struct i2c_client *client, | 538 | static int synaptics_i2c_probe(struct i2c_client *client, |
539 | const struct i2c_device_id *dev_id) | 539 | const struct i2c_device_id *dev_id) |
540 | { | 540 | { |
541 | int ret; | 541 | int ret; |
@@ -601,7 +601,7 @@ err_mem_free: | |||
601 | return ret; | 601 | return ret; |
602 | } | 602 | } |
603 | 603 | ||
604 | static int __devexit synaptics_i2c_remove(struct i2c_client *client) | 604 | static int synaptics_i2c_remove(struct i2c_client *client) |
605 | { | 605 | { |
606 | struct synaptics_i2c *touch = i2c_get_clientdata(client); | 606 | struct synaptics_i2c *touch = i2c_get_clientdata(client); |
607 | 607 | ||
@@ -662,7 +662,7 @@ static struct i2c_driver synaptics_i2c_driver = { | |||
662 | }, | 662 | }, |
663 | 663 | ||
664 | .probe = synaptics_i2c_probe, | 664 | .probe = synaptics_i2c_probe, |
665 | .remove = __devexit_p(synaptics_i2c_remove), | 665 | .remove = synaptics_i2c_remove, |
666 | 666 | ||
667 | .id_table = synaptics_i2c_id_table, | 667 | .id_table = synaptics_i2c_id_table, |
668 | }; | 668 | }; |
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig index 55f2c2293ec..4a4e182c33e 100644 --- a/drivers/input/serio/Kconfig +++ b/drivers/input/serio/Kconfig | |||
@@ -234,4 +234,13 @@ config SERIO_PS2MULT | |||
234 | To compile this driver as a module, choose M here: the | 234 | To compile this driver as a module, choose M here: the |
235 | module will be called ps2mult. | 235 | module will be called ps2mult. |
236 | 236 | ||
237 | config SERIO_ARC_PS2 | ||
238 | tristate "ARC PS/2 support" | ||
239 | help | ||
240 | Say Y here if you have an ARC FPGA platform with a PS/2 | ||
241 | controller in it. | ||
242 | |||
243 | To compile this driver as a module, choose M here; the module | ||
244 | will be called arc_ps2. | ||
245 | |||
237 | endif | 246 | endif |
diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile index dbbe37616c9..4b0c8f84f1c 100644 --- a/drivers/input/serio/Makefile +++ b/drivers/input/serio/Makefile | |||
@@ -25,3 +25,4 @@ obj-$(CONFIG_SERIO_RAW) += serio_raw.o | |||
25 | obj-$(CONFIG_SERIO_AMS_DELTA) += ams_delta_serio.o | 25 | obj-$(CONFIG_SERIO_AMS_DELTA) += ams_delta_serio.o |
26 | obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o | 26 | obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o |
27 | obj-$(CONFIG_SERIO_ALTERA_PS2) += altera_ps2.o | 27 | obj-$(CONFIG_SERIO_ALTERA_PS2) += altera_ps2.o |
28 | obj-$(CONFIG_SERIO_ARC_PS2) += arc_ps2.o | ||
diff --git a/drivers/input/serio/altera_ps2.c b/drivers/input/serio/altera_ps2.c index cc11f4efe11..479ce5fe895 100644 --- a/drivers/input/serio/altera_ps2.c +++ b/drivers/input/serio/altera_ps2.c | |||
@@ -81,7 +81,7 @@ static void altera_ps2_close(struct serio *io) | |||
81 | /* | 81 | /* |
82 | * Add one device to this driver. | 82 | * Add one device to this driver. |
83 | */ | 83 | */ |
84 | static int __devinit altera_ps2_probe(struct platform_device *pdev) | 84 | static int altera_ps2_probe(struct platform_device *pdev) |
85 | { | 85 | { |
86 | struct ps2if *ps2if; | 86 | struct ps2if *ps2if; |
87 | struct serio *serio; | 87 | struct serio *serio; |
@@ -159,7 +159,7 @@ static int __devinit altera_ps2_probe(struct platform_device *pdev) | |||
159 | /* | 159 | /* |
160 | * Remove one device from this driver. | 160 | * Remove one device from this driver. |
161 | */ | 161 | */ |
162 | static int __devexit altera_ps2_remove(struct platform_device *pdev) | 162 | static int altera_ps2_remove(struct platform_device *pdev) |
163 | { | 163 | { |
164 | struct ps2if *ps2if = platform_get_drvdata(pdev); | 164 | struct ps2if *ps2if = platform_get_drvdata(pdev); |
165 | 165 | ||
@@ -187,7 +187,7 @@ MODULE_DEVICE_TABLE(of, altera_ps2_match); | |||
187 | */ | 187 | */ |
188 | static struct platform_driver altera_ps2_driver = { | 188 | static struct platform_driver altera_ps2_driver = { |
189 | .probe = altera_ps2_probe, | 189 | .probe = altera_ps2_probe, |
190 | .remove = __devexit_p(altera_ps2_remove), | 190 | .remove = altera_ps2_remove, |
191 | .driver = { | 191 | .driver = { |
192 | .name = DRV_NAME, | 192 | .name = DRV_NAME, |
193 | .owner = THIS_MODULE, | 193 | .owner = THIS_MODULE, |
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c index 2e77246c2e5..4e2fd44865e 100644 --- a/drivers/input/serio/ambakmi.c +++ b/drivers/input/serio/ambakmi.c | |||
@@ -107,7 +107,7 @@ static void amba_kmi_close(struct serio *io) | |||
107 | clk_disable_unprepare(kmi->clk); | 107 | clk_disable_unprepare(kmi->clk); |
108 | } | 108 | } |
109 | 109 | ||
110 | static int __devinit amba_kmi_probe(struct amba_device *dev, | 110 | static int amba_kmi_probe(struct amba_device *dev, |
111 | const struct amba_id *id) | 111 | const struct amba_id *id) |
112 | { | 112 | { |
113 | struct amba_kmi_port *kmi; | 113 | struct amba_kmi_port *kmi; |
@@ -163,7 +163,7 @@ static int __devinit amba_kmi_probe(struct amba_device *dev, | |||
163 | return ret; | 163 | return ret; |
164 | } | 164 | } |
165 | 165 | ||
166 | static int __devexit amba_kmi_remove(struct amba_device *dev) | 166 | static int amba_kmi_remove(struct amba_device *dev) |
167 | { | 167 | { |
168 | struct amba_kmi_port *kmi = amba_get_drvdata(dev); | 168 | struct amba_kmi_port *kmi = amba_get_drvdata(dev); |
169 | 169 | ||
@@ -204,7 +204,7 @@ static struct amba_driver ambakmi_driver = { | |||
204 | }, | 204 | }, |
205 | .id_table = amba_kmi_idtable, | 205 | .id_table = amba_kmi_idtable, |
206 | .probe = amba_kmi_probe, | 206 | .probe = amba_kmi_probe, |
207 | .remove = __devexit_p(amba_kmi_remove), | 207 | .remove = amba_kmi_remove, |
208 | .resume = amba_kmi_resume, | 208 | .resume = amba_kmi_resume, |
209 | }; | 209 | }; |
210 | 210 | ||
diff --git a/drivers/input/serio/arc_ps2.c b/drivers/input/serio/arc_ps2.c new file mode 100644 index 00000000000..b571eb3e4ef --- /dev/null +++ b/drivers/input/serio/arc_ps2.c | |||
@@ -0,0 +1,274 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Driver is originally developed by Pavel Sokolov <psokolov@synopsys.com> | ||
9 | */ | ||
10 | |||
11 | #include <linux/module.h> | ||
12 | #include <linux/interrupt.h> | ||
13 | #include <linux/input.h> | ||
14 | #include <linux/serio.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/slab.h> | ||
19 | |||
20 | #define ARC_PS2_PORTS 2 | ||
21 | |||
22 | #define ARC_ARC_PS2_ID 0x0001f609 | ||
23 | |||
24 | #define STAT_TIMEOUT 128 | ||
25 | |||
26 | #define PS2_STAT_RX_FRM_ERR (1) | ||
27 | #define PS2_STAT_RX_BUF_OVER (1 << 1) | ||
28 | #define PS2_STAT_RX_INT_EN (1 << 2) | ||
29 | #define PS2_STAT_RX_VAL (1 << 3) | ||
30 | #define PS2_STAT_TX_ISNOT_FUL (1 << 4) | ||
31 | #define PS2_STAT_TX_INT_EN (1 << 5) | ||
32 | |||
33 | struct arc_ps2_port { | ||
34 | void __iomem *data_addr; | ||
35 | void __iomem *status_addr; | ||
36 | struct serio *io; | ||
37 | }; | ||
38 | |||
39 | struct arc_ps2_data { | ||
40 | struct arc_ps2_port port[ARC_PS2_PORTS]; | ||
41 | void __iomem *addr; | ||
42 | unsigned int frame_error; | ||
43 | unsigned int buf_overflow; | ||
44 | unsigned int total_int; | ||
45 | }; | ||
46 | |||
47 | static void arc_ps2_check_rx(struct arc_ps2_data *arc_ps2, | ||
48 | struct arc_ps2_port *port) | ||
49 | { | ||
50 | unsigned int timeout = 1000; | ||
51 | unsigned int flag, status; | ||
52 | unsigned char data; | ||
53 | |||
54 | do { | ||
55 | status = ioread32(port->status_addr); | ||
56 | if (!(status & PS2_STAT_RX_VAL)) | ||
57 | return; | ||
58 | |||
59 | data = ioread32(port->data_addr) & 0xff; | ||
60 | |||
61 | flag = 0; | ||
62 | arc_ps2->total_int++; | ||
63 | if (status & PS2_STAT_RX_FRM_ERR) { | ||
64 | arc_ps2->frame_error++; | ||
65 | flag |= SERIO_PARITY; | ||
66 | } else if (status & PS2_STAT_RX_BUF_OVER) { | ||
67 | arc_ps2->buf_overflow++; | ||
68 | flag |= SERIO_FRAME; | ||
69 | } | ||
70 | |||
71 | serio_interrupt(port->io, data, flag); | ||
72 | } while (--timeout); | ||
73 | |||
74 | dev_err(&port->io->dev, "PS/2 hardware stuck\n"); | ||
75 | } | ||
76 | |||
77 | static irqreturn_t arc_ps2_interrupt(int irq, void *dev) | ||
78 | { | ||
79 | struct arc_ps2_data *arc_ps2 = dev; | ||
80 | int i; | ||
81 | |||
82 | for (i = 0; i < ARC_PS2_PORTS; i++) | ||
83 | arc_ps2_check_rx(arc_ps2, &arc_ps2->port[i]); | ||
84 | |||
85 | return IRQ_HANDLED; | ||
86 | } | ||
87 | |||
88 | static int arc_ps2_write(struct serio *io, unsigned char val) | ||
89 | { | ||
90 | unsigned status; | ||
91 | struct arc_ps2_port *port = io->port_data; | ||
92 | int timeout = STAT_TIMEOUT; | ||
93 | |||
94 | do { | ||
95 | status = ioread32(port->status_addr); | ||
96 | cpu_relax(); | ||
97 | |||
98 | if (status & PS2_STAT_TX_ISNOT_FUL) { | ||
99 | iowrite32(val & 0xff, port->data_addr); | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | } while (--timeout); | ||
104 | |||
105 | dev_err(&io->dev, "write timeout\n"); | ||
106 | return -ETIMEDOUT; | ||
107 | } | ||
108 | |||
109 | static int arc_ps2_open(struct serio *io) | ||
110 | { | ||
111 | struct arc_ps2_port *port = io->port_data; | ||
112 | |||
113 | iowrite32(PS2_STAT_RX_INT_EN, port->status_addr); | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static void arc_ps2_close(struct serio *io) | ||
119 | { | ||
120 | struct arc_ps2_port *port = io->port_data; | ||
121 | |||
122 | iowrite32(ioread32(port->status_addr) & ~PS2_STAT_RX_INT_EN, | ||
123 | port->status_addr); | ||
124 | } | ||
125 | |||
126 | static void __iomem *arc_ps2_calc_addr(struct arc_ps2_data *arc_ps2, | ||
127 | int index, bool status) | ||
128 | { | ||
129 | void __iomem *addr; | ||
130 | |||
131 | addr = arc_ps2->addr + 4 + 4 * index; | ||
132 | if (status) | ||
133 | addr += ARC_PS2_PORTS * 4; | ||
134 | |||
135 | return addr; | ||
136 | } | ||
137 | |||
138 | static void arc_ps2_inhibit_ports(struct arc_ps2_data *arc_ps2) | ||
139 | { | ||
140 | void __iomem *addr; | ||
141 | u32 val; | ||
142 | int i; | ||
143 | |||
144 | for (i = 0; i < ARC_PS2_PORTS; i++) { | ||
145 | addr = arc_ps2_calc_addr(arc_ps2, i, true); | ||
146 | val = ioread32(addr); | ||
147 | val &= ~(PS2_STAT_RX_INT_EN | PS2_STAT_TX_INT_EN); | ||
148 | iowrite32(val, addr); | ||
149 | } | ||
150 | } | ||
151 | |||
152 | static int arc_ps2_create_port(struct platform_device *pdev, | ||
153 | struct arc_ps2_data *arc_ps2, | ||
154 | int index) | ||
155 | { | ||
156 | struct arc_ps2_port *port = &arc_ps2->port[index]; | ||
157 | struct serio *io; | ||
158 | |||
159 | io = kzalloc(sizeof(struct serio), GFP_KERNEL); | ||
160 | if (!io) | ||
161 | return -ENOMEM; | ||
162 | |||
163 | io->id.type = SERIO_8042; | ||
164 | io->write = arc_ps2_write; | ||
165 | io->open = arc_ps2_open; | ||
166 | io->close = arc_ps2_close; | ||
167 | snprintf(io->name, sizeof(io->name), "ARC PS/2 port%d", index); | ||
168 | snprintf(io->phys, sizeof(io->phys), "arc/serio%d", index); | ||
169 | io->port_data = port; | ||
170 | |||
171 | port->io = io; | ||
172 | |||
173 | port->data_addr = arc_ps2_calc_addr(arc_ps2, index, false); | ||
174 | port->status_addr = arc_ps2_calc_addr(arc_ps2, index, true); | ||
175 | |||
176 | dev_dbg(&pdev->dev, "port%d is allocated (data = 0x%p, status = 0x%p)\n", | ||
177 | index, port->data_addr, port->status_addr); | ||
178 | |||
179 | serio_register_port(port->io); | ||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | static int arc_ps2_probe(struct platform_device *pdev) | ||
184 | { | ||
185 | struct arc_ps2_data *arc_ps2; | ||
186 | struct resource *res; | ||
187 | int irq; | ||
188 | int error, id, i; | ||
189 | |||
190 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
191 | if (!res) { | ||
192 | dev_err(&pdev->dev, "no IO memory defined\n"); | ||
193 | return -EINVAL; | ||
194 | } | ||
195 | |||
196 | irq = platform_get_irq_byname(pdev, "arc_ps2_irq"); | ||
197 | if (irq < 0) { | ||
198 | dev_err(&pdev->dev, "no IRQ defined\n"); | ||
199 | return -EINVAL; | ||
200 | } | ||
201 | |||
202 | arc_ps2 = devm_kzalloc(&pdev->dev, sizeof(struct arc_ps2_data), | ||
203 | GFP_KERNEL); | ||
204 | if (!arc_ps2) { | ||
205 | dev_err(&pdev->dev, "out of memory\n"); | ||
206 | return -ENOMEM; | ||
207 | } | ||
208 | |||
209 | arc_ps2->addr = devm_request_and_ioremap(&pdev->dev, res); | ||
210 | if (!arc_ps2->addr) | ||
211 | return -EBUSY; | ||
212 | |||
213 | dev_info(&pdev->dev, "irq = %d, address = 0x%p, ports = %i\n", | ||
214 | irq, arc_ps2->addr, ARC_PS2_PORTS); | ||
215 | |||
216 | id = ioread32(arc_ps2->addr); | ||
217 | if (id != ARC_ARC_PS2_ID) { | ||
218 | dev_err(&pdev->dev, "device id does not match\n"); | ||
219 | return -ENXIO; | ||
220 | } | ||
221 | |||
222 | arc_ps2_inhibit_ports(arc_ps2); | ||
223 | |||
224 | error = devm_request_irq(&pdev->dev, irq, arc_ps2_interrupt, | ||
225 | 0, "arc_ps2", arc_ps2); | ||
226 | if (error) { | ||
227 | dev_err(&pdev->dev, "Could not allocate IRQ\n"); | ||
228 | return error; | ||
229 | } | ||
230 | |||
231 | for (i = 0; i < ARC_PS2_PORTS; i++) { | ||
232 | error = arc_ps2_create_port(pdev, arc_ps2, i); | ||
233 | if (error) { | ||
234 | while (--i >= 0) | ||
235 | serio_unregister_port(arc_ps2->port[i].io); | ||
236 | return error; | ||
237 | } | ||
238 | } | ||
239 | |||
240 | platform_set_drvdata(pdev, arc_ps2); | ||
241 | |||
242 | return 0; | ||
243 | } | ||
244 | |||
245 | static int arc_ps2_remove(struct platform_device *pdev) | ||
246 | { | ||
247 | struct arc_ps2_data *arc_ps2 = platform_get_drvdata(pdev); | ||
248 | int i; | ||
249 | |||
250 | for (i = 0; i < ARC_PS2_PORTS; i++) | ||
251 | serio_unregister_port(arc_ps2->port[i].io); | ||
252 | |||
253 | dev_dbg(&pdev->dev, "interrupt count = %i\n", arc_ps2->total_int); | ||
254 | dev_dbg(&pdev->dev, "frame error count = %i\n", arc_ps2->frame_error); | ||
255 | dev_dbg(&pdev->dev, "buffer overflow count = %i\n", | ||
256 | arc_ps2->buf_overflow); | ||
257 | |||
258 | return 0; | ||
259 | } | ||
260 | |||
261 | static struct platform_driver arc_ps2_driver = { | ||
262 | .driver = { | ||
263 | .name = "arc_ps2", | ||
264 | .owner = THIS_MODULE, | ||
265 | }, | ||
266 | .probe = arc_ps2_probe, | ||
267 | .remove = arc_ps2_remove, | ||
268 | }; | ||
269 | |||
270 | module_platform_driver(arc_ps2_driver); | ||
271 | |||
272 | MODULE_LICENSE("GPL"); | ||
273 | MODULE_AUTHOR("Pavel Sokolov <psokolov@synopsys.com>"); | ||
274 | MODULE_DESCRIPTION("ARC PS/2 Driver"); | ||
diff --git a/drivers/input/serio/ct82c710.c b/drivers/input/serio/ct82c710.c index 85281656724..cfe549d4eaa 100644 --- a/drivers/input/serio/ct82c710.c +++ b/drivers/input/serio/ct82c710.c | |||
@@ -175,7 +175,7 @@ static int __init ct82c710_detect(void) | |||
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
177 | 177 | ||
178 | static int __devinit ct82c710_probe(struct platform_device *dev) | 178 | static int ct82c710_probe(struct platform_device *dev) |
179 | { | 179 | { |
180 | ct82c710_port = kzalloc(sizeof(struct serio), GFP_KERNEL); | 180 | ct82c710_port = kzalloc(sizeof(struct serio), GFP_KERNEL); |
181 | if (!ct82c710_port) | 181 | if (!ct82c710_port) |
@@ -199,7 +199,7 @@ static int __devinit ct82c710_probe(struct platform_device *dev) | |||
199 | return 0; | 199 | return 0; |
200 | } | 200 | } |
201 | 201 | ||
202 | static int __devexit ct82c710_remove(struct platform_device *dev) | 202 | static int ct82c710_remove(struct platform_device *dev) |
203 | { | 203 | { |
204 | serio_unregister_port(ct82c710_port); | 204 | serio_unregister_port(ct82c710_port); |
205 | 205 | ||
@@ -212,7 +212,7 @@ static struct platform_driver ct82c710_driver = { | |||
212 | .owner = THIS_MODULE, | 212 | .owner = THIS_MODULE, |
213 | }, | 213 | }, |
214 | .probe = ct82c710_probe, | 214 | .probe = ct82c710_probe, |
215 | .remove = __devexit_p(ct82c710_remove), | 215 | .remove = ct82c710_remove, |
216 | }; | 216 | }; |
217 | 217 | ||
218 | 218 | ||
diff --git a/drivers/input/serio/gscps2.c b/drivers/input/serio/gscps2.c index 4225f5d6b15..8d9ba0c3827 100644 --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c | |||
@@ -327,7 +327,7 @@ static void gscps2_close(struct serio *port) | |||
327 | * @return: success/error report | 327 | * @return: success/error report |
328 | */ | 328 | */ |
329 | 329 | ||
330 | static int __devinit gscps2_probe(struct parisc_device *dev) | 330 | static int gscps2_probe(struct parisc_device *dev) |
331 | { | 331 | { |
332 | struct gscps2port *ps2port; | 332 | struct gscps2port *ps2port; |
333 | struct serio *serio; | 333 | struct serio *serio; |
@@ -414,7 +414,7 @@ fail_nomem: | |||
414 | * @return: success/error report | 414 | * @return: success/error report |
415 | */ | 415 | */ |
416 | 416 | ||
417 | static int __devexit gscps2_remove(struct parisc_device *dev) | 417 | static int gscps2_remove(struct parisc_device *dev) |
418 | { | 418 | { |
419 | struct gscps2port *ps2port = dev_get_drvdata(&dev->dev); | 419 | struct gscps2port *ps2port = dev_get_drvdata(&dev->dev); |
420 | 420 | ||
@@ -444,7 +444,7 @@ static struct parisc_driver parisc_ps2_driver = { | |||
444 | .name = "gsc_ps2", | 444 | .name = "gsc_ps2", |
445 | .id_table = gscps2_device_tbl, | 445 | .id_table = gscps2_device_tbl, |
446 | .probe = gscps2_probe, | 446 | .probe = gscps2_probe, |
447 | .remove = __devexit_p(gscps2_remove), | 447 | .remove = gscps2_remove, |
448 | }; | 448 | }; |
449 | 449 | ||
450 | static int __init gscps2_init(void) | 450 | static int __init gscps2_init(void) |
diff --git a/drivers/input/serio/hil_mlc.c b/drivers/input/serio/hil_mlc.c index bfd3865d886..65605e4ef3c 100644 --- a/drivers/input/serio/hil_mlc.c +++ b/drivers/input/serio/hil_mlc.c | |||
@@ -686,13 +686,12 @@ static int hilse_donode(hil_mlc *mlc) | |||
686 | write_lock_irqsave(&mlc->lock, flags); | 686 | write_lock_irqsave(&mlc->lock, flags); |
687 | pack = node->object.packet; | 687 | pack = node->object.packet; |
688 | out: | 688 | out: |
689 | if (mlc->istarted) | 689 | if (!mlc->istarted) { |
690 | goto out2; | 690 | /* Prepare to receive input */ |
691 | /* Prepare to receive input */ | 691 | if ((node + 1)->act & HILSE_IN) |
692 | if ((node + 1)->act & HILSE_IN) | 692 | hilse_setup_input(mlc, node + 1); |
693 | hilse_setup_input(mlc, node + 1); | 693 | } |
694 | 694 | ||
695 | out2: | ||
696 | write_unlock_irqrestore(&mlc->lock, flags); | 695 | write_unlock_irqrestore(&mlc->lock, flags); |
697 | 696 | ||
698 | if (down_trylock(&mlc->osem)) { | 697 | if (down_trylock(&mlc->osem)) { |
@@ -1010,8 +1009,6 @@ static int __init hil_mlc_init(void) | |||
1010 | static void __exit hil_mlc_exit(void) | 1009 | static void __exit hil_mlc_exit(void) |
1011 | { | 1010 | { |
1012 | del_timer_sync(&hil_mlcs_kicker); | 1011 | del_timer_sync(&hil_mlcs_kicker); |
1013 | |||
1014 | tasklet_disable(&hil_mlcs_tasklet); | ||
1015 | tasklet_kill(&hil_mlcs_tasklet); | 1012 | tasklet_kill(&hil_mlcs_tasklet); |
1016 | } | 1013 | } |
1017 | 1014 | ||
diff --git a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h index 5d48bb66aa7..a5eed2ade53 100644 --- a/drivers/input/serio/i8042-io.h +++ b/drivers/input/serio/i8042-io.h | |||
@@ -76,7 +76,7 @@ static inline int i8042_platform_init(void) | |||
76 | if (check_legacy_ioport(I8042_DATA_REG)) | 76 | if (check_legacy_ioport(I8042_DATA_REG)) |
77 | return -ENODEV; | 77 | return -ENODEV; |
78 | #endif | 78 | #endif |
79 | #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) | 79 | #if !defined(__sh__) && !defined(__alpha__) |
80 | if (!request_region(I8042_DATA_REG, 16, "i8042")) | 80 | if (!request_region(I8042_DATA_REG, 16, "i8042")) |
81 | return -EBUSY; | 81 | return -EBUSY; |
82 | #endif | 82 | #endif |
diff --git a/drivers/input/serio/i8042-sparcio.h b/drivers/input/serio/i8042-sparcio.h index 395a9af3adc..d6aa4c67dbb 100644 --- a/drivers/input/serio/i8042-sparcio.h +++ b/drivers/input/serio/i8042-sparcio.h | |||
@@ -49,7 +49,7 @@ static inline void i8042_write_command(int val) | |||
49 | #define OBP_PS2MS_NAME1 "kdmouse" | 49 | #define OBP_PS2MS_NAME1 "kdmouse" |
50 | #define OBP_PS2MS_NAME2 "mouse" | 50 | #define OBP_PS2MS_NAME2 "mouse" |
51 | 51 | ||
52 | static int __devinit sparc_i8042_probe(struct platform_device *op) | 52 | static int sparc_i8042_probe(struct platform_device *op) |
53 | { | 53 | { |
54 | struct device_node *dp = op->dev.of_node; | 54 | struct device_node *dp = op->dev.of_node; |
55 | 55 | ||
@@ -80,7 +80,7 @@ static int __devinit sparc_i8042_probe(struct platform_device *op) | |||
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int __devexit sparc_i8042_remove(struct platform_device *op) | 83 | static int sparc_i8042_remove(struct platform_device *op) |
84 | { | 84 | { |
85 | of_iounmap(kbd_res, kbd_iobase, 8); | 85 | of_iounmap(kbd_res, kbd_iobase, 8); |
86 | 86 | ||
@@ -102,7 +102,7 @@ static struct platform_driver sparc_i8042_driver = { | |||
102 | .of_match_table = sparc_i8042_match, | 102 | .of_match_table = sparc_i8042_match, |
103 | }, | 103 | }, |
104 | .probe = sparc_i8042_probe, | 104 | .probe = sparc_i8042_probe, |
105 | .remove = __devexit_p(sparc_i8042_remove), | 105 | .remove = sparc_i8042_remove, |
106 | }; | 106 | }; |
107 | 107 | ||
108 | static int __init i8042_platform_init(void) | 108 | static int __init i8042_platform_init(void) |
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 86564414b75..78e4de42efa 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -1284,7 +1284,7 @@ static void __init i8042_register_ports(void) | |||
1284 | } | 1284 | } |
1285 | } | 1285 | } |
1286 | 1286 | ||
1287 | static void __devexit i8042_unregister_ports(void) | 1287 | static void i8042_unregister_ports(void) |
1288 | { | 1288 | { |
1289 | int i; | 1289 | int i; |
1290 | 1290 | ||
@@ -1437,7 +1437,7 @@ static int __init i8042_probe(struct platform_device *dev) | |||
1437 | return error; | 1437 | return error; |
1438 | } | 1438 | } |
1439 | 1439 | ||
1440 | static int __devexit i8042_remove(struct platform_device *dev) | 1440 | static int i8042_remove(struct platform_device *dev) |
1441 | { | 1441 | { |
1442 | i8042_unregister_ports(); | 1442 | i8042_unregister_ports(); |
1443 | i8042_free_irqs(); | 1443 | i8042_free_irqs(); |
@@ -1455,7 +1455,7 @@ static struct platform_driver i8042_driver = { | |||
1455 | .pm = &i8042_pm_ops, | 1455 | .pm = &i8042_pm_ops, |
1456 | #endif | 1456 | #endif |
1457 | }, | 1457 | }, |
1458 | .remove = __devexit_p(i8042_remove), | 1458 | .remove = i8042_remove, |
1459 | .shutdown = i8042_shutdown, | 1459 | .shutdown = i8042_shutdown, |
1460 | }; | 1460 | }; |
1461 | 1461 | ||
diff --git a/drivers/input/serio/maceps2.c b/drivers/input/serio/maceps2.c index 61da763b120..bc85e1cc66d 100644 --- a/drivers/input/serio/maceps2.c +++ b/drivers/input/serio/maceps2.c | |||
@@ -116,7 +116,7 @@ static void maceps2_close(struct serio *dev) | |||
116 | } | 116 | } |
117 | 117 | ||
118 | 118 | ||
119 | static struct serio * __devinit maceps2_allocate_port(int idx) | 119 | static struct serio *maceps2_allocate_port(int idx) |
120 | { | 120 | { |
121 | struct serio *serio; | 121 | struct serio *serio; |
122 | 122 | ||
@@ -135,7 +135,7 @@ static struct serio * __devinit maceps2_allocate_port(int idx) | |||
135 | return serio; | 135 | return serio; |
136 | } | 136 | } |
137 | 137 | ||
138 | static int __devinit maceps2_probe(struct platform_device *dev) | 138 | static int maceps2_probe(struct platform_device *dev) |
139 | { | 139 | { |
140 | maceps2_port[0] = maceps2_allocate_port(0); | 140 | maceps2_port[0] = maceps2_allocate_port(0); |
141 | maceps2_port[1] = maceps2_allocate_port(1); | 141 | maceps2_port[1] = maceps2_allocate_port(1); |
@@ -151,7 +151,7 @@ static int __devinit maceps2_probe(struct platform_device *dev) | |||
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | 153 | ||
154 | static int __devexit maceps2_remove(struct platform_device *dev) | 154 | static int maceps2_remove(struct platform_device *dev) |
155 | { | 155 | { |
156 | serio_unregister_port(maceps2_port[0]); | 156 | serio_unregister_port(maceps2_port[0]); |
157 | serio_unregister_port(maceps2_port[1]); | 157 | serio_unregister_port(maceps2_port[1]); |
@@ -165,7 +165,7 @@ static struct platform_driver maceps2_driver = { | |||
165 | .owner = THIS_MODULE, | 165 | .owner = THIS_MODULE, |
166 | }, | 166 | }, |
167 | .probe = maceps2_probe, | 167 | .probe = maceps2_probe, |
168 | .remove = __devexit_p(maceps2_remove), | 168 | .remove = maceps2_remove, |
169 | }; | 169 | }; |
170 | 170 | ||
171 | static int __init maceps2_init(void) | 171 | static int __init maceps2_init(void) |
diff --git a/drivers/input/serio/pcips2.c b/drivers/input/serio/pcips2.c index 0c42497aaaf..76f83836fd5 100644 --- a/drivers/input/serio/pcips2.c +++ b/drivers/input/serio/pcips2.c | |||
@@ -127,7 +127,7 @@ static void pcips2_close(struct serio *io) | |||
127 | free_irq(ps2if->dev->irq, ps2if); | 127 | free_irq(ps2if->dev->irq, ps2if); |
128 | } | 128 | } |
129 | 129 | ||
130 | static int __devinit pcips2_probe(struct pci_dev *dev, const struct pci_device_id *id) | 130 | static int pcips2_probe(struct pci_dev *dev, const struct pci_device_id *id) |
131 | { | 131 | { |
132 | struct pcips2_data *ps2if; | 132 | struct pcips2_data *ps2if; |
133 | struct serio *serio; | 133 | struct serio *serio; |
@@ -176,7 +176,7 @@ static int __devinit pcips2_probe(struct pci_dev *dev, const struct pci_device_i | |||
176 | return ret; | 176 | return ret; |
177 | } | 177 | } |
178 | 178 | ||
179 | static void __devexit pcips2_remove(struct pci_dev *dev) | 179 | static void pcips2_remove(struct pci_dev *dev) |
180 | { | 180 | { |
181 | struct pcips2_data *ps2if = pci_get_drvdata(dev); | 181 | struct pcips2_data *ps2if = pci_get_drvdata(dev); |
182 | 182 | ||
@@ -212,7 +212,7 @@ static struct pci_driver pcips2_driver = { | |||
212 | .name = "pcips2", | 212 | .name = "pcips2", |
213 | .id_table = pcips2_ids, | 213 | .id_table = pcips2_ids, |
214 | .probe = pcips2_probe, | 214 | .probe = pcips2_probe, |
215 | .remove = __devexit_p(pcips2_remove), | 215 | .remove = pcips2_remove, |
216 | }; | 216 | }; |
217 | 217 | ||
218 | module_pci_driver(pcips2_driver); | 218 | module_pci_driver(pcips2_driver); |
diff --git a/drivers/input/serio/q40kbd.c b/drivers/input/serio/q40kbd.c index 0c0df7f7380..70fe542839f 100644 --- a/drivers/input/serio/q40kbd.c +++ b/drivers/input/serio/q40kbd.c | |||
@@ -122,7 +122,7 @@ static void q40kbd_close(struct serio *port) | |||
122 | q40kbd_flush(q40kbd); | 122 | q40kbd_flush(q40kbd); |
123 | } | 123 | } |
124 | 124 | ||
125 | static int __devinit q40kbd_probe(struct platform_device *pdev) | 125 | static int q40kbd_probe(struct platform_device *pdev) |
126 | { | 126 | { |
127 | struct q40kbd *q40kbd; | 127 | struct q40kbd *q40kbd; |
128 | struct serio *port; | 128 | struct serio *port; |
@@ -168,7 +168,7 @@ err_free_mem: | |||
168 | return error; | 168 | return error; |
169 | } | 169 | } |
170 | 170 | ||
171 | static int __devexit q40kbd_remove(struct platform_device *pdev) | 171 | static int q40kbd_remove(struct platform_device *pdev) |
172 | { | 172 | { |
173 | struct q40kbd *q40kbd = platform_get_drvdata(pdev); | 173 | struct q40kbd *q40kbd = platform_get_drvdata(pdev); |
174 | 174 | ||
@@ -190,7 +190,7 @@ static struct platform_driver q40kbd_driver = { | |||
190 | .name = "q40kbd", | 190 | .name = "q40kbd", |
191 | .owner = THIS_MODULE, | 191 | .owner = THIS_MODULE, |
192 | }, | 192 | }, |
193 | .remove = __devexit_p(q40kbd_remove), | 193 | .remove = q40kbd_remove, |
194 | }; | 194 | }; |
195 | 195 | ||
196 | static int __init q40kbd_init(void) | 196 | static int __init q40kbd_init(void) |
diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c index 2af5df6a8fb..567566ae0da 100644 --- a/drivers/input/serio/rpckbd.c +++ b/drivers/input/serio/rpckbd.c | |||
@@ -114,7 +114,7 @@ static void rpckbd_close(struct serio *port) | |||
114 | * Allocate and initialize serio structure for subsequent registration | 114 | * Allocate and initialize serio structure for subsequent registration |
115 | * with serio core. | 115 | * with serio core. |
116 | */ | 116 | */ |
117 | static int __devinit rpckbd_probe(struct platform_device *dev) | 117 | static int rpckbd_probe(struct platform_device *dev) |
118 | { | 118 | { |
119 | struct rpckbd_data *rpckbd; | 119 | struct rpckbd_data *rpckbd; |
120 | struct serio *serio; | 120 | struct serio *serio; |
@@ -153,7 +153,7 @@ static int __devinit rpckbd_probe(struct platform_device *dev) | |||
153 | return 0; | 153 | return 0; |
154 | } | 154 | } |
155 | 155 | ||
156 | static int __devexit rpckbd_remove(struct platform_device *dev) | 156 | static int rpckbd_remove(struct platform_device *dev) |
157 | { | 157 | { |
158 | struct serio *serio = platform_get_drvdata(dev); | 158 | struct serio *serio = platform_get_drvdata(dev); |
159 | struct rpckbd_data *rpckbd = serio->port_data; | 159 | struct rpckbd_data *rpckbd = serio->port_data; |
@@ -166,7 +166,7 @@ static int __devexit rpckbd_remove(struct platform_device *dev) | |||
166 | 166 | ||
167 | static struct platform_driver rpckbd_driver = { | 167 | static struct platform_driver rpckbd_driver = { |
168 | .probe = rpckbd_probe, | 168 | .probe = rpckbd_probe, |
169 | .remove = __devexit_p(rpckbd_remove), | 169 | .remove = rpckbd_remove, |
170 | .driver = { | 170 | .driver = { |
171 | .name = "kart", | 171 | .name = "kart", |
172 | .owner = THIS_MODULE, | 172 | .owner = THIS_MODULE, |
diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c index 38976670753..b3e688911fd 100644 --- a/drivers/input/serio/sa1111ps2.c +++ b/drivers/input/serio/sa1111ps2.c | |||
@@ -193,7 +193,7 @@ static void ps2_close(struct serio *io) | |||
193 | /* | 193 | /* |
194 | * Clear the input buffer. | 194 | * Clear the input buffer. |
195 | */ | 195 | */ |
196 | static void __devinit ps2_clear_input(struct ps2if *ps2if) | 196 | static void ps2_clear_input(struct ps2if *ps2if) |
197 | { | 197 | { |
198 | int maxread = 100; | 198 | int maxread = 100; |
199 | 199 | ||
@@ -203,7 +203,7 @@ static void __devinit ps2_clear_input(struct ps2if *ps2if) | |||
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | static unsigned int __devinit ps2_test_one(struct ps2if *ps2if, | 206 | static unsigned int ps2_test_one(struct ps2if *ps2if, |
207 | unsigned int mask) | 207 | unsigned int mask) |
208 | { | 208 | { |
209 | unsigned int val; | 209 | unsigned int val; |
@@ -220,7 +220,7 @@ static unsigned int __devinit ps2_test_one(struct ps2if *ps2if, | |||
220 | * Test the keyboard interface. We basically check to make sure that | 220 | * Test the keyboard interface. We basically check to make sure that |
221 | * we can drive each line to the keyboard independently of each other. | 221 | * we can drive each line to the keyboard independently of each other. |
222 | */ | 222 | */ |
223 | static int __devinit ps2_test(struct ps2if *ps2if) | 223 | static int ps2_test(struct ps2if *ps2if) |
224 | { | 224 | { |
225 | unsigned int stat; | 225 | unsigned int stat; |
226 | int ret = 0; | 226 | int ret = 0; |
@@ -251,7 +251,7 @@ static int __devinit ps2_test(struct ps2if *ps2if) | |||
251 | /* | 251 | /* |
252 | * Add one device to this driver. | 252 | * Add one device to this driver. |
253 | */ | 253 | */ |
254 | static int __devinit ps2_probe(struct sa1111_dev *dev) | 254 | static int ps2_probe(struct sa1111_dev *dev) |
255 | { | 255 | { |
256 | struct ps2if *ps2if; | 256 | struct ps2if *ps2if; |
257 | struct serio *serio; | 257 | struct serio *serio; |
@@ -334,7 +334,7 @@ static int __devinit ps2_probe(struct sa1111_dev *dev) | |||
334 | /* | 334 | /* |
335 | * Remove one device from this driver. | 335 | * Remove one device from this driver. |
336 | */ | 336 | */ |
337 | static int __devexit ps2_remove(struct sa1111_dev *dev) | 337 | static int ps2_remove(struct sa1111_dev *dev) |
338 | { | 338 | { |
339 | struct ps2if *ps2if = sa1111_get_drvdata(dev); | 339 | struct ps2if *ps2if = sa1111_get_drvdata(dev); |
340 | 340 | ||
@@ -357,7 +357,7 @@ static struct sa1111_driver ps2_driver = { | |||
357 | }, | 357 | }, |
358 | .devid = SA1111_DEVID_PS2, | 358 | .devid = SA1111_DEVID_PS2, |
359 | .probe = ps2_probe, | 359 | .probe = ps2_probe, |
360 | .remove = __devexit_p(ps2_remove), | 360 | .remove = ps2_remove, |
361 | }; | 361 | }; |
362 | 362 | ||
363 | static int __init ps2_init(void) | 363 | static int __init ps2_init(void) |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index d0f7533dbf8..25fc5971f42 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -891,8 +891,6 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv) | |||
891 | return serio_match_port(serio_drv->id_table, serio); | 891 | return serio_match_port(serio_drv->id_table, serio); |
892 | } | 892 | } |
893 | 893 | ||
894 | #ifdef CONFIG_HOTPLUG | ||
895 | |||
896 | #define SERIO_ADD_UEVENT_VAR(fmt, val...) \ | 894 | #define SERIO_ADD_UEVENT_VAR(fmt, val...) \ |
897 | do { \ | 895 | do { \ |
898 | int err = add_uevent_var(env, fmt, val); \ | 896 | int err = add_uevent_var(env, fmt, val); \ |
@@ -920,15 +918,6 @@ static int serio_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
920 | } | 918 | } |
921 | #undef SERIO_ADD_UEVENT_VAR | 919 | #undef SERIO_ADD_UEVENT_VAR |
922 | 920 | ||
923 | #else | ||
924 | |||
925 | static int serio_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
926 | { | ||
927 | return -ENODEV; | ||
928 | } | ||
929 | |||
930 | #endif /* CONFIG_HOTPLUG */ | ||
931 | |||
932 | #ifdef CONFIG_PM | 921 | #ifdef CONFIG_PM |
933 | static int serio_suspend(struct device *dev) | 922 | static int serio_suspend(struct device *dev) |
934 | { | 923 | { |
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c index 1e983bec7d8..17be85948ff 100644 --- a/drivers/input/serio/xilinx_ps2.c +++ b/drivers/input/serio/xilinx_ps2.c | |||
@@ -233,7 +233,7 @@ static void sxps2_close(struct serio *pserio) | |||
233 | * It returns 0, if the driver is bound to the PS/2 device, or a negative | 233 | * It returns 0, if the driver is bound to the PS/2 device, or a negative |
234 | * value if there is an error. | 234 | * value if there is an error. |
235 | */ | 235 | */ |
236 | static int __devinit xps2_of_probe(struct platform_device *ofdev) | 236 | static int xps2_of_probe(struct platform_device *ofdev) |
237 | { | 237 | { |
238 | struct resource r_irq; /* Interrupt resources */ | 238 | struct resource r_irq; /* Interrupt resources */ |
239 | struct resource r_mem; /* IO mem resources */ | 239 | struct resource r_mem; /* IO mem resources */ |
@@ -333,7 +333,7 @@ failed1: | |||
333 | * if the driver module is being unloaded. It frees any resources allocated to | 333 | * if the driver module is being unloaded. It frees any resources allocated to |
334 | * the device. | 334 | * the device. |
335 | */ | 335 | */ |
336 | static int __devexit xps2_of_remove(struct platform_device *of_dev) | 336 | static int xps2_of_remove(struct platform_device *of_dev) |
337 | { | 337 | { |
338 | struct xps2data *drvdata = platform_get_drvdata(of_dev); | 338 | struct xps2data *drvdata = platform_get_drvdata(of_dev); |
339 | struct resource r_mem; /* IO mem resources */ | 339 | struct resource r_mem; /* IO mem resources */ |
@@ -355,7 +355,7 @@ static int __devexit xps2_of_remove(struct platform_device *of_dev) | |||
355 | } | 355 | } |
356 | 356 | ||
357 | /* Match table for of_platform binding */ | 357 | /* Match table for of_platform binding */ |
358 | static const struct of_device_id xps2_of_match[] __devinitconst = { | 358 | static const struct of_device_id xps2_of_match[] = { |
359 | { .compatible = "xlnx,xps-ps2-1.00.a", }, | 359 | { .compatible = "xlnx,xps-ps2-1.00.a", }, |
360 | { /* end of list */ }, | 360 | { /* end of list */ }, |
361 | }; | 361 | }; |
@@ -368,7 +368,7 @@ static struct platform_driver xps2_of_driver = { | |||
368 | .of_match_table = xps2_of_match, | 368 | .of_match_table = xps2_of_match, |
369 | }, | 369 | }, |
370 | .probe = xps2_of_probe, | 370 | .probe = xps2_of_probe, |
371 | .remove = __devexit_p(xps2_of_remove), | 371 | .remove = xps2_of_remove, |
372 | }; | 372 | }; |
373 | module_platform_driver(xps2_of_driver); | 373 | module_platform_driver(xps2_of_driver); |
374 | 374 | ||
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c index 858ad446de9..f92d34f45a1 100644 --- a/drivers/input/tablet/wacom_sys.c +++ b/drivers/input/tablet/wacom_sys.c | |||
@@ -386,23 +386,40 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
386 | if (usage == WCM_DESKTOP) { | 386 | if (usage == WCM_DESKTOP) { |
387 | if (finger) { | 387 | if (finger) { |
388 | features->device_type = BTN_TOOL_FINGER; | 388 | features->device_type = BTN_TOOL_FINGER; |
389 | if (features->type == TABLETPC2FG) { | 389 | |
390 | /* need to reset back */ | 390 | switch (features->type) { |
391 | case TABLETPC2FG: | ||
391 | features->pktlen = WACOM_PKGLEN_TPC2FG; | 392 | features->pktlen = WACOM_PKGLEN_TPC2FG; |
392 | } | 393 | break; |
393 | 394 | ||
394 | if (features->type == MTSCREEN || features->type == WACOM_24HDT) | 395 | case MTSCREEN: |
396 | case WACOM_24HDT: | ||
395 | features->pktlen = WACOM_PKGLEN_MTOUCH; | 397 | features->pktlen = WACOM_PKGLEN_MTOUCH; |
398 | break; | ||
396 | 399 | ||
397 | if (features->type == BAMBOO_PT) { | 400 | case MTTPC: |
398 | /* need to reset back */ | 401 | features->pktlen = WACOM_PKGLEN_MTTPC; |
402 | break; | ||
403 | |||
404 | case BAMBOO_PT: | ||
399 | features->pktlen = WACOM_PKGLEN_BBTOUCH; | 405 | features->pktlen = WACOM_PKGLEN_BBTOUCH; |
406 | break; | ||
407 | |||
408 | default: | ||
409 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | ||
410 | break; | ||
411 | } | ||
412 | |||
413 | switch (features->type) { | ||
414 | case BAMBOO_PT: | ||
400 | features->x_phy = | 415 | features->x_phy = |
401 | get_unaligned_le16(&report[i + 5]); | 416 | get_unaligned_le16(&report[i + 5]); |
402 | features->x_max = | 417 | features->x_max = |
403 | get_unaligned_le16(&report[i + 8]); | 418 | get_unaligned_le16(&report[i + 8]); |
404 | i += 15; | 419 | i += 15; |
405 | } else if (features->type == WACOM_24HDT) { | 420 | break; |
421 | |||
422 | case WACOM_24HDT: | ||
406 | features->x_max = | 423 | features->x_max = |
407 | get_unaligned_le16(&report[i + 3]); | 424 | get_unaligned_le16(&report[i + 3]); |
408 | features->x_phy = | 425 | features->x_phy = |
@@ -410,7 +427,9 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
410 | features->unit = report[i - 1]; | 427 | features->unit = report[i - 1]; |
411 | features->unitExpo = report[i - 3]; | 428 | features->unitExpo = report[i - 3]; |
412 | i += 12; | 429 | i += 12; |
413 | } else { | 430 | break; |
431 | |||
432 | default: | ||
414 | features->x_max = | 433 | features->x_max = |
415 | get_unaligned_le16(&report[i + 3]); | 434 | get_unaligned_le16(&report[i + 3]); |
416 | features->x_phy = | 435 | features->x_phy = |
@@ -418,10 +437,11 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
418 | features->unit = report[i + 9]; | 437 | features->unit = report[i + 9]; |
419 | features->unitExpo = report[i + 11]; | 438 | features->unitExpo = report[i + 11]; |
420 | i += 12; | 439 | i += 12; |
440 | break; | ||
421 | } | 441 | } |
422 | } else if (pen) { | 442 | } else if (pen) { |
423 | /* penabled only accepts exact bytes of data */ | 443 | /* penabled only accepts exact bytes of data */ |
424 | if (features->type == TABLETPC2FG) | 444 | if (features->type >= TABLETPC) |
425 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; | 445 | features->pktlen = WACOM_PKGLEN_GRAPHIRE; |
426 | features->device_type = BTN_TOOL_PEN; | 446 | features->device_type = BTN_TOOL_PEN; |
427 | features->x_max = | 447 | features->x_max = |
@@ -434,32 +454,40 @@ static int wacom_parse_hid(struct usb_interface *intf, | |||
434 | case HID_USAGE_Y: | 454 | case HID_USAGE_Y: |
435 | if (usage == WCM_DESKTOP) { | 455 | if (usage == WCM_DESKTOP) { |
436 | if (finger) { | 456 | if (finger) { |
437 | int type = features->type; | 457 | switch (features->type) { |
438 | 458 | case TABLETPC2FG: | |
439 | if (type == TABLETPC2FG || type == MTSCREEN) { | 459 | case MTSCREEN: |
460 | case MTTPC: | ||
440 | features->y_max = | 461 | features->y_max = |
441 | get_unaligned_le16(&report[i + 3]); | 462 | get_unaligned_le16(&report[i + 3]); |
442 | features->y_phy = | 463 | features->y_phy = |
443 | get_unaligned_le16(&report[i + 6]); | 464 | get_unaligned_le16(&report[i + 6]); |
444 | i += 7; | 465 | i += 7; |
445 | } else if (type == WACOM_24HDT) { | 466 | break; |
467 | |||
468 | case WACOM_24HDT: | ||
446 | features->y_max = | 469 | features->y_max = |
447 | get_unaligned_le16(&report[i + 3]); | 470 | get_unaligned_le16(&report[i + 3]); |
448 | features->y_phy = | 471 | features->y_phy = |
449 | get_unaligned_le16(&report[i - 2]); | 472 | get_unaligned_le16(&report[i - 2]); |
450 | i += 7; | 473 | i += 7; |
451 | } else if (type == BAMBOO_PT) { | 474 | break; |
475 | |||
476 | case BAMBOO_PT: | ||
452 | features->y_phy = | 477 | features->y_phy = |
453 | get_unaligned_le16(&report[i + 3]); | 478 | get_unaligned_le16(&report[i + 3]); |
454 | features->y_max = | 479 | features->y_max = |
455 | get_unaligned_le16(&report[i + 6]); | 480 | get_unaligned_le16(&report[i + 6]); |
456 | i += 12; | 481 | i += 12; |
457 | } else { | 482 | break; |
483 | |||
484 | default: | ||
458 | features->y_max = | 485 | features->y_max = |
459 | features->x_max; | 486 | features->x_max; |
460 | features->y_phy = | 487 | features->y_phy = |
461 | get_unaligned_le16(&report[i + 3]); | 488 | get_unaligned_le16(&report[i + 3]); |
462 | i += 4; | 489 | i += 4; |
490 | break; | ||
463 | } | 491 | } |
464 | } else if (pen) { | 492 | } else if (pen) { |
465 | features->y_max = | 493 | features->y_max = |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index c2bfe9242cc..264138f3217 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -467,9 +467,7 @@ static void wacom_intuos_general(struct wacom_wac *wacom) | |||
467 | /* general pen packet */ | 467 | /* general pen packet */ |
468 | if ((data[1] & 0xb8) == 0xa0) { | 468 | if ((data[1] & 0xb8) == 0xa0) { |
469 | t = (data[6] << 2) | ((data[7] >> 6) & 3); | 469 | t = (data[6] << 2) | ((data[7] >> 6) & 3); |
470 | if ((features->type >= INTUOS4S && features->type <= INTUOS4L) || | 470 | if (features->type >= INTUOS4S && features->type <= WACOM_24HD) { |
471 | (features->type >= INTUOS5S && features->type <= INTUOS5L) || | ||
472 | (features->type >= WACOM_21UX2 && features->type <= WACOM_24HD)) { | ||
473 | t = (t << 1) | (data[1] & 1); | 471 | t = (t << 1) | (data[1] & 1); |
474 | } | 472 | } |
475 | input_report_abs(input, ABS_PRESSURE, t); | 473 | input_report_abs(input, ABS_PRESSURE, t); |
@@ -877,6 +875,11 @@ static int wacom_mt_touch(struct wacom_wac *wacom) | |||
877 | int i; | 875 | int i; |
878 | int current_num_contacts = data[2]; | 876 | int current_num_contacts = data[2]; |
879 | int contacts_to_send = 0; | 877 | int contacts_to_send = 0; |
878 | int x_offset = 0; | ||
879 | |||
880 | /* MTTPC does not support Height and Width */ | ||
881 | if (wacom->features.type == MTTPC) | ||
882 | x_offset = -4; | ||
880 | 883 | ||
881 | /* | 884 | /* |
882 | * First packet resets the counter since only the first | 885 | * First packet resets the counter since only the first |
@@ -889,7 +892,7 @@ static int wacom_mt_touch(struct wacom_wac *wacom) | |||
889 | contacts_to_send = min(5, wacom->num_contacts_left); | 892 | contacts_to_send = min(5, wacom->num_contacts_left); |
890 | 893 | ||
891 | for (i = 0; i < contacts_to_send; i++) { | 894 | for (i = 0; i < contacts_to_send; i++) { |
892 | int offset = (WACOM_BYTES_PER_MT_PACKET * i) + 3; | 895 | int offset = (WACOM_BYTES_PER_MT_PACKET + x_offset) * i + 3; |
893 | bool touch = data[offset] & 0x1; | 896 | bool touch = data[offset] & 0x1; |
894 | int id = le16_to_cpup((__le16 *)&data[offset + 1]); | 897 | int id = le16_to_cpup((__le16 *)&data[offset + 1]); |
895 | int slot = find_slot_from_contactid(wacom, id); | 898 | int slot = find_slot_from_contactid(wacom, id); |
@@ -900,8 +903,8 @@ static int wacom_mt_touch(struct wacom_wac *wacom) | |||
900 | input_mt_slot(input, slot); | 903 | input_mt_slot(input, slot); |
901 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); | 904 | input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); |
902 | if (touch) { | 905 | if (touch) { |
903 | int x = le16_to_cpup((__le16 *)&data[offset + 7]); | 906 | int x = le16_to_cpup((__le16 *)&data[offset + x_offset + 7]); |
904 | int y = le16_to_cpup((__le16 *)&data[offset + 9]); | 907 | int y = le16_to_cpup((__le16 *)&data[offset + x_offset + 9]); |
905 | input_report_abs(input, ABS_MT_POSITION_X, x); | 908 | input_report_abs(input, ABS_MT_POSITION_X, x); |
906 | input_report_abs(input, ABS_MT_POSITION_Y, y); | 909 | input_report_abs(input, ABS_MT_POSITION_Y, y); |
907 | } | 910 | } |
@@ -1336,6 +1339,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len) | |||
1336 | case TABLETPCE: | 1339 | case TABLETPCE: |
1337 | case TABLETPC2FG: | 1340 | case TABLETPC2FG: |
1338 | case MTSCREEN: | 1341 | case MTSCREEN: |
1342 | case MTTPC: | ||
1339 | sync = wacom_tpc_irq(wacom_wac, len); | 1343 | sync = wacom_tpc_irq(wacom_wac, len); |
1340 | break; | 1344 | break; |
1341 | 1345 | ||
@@ -1657,6 +1661,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, | |||
1657 | /* fall through */ | 1661 | /* fall through */ |
1658 | 1662 | ||
1659 | case MTSCREEN: | 1663 | case MTSCREEN: |
1664 | case MTTPC: | ||
1660 | if (features->device_type == BTN_TOOL_FINGER) { | 1665 | if (features->device_type == BTN_TOOL_FINGER) { |
1661 | wacom_wac->slots = kmalloc(features->touch_max * | 1666 | wacom_wac->slots = kmalloc(features->touch_max * |
1662 | sizeof(int), | 1667 | sizeof(int), |
@@ -2018,6 +2023,15 @@ static const struct wacom_features wacom_features_0xED = | |||
2018 | static const struct wacom_features wacom_features_0xEF = | 2023 | static const struct wacom_features wacom_features_0xEF = |
2019 | { "Wacom ISDv4 EF", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, | 2024 | { "Wacom ISDv4 EF", WACOM_PKGLEN_GRAPHIRE, 26202, 16325, 255, |
2020 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2025 | 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
2026 | static const struct wacom_features wacom_features_0x100 = | ||
2027 | { "Wacom ISDv4 100", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | ||
2028 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
2029 | static const struct wacom_features wacom_features_0x101 = | ||
2030 | { "Wacom ISDv4 101", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | ||
2031 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
2032 | static const struct wacom_features wacom_features_0x4001 = | ||
2033 | { "Wacom ISDv4 4001", WACOM_PKGLEN_MTTPC, 26202, 16325, 255, | ||
2034 | 0, MTTPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | ||
2021 | static const struct wacom_features wacom_features_0x47 = | 2035 | static const struct wacom_features wacom_features_0x47 = |
2022 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, | 2036 | { "Wacom Intuos2 6x8", WACOM_PKGLEN_INTUOS, 20320, 16240, 1023, |
2023 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; | 2037 | 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; |
@@ -2195,6 +2209,9 @@ const struct usb_device_id wacom_ids[] = { | |||
2195 | { USB_DEVICE_WACOM(0xEC) }, | 2209 | { USB_DEVICE_WACOM(0xEC) }, |
2196 | { USB_DEVICE_WACOM(0xED) }, | 2210 | { USB_DEVICE_WACOM(0xED) }, |
2197 | { USB_DEVICE_WACOM(0xEF) }, | 2211 | { USB_DEVICE_WACOM(0xEF) }, |
2212 | { USB_DEVICE_WACOM(0x100) }, | ||
2213 | { USB_DEVICE_WACOM(0x101) }, | ||
2214 | { USB_DEVICE_WACOM(0x4001) }, | ||
2198 | { USB_DEVICE_WACOM(0x47) }, | 2215 | { USB_DEVICE_WACOM(0x47) }, |
2199 | { USB_DEVICE_WACOM(0xF4) }, | 2216 | { USB_DEVICE_WACOM(0xF4) }, |
2200 | { USB_DEVICE_WACOM(0xF8) }, | 2217 | { USB_DEVICE_WACOM(0xF8) }, |
diff --git a/drivers/input/tablet/wacom_wac.h b/drivers/input/tablet/wacom_wac.h index 345f1e76975..9396d7769f8 100644 --- a/drivers/input/tablet/wacom_wac.h +++ b/drivers/input/tablet/wacom_wac.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #define WACOM_PKGLEN_BBPEN 10 | 26 | #define WACOM_PKGLEN_BBPEN 10 |
27 | #define WACOM_PKGLEN_WIRELESS 32 | 27 | #define WACOM_PKGLEN_WIRELESS 32 |
28 | #define WACOM_PKGLEN_MTOUCH 62 | 28 | #define WACOM_PKGLEN_MTOUCH 62 |
29 | #define WACOM_PKGLEN_MTTPC 40 | ||
29 | 30 | ||
30 | /* wacom data size per MT contact */ | 31 | /* wacom data size per MT contact */ |
31 | #define WACOM_BYTES_PER_MT_PACKET 11 | 32 | #define WACOM_BYTES_PER_MT_PACKET 11 |
@@ -88,6 +89,7 @@ enum { | |||
88 | TABLETPCE, | 89 | TABLETPCE, |
89 | TABLETPC2FG, | 90 | TABLETPC2FG, |
90 | MTSCREEN, | 91 | MTSCREEN, |
92 | MTTPC, | ||
91 | MAX_TYPE | 93 | MAX_TYPE |
92 | }; | 94 | }; |
93 | 95 | ||
diff --git a/drivers/input/touchscreen/88pm860x-ts.c b/drivers/input/touchscreen/88pm860x-ts.c index 326218dbd6e..c7068942ebe 100644 --- a/drivers/input/touchscreen/88pm860x-ts.c +++ b/drivers/input/touchscreen/88pm860x-ts.c | |||
@@ -115,7 +115,7 @@ static void pm860x_touch_close(struct input_dev *dev) | |||
115 | } | 115 | } |
116 | 116 | ||
117 | #ifdef CONFIG_OF | 117 | #ifdef CONFIG_OF |
118 | static int __devinit pm860x_touch_dt_init(struct platform_device *pdev, | 118 | static int pm860x_touch_dt_init(struct platform_device *pdev, |
119 | struct pm860x_chip *chip, | 119 | struct pm860x_chip *chip, |
120 | int *res_x) | 120 | int *res_x) |
121 | { | 121 | { |
@@ -169,7 +169,7 @@ static int __devinit pm860x_touch_dt_init(struct platform_device *pdev, | |||
169 | #define pm860x_touch_dt_init(x, y, z) (-1) | 169 | #define pm860x_touch_dt_init(x, y, z) (-1) |
170 | #endif | 170 | #endif |
171 | 171 | ||
172 | static int __devinit pm860x_touch_probe(struct platform_device *pdev) | 172 | static int pm860x_touch_probe(struct platform_device *pdev) |
173 | { | 173 | { |
174 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); | 174 | struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); |
175 | struct pm860x_touch_pdata *pdata = pdev->dev.platform_data; | 175 | struct pm860x_touch_pdata *pdata = pdev->dev.platform_data; |
@@ -293,7 +293,7 @@ out: | |||
293 | return ret; | 293 | return ret; |
294 | } | 294 | } |
295 | 295 | ||
296 | static int __devexit pm860x_touch_remove(struct platform_device *pdev) | 296 | static int pm860x_touch_remove(struct platform_device *pdev) |
297 | { | 297 | { |
298 | struct pm860x_touch *touch = platform_get_drvdata(pdev); | 298 | struct pm860x_touch *touch = platform_get_drvdata(pdev); |
299 | 299 | ||
@@ -310,7 +310,7 @@ static struct platform_driver pm860x_touch_driver = { | |||
310 | .owner = THIS_MODULE, | 310 | .owner = THIS_MODULE, |
311 | }, | 311 | }, |
312 | .probe = pm860x_touch_probe, | 312 | .probe = pm860x_touch_probe, |
313 | .remove = __devexit_p(pm860x_touch_remove), | 313 | .remove = pm860x_touch_remove, |
314 | }; | 314 | }; |
315 | module_platform_driver(pm860x_touch_driver); | 315 | module_platform_driver(pm860x_touch_driver); |
316 | 316 | ||
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index f7668b24c37..b93b5988ace 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -111,18 +111,6 @@ config TOUCHSCREEN_AUO_PIXCIR | |||
111 | To compile this driver as a module, choose M here: the | 111 | To compile this driver as a module, choose M here: the |
112 | module will be called auo-pixcir-ts. | 112 | module will be called auo-pixcir-ts. |
113 | 113 | ||
114 | config TOUCHSCREEN_BITSY | ||
115 | tristate "Compaq iPAQ H3600 (Bitsy) touchscreen" | ||
116 | depends on SA1100_BITSY | ||
117 | select SERIO | ||
118 | help | ||
119 | Say Y here if you have the h3600 (Bitsy) touchscreen. | ||
120 | |||
121 | If unsure, say N. | ||
122 | |||
123 | To compile this driver as a module, choose M here: the | ||
124 | module will be called h3600_ts_input. | ||
125 | |||
126 | config TOUCHSCREEN_BU21013 | 114 | config TOUCHSCREEN_BU21013 |
127 | tristate "BU21013 based touch panel controllers" | 115 | tristate "BU21013 based touch panel controllers" |
128 | depends on I2C | 116 | depends on I2C |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index 178eb128d90..5f949c0bf82 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
@@ -15,7 +15,6 @@ obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o | |||
15 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o | 15 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o |
16 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o | 16 | obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o |
17 | obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR) += auo-pixcir-ts.o | 17 | obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR) += auo-pixcir-ts.o |
18 | obj-$(CONFIG_TOUCHSCREEN_BITSY) += h3600_ts_input.o | ||
19 | obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o | 18 | obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o |
20 | obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o | 19 | obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o |
21 | obj-$(CONFIG_TOUCHSCREEN_CYTTSP_CORE) += cyttsp_core.o | 20 | obj-$(CONFIG_TOUCHSCREEN_CYTTSP_CORE) += cyttsp_core.o |
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c index 2c7692108e6..23fa829b869 100644 --- a/drivers/input/touchscreen/ad7877.c +++ b/drivers/input/touchscreen/ad7877.c | |||
@@ -682,7 +682,7 @@ static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts) | |||
682 | } | 682 | } |
683 | } | 683 | } |
684 | 684 | ||
685 | static int __devinit ad7877_probe(struct spi_device *spi) | 685 | static int ad7877_probe(struct spi_device *spi) |
686 | { | 686 | { |
687 | struct ad7877 *ts; | 687 | struct ad7877 *ts; |
688 | struct input_dev *input_dev; | 688 | struct input_dev *input_dev; |
@@ -810,7 +810,7 @@ err_free_mem: | |||
810 | return err; | 810 | return err; |
811 | } | 811 | } |
812 | 812 | ||
813 | static int __devexit ad7877_remove(struct spi_device *spi) | 813 | static int ad7877_remove(struct spi_device *spi) |
814 | { | 814 | { |
815 | struct ad7877 *ts = dev_get_drvdata(&spi->dev); | 815 | struct ad7877 *ts = dev_get_drvdata(&spi->dev); |
816 | 816 | ||
@@ -857,7 +857,7 @@ static struct spi_driver ad7877_driver = { | |||
857 | .pm = &ad7877_pm, | 857 | .pm = &ad7877_pm, |
858 | }, | 858 | }, |
859 | .probe = ad7877_probe, | 859 | .probe = ad7877_probe, |
860 | .remove = __devexit_p(ad7877_remove), | 860 | .remove = ad7877_remove, |
861 | }; | 861 | }; |
862 | 862 | ||
863 | module_spi_driver(ad7877_driver); | 863 | module_spi_driver(ad7877_driver); |
diff --git a/drivers/input/touchscreen/ad7879-i2c.c b/drivers/input/touchscreen/ad7879-i2c.c index 3054354d0dd..dcf39077154 100644 --- a/drivers/input/touchscreen/ad7879-i2c.c +++ b/drivers/input/touchscreen/ad7879-i2c.c | |||
@@ -54,7 +54,7 @@ static const struct ad7879_bus_ops ad7879_i2c_bus_ops = { | |||
54 | .write = ad7879_i2c_write, | 54 | .write = ad7879_i2c_write, |
55 | }; | 55 | }; |
56 | 56 | ||
57 | static int __devinit ad7879_i2c_probe(struct i2c_client *client, | 57 | static int ad7879_i2c_probe(struct i2c_client *client, |
58 | const struct i2c_device_id *id) | 58 | const struct i2c_device_id *id) |
59 | { | 59 | { |
60 | struct ad7879 *ts; | 60 | struct ad7879 *ts; |
@@ -75,7 +75,7 @@ static int __devinit ad7879_i2c_probe(struct i2c_client *client, | |||
75 | return 0; | 75 | return 0; |
76 | } | 76 | } |
77 | 77 | ||
78 | static int __devexit ad7879_i2c_remove(struct i2c_client *client) | 78 | static int ad7879_i2c_remove(struct i2c_client *client) |
79 | { | 79 | { |
80 | struct ad7879 *ts = i2c_get_clientdata(client); | 80 | struct ad7879 *ts = i2c_get_clientdata(client); |
81 | 81 | ||
@@ -98,7 +98,7 @@ static struct i2c_driver ad7879_i2c_driver = { | |||
98 | .pm = &ad7879_pm_ops, | 98 | .pm = &ad7879_pm_ops, |
99 | }, | 99 | }, |
100 | .probe = ad7879_i2c_probe, | 100 | .probe = ad7879_i2c_probe, |
101 | .remove = __devexit_p(ad7879_i2c_remove), | 101 | .remove = ad7879_i2c_remove, |
102 | .id_table = ad7879_id, | 102 | .id_table = ad7879_id, |
103 | }; | 103 | }; |
104 | 104 | ||
diff --git a/drivers/input/touchscreen/ad7879-spi.c b/drivers/input/touchscreen/ad7879-spi.c index db49abf056b..606da5bd611 100644 --- a/drivers/input/touchscreen/ad7879-spi.c +++ b/drivers/input/touchscreen/ad7879-spi.c | |||
@@ -110,7 +110,7 @@ static const struct ad7879_bus_ops ad7879_spi_bus_ops = { | |||
110 | .write = ad7879_spi_write, | 110 | .write = ad7879_spi_write, |
111 | }; | 111 | }; |
112 | 112 | ||
113 | static int __devinit ad7879_spi_probe(struct spi_device *spi) | 113 | static int ad7879_spi_probe(struct spi_device *spi) |
114 | { | 114 | { |
115 | struct ad7879 *ts; | 115 | struct ad7879 *ts; |
116 | int err; | 116 | int err; |
@@ -137,7 +137,7 @@ static int __devinit ad7879_spi_probe(struct spi_device *spi) | |||
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
139 | 139 | ||
140 | static int __devexit ad7879_spi_remove(struct spi_device *spi) | 140 | static int ad7879_spi_remove(struct spi_device *spi) |
141 | { | 141 | { |
142 | struct ad7879 *ts = spi_get_drvdata(spi); | 142 | struct ad7879 *ts = spi_get_drvdata(spi); |
143 | 143 | ||
@@ -154,7 +154,7 @@ static struct spi_driver ad7879_spi_driver = { | |||
154 | .pm = &ad7879_pm_ops, | 154 | .pm = &ad7879_pm_ops, |
155 | }, | 155 | }, |
156 | .probe = ad7879_spi_probe, | 156 | .probe = ad7879_spi_probe, |
157 | .remove = __devexit_p(ad7879_spi_remove), | 157 | .remove = ad7879_spi_remove, |
158 | }; | 158 | }; |
159 | 159 | ||
160 | module_spi_driver(ad7879_spi_driver); | 160 | module_spi_driver(ad7879_spi_driver); |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 78e5d9ab0ba..4f702b3ec1a 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -955,7 +955,7 @@ static int ads7846_resume(struct device *dev) | |||
955 | 955 | ||
956 | static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume); | 956 | static SIMPLE_DEV_PM_OPS(ads7846_pm, ads7846_suspend, ads7846_resume); |
957 | 957 | ||
958 | static int __devinit ads7846_setup_pendown(struct spi_device *spi, | 958 | static int ads7846_setup_pendown(struct spi_device *spi, |
959 | struct ads7846 *ts) | 959 | struct ads7846 *ts) |
960 | { | 960 | { |
961 | struct ads7846_platform_data *pdata = spi->dev.platform_data; | 961 | struct ads7846_platform_data *pdata = spi->dev.platform_data; |
@@ -997,7 +997,7 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, | |||
997 | * Set up the transfers to read touchscreen state; this assumes we | 997 | * Set up the transfers to read touchscreen state; this assumes we |
998 | * use formula #2 for pressure, not #3. | 998 | * use formula #2 for pressure, not #3. |
999 | */ | 999 | */ |
1000 | static void __devinit ads7846_setup_spi_msg(struct ads7846 *ts, | 1000 | static void ads7846_setup_spi_msg(struct ads7846 *ts, |
1001 | const struct ads7846_platform_data *pdata) | 1001 | const struct ads7846_platform_data *pdata) |
1002 | { | 1002 | { |
1003 | struct spi_message *m = &ts->msg[0]; | 1003 | struct spi_message *m = &ts->msg[0]; |
@@ -1196,7 +1196,7 @@ static void __devinit ads7846_setup_spi_msg(struct ads7846 *ts, | |||
1196 | spi_message_add_tail(x, m); | 1196 | spi_message_add_tail(x, m); |
1197 | } | 1197 | } |
1198 | 1198 | ||
1199 | static int __devinit ads7846_probe(struct spi_device *spi) | 1199 | static int ads7846_probe(struct spi_device *spi) |
1200 | { | 1200 | { |
1201 | struct ads7846 *ts; | 1201 | struct ads7846 *ts; |
1202 | struct ads7846_packet *packet; | 1202 | struct ads7846_packet *packet; |
@@ -1390,7 +1390,7 @@ static int __devinit ads7846_probe(struct spi_device *spi) | |||
1390 | return err; | 1390 | return err; |
1391 | } | 1391 | } |
1392 | 1392 | ||
1393 | static int __devexit ads7846_remove(struct spi_device *spi) | 1393 | static int ads7846_remove(struct spi_device *spi) |
1394 | { | 1394 | { |
1395 | struct ads7846 *ts = dev_get_drvdata(&spi->dev); | 1395 | struct ads7846 *ts = dev_get_drvdata(&spi->dev); |
1396 | 1396 | ||
@@ -1434,7 +1434,7 @@ static struct spi_driver ads7846_driver = { | |||
1434 | .pm = &ads7846_pm, | 1434 | .pm = &ads7846_pm, |
1435 | }, | 1435 | }, |
1436 | .probe = ads7846_probe, | 1436 | .probe = ads7846_probe, |
1437 | .remove = __devexit_p(ads7846_remove), | 1437 | .remove = ads7846_remove, |
1438 | }; | 1438 | }; |
1439 | 1439 | ||
1440 | module_spi_driver(ads7846_driver); | 1440 | module_spi_driver(ads7846_driver); |
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 1df2396af00..d04f810cb1d 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c | |||
@@ -1095,7 +1095,7 @@ static void mxt_input_close(struct input_dev *dev) | |||
1095 | mxt_stop(data); | 1095 | mxt_stop(data); |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | static int __devinit mxt_probe(struct i2c_client *client, | 1098 | static int mxt_probe(struct i2c_client *client, |
1099 | const struct i2c_device_id *id) | 1099 | const struct i2c_device_id *id) |
1100 | { | 1100 | { |
1101 | const struct mxt_platform_data *pdata = client->dev.platform_data; | 1101 | const struct mxt_platform_data *pdata = client->dev.platform_data; |
@@ -1200,7 +1200,7 @@ err_free_mem: | |||
1200 | return error; | 1200 | return error; |
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | static int __devexit mxt_remove(struct i2c_client *client) | 1203 | static int mxt_remove(struct i2c_client *client) |
1204 | { | 1204 | { |
1205 | struct mxt_data *data = i2c_get_clientdata(client); | 1205 | struct mxt_data *data = i2c_get_clientdata(client); |
1206 | 1206 | ||
@@ -1270,7 +1270,7 @@ static struct i2c_driver mxt_driver = { | |||
1270 | .pm = &mxt_pm_ops, | 1270 | .pm = &mxt_pm_ops, |
1271 | }, | 1271 | }, |
1272 | .probe = mxt_probe, | 1272 | .probe = mxt_probe, |
1273 | .remove = __devexit_p(mxt_remove), | 1273 | .remove = mxt_remove, |
1274 | .id_table = mxt_id, | 1274 | .id_table = mxt_id, |
1275 | }; | 1275 | }; |
1276 | 1276 | ||
diff --git a/drivers/input/touchscreen/atmel_tsadcc.c b/drivers/input/touchscreen/atmel_tsadcc.c index 201b2d2ec1b..55092d1c5cb 100644 --- a/drivers/input/touchscreen/atmel_tsadcc.c +++ b/drivers/input/touchscreen/atmel_tsadcc.c | |||
@@ -177,7 +177,7 @@ static irqreturn_t atmel_tsadcc_interrupt(int irq, void *dev) | |||
177 | * The functions for inserting/removing us as a module. | 177 | * The functions for inserting/removing us as a module. |
178 | */ | 178 | */ |
179 | 179 | ||
180 | static int __devinit atmel_tsadcc_probe(struct platform_device *pdev) | 180 | static int atmel_tsadcc_probe(struct platform_device *pdev) |
181 | { | 181 | { |
182 | struct atmel_tsadcc *ts_dev; | 182 | struct atmel_tsadcc *ts_dev; |
183 | struct input_dev *input_dev; | 183 | struct input_dev *input_dev; |
@@ -323,7 +323,7 @@ err_free_mem: | |||
323 | return err; | 323 | return err; |
324 | } | 324 | } |
325 | 325 | ||
326 | static int __devexit atmel_tsadcc_remove(struct platform_device *pdev) | 326 | static int atmel_tsadcc_remove(struct platform_device *pdev) |
327 | { | 327 | { |
328 | struct atmel_tsadcc *ts_dev = dev_get_drvdata(&pdev->dev); | 328 | struct atmel_tsadcc *ts_dev = dev_get_drvdata(&pdev->dev); |
329 | struct resource *res; | 329 | struct resource *res; |
@@ -346,7 +346,7 @@ static int __devexit atmel_tsadcc_remove(struct platform_device *pdev) | |||
346 | 346 | ||
347 | static struct platform_driver atmel_tsadcc_driver = { | 347 | static struct platform_driver atmel_tsadcc_driver = { |
348 | .probe = atmel_tsadcc_probe, | 348 | .probe = atmel_tsadcc_probe, |
349 | .remove = __devexit_p(atmel_tsadcc_remove), | 349 | .remove = atmel_tsadcc_remove, |
350 | .driver = { | 350 | .driver = { |
351 | .name = "atmel_tsadcc", | 351 | .name = "atmel_tsadcc", |
352 | }, | 352 | }, |
diff --git a/drivers/input/touchscreen/auo-pixcir-ts.c b/drivers/input/touchscreen/auo-pixcir-ts.c index c7047b6bb02..c6e19a96348 100644 --- a/drivers/input/touchscreen/auo-pixcir-ts.c +++ b/drivers/input/touchscreen/auo-pixcir-ts.c | |||
@@ -286,7 +286,7 @@ static int auo_pixcir_power_mode(struct auo_pixcir_ts *ts, int mode) | |||
286 | return 0; | 286 | return 0; |
287 | } | 287 | } |
288 | 288 | ||
289 | static __devinit int auo_pixcir_int_config(struct auo_pixcir_ts *ts, | 289 | static int auo_pixcir_int_config(struct auo_pixcir_ts *ts, |
290 | int int_setting) | 290 | int int_setting) |
291 | { | 291 | { |
292 | struct i2c_client *client = ts->client; | 292 | struct i2c_client *client = ts->client; |
@@ -482,7 +482,7 @@ unlock: | |||
482 | static SIMPLE_DEV_PM_OPS(auo_pixcir_pm_ops, auo_pixcir_suspend, | 482 | static SIMPLE_DEV_PM_OPS(auo_pixcir_pm_ops, auo_pixcir_suspend, |
483 | auo_pixcir_resume); | 483 | auo_pixcir_resume); |
484 | 484 | ||
485 | static int __devinit auo_pixcir_probe(struct i2c_client *client, | 485 | static int auo_pixcir_probe(struct i2c_client *client, |
486 | const struct i2c_device_id *id) | 486 | const struct i2c_device_id *id) |
487 | { | 487 | { |
488 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | 488 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; |
@@ -599,7 +599,7 @@ err_gpio_int: | |||
599 | return ret; | 599 | return ret; |
600 | } | 600 | } |
601 | 601 | ||
602 | static int __devexit auo_pixcir_remove(struct i2c_client *client) | 602 | static int auo_pixcir_remove(struct i2c_client *client) |
603 | { | 603 | { |
604 | struct auo_pixcir_ts *ts = i2c_get_clientdata(client); | 604 | struct auo_pixcir_ts *ts = i2c_get_clientdata(client); |
605 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; | 605 | const struct auo_pixcir_ts_platdata *pdata = client->dev.platform_data; |
@@ -631,7 +631,7 @@ static struct i2c_driver auo_pixcir_driver = { | |||
631 | .pm = &auo_pixcir_pm_ops, | 631 | .pm = &auo_pixcir_pm_ops, |
632 | }, | 632 | }, |
633 | .probe = auo_pixcir_probe, | 633 | .probe = auo_pixcir_probe, |
634 | .remove = __devexit_p(auo_pixcir_remove), | 634 | .remove = auo_pixcir_remove, |
635 | .id_table = auo_pixcir_idtable, | 635 | .id_table = auo_pixcir_idtable, |
636 | }; | 636 | }; |
637 | 637 | ||
diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c index 5c487d23f11..b9b5ddad665 100644 --- a/drivers/input/touchscreen/bu21013_ts.c +++ b/drivers/input/touchscreen/bu21013_ts.c | |||
@@ -14,6 +14,9 @@ | |||
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/regulator/consumer.h> | 15 | #include <linux/regulator/consumer.h> |
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/gpio.h> | ||
18 | #include <linux/of.h> | ||
19 | #include <linux/of_gpio.h> | ||
17 | 20 | ||
18 | #define PEN_DOWN_INTR 0 | 21 | #define PEN_DOWN_INTR 0 |
19 | #define MAX_FINGERS 2 | 22 | #define MAX_FINGERS 2 |
@@ -148,11 +151,12 @@ | |||
148 | struct bu21013_ts_data { | 151 | struct bu21013_ts_data { |
149 | struct i2c_client *client; | 152 | struct i2c_client *client; |
150 | wait_queue_head_t wait; | 153 | wait_queue_head_t wait; |
151 | bool touch_stopped; | ||
152 | const struct bu21013_platform_device *chip; | 154 | const struct bu21013_platform_device *chip; |
153 | struct input_dev *in_dev; | 155 | struct input_dev *in_dev; |
154 | unsigned int intr_pin; | ||
155 | struct regulator *regulator; | 156 | struct regulator *regulator; |
157 | unsigned int irq; | ||
158 | unsigned int intr_pin; | ||
159 | bool touch_stopped; | ||
156 | }; | 160 | }; |
157 | 161 | ||
158 | /** | 162 | /** |
@@ -262,7 +266,7 @@ static irqreturn_t bu21013_gpio_irq(int irq, void *device_data) | |||
262 | return IRQ_NONE; | 266 | return IRQ_NONE; |
263 | } | 267 | } |
264 | 268 | ||
265 | data->intr_pin = data->chip->irq_read_val(); | 269 | data->intr_pin = gpio_get_value(data->chip->touch_pin); |
266 | if (data->intr_pin == PEN_DOWN_INTR) | 270 | if (data->intr_pin == PEN_DOWN_INTR) |
267 | wait_event_timeout(data->wait, data->touch_stopped, | 271 | wait_event_timeout(data->wait, data->touch_stopped, |
268 | msecs_to_jiffies(2)); | 272 | msecs_to_jiffies(2)); |
@@ -418,8 +422,70 @@ static void bu21013_free_irq(struct bu21013_ts_data *bu21013_data) | |||
418 | { | 422 | { |
419 | bu21013_data->touch_stopped = true; | 423 | bu21013_data->touch_stopped = true; |
420 | wake_up(&bu21013_data->wait); | 424 | wake_up(&bu21013_data->wait); |
421 | free_irq(bu21013_data->chip->irq, bu21013_data); | 425 | free_irq(bu21013_data->irq, bu21013_data); |
426 | } | ||
427 | |||
428 | /** | ||
429 | * bu21013_cs_disable() - deconfigures the touch panel controller | ||
430 | * @bu21013_data: device structure pointer | ||
431 | * | ||
432 | * This function is used to deconfigure the chip selection | ||
433 | * for touch panel controller. | ||
434 | */ | ||
435 | static void bu21013_cs_disable(struct bu21013_ts_data *bu21013_data) | ||
436 | { | ||
437 | int error; | ||
438 | |||
439 | error = gpio_direction_output(bu21013_data->chip->cs_pin, 0); | ||
440 | if (error < 0) | ||
441 | dev_warn(&bu21013_data->client->dev, | ||
442 | "%s: gpio direction failed, error: %d\n", | ||
443 | __func__, error); | ||
444 | else | ||
445 | gpio_set_value(bu21013_data->chip->cs_pin, 0); | ||
446 | |||
447 | gpio_free(bu21013_data->chip->cs_pin); | ||
448 | } | ||
449 | |||
450 | #ifdef CONFIG_OF | ||
451 | static const struct bu21013_platform_device * | ||
452 | bu21013_parse_dt(struct device *dev) | ||
453 | { | ||
454 | struct device_node *np = dev->of_node; | ||
455 | struct bu21013_platform_device *pdata; | ||
456 | |||
457 | if (!np) { | ||
458 | dev_err(dev, "no device tree or platform data\n"); | ||
459 | return ERR_PTR(-EINVAL); | ||
460 | } | ||
461 | |||
462 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | ||
463 | if (!pdata) | ||
464 | return ERR_PTR(-ENOMEM); | ||
465 | |||
466 | pdata->y_flip = pdata->x_flip = false; | ||
467 | |||
468 | pdata->x_flip = of_property_read_bool(np, "rohm,flip-x"); | ||
469 | pdata->y_flip = of_property_read_bool(np, "rohm,flip-y"); | ||
470 | |||
471 | of_property_read_u32(np, "rohm,touch-max-x", &pdata->touch_x_max); | ||
472 | of_property_read_u32(np, "rohm,touch-max-y", &pdata->touch_y_max); | ||
473 | |||
474 | pdata->touch_pin = of_get_named_gpio(np, "touch-gpio", 0); | ||
475 | pdata->cs_pin = of_get_named_gpio(np, "reset-gpio", 0); | ||
476 | |||
477 | pdata->ext_clk = false; | ||
478 | |||
479 | return pdata; | ||
422 | } | 480 | } |
481 | #else | ||
482 | static inline const struct bu21013_platform_device * | ||
483 | bu21013_parse_dt(struct device *dev) | ||
484 | { | ||
485 | dev_err(dev, "no platform data available\n"); | ||
486 | return ERR_PTR(-EINVAL); | ||
487 | } | ||
488 | #endif | ||
423 | 489 | ||
424 | /** | 490 | /** |
425 | * bu21013_probe() - initializes the i2c-client touchscreen driver | 491 | * bu21013_probe() - initializes the i2c-client touchscreen driver |
@@ -429,13 +495,13 @@ static void bu21013_free_irq(struct bu21013_ts_data *bu21013_data) | |||
429 | * This function used to initializes the i2c-client touchscreen | 495 | * This function used to initializes the i2c-client touchscreen |
430 | * driver and returns integer. | 496 | * driver and returns integer. |
431 | */ | 497 | */ |
432 | static int __devinit bu21013_probe(struct i2c_client *client, | 498 | static int bu21013_probe(struct i2c_client *client, |
433 | const struct i2c_device_id *id) | 499 | const struct i2c_device_id *id) |
434 | { | 500 | { |
501 | const struct bu21013_platform_device *pdata = | ||
502 | dev_get_platdata(&client->dev); | ||
435 | struct bu21013_ts_data *bu21013_data; | 503 | struct bu21013_ts_data *bu21013_data; |
436 | struct input_dev *in_dev; | 504 | struct input_dev *in_dev; |
437 | const struct bu21013_platform_device *pdata = | ||
438 | client->dev.platform_data; | ||
439 | int error; | 505 | int error; |
440 | 506 | ||
441 | if (!i2c_check_functionality(client->adapter, | 507 | if (!i2c_check_functionality(client->adapter, |
@@ -445,7 +511,13 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
445 | } | 511 | } |
446 | 512 | ||
447 | if (!pdata) { | 513 | if (!pdata) { |
448 | dev_err(&client->dev, "platform data not defined\n"); | 514 | pdata = bu21013_parse_dt(&client->dev); |
515 | if (IS_ERR(pdata)) | ||
516 | return PTR_ERR(pdata); | ||
517 | } | ||
518 | |||
519 | if (!gpio_is_valid(pdata->touch_pin)) { | ||
520 | dev_err(&client->dev, "invalid touch_pin supplied\n"); | ||
449 | return -EINVAL; | 521 | return -EINVAL; |
450 | } | 522 | } |
451 | 523 | ||
@@ -460,8 +532,9 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
460 | bu21013_data->in_dev = in_dev; | 532 | bu21013_data->in_dev = in_dev; |
461 | bu21013_data->chip = pdata; | 533 | bu21013_data->chip = pdata; |
462 | bu21013_data->client = client; | 534 | bu21013_data->client = client; |
535 | bu21013_data->irq = gpio_to_irq(pdata->touch_pin); | ||
463 | 536 | ||
464 | bu21013_data->regulator = regulator_get(&client->dev, "V-TOUCH"); | 537 | bu21013_data->regulator = regulator_get(&client->dev, "avdd"); |
465 | if (IS_ERR(bu21013_data->regulator)) { | 538 | if (IS_ERR(bu21013_data->regulator)) { |
466 | dev_err(&client->dev, "regulator_get failed\n"); | 539 | dev_err(&client->dev, "regulator_get failed\n"); |
467 | error = PTR_ERR(bu21013_data->regulator); | 540 | error = PTR_ERR(bu21013_data->regulator); |
@@ -478,12 +551,11 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
478 | init_waitqueue_head(&bu21013_data->wait); | 551 | init_waitqueue_head(&bu21013_data->wait); |
479 | 552 | ||
480 | /* configure the gpio pins */ | 553 | /* configure the gpio pins */ |
481 | if (pdata->cs_en) { | 554 | error = gpio_request_one(pdata->cs_pin, GPIOF_OUT_INIT_HIGH, |
482 | error = pdata->cs_en(pdata->cs_pin); | 555 | "touchp_reset"); |
483 | if (error < 0) { | 556 | if (error < 0) { |
484 | dev_err(&client->dev, "chip init failed\n"); | 557 | dev_err(&client->dev, "Unable to request gpio reset_pin\n"); |
485 | goto err_disable_regulator; | 558 | goto err_disable_regulator; |
486 | } | ||
487 | } | 559 | } |
488 | 560 | ||
489 | /* configure the touch panel controller */ | 561 | /* configure the touch panel controller */ |
@@ -508,12 +580,13 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
508 | pdata->touch_y_max, 0, 0); | 580 | pdata->touch_y_max, 0, 0); |
509 | input_set_drvdata(in_dev, bu21013_data); | 581 | input_set_drvdata(in_dev, bu21013_data); |
510 | 582 | ||
511 | error = request_threaded_irq(pdata->irq, NULL, bu21013_gpio_irq, | 583 | error = request_threaded_irq(bu21013_data->irq, NULL, bu21013_gpio_irq, |
512 | IRQF_TRIGGER_FALLING | IRQF_SHARED | | 584 | IRQF_TRIGGER_FALLING | IRQF_SHARED | |
513 | IRQF_ONESHOT, | 585 | IRQF_ONESHOT, |
514 | DRIVER_TP, bu21013_data); | 586 | DRIVER_TP, bu21013_data); |
515 | if (error) { | 587 | if (error) { |
516 | dev_err(&client->dev, "request irq %d failed\n", pdata->irq); | 588 | dev_err(&client->dev, "request irq %d failed\n", |
589 | bu21013_data->irq); | ||
517 | goto err_cs_disable; | 590 | goto err_cs_disable; |
518 | } | 591 | } |
519 | 592 | ||
@@ -531,7 +604,7 @@ static int __devinit bu21013_probe(struct i2c_client *client, | |||
531 | err_free_irq: | 604 | err_free_irq: |
532 | bu21013_free_irq(bu21013_data); | 605 | bu21013_free_irq(bu21013_data); |
533 | err_cs_disable: | 606 | err_cs_disable: |
534 | pdata->cs_dis(pdata->cs_pin); | 607 | bu21013_cs_disable(bu21013_data); |
535 | err_disable_regulator: | 608 | err_disable_regulator: |
536 | regulator_disable(bu21013_data->regulator); | 609 | regulator_disable(bu21013_data->regulator); |
537 | err_put_regulator: | 610 | err_put_regulator: |
@@ -549,13 +622,13 @@ err_free_mem: | |||
549 | * This function uses to remove the i2c-client | 622 | * This function uses to remove the i2c-client |
550 | * touchscreen driver and returns integer. | 623 | * touchscreen driver and returns integer. |
551 | */ | 624 | */ |
552 | static int __devexit bu21013_remove(struct i2c_client *client) | 625 | static int bu21013_remove(struct i2c_client *client) |
553 | { | 626 | { |
554 | struct bu21013_ts_data *bu21013_data = i2c_get_clientdata(client); | 627 | struct bu21013_ts_data *bu21013_data = i2c_get_clientdata(client); |
555 | 628 | ||
556 | bu21013_free_irq(bu21013_data); | 629 | bu21013_free_irq(bu21013_data); |
557 | 630 | ||
558 | bu21013_data->chip->cs_dis(bu21013_data->chip->cs_pin); | 631 | bu21013_cs_disable(bu21013_data); |
559 | 632 | ||
560 | input_unregister_device(bu21013_data->in_dev); | 633 | input_unregister_device(bu21013_data->in_dev); |
561 | 634 | ||
@@ -584,9 +657,9 @@ static int bu21013_suspend(struct device *dev) | |||
584 | 657 | ||
585 | bu21013_data->touch_stopped = true; | 658 | bu21013_data->touch_stopped = true; |
586 | if (device_may_wakeup(&client->dev)) | 659 | if (device_may_wakeup(&client->dev)) |
587 | enable_irq_wake(bu21013_data->chip->irq); | 660 | enable_irq_wake(bu21013_data->irq); |
588 | else | 661 | else |
589 | disable_irq(bu21013_data->chip->irq); | 662 | disable_irq(bu21013_data->irq); |
590 | 663 | ||
591 | regulator_disable(bu21013_data->regulator); | 664 | regulator_disable(bu21013_data->regulator); |
592 | 665 | ||
@@ -621,9 +694,9 @@ static int bu21013_resume(struct device *dev) | |||
621 | bu21013_data->touch_stopped = false; | 694 | bu21013_data->touch_stopped = false; |
622 | 695 | ||
623 | if (device_may_wakeup(&client->dev)) | 696 | if (device_may_wakeup(&client->dev)) |
624 | disable_irq_wake(bu21013_data->chip->irq); | 697 | disable_irq_wake(bu21013_data->irq); |
625 | else | 698 | else |
626 | enable_irq(bu21013_data->chip->irq); | 699 | enable_irq(bu21013_data->irq); |
627 | 700 | ||
628 | return 0; | 701 | return 0; |
629 | } | 702 | } |
@@ -649,7 +722,7 @@ static struct i2c_driver bu21013_driver = { | |||
649 | #endif | 722 | #endif |
650 | }, | 723 | }, |
651 | .probe = bu21013_probe, | 724 | .probe = bu21013_probe, |
652 | .remove = __devexit_p(bu21013_remove), | 725 | .remove = bu21013_remove, |
653 | .id_table = bu21013_id, | 726 | .id_table = bu21013_id, |
654 | }; | 727 | }; |
655 | 728 | ||
diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c index 464f1bf4b61..96e0eedcc7e 100644 --- a/drivers/input/touchscreen/cy8ctmg110_ts.c +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c | |||
@@ -99,9 +99,18 @@ static int cy8ctmg110_read_regs(struct cy8ctmg110 *tsc, | |||
99 | int ret; | 99 | int ret; |
100 | struct i2c_msg msg[2] = { | 100 | struct i2c_msg msg[2] = { |
101 | /* first write slave position to i2c devices */ | 101 | /* first write slave position to i2c devices */ |
102 | { client->addr, 0, 1, &cmd }, | 102 | { |
103 | .addr = client->addr, | ||
104 | .len = 1, | ||
105 | .buf = &cmd | ||
106 | }, | ||
103 | /* Second read data from position */ | 107 | /* Second read data from position */ |
104 | { client->addr, I2C_M_RD, len, data } | 108 | { |
109 | .addr = client->addr, | ||
110 | .flags = I2C_M_RD, | ||
111 | .len = len, | ||
112 | .buf = data | ||
113 | } | ||
105 | }; | 114 | }; |
106 | 115 | ||
107 | ret = i2c_transfer(client->adapter, msg, 2); | 116 | ret = i2c_transfer(client->adapter, msg, 2); |
@@ -166,7 +175,7 @@ static irqreturn_t cy8ctmg110_irq_thread(int irq, void *dev_id) | |||
166 | return IRQ_HANDLED; | 175 | return IRQ_HANDLED; |
167 | } | 176 | } |
168 | 177 | ||
169 | static int __devinit cy8ctmg110_probe(struct i2c_client *client, | 178 | static int cy8ctmg110_probe(struct i2c_client *client, |
170 | const struct i2c_device_id *id) | 179 | const struct i2c_device_id *id) |
171 | { | 180 | { |
172 | const struct cy8ctmg110_pdata *pdata = client->dev.platform_data; | 181 | const struct cy8ctmg110_pdata *pdata = client->dev.platform_data; |
@@ -314,7 +323,7 @@ static int cy8ctmg110_resume(struct device *dev) | |||
314 | static SIMPLE_DEV_PM_OPS(cy8ctmg110_pm, cy8ctmg110_suspend, cy8ctmg110_resume); | 323 | static SIMPLE_DEV_PM_OPS(cy8ctmg110_pm, cy8ctmg110_suspend, cy8ctmg110_resume); |
315 | #endif | 324 | #endif |
316 | 325 | ||
317 | static int __devexit cy8ctmg110_remove(struct i2c_client *client) | 326 | static int cy8ctmg110_remove(struct i2c_client *client) |
318 | { | 327 | { |
319 | struct cy8ctmg110 *ts = i2c_get_clientdata(client); | 328 | struct cy8ctmg110 *ts = i2c_get_clientdata(client); |
320 | 329 | ||
@@ -348,7 +357,7 @@ static struct i2c_driver cy8ctmg110_driver = { | |||
348 | }, | 357 | }, |
349 | .id_table = cy8ctmg110_idtable, | 358 | .id_table = cy8ctmg110_idtable, |
350 | .probe = cy8ctmg110_probe, | 359 | .probe = cy8ctmg110_probe, |
351 | .remove = __devexit_p(cy8ctmg110_remove), | 360 | .remove = cy8ctmg110_remove, |
352 | }; | 361 | }; |
353 | 362 | ||
354 | module_i2c_driver(cy8ctmg110_driver); | 363 | module_i2c_driver(cy8ctmg110_driver); |
diff --git a/drivers/input/touchscreen/cyttsp_i2c.c b/drivers/input/touchscreen/cyttsp_i2c.c index 2af1d0c52bc..4dbdf44b8fc 100644 --- a/drivers/input/touchscreen/cyttsp_i2c.c +++ b/drivers/input/touchscreen/cyttsp_i2c.c | |||
@@ -81,7 +81,7 @@ static const struct cyttsp_bus_ops cyttsp_i2c_bus_ops = { | |||
81 | .read = cyttsp_i2c_read_block_data, | 81 | .read = cyttsp_i2c_read_block_data, |
82 | }; | 82 | }; |
83 | 83 | ||
84 | static int __devinit cyttsp_i2c_probe(struct i2c_client *client, | 84 | static int cyttsp_i2c_probe(struct i2c_client *client, |
85 | const struct i2c_device_id *id) | 85 | const struct i2c_device_id *id) |
86 | { | 86 | { |
87 | struct cyttsp *ts; | 87 | struct cyttsp *ts; |
@@ -102,7 +102,7 @@ static int __devinit cyttsp_i2c_probe(struct i2c_client *client, | |||
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
104 | 104 | ||
105 | static int __devexit cyttsp_i2c_remove(struct i2c_client *client) | 105 | static int cyttsp_i2c_remove(struct i2c_client *client) |
106 | { | 106 | { |
107 | struct cyttsp *ts = i2c_get_clientdata(client); | 107 | struct cyttsp *ts = i2c_get_clientdata(client); |
108 | 108 | ||
@@ -124,7 +124,7 @@ static struct i2c_driver cyttsp_i2c_driver = { | |||
124 | .pm = &cyttsp_pm_ops, | 124 | .pm = &cyttsp_pm_ops, |
125 | }, | 125 | }, |
126 | .probe = cyttsp_i2c_probe, | 126 | .probe = cyttsp_i2c_probe, |
127 | .remove = __devexit_p(cyttsp_i2c_remove), | 127 | .remove = cyttsp_i2c_remove, |
128 | .id_table = cyttsp_i2c_id, | 128 | .id_table = cyttsp_i2c_id, |
129 | }; | 129 | }; |
130 | 130 | ||
diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c index 9f263410407..638e20310f1 100644 --- a/drivers/input/touchscreen/cyttsp_spi.c +++ b/drivers/input/touchscreen/cyttsp_spi.c | |||
@@ -147,7 +147,7 @@ static const struct cyttsp_bus_ops cyttsp_spi_bus_ops = { | |||
147 | .read = cyttsp_spi_read_block_data, | 147 | .read = cyttsp_spi_read_block_data, |
148 | }; | 148 | }; |
149 | 149 | ||
150 | static int __devinit cyttsp_spi_probe(struct spi_device *spi) | 150 | static int cyttsp_spi_probe(struct spi_device *spi) |
151 | { | 151 | { |
152 | struct cyttsp *ts; | 152 | struct cyttsp *ts; |
153 | int error; | 153 | int error; |
@@ -172,7 +172,7 @@ static int __devinit cyttsp_spi_probe(struct spi_device *spi) | |||
172 | return 0; | 172 | return 0; |
173 | } | 173 | } |
174 | 174 | ||
175 | static int __devexit cyttsp_spi_remove(struct spi_device *spi) | 175 | static int cyttsp_spi_remove(struct spi_device *spi) |
176 | { | 176 | { |
177 | struct cyttsp *ts = spi_get_drvdata(spi); | 177 | struct cyttsp *ts = spi_get_drvdata(spi); |
178 | 178 | ||
@@ -188,7 +188,7 @@ static struct spi_driver cyttsp_spi_driver = { | |||
188 | .pm = &cyttsp_pm_ops, | 188 | .pm = &cyttsp_pm_ops, |
189 | }, | 189 | }, |
190 | .probe = cyttsp_spi_probe, | 190 | .probe = cyttsp_spi_probe, |
191 | .remove = __devexit_p(cyttsp_spi_remove), | 191 | .remove = cyttsp_spi_remove, |
192 | }; | 192 | }; |
193 | 193 | ||
194 | module_spi_driver(cyttsp_spi_driver); | 194 | module_spi_driver(cyttsp_spi_driver); |
diff --git a/drivers/input/touchscreen/da9034-ts.c b/drivers/input/touchscreen/da9034-ts.c index 36b65cf10d7..34ad84105e6 100644 --- a/drivers/input/touchscreen/da9034-ts.c +++ b/drivers/input/touchscreen/da9034-ts.c | |||
@@ -297,7 +297,7 @@ static void da9034_touch_close(struct input_dev *dev) | |||
297 | } | 297 | } |
298 | 298 | ||
299 | 299 | ||
300 | static int __devinit da9034_touch_probe(struct platform_device *pdev) | 300 | static int da9034_touch_probe(struct platform_device *pdev) |
301 | { | 301 | { |
302 | struct da9034_touch_pdata *pdata = pdev->dev.platform_data; | 302 | struct da9034_touch_pdata *pdata = pdev->dev.platform_data; |
303 | struct da9034_touch *touch; | 303 | struct da9034_touch *touch; |
@@ -361,7 +361,7 @@ err_free_touch: | |||
361 | return ret; | 361 | return ret; |
362 | } | 362 | } |
363 | 363 | ||
364 | static int __devexit da9034_touch_remove(struct platform_device *pdev) | 364 | static int da9034_touch_remove(struct platform_device *pdev) |
365 | { | 365 | { |
366 | struct da9034_touch *touch = platform_get_drvdata(pdev); | 366 | struct da9034_touch *touch = platform_get_drvdata(pdev); |
367 | 367 | ||
@@ -377,7 +377,7 @@ static struct platform_driver da9034_touch_driver = { | |||
377 | .owner = THIS_MODULE, | 377 | .owner = THIS_MODULE, |
378 | }, | 378 | }, |
379 | .probe = da9034_touch_probe, | 379 | .probe = da9034_touch_probe, |
380 | .remove = __devexit_p(da9034_touch_remove), | 380 | .remove = da9034_touch_remove, |
381 | }; | 381 | }; |
382 | module_platform_driver(da9034_touch_driver); | 382 | module_platform_driver(da9034_touch_driver); |
383 | 383 | ||
diff --git a/drivers/input/touchscreen/da9052_tsi.c b/drivers/input/touchscreen/da9052_tsi.c index e8df341090c..303966ffe1e 100644 --- a/drivers/input/touchscreen/da9052_tsi.c +++ b/drivers/input/touchscreen/da9052_tsi.c | |||
@@ -143,7 +143,7 @@ static void da9052_ts_pen_work(struct work_struct *work) | |||
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | static int __devinit da9052_ts_configure_gpio(struct da9052 *da9052) | 146 | static int da9052_ts_configure_gpio(struct da9052 *da9052) |
147 | { | 147 | { |
148 | int error; | 148 | int error; |
149 | 149 | ||
@@ -162,7 +162,7 @@ static int __devinit da9052_ts_configure_gpio(struct da9052 *da9052) | |||
162 | return 0; | 162 | return 0; |
163 | } | 163 | } |
164 | 164 | ||
165 | static int __devinit da9052_configure_tsi(struct da9052_tsi *tsi) | 165 | static int da9052_configure_tsi(struct da9052_tsi *tsi) |
166 | { | 166 | { |
167 | int error; | 167 | int error; |
168 | 168 | ||
@@ -229,7 +229,7 @@ static void da9052_ts_input_close(struct input_dev *input_dev) | |||
229 | da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 1, 0); | 229 | da9052_reg_update(tsi->da9052, DA9052_TSI_CONT_A_REG, 1 << 1, 0); |
230 | } | 230 | } |
231 | 231 | ||
232 | static int __devinit da9052_ts_probe(struct platform_device *pdev) | 232 | static int da9052_ts_probe(struct platform_device *pdev) |
233 | { | 233 | { |
234 | struct da9052 *da9052; | 234 | struct da9052 *da9052; |
235 | struct da9052_tsi *tsi; | 235 | struct da9052_tsi *tsi; |
@@ -336,7 +336,7 @@ err_free_mem: | |||
336 | return error; | 336 | return error; |
337 | } | 337 | } |
338 | 338 | ||
339 | static int __devexit da9052_ts_remove(struct platform_device *pdev) | 339 | static int da9052_ts_remove(struct platform_device *pdev) |
340 | { | 340 | { |
341 | struct da9052_tsi *tsi = platform_get_drvdata(pdev); | 341 | struct da9052_tsi *tsi = platform_get_drvdata(pdev); |
342 | 342 | ||
@@ -355,7 +355,7 @@ static int __devexit da9052_ts_remove(struct platform_device *pdev) | |||
355 | 355 | ||
356 | static struct platform_driver da9052_tsi_driver = { | 356 | static struct platform_driver da9052_tsi_driver = { |
357 | .probe = da9052_ts_probe, | 357 | .probe = da9052_ts_probe, |
358 | .remove = __devexit_p(da9052_ts_remove), | 358 | .remove = da9052_ts_remove, |
359 | .driver = { | 359 | .driver = { |
360 | .name = "da9052-tsi", | 360 | .name = "da9052-tsi", |
361 | .owner = THIS_MODULE, | 361 | .owner = THIS_MODULE, |
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 099d144ab7c..a9170157b44 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c | |||
@@ -491,14 +491,6 @@ static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode) | |||
491 | DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get, | 491 | DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get, |
492 | edt_ft5x06_debugfs_mode_set, "%llu\n"); | 492 | edt_ft5x06_debugfs_mode_set, "%llu\n"); |
493 | 493 | ||
494 | static int edt_ft5x06_debugfs_raw_data_open(struct inode *inode, | ||
495 | struct file *file) | ||
496 | { | ||
497 | file->private_data = inode->i_private; | ||
498 | |||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file, | 494 | static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file, |
503 | char __user *buf, size_t count, loff_t *off) | 495 | char __user *buf, size_t count, loff_t *off) |
504 | { | 496 | { |
@@ -579,11 +571,11 @@ out: | |||
579 | 571 | ||
580 | 572 | ||
581 | static const struct file_operations debugfs_raw_data_fops = { | 573 | static const struct file_operations debugfs_raw_data_fops = { |
582 | .open = edt_ft5x06_debugfs_raw_data_open, | 574 | .open = simple_open, |
583 | .read = edt_ft5x06_debugfs_raw_data_read, | 575 | .read = edt_ft5x06_debugfs_raw_data_read, |
584 | }; | 576 | }; |
585 | 577 | ||
586 | static void __devinit | 578 | static void |
587 | edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata, | 579 | edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata, |
588 | const char *debugfs_name) | 580 | const char *debugfs_name) |
589 | { | 581 | { |
@@ -600,7 +592,7 @@ edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata, | |||
600 | tsdata->debug_dir, tsdata, &debugfs_raw_data_fops); | 592 | tsdata->debug_dir, tsdata, &debugfs_raw_data_fops); |
601 | } | 593 | } |
602 | 594 | ||
603 | static void __devexit | 595 | static void |
604 | edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata) | 596 | edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata) |
605 | { | 597 | { |
606 | if (tsdata->debug_dir) | 598 | if (tsdata->debug_dir) |
@@ -625,7 +617,7 @@ edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata) | |||
625 | 617 | ||
626 | 618 | ||
627 | 619 | ||
628 | static int __devinit edt_ft5x06_ts_reset(struct i2c_client *client, | 620 | static int edt_ft5x06_ts_reset(struct i2c_client *client, |
629 | int reset_pin) | 621 | int reset_pin) |
630 | { | 622 | { |
631 | int error; | 623 | int error; |
@@ -649,7 +641,7 @@ static int __devinit edt_ft5x06_ts_reset(struct i2c_client *client, | |||
649 | return 0; | 641 | return 0; |
650 | } | 642 | } |
651 | 643 | ||
652 | static int __devinit edt_ft5x06_ts_identify(struct i2c_client *client, | 644 | static int edt_ft5x06_ts_identify(struct i2c_client *client, |
653 | char *model_name, | 645 | char *model_name, |
654 | char *fw_version) | 646 | char *fw_version) |
655 | { | 647 | { |
@@ -683,7 +675,7 @@ static int __devinit edt_ft5x06_ts_identify(struct i2c_client *client, | |||
683 | pdata->name <= edt_ft5x06_attr_##name.limit_high) \ | 675 | pdata->name <= edt_ft5x06_attr_##name.limit_high) \ |
684 | edt_ft5x06_register_write(tsdata, reg, pdata->name) | 676 | edt_ft5x06_register_write(tsdata, reg, pdata->name) |
685 | 677 | ||
686 | static void __devinit | 678 | static void |
687 | edt_ft5x06_ts_get_defaults(struct edt_ft5x06_ts_data *tsdata, | 679 | edt_ft5x06_ts_get_defaults(struct edt_ft5x06_ts_data *tsdata, |
688 | const struct edt_ft5x06_platform_data *pdata) | 680 | const struct edt_ft5x06_platform_data *pdata) |
689 | { | 681 | { |
@@ -697,7 +689,7 @@ edt_ft5x06_ts_get_defaults(struct edt_ft5x06_ts_data *tsdata, | |||
697 | EDT_ATTR_CHECKSET(report_rate, WORK_REGISTER_REPORT_RATE); | 689 | EDT_ATTR_CHECKSET(report_rate, WORK_REGISTER_REPORT_RATE); |
698 | } | 690 | } |
699 | 691 | ||
700 | static void __devinit | 692 | static void |
701 | edt_ft5x06_ts_get_parameters(struct edt_ft5x06_ts_data *tsdata) | 693 | edt_ft5x06_ts_get_parameters(struct edt_ft5x06_ts_data *tsdata) |
702 | { | 694 | { |
703 | tsdata->threshold = edt_ft5x06_register_read(tsdata, | 695 | tsdata->threshold = edt_ft5x06_register_read(tsdata, |
@@ -710,7 +702,7 @@ edt_ft5x06_ts_get_parameters(struct edt_ft5x06_ts_data *tsdata) | |||
710 | tsdata->num_y = edt_ft5x06_register_read(tsdata, WORK_REGISTER_NUM_Y); | 702 | tsdata->num_y = edt_ft5x06_register_read(tsdata, WORK_REGISTER_NUM_Y); |
711 | } | 703 | } |
712 | 704 | ||
713 | static int __devinit edt_ft5x06_ts_probe(struct i2c_client *client, | 705 | static int edt_ft5x06_ts_probe(struct i2c_client *client, |
714 | const struct i2c_device_id *id) | 706 | const struct i2c_device_id *id) |
715 | { | 707 | { |
716 | const struct edt_ft5x06_platform_data *pdata = | 708 | const struct edt_ft5x06_platform_data *pdata = |
@@ -830,7 +822,7 @@ err_free_mem: | |||
830 | return error; | 822 | return error; |
831 | } | 823 | } |
832 | 824 | ||
833 | static int __devexit edt_ft5x06_ts_remove(struct i2c_client *client) | 825 | static int edt_ft5x06_ts_remove(struct i2c_client *client) |
834 | { | 826 | { |
835 | const struct edt_ft5x06_platform_data *pdata = | 827 | const struct edt_ft5x06_platform_data *pdata = |
836 | dev_get_platdata(&client->dev); | 828 | dev_get_platdata(&client->dev); |
@@ -891,7 +883,7 @@ static struct i2c_driver edt_ft5x06_ts_driver = { | |||
891 | }, | 883 | }, |
892 | .id_table = edt_ft5x06_ts_id, | 884 | .id_table = edt_ft5x06_ts_id, |
893 | .probe = edt_ft5x06_ts_probe, | 885 | .probe = edt_ft5x06_ts_probe, |
894 | .remove = __devexit_p(edt_ft5x06_ts_remove), | 886 | .remove = edt_ft5x06_ts_remove, |
895 | }; | 887 | }; |
896 | 888 | ||
897 | module_i2c_driver(edt_ft5x06_ts_driver); | 889 | module_i2c_driver(edt_ft5x06_ts_driver); |
diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c index 908407efc67..55255a94007 100644 --- a/drivers/input/touchscreen/eeti_ts.c +++ b/drivers/input/touchscreen/eeti_ts.c | |||
@@ -154,7 +154,7 @@ static void eeti_ts_close(struct input_dev *dev) | |||
154 | eeti_ts_stop(priv); | 154 | eeti_ts_stop(priv); |
155 | } | 155 | } |
156 | 156 | ||
157 | static int __devinit eeti_ts_probe(struct i2c_client *client, | 157 | static int eeti_ts_probe(struct i2c_client *client, |
158 | const struct i2c_device_id *idp) | 158 | const struct i2c_device_id *idp) |
159 | { | 159 | { |
160 | struct eeti_ts_platform_data *pdata = client->dev.platform_data; | 160 | struct eeti_ts_platform_data *pdata = client->dev.platform_data; |
@@ -248,7 +248,7 @@ err0: | |||
248 | return err; | 248 | return err; |
249 | } | 249 | } |
250 | 250 | ||
251 | static int __devexit eeti_ts_remove(struct i2c_client *client) | 251 | static int eeti_ts_remove(struct i2c_client *client) |
252 | { | 252 | { |
253 | struct eeti_ts_priv *priv = i2c_get_clientdata(client); | 253 | struct eeti_ts_priv *priv = i2c_get_clientdata(client); |
254 | 254 | ||
@@ -321,7 +321,7 @@ static struct i2c_driver eeti_ts_driver = { | |||
321 | #endif | 321 | #endif |
322 | }, | 322 | }, |
323 | .probe = eeti_ts_probe, | 323 | .probe = eeti_ts_probe, |
324 | .remove = __devexit_p(eeti_ts_remove), | 324 | .remove = eeti_ts_remove, |
325 | .id_table = eeti_ts_id, | 325 | .id_table = eeti_ts_id, |
326 | }; | 326 | }; |
327 | 327 | ||
diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c index 13fa62fdfb0..17c9097f3b5 100644 --- a/drivers/input/touchscreen/egalax_ts.c +++ b/drivers/input/touchscreen/egalax_ts.c | |||
@@ -153,7 +153,7 @@ static int egalax_wake_up_device(struct i2c_client *client) | |||
153 | return 0; | 153 | return 0; |
154 | } | 154 | } |
155 | 155 | ||
156 | static int __devinit egalax_firmware_version(struct i2c_client *client) | 156 | static int egalax_firmware_version(struct i2c_client *client) |
157 | { | 157 | { |
158 | static const u8 cmd[MAX_I2C_DATA_LEN] = { 0x03, 0x03, 0xa, 0x01, 0x41 }; | 158 | static const u8 cmd[MAX_I2C_DATA_LEN] = { 0x03, 0x03, 0xa, 0x01, 0x41 }; |
159 | int ret; | 159 | int ret; |
@@ -165,7 +165,7 @@ static int __devinit egalax_firmware_version(struct i2c_client *client) | |||
165 | return 0; | 165 | return 0; |
166 | } | 166 | } |
167 | 167 | ||
168 | static int __devinit egalax_ts_probe(struct i2c_client *client, | 168 | static int egalax_ts_probe(struct i2c_client *client, |
169 | const struct i2c_device_id *id) | 169 | const struct i2c_device_id *id) |
170 | { | 170 | { |
171 | struct egalax_ts *ts; | 171 | struct egalax_ts *ts; |
@@ -246,7 +246,7 @@ err_free_ts: | |||
246 | return error; | 246 | return error; |
247 | } | 247 | } |
248 | 248 | ||
249 | static __devexit int egalax_ts_remove(struct i2c_client *client) | 249 | static int egalax_ts_remove(struct i2c_client *client) |
250 | { | 250 | { |
251 | struct egalax_ts *ts = i2c_get_clientdata(client); | 251 | struct egalax_ts *ts = i2c_get_clientdata(client); |
252 | 252 | ||
@@ -301,7 +301,7 @@ static struct i2c_driver egalax_ts_driver = { | |||
301 | }, | 301 | }, |
302 | .id_table = egalax_ts_id, | 302 | .id_table = egalax_ts_id, |
303 | .probe = egalax_ts_probe, | 303 | .probe = egalax_ts_probe, |
304 | .remove = __devexit_p(egalax_ts_remove), | 304 | .remove = egalax_ts_remove, |
305 | }; | 305 | }; |
306 | 306 | ||
307 | module_i2c_driver(egalax_ts_driver); | 307 | module_i2c_driver(egalax_ts_driver); |
diff --git a/drivers/input/touchscreen/h3600_ts_input.c b/drivers/input/touchscreen/h3600_ts_input.c deleted file mode 100644 index b9e8686a6f1..00000000000 --- a/drivers/input/touchscreen/h3600_ts_input.c +++ /dev/null | |||
@@ -1,479 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2001 "Crazy" James Simmons jsimmons@transvirtual.com | ||
3 | * | ||
4 | * Sponsored by Transvirtual Technology. | ||
5 | * | ||
6 | * Derived from the code in h3600_ts.[ch] by Charles Flynn | ||
7 | */ | ||
8 | |||
9 | /* | ||
10 | * Driver for the h3600 Touch Screen and other Atmel controlled devices. | ||
11 | */ | ||
12 | |||
13 | /* | ||
14 | * This program is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License as published by | ||
16 | * the Free Software Foundation; either version 2 of the License, or | ||
17 | * (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
27 | * | ||
28 | * Should you need to contact me, the author, you can do so by | ||
29 | * e-mail - mail your message to <jsimmons@transvirtual.com>. | ||
30 | */ | ||
31 | |||
32 | #include <linux/errno.h> | ||
33 | #include <linux/kernel.h> | ||
34 | #include <linux/module.h> | ||
35 | #include <linux/slab.h> | ||
36 | #include <linux/input.h> | ||
37 | #include <linux/serio.h> | ||
38 | #include <linux/init.h> | ||
39 | #include <linux/delay.h> | ||
40 | |||
41 | /* SA1100 serial defines */ | ||
42 | #include <mach/hardware.h> | ||
43 | #include <mach/irqs.h> | ||
44 | |||
45 | #define DRIVER_DESC "H3600 touchscreen driver" | ||
46 | |||
47 | MODULE_AUTHOR("James Simmons <jsimmons@transvirtual.com>"); | ||
48 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
49 | MODULE_LICENSE("GPL"); | ||
50 | |||
51 | /* | ||
52 | * Definitions & global arrays. | ||
53 | */ | ||
54 | |||
55 | /* The start and end of frame characters SOF and EOF */ | ||
56 | #define CHAR_SOF 0x02 | ||
57 | #define CHAR_EOF 0x03 | ||
58 | #define FRAME_OVERHEAD 3 /* CHAR_SOF,CHAR_EOF,LENGTH = 3 */ | ||
59 | |||
60 | /* | ||
61 | Atmel events and response IDs contained in frame. | ||
62 | Programmer has no control over these numbers. | ||
63 | TODO there are holes - specifically 1,7,0x0a | ||
64 | */ | ||
65 | #define VERSION_ID 0 /* Get Version (request/response) */ | ||
66 | #define KEYBD_ID 2 /* Keyboard (event) */ | ||
67 | #define TOUCHS_ID 3 /* Touch Screen (event)*/ | ||
68 | #define EEPROM_READ_ID 4 /* (request/response) */ | ||
69 | #define EEPROM_WRITE_ID 5 /* (request/response) */ | ||
70 | #define THERMAL_ID 6 /* (request/response) */ | ||
71 | #define NOTIFY_LED_ID 8 /* (request/response) */ | ||
72 | #define BATTERY_ID 9 /* (request/response) */ | ||
73 | #define SPI_READ_ID 0x0b /* ( request/response) */ | ||
74 | #define SPI_WRITE_ID 0x0c /* ( request/response) */ | ||
75 | #define FLITE_ID 0x0d /* backlight ( request/response) */ | ||
76 | #define STX_ID 0xa1 /* extension pack status (req/resp) */ | ||
77 | |||
78 | #define MAX_ID 14 | ||
79 | |||
80 | #define H3600_MAX_LENGTH 16 | ||
81 | #define H3600_KEY 0xf | ||
82 | |||
83 | #define H3600_SCANCODE_RECORD 1 /* 1 -> record button */ | ||
84 | #define H3600_SCANCODE_CALENDAR 2 /* 2 -> calendar */ | ||
85 | #define H3600_SCANCODE_CONTACTS 3 /* 3 -> contact */ | ||
86 | #define H3600_SCANCODE_Q 4 /* 4 -> Q button */ | ||
87 | #define H3600_SCANCODE_START 5 /* 5 -> start menu */ | ||
88 | #define H3600_SCANCODE_UP 6 /* 6 -> up */ | ||
89 | #define H3600_SCANCODE_RIGHT 7 /* 7 -> right */ | ||
90 | #define H3600_SCANCODE_LEFT 8 /* 8 -> left */ | ||
91 | #define H3600_SCANCODE_DOWN 9 /* 9 -> down */ | ||
92 | |||
93 | /* | ||
94 | * Per-touchscreen data. | ||
95 | */ | ||
96 | struct h3600_dev { | ||
97 | struct input_dev *dev; | ||
98 | struct serio *serio; | ||
99 | unsigned char event; /* event ID from packet */ | ||
100 | unsigned char chksum; | ||
101 | unsigned char len; | ||
102 | unsigned char idx; | ||
103 | unsigned char buf[H3600_MAX_LENGTH]; | ||
104 | char phys[32]; | ||
105 | }; | ||
106 | |||
107 | static irqreturn_t action_button_handler(int irq, void *dev_id) | ||
108 | { | ||
109 | int down = (GPLR & GPIO_BITSY_ACTION_BUTTON) ? 0 : 1; | ||
110 | struct input_dev *dev = dev_id; | ||
111 | |||
112 | input_report_key(dev, KEY_ENTER, down); | ||
113 | input_sync(dev); | ||
114 | |||
115 | return IRQ_HANDLED; | ||
116 | } | ||
117 | |||
118 | static irqreturn_t npower_button_handler(int irq, void *dev_id) | ||
119 | { | ||
120 | int down = (GPLR & GPIO_BITSY_NPOWER_BUTTON) ? 0 : 1; | ||
121 | struct input_dev *dev = dev_id; | ||
122 | |||
123 | /* | ||
124 | * This interrupt is only called when we release the key. So we have | ||
125 | * to fake a key press. | ||
126 | */ | ||
127 | input_report_key(dev, KEY_SUSPEND, 1); | ||
128 | input_report_key(dev, KEY_SUSPEND, down); | ||
129 | input_sync(dev); | ||
130 | |||
131 | return IRQ_HANDLED; | ||
132 | } | ||
133 | |||
134 | #ifdef CONFIG_PM | ||
135 | |||
136 | static int flite_brightness = 25; | ||
137 | |||
138 | enum flite_pwr { | ||
139 | FLITE_PWR_OFF = 0, | ||
140 | FLITE_PWR_ON = 1 | ||
141 | }; | ||
142 | |||
143 | /* | ||
144 | * h3600_flite_power: enables or disables power to frontlight, using last bright */ | ||
145 | unsigned int h3600_flite_power(struct input_dev *dev, enum flite_pwr pwr) | ||
146 | { | ||
147 | unsigned char brightness = (pwr == FLITE_PWR_OFF) ? 0 : flite_brightness; | ||
148 | struct h3600_dev *ts = input_get_drvdata(dev); | ||
149 | |||
150 | /* Must be in this order */ | ||
151 | serio_write(ts->serio, 1); | ||
152 | serio_write(ts->serio, pwr); | ||
153 | serio_write(ts->serio, brightness); | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | #endif | ||
159 | |||
160 | /* | ||
161 | * This function translates the native event packets to linux input event | ||
162 | * packets. Some packets coming from serial are not touchscreen related. In | ||
163 | * this case we send them off to be processed elsewhere. | ||
164 | */ | ||
165 | static void h3600ts_process_packet(struct h3600_dev *ts) | ||
166 | { | ||
167 | struct input_dev *dev = ts->dev; | ||
168 | static int touched = 0; | ||
169 | int key, down = 0; | ||
170 | |||
171 | switch (ts->event) { | ||
172 | /* | ||
173 | Buttons - returned as a single byte | ||
174 | 7 6 5 4 3 2 1 0 | ||
175 | S x x x N N N N | ||
176 | |||
177 | S switch state ( 0=pressed 1=released) | ||
178 | x Unused. | ||
179 | NNNN switch number 0-15 | ||
180 | |||
181 | Note: This is true for non interrupt generated key events. | ||
182 | */ | ||
183 | case KEYBD_ID: | ||
184 | down = (ts->buf[0] & 0x80) ? 0 : 1; | ||
185 | |||
186 | switch (ts->buf[0] & 0x7f) { | ||
187 | case H3600_SCANCODE_RECORD: | ||
188 | key = KEY_RECORD; | ||
189 | break; | ||
190 | case H3600_SCANCODE_CALENDAR: | ||
191 | key = KEY_PROG1; | ||
192 | break; | ||
193 | case H3600_SCANCODE_CONTACTS: | ||
194 | key = KEY_PROG2; | ||
195 | break; | ||
196 | case H3600_SCANCODE_Q: | ||
197 | key = KEY_Q; | ||
198 | break; | ||
199 | case H3600_SCANCODE_START: | ||
200 | key = KEY_PROG3; | ||
201 | break; | ||
202 | case H3600_SCANCODE_UP: | ||
203 | key = KEY_UP; | ||
204 | break; | ||
205 | case H3600_SCANCODE_RIGHT: | ||
206 | key = KEY_RIGHT; | ||
207 | break; | ||
208 | case H3600_SCANCODE_LEFT: | ||
209 | key = KEY_LEFT; | ||
210 | break; | ||
211 | case H3600_SCANCODE_DOWN: | ||
212 | key = KEY_DOWN; | ||
213 | break; | ||
214 | default: | ||
215 | key = 0; | ||
216 | } | ||
217 | if (key) | ||
218 | input_report_key(dev, key, down); | ||
219 | break; | ||
220 | /* | ||
221 | * Native touchscreen event data is formatted as shown below:- | ||
222 | * | ||
223 | * +-------+-------+-------+-------+ | ||
224 | * | Xmsb | Xlsb | Ymsb | Ylsb | | ||
225 | * +-------+-------+-------+-------+ | ||
226 | * byte 0 1 2 3 | ||
227 | */ | ||
228 | case TOUCHS_ID: | ||
229 | if (!touched) { | ||
230 | input_report_key(dev, BTN_TOUCH, 1); | ||
231 | touched = 1; | ||
232 | } | ||
233 | |||
234 | if (ts->len) { | ||
235 | unsigned short x, y; | ||
236 | |||
237 | x = ts->buf[0]; x <<= 8; x += ts->buf[1]; | ||
238 | y = ts->buf[2]; y <<= 8; y += ts->buf[3]; | ||
239 | |||
240 | input_report_abs(dev, ABS_X, x); | ||
241 | input_report_abs(dev, ABS_Y, y); | ||
242 | } else { | ||
243 | input_report_key(dev, BTN_TOUCH, 0); | ||
244 | touched = 0; | ||
245 | } | ||
246 | break; | ||
247 | default: | ||
248 | /* Send a non input event elsewhere */ | ||
249 | break; | ||
250 | } | ||
251 | |||
252 | input_sync(dev); | ||
253 | } | ||
254 | |||
255 | /* | ||
256 | * h3600ts_event() handles events from the input module. | ||
257 | */ | ||
258 | static int h3600ts_event(struct input_dev *dev, unsigned int type, | ||
259 | unsigned int code, int value) | ||
260 | { | ||
261 | #if 0 | ||
262 | struct h3600_dev *ts = input_get_drvdata(dev); | ||
263 | |||
264 | switch (type) { | ||
265 | case EV_LED: { | ||
266 | // serio_write(ts->serio, SOME_CMD); | ||
267 | return 0; | ||
268 | } | ||
269 | } | ||
270 | return -1; | ||
271 | #endif | ||
272 | return 0; | ||
273 | } | ||
274 | |||
275 | /* | ||
276 | Frame format | ||
277 | byte 1 2 3 len + 4 | ||
278 | +-------+---------------+---------------+--=------------+ | ||
279 | |SOF |id |len | len bytes | Chksum | | ||
280 | +-------+---------------+---------------+--=------------+ | ||
281 | bit 0 7 8 11 12 15 16 | ||
282 | |||
283 | +-------+---------------+-------+ | ||
284 | |SOF |id |0 |Chksum | - Note Chksum does not include SOF | ||
285 | +-------+---------------+-------+ | ||
286 | bit 0 7 8 11 12 15 16 | ||
287 | |||
288 | */ | ||
289 | |||
290 | static int state; | ||
291 | |||
292 | /* decode States */ | ||
293 | #define STATE_SOF 0 /* start of FRAME */ | ||
294 | #define STATE_ID 1 /* state where we decode the ID & len */ | ||
295 | #define STATE_DATA 2 /* state where we decode data */ | ||
296 | #define STATE_EOF 3 /* state where we decode checksum or EOF */ | ||
297 | |||
298 | static irqreturn_t h3600ts_interrupt(struct serio *serio, unsigned char data, | ||
299 | unsigned int flags) | ||
300 | { | ||
301 | struct h3600_dev *ts = serio_get_drvdata(serio); | ||
302 | |||
303 | /* | ||
304 | * We have a new frame coming in. | ||
305 | */ | ||
306 | switch (state) { | ||
307 | case STATE_SOF: | ||
308 | if (data == CHAR_SOF) | ||
309 | state = STATE_ID; | ||
310 | break; | ||
311 | case STATE_ID: | ||
312 | ts->event = (data & 0xf0) >> 4; | ||
313 | ts->len = (data & 0xf); | ||
314 | ts->idx = 0; | ||
315 | if (ts->event >= MAX_ID) { | ||
316 | state = STATE_SOF; | ||
317 | break; | ||
318 | } | ||
319 | ts->chksum = data; | ||
320 | state = (ts->len > 0) ? STATE_DATA : STATE_EOF; | ||
321 | break; | ||
322 | case STATE_DATA: | ||
323 | ts->chksum += data; | ||
324 | ts->buf[ts->idx]= data; | ||
325 | if (++ts->idx == ts->len) | ||
326 | state = STATE_EOF; | ||
327 | break; | ||
328 | case STATE_EOF: | ||
329 | state = STATE_SOF; | ||
330 | if (data == CHAR_EOF || data == ts->chksum) | ||
331 | h3600ts_process_packet(ts); | ||
332 | break; | ||
333 | default: | ||
334 | printk("Error3\n"); | ||
335 | break; | ||
336 | } | ||
337 | |||
338 | return IRQ_HANDLED; | ||
339 | } | ||
340 | |||
341 | /* | ||
342 | * h3600ts_connect() is the routine that is called when someone adds a | ||
343 | * new serio device that supports H3600 protocol and registers it as | ||
344 | * an input device. | ||
345 | */ | ||
346 | static int h3600ts_connect(struct serio *serio, struct serio_driver *drv) | ||
347 | { | ||
348 | struct h3600_dev *ts; | ||
349 | struct input_dev *input_dev; | ||
350 | int err; | ||
351 | |||
352 | ts = kzalloc(sizeof(struct h3600_dev), GFP_KERNEL); | ||
353 | input_dev = input_allocate_device(); | ||
354 | if (!ts || !input_dev) { | ||
355 | err = -ENOMEM; | ||
356 | goto fail1; | ||
357 | } | ||
358 | |||
359 | ts->serio = serio; | ||
360 | ts->dev = input_dev; | ||
361 | snprintf(ts->phys, sizeof(ts->phys), "%s/input0", serio->phys); | ||
362 | |||
363 | input_dev->name = "H3600 TouchScreen"; | ||
364 | input_dev->phys = ts->phys; | ||
365 | input_dev->id.bustype = BUS_RS232; | ||
366 | input_dev->id.vendor = SERIO_H3600; | ||
367 | input_dev->id.product = 0x0666; /* FIXME !!! We can ask the hardware */ | ||
368 | input_dev->id.version = 0x0100; | ||
369 | input_dev->dev.parent = &serio->dev; | ||
370 | |||
371 | input_set_drvdata(input_dev, ts); | ||
372 | |||
373 | input_dev->event = h3600ts_event; | ||
374 | |||
375 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS) | | ||
376 | BIT_MASK(EV_LED) | BIT_MASK(EV_PWR); | ||
377 | input_dev->ledbit[0] = BIT_MASK(LED_SLEEP); | ||
378 | input_set_abs_params(input_dev, ABS_X, 60, 985, 0, 0); | ||
379 | input_set_abs_params(input_dev, ABS_Y, 35, 1024, 0, 0); | ||
380 | |||
381 | set_bit(KEY_RECORD, input_dev->keybit); | ||
382 | set_bit(KEY_Q, input_dev->keybit); | ||
383 | set_bit(KEY_PROG1, input_dev->keybit); | ||
384 | set_bit(KEY_PROG2, input_dev->keybit); | ||
385 | set_bit(KEY_PROG3, input_dev->keybit); | ||
386 | set_bit(KEY_UP, input_dev->keybit); | ||
387 | set_bit(KEY_RIGHT, input_dev->keybit); | ||
388 | set_bit(KEY_LEFT, input_dev->keybit); | ||
389 | set_bit(KEY_DOWN, input_dev->keybit); | ||
390 | set_bit(KEY_ENTER, input_dev->keybit); | ||
391 | set_bit(KEY_SUSPEND, input_dev->keybit); | ||
392 | set_bit(BTN_TOUCH, input_dev->keybit); | ||
393 | |||
394 | /* Device specific stuff */ | ||
395 | set_GPIO_IRQ_edge(GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES); | ||
396 | set_GPIO_IRQ_edge(GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE); | ||
397 | |||
398 | if (request_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, action_button_handler, | ||
399 | IRQF_SHARED, "h3600_action", ts->dev)) { | ||
400 | printk(KERN_ERR "h3600ts.c: Could not allocate Action Button IRQ!\n"); | ||
401 | err = -EBUSY; | ||
402 | goto fail1; | ||
403 | } | ||
404 | |||
405 | if (request_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, npower_button_handler, | ||
406 | IRQF_SHARED, "h3600_suspend", ts->dev)) { | ||
407 | printk(KERN_ERR "h3600ts.c: Could not allocate Power Button IRQ!\n"); | ||
408 | err = -EBUSY; | ||
409 | goto fail2; | ||
410 | } | ||
411 | |||
412 | serio_set_drvdata(serio, ts); | ||
413 | |||
414 | err = serio_open(serio, drv); | ||
415 | if (err) | ||
416 | goto fail3; | ||
417 | |||
418 | //h3600_flite_control(1, 25); /* default brightness */ | ||
419 | err = input_register_device(ts->dev); | ||
420 | if (err) | ||
421 | goto fail4; | ||
422 | |||
423 | return 0; | ||
424 | |||
425 | fail4: serio_close(serio); | ||
426 | fail3: serio_set_drvdata(serio, NULL); | ||
427 | free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev); | ||
428 | fail2: free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev); | ||
429 | fail1: input_free_device(input_dev); | ||
430 | kfree(ts); | ||
431 | return err; | ||
432 | } | ||
433 | |||
434 | /* | ||
435 | * h3600ts_disconnect() is the opposite of h3600ts_connect() | ||
436 | */ | ||
437 | |||
438 | static void h3600ts_disconnect(struct serio *serio) | ||
439 | { | ||
440 | struct h3600_dev *ts = serio_get_drvdata(serio); | ||
441 | |||
442 | free_irq(IRQ_GPIO_BITSY_ACTION_BUTTON, ts->dev); | ||
443 | free_irq(IRQ_GPIO_BITSY_NPOWER_BUTTON, ts->dev); | ||
444 | input_get_device(ts->dev); | ||
445 | input_unregister_device(ts->dev); | ||
446 | serio_close(serio); | ||
447 | serio_set_drvdata(serio, NULL); | ||
448 | input_put_device(ts->dev); | ||
449 | kfree(ts); | ||
450 | } | ||
451 | |||
452 | /* | ||
453 | * The serio driver structure. | ||
454 | */ | ||
455 | |||
456 | static struct serio_device_id h3600ts_serio_ids[] = { | ||
457 | { | ||
458 | .type = SERIO_RS232, | ||
459 | .proto = SERIO_H3600, | ||
460 | .id = SERIO_ANY, | ||
461 | .extra = SERIO_ANY, | ||
462 | }, | ||
463 | { 0 } | ||
464 | }; | ||
465 | |||
466 | MODULE_DEVICE_TABLE(serio, h3600ts_serio_ids); | ||
467 | |||
468 | static struct serio_driver h3600ts_drv = { | ||
469 | .driver = { | ||
470 | .name = "h3600ts", | ||
471 | }, | ||
472 | .description = DRIVER_DESC, | ||
473 | .id_table = h3600ts_serio_ids, | ||
474 | .interrupt = h3600ts_interrupt, | ||
475 | .connect = h3600ts_connect, | ||
476 | .disconnect = h3600ts_disconnect, | ||
477 | }; | ||
478 | |||
479 | module_serio_driver(h3600ts_drv); | ||
diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c index d13143b68b3..6c4fb843695 100644 --- a/drivers/input/touchscreen/htcpen.c +++ b/drivers/input/touchscreen/htcpen.c | |||
@@ -102,7 +102,7 @@ static void htcpen_close(struct input_dev *dev) | |||
102 | synchronize_irq(HTCPEN_IRQ); | 102 | synchronize_irq(HTCPEN_IRQ); |
103 | } | 103 | } |
104 | 104 | ||
105 | static int __devinit htcpen_isa_probe(struct device *dev, unsigned int id) | 105 | static int htcpen_isa_probe(struct device *dev, unsigned int id) |
106 | { | 106 | { |
107 | struct input_dev *htcpen_dev; | 107 | struct input_dev *htcpen_dev; |
108 | int err = -EBUSY; | 108 | int err = -EBUSY; |
@@ -174,7 +174,7 @@ static int __devinit htcpen_isa_probe(struct device *dev, unsigned int id) | |||
174 | return err; | 174 | return err; |
175 | } | 175 | } |
176 | 176 | ||
177 | static int __devexit htcpen_isa_remove(struct device *dev, unsigned int id) | 177 | static int htcpen_isa_remove(struct device *dev, unsigned int id) |
178 | { | 178 | { |
179 | struct input_dev *htcpen_dev = dev_get_drvdata(dev); | 179 | struct input_dev *htcpen_dev = dev_get_drvdata(dev); |
180 | 180 | ||
@@ -210,7 +210,7 @@ static int htcpen_isa_resume(struct device *dev, unsigned int n) | |||
210 | 210 | ||
211 | static struct isa_driver htcpen_isa_driver = { | 211 | static struct isa_driver htcpen_isa_driver = { |
212 | .probe = htcpen_isa_probe, | 212 | .probe = htcpen_isa_probe, |
213 | .remove = __devexit_p(htcpen_isa_remove), | 213 | .remove = htcpen_isa_remove, |
214 | #ifdef CONFIG_PM | 214 | #ifdef CONFIG_PM |
215 | .suspend = htcpen_isa_suspend, | 215 | .suspend = htcpen_isa_suspend, |
216 | .resume = htcpen_isa_resume, | 216 | .resume = htcpen_isa_resume, |
diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c index 4ac69760ec0..1418bdda61b 100644 --- a/drivers/input/touchscreen/ili210x.c +++ b/drivers/input/touchscreen/ili210x.c | |||
@@ -180,7 +180,7 @@ static const struct attribute_group ili210x_attr_group = { | |||
180 | .attrs = ili210x_attributes, | 180 | .attrs = ili210x_attributes, |
181 | }; | 181 | }; |
182 | 182 | ||
183 | static int __devinit ili210x_i2c_probe(struct i2c_client *client, | 183 | static int ili210x_i2c_probe(struct i2c_client *client, |
184 | const struct i2c_device_id *id) | 184 | const struct i2c_device_id *id) |
185 | { | 185 | { |
186 | struct device *dev = &client->dev; | 186 | struct device *dev = &client->dev; |
@@ -298,7 +298,7 @@ err_free_mem: | |||
298 | return error; | 298 | return error; |
299 | } | 299 | } |
300 | 300 | ||
301 | static int __devexit ili210x_i2c_remove(struct i2c_client *client) | 301 | static int ili210x_i2c_remove(struct i2c_client *client) |
302 | { | 302 | { |
303 | struct ili210x *priv = i2c_get_clientdata(client); | 303 | struct ili210x *priv = i2c_get_clientdata(client); |
304 | 304 | ||
@@ -350,7 +350,7 @@ static struct i2c_driver ili210x_ts_driver = { | |||
350 | }, | 350 | }, |
351 | .id_table = ili210x_i2c_id, | 351 | .id_table = ili210x_i2c_id, |
352 | .probe = ili210x_i2c_probe, | 352 | .probe = ili210x_i2c_probe, |
353 | .remove = __devexit_p(ili210x_i2c_remove), | 353 | .remove = ili210x_i2c_remove, |
354 | }; | 354 | }; |
355 | 355 | ||
356 | module_i2c_driver(ili210x_ts_driver); | 356 | module_i2c_driver(ili210x_ts_driver); |
diff --git a/drivers/input/touchscreen/intel-mid-touch.c b/drivers/input/touchscreen/intel-mid-touch.c index cf299377fc4..465db5dba8b 100644 --- a/drivers/input/touchscreen/intel-mid-touch.c +++ b/drivers/input/touchscreen/intel-mid-touch.c | |||
@@ -427,7 +427,7 @@ out: | |||
427 | } | 427 | } |
428 | 428 | ||
429 | /* Utility to read PMIC ID */ | 429 | /* Utility to read PMIC ID */ |
430 | static int __devinit mrstouch_read_pmic_id(uint *vendor, uint *rev) | 430 | static int mrstouch_read_pmic_id(uint *vendor, uint *rev) |
431 | { | 431 | { |
432 | int err; | 432 | int err; |
433 | u8 r; | 433 | u8 r; |
@@ -446,7 +446,7 @@ static int __devinit mrstouch_read_pmic_id(uint *vendor, uint *rev) | |||
446 | * Parse ADC channels to find end of the channel configured by other ADC user | 446 | * Parse ADC channels to find end of the channel configured by other ADC user |
447 | * NEC and MAXIM requires 4 channels and FreeScale needs 18 channels | 447 | * NEC and MAXIM requires 4 channels and FreeScale needs 18 channels |
448 | */ | 448 | */ |
449 | static int __devinit mrstouch_chan_parse(struct mrstouch_dev *tsdev) | 449 | static int mrstouch_chan_parse(struct mrstouch_dev *tsdev) |
450 | { | 450 | { |
451 | int found = 0; | 451 | int found = 0; |
452 | int err, i; | 452 | int err, i; |
@@ -478,7 +478,7 @@ static int __devinit mrstouch_chan_parse(struct mrstouch_dev *tsdev) | |||
478 | /* | 478 | /* |
479 | * Writes touch screen channels to ADC address selection registers | 479 | * Writes touch screen channels to ADC address selection registers |
480 | */ | 480 | */ |
481 | static int __devinit mrstouch_ts_chan_set(uint offset) | 481 | static int mrstouch_ts_chan_set(uint offset) |
482 | { | 482 | { |
483 | u16 chan; | 483 | u16 chan; |
484 | 484 | ||
@@ -494,7 +494,7 @@ static int __devinit mrstouch_ts_chan_set(uint offset) | |||
494 | } | 494 | } |
495 | 495 | ||
496 | /* Initialize ADC */ | 496 | /* Initialize ADC */ |
497 | static int __devinit mrstouch_adc_init(struct mrstouch_dev *tsdev) | 497 | static int mrstouch_adc_init(struct mrstouch_dev *tsdev) |
498 | { | 498 | { |
499 | int err, start; | 499 | int err, start; |
500 | u8 ra, rm; | 500 | u8 ra, rm; |
@@ -568,7 +568,7 @@ static int __devinit mrstouch_adc_init(struct mrstouch_dev *tsdev) | |||
568 | 568 | ||
569 | 569 | ||
570 | /* Probe function for touch screen driver */ | 570 | /* Probe function for touch screen driver */ |
571 | static int __devinit mrstouch_probe(struct platform_device *pdev) | 571 | static int mrstouch_probe(struct platform_device *pdev) |
572 | { | 572 | { |
573 | struct mrstouch_dev *tsdev; | 573 | struct mrstouch_dev *tsdev; |
574 | struct input_dev *input; | 574 | struct input_dev *input; |
@@ -643,7 +643,7 @@ err_free_mem: | |||
643 | return err; | 643 | return err; |
644 | } | 644 | } |
645 | 645 | ||
646 | static int __devexit mrstouch_remove(struct platform_device *pdev) | 646 | static int mrstouch_remove(struct platform_device *pdev) |
647 | { | 647 | { |
648 | struct mrstouch_dev *tsdev = platform_get_drvdata(pdev); | 648 | struct mrstouch_dev *tsdev = platform_get_drvdata(pdev); |
649 | 649 | ||
@@ -662,7 +662,7 @@ static struct platform_driver mrstouch_driver = { | |||
662 | .owner = THIS_MODULE, | 662 | .owner = THIS_MODULE, |
663 | }, | 663 | }, |
664 | .probe = mrstouch_probe, | 664 | .probe = mrstouch_probe, |
665 | .remove = __devexit_p(mrstouch_remove), | 665 | .remove = mrstouch_remove, |
666 | }; | 666 | }; |
667 | module_platform_driver(mrstouch_driver); | 667 | module_platform_driver(mrstouch_driver); |
668 | 668 | ||
diff --git a/drivers/input/touchscreen/jornada720_ts.c b/drivers/input/touchscreen/jornada720_ts.c index 7f03d1bd916..282d7c7ad2f 100644 --- a/drivers/input/touchscreen/jornada720_ts.c +++ b/drivers/input/touchscreen/jornada720_ts.c | |||
@@ -99,7 +99,7 @@ static irqreturn_t jornada720_ts_interrupt(int irq, void *dev_id) | |||
99 | return IRQ_HANDLED; | 99 | return IRQ_HANDLED; |
100 | } | 100 | } |
101 | 101 | ||
102 | static int __devinit jornada720_ts_probe(struct platform_device *pdev) | 102 | static int jornada720_ts_probe(struct platform_device *pdev) |
103 | { | 103 | { |
104 | struct jornada_ts *jornada_ts; | 104 | struct jornada_ts *jornada_ts; |
105 | struct input_dev *input_dev; | 105 | struct input_dev *input_dev; |
@@ -151,7 +151,7 @@ static int __devinit jornada720_ts_probe(struct platform_device *pdev) | |||
151 | return error; | 151 | return error; |
152 | } | 152 | } |
153 | 153 | ||
154 | static int __devexit jornada720_ts_remove(struct platform_device *pdev) | 154 | static int jornada720_ts_remove(struct platform_device *pdev) |
155 | { | 155 | { |
156 | struct jornada_ts *jornada_ts = platform_get_drvdata(pdev); | 156 | struct jornada_ts *jornada_ts = platform_get_drvdata(pdev); |
157 | 157 | ||
@@ -168,7 +168,7 @@ MODULE_ALIAS("platform:jornada_ts"); | |||
168 | 168 | ||
169 | static struct platform_driver jornada720_ts_driver = { | 169 | static struct platform_driver jornada720_ts_driver = { |
170 | .probe = jornada720_ts_probe, | 170 | .probe = jornada720_ts_probe, |
171 | .remove = __devexit_p(jornada720_ts_remove), | 171 | .remove = jornada720_ts_remove, |
172 | .driver = { | 172 | .driver = { |
173 | .name = "jornada_ts", | 173 | .name = "jornada_ts", |
174 | .owner = THIS_MODULE, | 174 | .owner = THIS_MODULE, |
diff --git a/drivers/input/touchscreen/lpc32xx_ts.c b/drivers/input/touchscreen/lpc32xx_ts.c index 4c2b8ed3bf1..9101ee529c9 100644 --- a/drivers/input/touchscreen/lpc32xx_ts.c +++ b/drivers/input/touchscreen/lpc32xx_ts.c | |||
@@ -203,7 +203,7 @@ static void lpc32xx_ts_close(struct input_dev *dev) | |||
203 | lpc32xx_stop_tsc(tsc); | 203 | lpc32xx_stop_tsc(tsc); |
204 | } | 204 | } |
205 | 205 | ||
206 | static int __devinit lpc32xx_ts_probe(struct platform_device *pdev) | 206 | static int lpc32xx_ts_probe(struct platform_device *pdev) |
207 | { | 207 | { |
208 | struct lpc32xx_tsc *tsc; | 208 | struct lpc32xx_tsc *tsc; |
209 | struct input_dev *input; | 209 | struct input_dev *input; |
@@ -309,7 +309,7 @@ err_free_mem: | |||
309 | return error; | 309 | return error; |
310 | } | 310 | } |
311 | 311 | ||
312 | static int __devexit lpc32xx_ts_remove(struct platform_device *pdev) | 312 | static int lpc32xx_ts_remove(struct platform_device *pdev) |
313 | { | 313 | { |
314 | struct lpc32xx_tsc *tsc = platform_get_drvdata(pdev); | 314 | struct lpc32xx_tsc *tsc = platform_get_drvdata(pdev); |
315 | struct resource *res; | 315 | struct resource *res; |
@@ -394,7 +394,7 @@ MODULE_DEVICE_TABLE(of, lpc32xx_tsc_of_match); | |||
394 | 394 | ||
395 | static struct platform_driver lpc32xx_ts_driver = { | 395 | static struct platform_driver lpc32xx_ts_driver = { |
396 | .probe = lpc32xx_ts_probe, | 396 | .probe = lpc32xx_ts_probe, |
397 | .remove = __devexit_p(lpc32xx_ts_remove), | 397 | .remove = lpc32xx_ts_remove, |
398 | .driver = { | 398 | .driver = { |
399 | .name = MOD_NAME, | 399 | .name = MOD_NAME, |
400 | .owner = THIS_MODULE, | 400 | .owner = THIS_MODULE, |
diff --git a/drivers/input/touchscreen/max11801_ts.c b/drivers/input/touchscreen/max11801_ts.c index 4eab50b856d..00bc6caa27f 100644 --- a/drivers/input/touchscreen/max11801_ts.c +++ b/drivers/input/touchscreen/max11801_ts.c | |||
@@ -156,7 +156,7 @@ out: | |||
156 | return IRQ_HANDLED; | 156 | return IRQ_HANDLED; |
157 | } | 157 | } |
158 | 158 | ||
159 | static void __devinit max11801_ts_phy_init(struct max11801_data *data) | 159 | static void max11801_ts_phy_init(struct max11801_data *data) |
160 | { | 160 | { |
161 | struct i2c_client *client = data->client; | 161 | struct i2c_client *client = data->client; |
162 | 162 | ||
@@ -174,7 +174,7 @@ static void __devinit max11801_ts_phy_init(struct max11801_data *data) | |||
174 | max11801_write_reg(client, OP_MODE_CONF_REG, 0x36); | 174 | max11801_write_reg(client, OP_MODE_CONF_REG, 0x36); |
175 | } | 175 | } |
176 | 176 | ||
177 | static int __devinit max11801_ts_probe(struct i2c_client *client, | 177 | static int max11801_ts_probe(struct i2c_client *client, |
178 | const struct i2c_device_id *id) | 178 | const struct i2c_device_id *id) |
179 | { | 179 | { |
180 | struct max11801_data *data; | 180 | struct max11801_data *data; |
@@ -228,7 +228,7 @@ err_free_mem: | |||
228 | return error; | 228 | return error; |
229 | } | 229 | } |
230 | 230 | ||
231 | static __devexit int max11801_ts_remove(struct i2c_client *client) | 231 | static int max11801_ts_remove(struct i2c_client *client) |
232 | { | 232 | { |
233 | struct max11801_data *data = i2c_get_clientdata(client); | 233 | struct max11801_data *data = i2c_get_clientdata(client); |
234 | 234 | ||
@@ -252,7 +252,7 @@ static struct i2c_driver max11801_ts_driver = { | |||
252 | }, | 252 | }, |
253 | .id_table = max11801_ts_id, | 253 | .id_table = max11801_ts_id, |
254 | .probe = max11801_ts_probe, | 254 | .probe = max11801_ts_probe, |
255 | .remove = __devexit_p(max11801_ts_remove), | 255 | .remove = max11801_ts_remove, |
256 | }; | 256 | }; |
257 | 257 | ||
258 | module_i2c_driver(max11801_ts_driver); | 258 | module_i2c_driver(max11801_ts_driver); |
diff --git a/drivers/input/touchscreen/mc13783_ts.c b/drivers/input/touchscreen/mc13783_ts.c index 48dc5b0d26f..02103b6abb3 100644 --- a/drivers/input/touchscreen/mc13783_ts.c +++ b/drivers/input/touchscreen/mc13783_ts.c | |||
@@ -229,7 +229,7 @@ err_free_mem: | |||
229 | return ret; | 229 | return ret; |
230 | } | 230 | } |
231 | 231 | ||
232 | static int __devexit mc13783_ts_remove(struct platform_device *pdev) | 232 | static int mc13783_ts_remove(struct platform_device *pdev) |
233 | { | 233 | { |
234 | struct mc13783_ts_priv *priv = platform_get_drvdata(pdev); | 234 | struct mc13783_ts_priv *priv = platform_get_drvdata(pdev); |
235 | 235 | ||
@@ -243,7 +243,7 @@ static int __devexit mc13783_ts_remove(struct platform_device *pdev) | |||
243 | } | 243 | } |
244 | 244 | ||
245 | static struct platform_driver mc13783_ts_driver = { | 245 | static struct platform_driver mc13783_ts_driver = { |
246 | .remove = __devexit_p(mc13783_ts_remove), | 246 | .remove = mc13783_ts_remove, |
247 | .driver = { | 247 | .driver = { |
248 | .owner = THIS_MODULE, | 248 | .owner = THIS_MODULE, |
249 | .name = MC13783_TS_NAME, | 249 | .name = MC13783_TS_NAME, |
diff --git a/drivers/input/touchscreen/mcs5000_ts.c b/drivers/input/touchscreen/mcs5000_ts.c index b528511861c..f9f4e0c56ed 100644 --- a/drivers/input/touchscreen/mcs5000_ts.c +++ b/drivers/input/touchscreen/mcs5000_ts.c | |||
@@ -187,7 +187,7 @@ static void mcs5000_ts_phys_init(struct mcs5000_ts_data *data) | |||
187 | OP_MODE_ACTIVE | REPORT_RATE_80); | 187 | OP_MODE_ACTIVE | REPORT_RATE_80); |
188 | } | 188 | } |
189 | 189 | ||
190 | static int __devinit mcs5000_ts_probe(struct i2c_client *client, | 190 | static int mcs5000_ts_probe(struct i2c_client *client, |
191 | const struct i2c_device_id *id) | 191 | const struct i2c_device_id *id) |
192 | { | 192 | { |
193 | struct mcs5000_ts_data *data; | 193 | struct mcs5000_ts_data *data; |
@@ -249,7 +249,7 @@ err_free_mem: | |||
249 | return ret; | 249 | return ret; |
250 | } | 250 | } |
251 | 251 | ||
252 | static int __devexit mcs5000_ts_remove(struct i2c_client *client) | 252 | static int mcs5000_ts_remove(struct i2c_client *client) |
253 | { | 253 | { |
254 | struct mcs5000_ts_data *data = i2c_get_clientdata(client); | 254 | struct mcs5000_ts_data *data = i2c_get_clientdata(client); |
255 | 255 | ||
@@ -292,7 +292,7 @@ MODULE_DEVICE_TABLE(i2c, mcs5000_ts_id); | |||
292 | 292 | ||
293 | static struct i2c_driver mcs5000_ts_driver = { | 293 | static struct i2c_driver mcs5000_ts_driver = { |
294 | .probe = mcs5000_ts_probe, | 294 | .probe = mcs5000_ts_probe, |
295 | .remove = __devexit_p(mcs5000_ts_remove), | 295 | .remove = mcs5000_ts_remove, |
296 | .driver = { | 296 | .driver = { |
297 | .name = "mcs5000_ts", | 297 | .name = "mcs5000_ts", |
298 | #ifdef CONFIG_PM | 298 | #ifdef CONFIG_PM |
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 560cf09d1c5..98841d8aa63 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
13 | #include <linux/of.h> | ||
13 | #include <linux/i2c.h> | 14 | #include <linux/i2c.h> |
14 | #include <linux/i2c/mms114.h> | 15 | #include <linux/i2c/mms114.h> |
15 | #include <linux/input/mt.h> | 16 | #include <linux/input/mt.h> |
@@ -360,14 +361,63 @@ static void mms114_input_close(struct input_dev *dev) | |||
360 | mms114_stop(data); | 361 | mms114_stop(data); |
361 | } | 362 | } |
362 | 363 | ||
363 | static int __devinit mms114_probe(struct i2c_client *client, | 364 | #ifdef CONFIG_OF |
365 | static struct mms114_platform_data *mms114_parse_dt(struct device *dev) | ||
366 | { | ||
367 | struct mms114_platform_data *pdata; | ||
368 | struct device_node *np = dev->of_node; | ||
369 | |||
370 | if (!np) | ||
371 | return NULL; | ||
372 | |||
373 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | ||
374 | if (!pdata) { | ||
375 | dev_err(dev, "failed to allocate platform data\n"); | ||
376 | return NULL; | ||
377 | } | ||
378 | |||
379 | if (of_property_read_u32(np, "x-size", &pdata->x_size)) { | ||
380 | dev_err(dev, "failed to get x-size property\n"); | ||
381 | return NULL; | ||
382 | }; | ||
383 | |||
384 | if (of_property_read_u32(np, "y-size", &pdata->y_size)) { | ||
385 | dev_err(dev, "failed to get y-size property\n"); | ||
386 | return NULL; | ||
387 | }; | ||
388 | |||
389 | of_property_read_u32(np, "contact-threshold", | ||
390 | &pdata->contact_threshold); | ||
391 | of_property_read_u32(np, "moving-threshold", | ||
392 | &pdata->moving_threshold); | ||
393 | |||
394 | if (of_find_property(np, "x-invert", NULL)) | ||
395 | pdata->x_invert = true; | ||
396 | if (of_find_property(np, "y-invert", NULL)) | ||
397 | pdata->y_invert = true; | ||
398 | |||
399 | return pdata; | ||
400 | } | ||
401 | #else | ||
402 | static inline struct mms114_platform_data *mms114_parse_dt(struct device *dev) | ||
403 | { | ||
404 | return NULL; | ||
405 | } | ||
406 | #endif | ||
407 | |||
408 | static int mms114_probe(struct i2c_client *client, | ||
364 | const struct i2c_device_id *id) | 409 | const struct i2c_device_id *id) |
365 | { | 410 | { |
411 | const struct mms114_platform_data *pdata; | ||
366 | struct mms114_data *data; | 412 | struct mms114_data *data; |
367 | struct input_dev *input_dev; | 413 | struct input_dev *input_dev; |
368 | int error; | 414 | int error; |
369 | 415 | ||
370 | if (!client->dev.platform_data) { | 416 | pdata = dev_get_platdata(&client->dev); |
417 | if (!pdata) | ||
418 | pdata = mms114_parse_dt(&client->dev); | ||
419 | |||
420 | if (!pdata) { | ||
371 | dev_err(&client->dev, "Need platform data\n"); | 421 | dev_err(&client->dev, "Need platform data\n"); |
372 | return -EINVAL; | 422 | return -EINVAL; |
373 | } | 423 | } |
@@ -389,7 +439,7 @@ static int __devinit mms114_probe(struct i2c_client *client, | |||
389 | 439 | ||
390 | data->client = client; | 440 | data->client = client; |
391 | data->input_dev = input_dev; | 441 | data->input_dev = input_dev; |
392 | data->pdata = client->dev.platform_data; | 442 | data->pdata = pdata; |
393 | 443 | ||
394 | input_dev->name = "MELPAS MMS114 Touchscreen"; | 444 | input_dev->name = "MELPAS MMS114 Touchscreen"; |
395 | input_dev->id.bustype = BUS_I2C; | 445 | input_dev->id.bustype = BUS_I2C; |
@@ -458,7 +508,7 @@ err_free_mem: | |||
458 | return error; | 508 | return error; |
459 | } | 509 | } |
460 | 510 | ||
461 | static int __devexit mms114_remove(struct i2c_client *client) | 511 | static int mms114_remove(struct i2c_client *client) |
462 | { | 512 | { |
463 | struct mms114_data *data = i2c_get_clientdata(client); | 513 | struct mms114_data *data = i2c_get_clientdata(client); |
464 | 514 | ||
@@ -525,14 +575,22 @@ static const struct i2c_device_id mms114_id[] = { | |||
525 | }; | 575 | }; |
526 | MODULE_DEVICE_TABLE(i2c, mms114_id); | 576 | MODULE_DEVICE_TABLE(i2c, mms114_id); |
527 | 577 | ||
578 | #ifdef CONFIG_OF | ||
579 | static struct of_device_id mms114_dt_match[] = { | ||
580 | { .compatible = "melfas,mms114" }, | ||
581 | { } | ||
582 | }; | ||
583 | #endif | ||
584 | |||
528 | static struct i2c_driver mms114_driver = { | 585 | static struct i2c_driver mms114_driver = { |
529 | .driver = { | 586 | .driver = { |
530 | .name = "mms114", | 587 | .name = "mms114", |
531 | .owner = THIS_MODULE, | 588 | .owner = THIS_MODULE, |
532 | .pm = &mms114_pm_ops, | 589 | .pm = &mms114_pm_ops, |
590 | .of_match_table = of_match_ptr(mms114_dt_match), | ||
533 | }, | 591 | }, |
534 | .probe = mms114_probe, | 592 | .probe = mms114_probe, |
535 | .remove = __devexit_p(mms114_remove), | 593 | .remove = mms114_remove, |
536 | .id_table = mms114_id, | 594 | .id_table = mms114_id, |
537 | }; | 595 | }; |
538 | 596 | ||
diff --git a/drivers/input/touchscreen/pcap_ts.c b/drivers/input/touchscreen/pcap_ts.c index f57aeb80f7e..f22e04dd4e1 100644 --- a/drivers/input/touchscreen/pcap_ts.c +++ b/drivers/input/touchscreen/pcap_ts.c | |||
@@ -137,7 +137,7 @@ static void pcap_ts_close(struct input_dev *dev) | |||
137 | pcap_ts->read_state << PCAP_ADC_TS_M_SHIFT); | 137 | pcap_ts->read_state << PCAP_ADC_TS_M_SHIFT); |
138 | } | 138 | } |
139 | 139 | ||
140 | static int __devinit pcap_ts_probe(struct platform_device *pdev) | 140 | static int pcap_ts_probe(struct platform_device *pdev) |
141 | { | 141 | { |
142 | struct input_dev *input_dev; | 142 | struct input_dev *input_dev; |
143 | struct pcap_ts *pcap_ts; | 143 | struct pcap_ts *pcap_ts; |
@@ -202,7 +202,7 @@ fail: | |||
202 | return err; | 202 | return err; |
203 | } | 203 | } |
204 | 204 | ||
205 | static int __devexit pcap_ts_remove(struct platform_device *pdev) | 205 | static int pcap_ts_remove(struct platform_device *pdev) |
206 | { | 206 | { |
207 | struct pcap_ts *pcap_ts = platform_get_drvdata(pdev); | 207 | struct pcap_ts *pcap_ts = platform_get_drvdata(pdev); |
208 | 208 | ||
@@ -245,7 +245,7 @@ static const struct dev_pm_ops pcap_ts_pm_ops = { | |||
245 | 245 | ||
246 | static struct platform_driver pcap_ts_driver = { | 246 | static struct platform_driver pcap_ts_driver = { |
247 | .probe = pcap_ts_probe, | 247 | .probe = pcap_ts_probe, |
248 | .remove = __devexit_p(pcap_ts_remove), | 248 | .remove = pcap_ts_remove, |
249 | .driver = { | 249 | .driver = { |
250 | .name = "pcap-ts", | 250 | .name = "pcap-ts", |
251 | .owner = THIS_MODULE, | 251 | .owner = THIS_MODULE, |
diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c index 953b4c105ca..6cc6b36663f 100644 --- a/drivers/input/touchscreen/pixcir_i2c_ts.c +++ b/drivers/input/touchscreen/pixcir_i2c_ts.c | |||
@@ -125,7 +125,7 @@ static int pixcir_i2c_ts_resume(struct device *dev) | |||
125 | static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops, | 125 | static SIMPLE_DEV_PM_OPS(pixcir_dev_pm_ops, |
126 | pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume); | 126 | pixcir_i2c_ts_suspend, pixcir_i2c_ts_resume); |
127 | 127 | ||
128 | static int __devinit pixcir_i2c_ts_probe(struct i2c_client *client, | 128 | static int pixcir_i2c_ts_probe(struct i2c_client *client, |
129 | const struct i2c_device_id *id) | 129 | const struct i2c_device_id *id) |
130 | { | 130 | { |
131 | const struct pixcir_ts_platform_data *pdata = client->dev.platform_data; | 131 | const struct pixcir_ts_platform_data *pdata = client->dev.platform_data; |
@@ -189,7 +189,7 @@ err_free_mem: | |||
189 | return error; | 189 | return error; |
190 | } | 190 | } |
191 | 191 | ||
192 | static int __devexit pixcir_i2c_ts_remove(struct i2c_client *client) | 192 | static int pixcir_i2c_ts_remove(struct i2c_client *client) |
193 | { | 193 | { |
194 | struct pixcir_i2c_ts_data *tsdata = i2c_get_clientdata(client); | 194 | struct pixcir_i2c_ts_data *tsdata = i2c_get_clientdata(client); |
195 | 195 | ||
@@ -218,7 +218,7 @@ static struct i2c_driver pixcir_i2c_ts_driver = { | |||
218 | .pm = &pixcir_dev_pm_ops, | 218 | .pm = &pixcir_dev_pm_ops, |
219 | }, | 219 | }, |
220 | .probe = pixcir_i2c_ts_probe, | 220 | .probe = pixcir_i2c_ts_probe, |
221 | .remove = __devexit_p(pixcir_i2c_ts_remove), | 221 | .remove = pixcir_i2c_ts_remove, |
222 | .id_table = pixcir_i2c_ts_id, | 222 | .id_table = pixcir_i2c_ts_id, |
223 | }; | 223 | }; |
224 | 224 | ||
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c index 549fa29548f..b061af2c837 100644 --- a/drivers/input/touchscreen/s3c2410_ts.c +++ b/drivers/input/touchscreen/s3c2410_ts.c | |||
@@ -238,7 +238,7 @@ static void s3c24xx_ts_select(struct s3c_adc_client *client, unsigned select) | |||
238 | * Initialise, find and allocate any resources we need to run and then | 238 | * Initialise, find and allocate any resources we need to run and then |
239 | * register with the ADC and input systems. | 239 | * register with the ADC and input systems. |
240 | */ | 240 | */ |
241 | static int __devinit s3c2410ts_probe(struct platform_device *pdev) | 241 | static int s3c2410ts_probe(struct platform_device *pdev) |
242 | { | 242 | { |
243 | struct s3c2410_ts_mach_info *info; | 243 | struct s3c2410_ts_mach_info *info; |
244 | struct device *dev = &pdev->dev; | 244 | struct device *dev = &pdev->dev; |
@@ -365,7 +365,7 @@ static int __devinit s3c2410ts_probe(struct platform_device *pdev) | |||
365 | * | 365 | * |
366 | * Free up our state ready to be removed. | 366 | * Free up our state ready to be removed. |
367 | */ | 367 | */ |
368 | static int __devexit s3c2410ts_remove(struct platform_device *pdev) | 368 | static int s3c2410ts_remove(struct platform_device *pdev) |
369 | { | 369 | { |
370 | free_irq(ts.irq_tc, ts.input); | 370 | free_irq(ts.irq_tc, ts.input); |
371 | del_timer_sync(&touch_timer); | 371 | del_timer_sync(&touch_timer); |
@@ -430,7 +430,7 @@ static struct platform_driver s3c_ts_driver = { | |||
430 | }, | 430 | }, |
431 | .id_table = s3cts_driver_ids, | 431 | .id_table = s3cts_driver_ids, |
432 | .probe = s3c2410ts_probe, | 432 | .probe = s3c2410ts_probe, |
433 | .remove = __devexit_p(s3c2410ts_remove), | 433 | .remove = s3c2410ts_remove, |
434 | }; | 434 | }; |
435 | module_platform_driver(s3c_ts_driver); | 435 | module_platform_driver(s3c_ts_driver); |
436 | 436 | ||
diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index 6cb68a1981b..d9d05e22242 100644 --- a/drivers/input/touchscreen/st1232.c +++ b/drivers/input/touchscreen/st1232.c | |||
@@ -139,7 +139,7 @@ end: | |||
139 | return IRQ_HANDLED; | 139 | return IRQ_HANDLED; |
140 | } | 140 | } |
141 | 141 | ||
142 | static int __devinit st1232_ts_probe(struct i2c_client *client, | 142 | static int st1232_ts_probe(struct i2c_client *client, |
143 | const struct i2c_device_id *id) | 143 | const struct i2c_device_id *id) |
144 | { | 144 | { |
145 | struct st1232_ts_data *ts; | 145 | struct st1232_ts_data *ts; |
@@ -206,7 +206,7 @@ err_free_mem: | |||
206 | return error; | 206 | return error; |
207 | } | 207 | } |
208 | 208 | ||
209 | static int __devexit st1232_ts_remove(struct i2c_client *client) | 209 | static int st1232_ts_remove(struct i2c_client *client) |
210 | { | 210 | { |
211 | struct st1232_ts_data *ts = i2c_get_clientdata(client); | 211 | struct st1232_ts_data *ts = i2c_get_clientdata(client); |
212 | 212 | ||
@@ -255,7 +255,7 @@ static const struct i2c_device_id st1232_ts_id[] = { | |||
255 | MODULE_DEVICE_TABLE(i2c, st1232_ts_id); | 255 | MODULE_DEVICE_TABLE(i2c, st1232_ts_id); |
256 | 256 | ||
257 | #ifdef CONFIG_OF | 257 | #ifdef CONFIG_OF |
258 | static const struct of_device_id st1232_ts_dt_ids[] __devinitconst = { | 258 | static const struct of_device_id st1232_ts_dt_ids[] = { |
259 | { .compatible = "sitronix,st1232", }, | 259 | { .compatible = "sitronix,st1232", }, |
260 | { } | 260 | { } |
261 | }; | 261 | }; |
@@ -264,7 +264,7 @@ MODULE_DEVICE_TABLE(of, st1232_ts_dt_ids); | |||
264 | 264 | ||
265 | static struct i2c_driver st1232_ts_driver = { | 265 | static struct i2c_driver st1232_ts_driver = { |
266 | .probe = st1232_ts_probe, | 266 | .probe = st1232_ts_probe, |
267 | .remove = __devexit_p(st1232_ts_remove), | 267 | .remove = st1232_ts_remove, |
268 | .id_table = st1232_ts_id, | 268 | .id_table = st1232_ts_id, |
269 | .driver = { | 269 | .driver = { |
270 | .name = ST1232_TS_NAME, | 270 | .name = ST1232_TS_NAME, |
diff --git a/drivers/input/touchscreen/stmpe-ts.c b/drivers/input/touchscreen/stmpe-ts.c index 692b685720c..84d884b4ec3 100644 --- a/drivers/input/touchscreen/stmpe-ts.c +++ b/drivers/input/touchscreen/stmpe-ts.c | |||
@@ -1,4 +1,5 @@ | |||
1 | /* STMicroelectronics STMPE811 Touchscreen Driver | 1 | /* |
2 | * STMicroelectronics STMPE811 Touchscreen Driver | ||
2 | * | 3 | * |
3 | * (C) 2010 Luotao Fu <l.fu@pengutronix.de> | 4 | * (C) 2010 Luotao Fu <l.fu@pengutronix.de> |
4 | * All rights reserved. | 5 | * All rights reserved. |
@@ -16,6 +17,7 @@ | |||
16 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
17 | #include <linux/init.h> | 18 | #include <linux/init.h> |
18 | #include <linux/device.h> | 19 | #include <linux/device.h> |
20 | #include <linux/of.h> | ||
19 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
20 | #include <linux/input.h> | 22 | #include <linux/input.h> |
21 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
@@ -166,7 +168,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data) | |||
166 | return IRQ_HANDLED; | 168 | return IRQ_HANDLED; |
167 | } | 169 | } |
168 | 170 | ||
169 | static int __devinit stmpe_init_hw(struct stmpe_touch *ts) | 171 | static int stmpe_init_hw(struct stmpe_touch *ts) |
170 | { | 172 | { |
171 | int ret; | 173 | int ret; |
172 | u8 adc_ctrl1, adc_ctrl1_mask, tsc_cfg, tsc_cfg_mask; | 174 | u8 adc_ctrl1, adc_ctrl1_mask, tsc_cfg, tsc_cfg_mask; |
@@ -261,41 +263,18 @@ static void stmpe_ts_close(struct input_dev *dev) | |||
261 | STMPE_TSC_CTRL_TSC_EN, 0); | 263 | STMPE_TSC_CTRL_TSC_EN, 0); |
262 | } | 264 | } |
263 | 265 | ||
264 | static int __devinit stmpe_input_probe(struct platform_device *pdev) | 266 | static void stmpe_ts_get_platform_info(struct platform_device *pdev, |
267 | struct stmpe_touch *ts) | ||
265 | { | 268 | { |
266 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); | 269 | struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); |
267 | struct stmpe_platform_data *pdata = stmpe->pdata; | 270 | struct device_node *np = pdev->dev.of_node; |
268 | struct stmpe_touch *ts; | ||
269 | struct input_dev *idev; | ||
270 | struct stmpe_ts_platform_data *ts_pdata = NULL; | 271 | struct stmpe_ts_platform_data *ts_pdata = NULL; |
271 | int ret; | ||
272 | int ts_irq; | ||
273 | |||
274 | ts_irq = platform_get_irq_byname(pdev, "FIFO_TH"); | ||
275 | if (ts_irq < 0) | ||
276 | return ts_irq; | ||
277 | |||
278 | ts = kzalloc(sizeof(*ts), GFP_KERNEL); | ||
279 | if (!ts) { | ||
280 | ret = -ENOMEM; | ||
281 | goto err_out; | ||
282 | } | ||
283 | 272 | ||
284 | idev = input_allocate_device(); | ||
285 | if (!idev) { | ||
286 | ret = -ENOMEM; | ||
287 | goto err_free_ts; | ||
288 | } | ||
289 | |||
290 | platform_set_drvdata(pdev, ts); | ||
291 | ts->stmpe = stmpe; | 273 | ts->stmpe = stmpe; |
292 | ts->idev = idev; | ||
293 | ts->dev = &pdev->dev; | ||
294 | 274 | ||
295 | if (pdata) | 275 | if (stmpe->pdata && stmpe->pdata->ts) { |
296 | ts_pdata = pdata->ts; | 276 | ts_pdata = stmpe->pdata->ts; |
297 | 277 | ||
298 | if (ts_pdata) { | ||
299 | ts->sample_time = ts_pdata->sample_time; | 278 | ts->sample_time = ts_pdata->sample_time; |
300 | ts->mod_12b = ts_pdata->mod_12b; | 279 | ts->mod_12b = ts_pdata->mod_12b; |
301 | ts->ref_sel = ts_pdata->ref_sel; | 280 | ts->ref_sel = ts_pdata->ref_sel; |
@@ -305,22 +284,71 @@ static int __devinit stmpe_input_probe(struct platform_device *pdev) | |||
305 | ts->settling = ts_pdata->settling; | 284 | ts->settling = ts_pdata->settling; |
306 | ts->fraction_z = ts_pdata->fraction_z; | 285 | ts->fraction_z = ts_pdata->fraction_z; |
307 | ts->i_drive = ts_pdata->i_drive; | 286 | ts->i_drive = ts_pdata->i_drive; |
287 | } else if (np) { | ||
288 | u32 val; | ||
289 | |||
290 | if (!of_property_read_u32(np, "st,sample-time", &val)) | ||
291 | ts->sample_time = val; | ||
292 | if (!of_property_read_u32(np, "st,mod-12b", &val)) | ||
293 | ts->mod_12b = val; | ||
294 | if (!of_property_read_u32(np, "st,ref-sel", &val)) | ||
295 | ts->ref_sel = val; | ||
296 | if (!of_property_read_u32(np, "st,adc-freq", &val)) | ||
297 | ts->adc_freq = val; | ||
298 | if (!of_property_read_u32(np, "st,ave-ctrl", &val)) | ||
299 | ts->ave_ctrl = val; | ||
300 | if (!of_property_read_u32(np, "st,touch-det-delay", &val)) | ||
301 | ts->touch_det_delay = val; | ||
302 | if (!of_property_read_u32(np, "st,settling", &val)) | ||
303 | ts->settling = val; | ||
304 | if (!of_property_read_u32(np, "st,fraction-z", &val)) | ||
305 | ts->fraction_z = val; | ||
306 | if (!of_property_read_u32(np, "st,i-drive", &val)) | ||
307 | ts->i_drive = val; | ||
308 | } | 308 | } |
309 | } | ||
310 | |||
311 | static int stmpe_input_probe(struct platform_device *pdev) | ||
312 | { | ||
313 | struct stmpe_touch *ts; | ||
314 | struct input_dev *idev; | ||
315 | int error; | ||
316 | int ts_irq; | ||
317 | |||
318 | ts_irq = platform_get_irq_byname(pdev, "FIFO_TH"); | ||
319 | if (ts_irq < 0) | ||
320 | return ts_irq; | ||
321 | |||
322 | ts = devm_kzalloc(&pdev->dev, sizeof(*ts), GFP_KERNEL); | ||
323 | if (!ts) | ||
324 | return -ENOMEM; | ||
325 | |||
326 | idev = devm_input_allocate_device(&pdev->dev); | ||
327 | if (!idev) | ||
328 | return -ENOMEM; | ||
329 | |||
330 | platform_set_drvdata(pdev, ts); | ||
331 | ts->idev = idev; | ||
332 | ts->dev = &pdev->dev; | ||
333 | |||
334 | stmpe_ts_get_platform_info(pdev, ts); | ||
309 | 335 | ||
310 | INIT_DELAYED_WORK(&ts->work, stmpe_work); | 336 | INIT_DELAYED_WORK(&ts->work, stmpe_work); |
311 | 337 | ||
312 | ret = request_threaded_irq(ts_irq, NULL, stmpe_ts_handler, | 338 | error = devm_request_threaded_irq(&pdev->dev, ts_irq, |
313 | IRQF_ONESHOT, STMPE_TS_NAME, ts); | 339 | NULL, stmpe_ts_handler, |
314 | if (ret) { | 340 | IRQF_ONESHOT, STMPE_TS_NAME, ts); |
341 | if (error) { | ||
315 | dev_err(&pdev->dev, "Failed to request IRQ %d\n", ts_irq); | 342 | dev_err(&pdev->dev, "Failed to request IRQ %d\n", ts_irq); |
316 | goto err_free_input; | 343 | return error; |
317 | } | 344 | } |
318 | 345 | ||
319 | ret = stmpe_init_hw(ts); | 346 | error = stmpe_init_hw(ts); |
320 | if (ret) | 347 | if (error) |
321 | goto err_free_irq; | 348 | return error; |
322 | 349 | ||
323 | idev->name = STMPE_TS_NAME; | 350 | idev->name = STMPE_TS_NAME; |
351 | idev->phys = STMPE_TS_NAME"/input0"; | ||
324 | idev->id.bustype = BUS_I2C; | 352 | idev->id.bustype = BUS_I2C; |
325 | idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | 353 | idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); |
326 | idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); | 354 | idev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); |
@@ -334,40 +362,21 @@ static int __devinit stmpe_input_probe(struct platform_device *pdev) | |||
334 | input_set_abs_params(idev, ABS_Y, 0, XY_MASK, 0, 0); | 362 | input_set_abs_params(idev, ABS_Y, 0, XY_MASK, 0, 0); |
335 | input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0); | 363 | input_set_abs_params(idev, ABS_PRESSURE, 0x0, 0xff, 0, 0); |
336 | 364 | ||
337 | ret = input_register_device(idev); | 365 | error = input_register_device(idev); |
338 | if (ret) { | 366 | if (error) { |
339 | dev_err(&pdev->dev, "Could not register input device\n"); | 367 | dev_err(&pdev->dev, "Could not register input device\n"); |
340 | goto err_free_irq; | 368 | return error; |
341 | } | 369 | } |
342 | 370 | ||
343 | return ret; | 371 | return 0; |
344 | |||
345 | err_free_irq: | ||
346 | free_irq(ts_irq, ts); | ||
347 | err_free_input: | ||
348 | input_free_device(idev); | ||
349 | platform_set_drvdata(pdev, NULL); | ||
350 | err_free_ts: | ||
351 | kfree(ts); | ||
352 | err_out: | ||
353 | return ret; | ||
354 | } | 372 | } |
355 | 373 | ||
356 | static int __devexit stmpe_ts_remove(struct platform_device *pdev) | 374 | static int stmpe_ts_remove(struct platform_device *pdev) |
357 | { | 375 | { |
358 | struct stmpe_touch *ts = platform_get_drvdata(pdev); | 376 | struct stmpe_touch *ts = platform_get_drvdata(pdev); |
359 | unsigned int ts_irq = platform_get_irq_byname(pdev, "FIFO_TH"); | ||
360 | 377 | ||
361 | stmpe_disable(ts->stmpe, STMPE_BLOCK_TOUCHSCREEN); | 378 | stmpe_disable(ts->stmpe, STMPE_BLOCK_TOUCHSCREEN); |
362 | 379 | ||
363 | free_irq(ts_irq, ts); | ||
364 | |||
365 | platform_set_drvdata(pdev, NULL); | ||
366 | |||
367 | input_unregister_device(ts->idev); | ||
368 | |||
369 | kfree(ts); | ||
370 | |||
371 | return 0; | 380 | return 0; |
372 | } | 381 | } |
373 | 382 | ||
@@ -377,7 +386,7 @@ static struct platform_driver stmpe_ts_driver = { | |||
377 | .owner = THIS_MODULE, | 386 | .owner = THIS_MODULE, |
378 | }, | 387 | }, |
379 | .probe = stmpe_input_probe, | 388 | .probe = stmpe_input_probe, |
380 | .remove = __devexit_p(stmpe_ts_remove), | 389 | .remove = stmpe_ts_remove, |
381 | }; | 390 | }; |
382 | module_platform_driver(stmpe_ts_driver); | 391 | module_platform_driver(stmpe_ts_driver); |
383 | 392 | ||
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c index d229c741d54..bcedf2e7468 100644 --- a/drivers/input/touchscreen/ti_tscadc.c +++ b/drivers/input/touchscreen/ti_tscadc.c | |||
@@ -303,7 +303,7 @@ static irqreturn_t tscadc_irq(int irq, void *dev) | |||
303 | * The functions for inserting/removing driver as a module. | 303 | * The functions for inserting/removing driver as a module. |
304 | */ | 304 | */ |
305 | 305 | ||
306 | static int __devinit tscadc_probe(struct platform_device *pdev) | 306 | static int tscadc_probe(struct platform_device *pdev) |
307 | { | 307 | { |
308 | const struct tsc_data *pdata = pdev->dev.platform_data; | 308 | const struct tsc_data *pdata = pdev->dev.platform_data; |
309 | struct resource *res; | 309 | struct resource *res; |
diff --git a/drivers/input/touchscreen/tnetv107x-ts.c b/drivers/input/touchscreen/tnetv107x-ts.c index 368d2c6cf78..acfb87607b8 100644 --- a/drivers/input/touchscreen/tnetv107x-ts.c +++ b/drivers/input/touchscreen/tnetv107x-ts.c | |||
@@ -243,7 +243,7 @@ static void tsc_stop(struct input_dev *dev) | |||
243 | clk_disable(ts->clk); | 243 | clk_disable(ts->clk); |
244 | } | 244 | } |
245 | 245 | ||
246 | static int __devinit tsc_probe(struct platform_device *pdev) | 246 | static int tsc_probe(struct platform_device *pdev) |
247 | { | 247 | { |
248 | struct device *dev = &pdev->dev; | 248 | struct device *dev = &pdev->dev; |
249 | struct tsc_data *ts; | 249 | struct tsc_data *ts; |
@@ -357,7 +357,7 @@ error_res: | |||
357 | return error; | 357 | return error; |
358 | } | 358 | } |
359 | 359 | ||
360 | static int __devexit tsc_remove(struct platform_device *pdev) | 360 | static int tsc_remove(struct platform_device *pdev) |
361 | { | 361 | { |
362 | struct tsc_data *ts = platform_get_drvdata(pdev); | 362 | struct tsc_data *ts = platform_get_drvdata(pdev); |
363 | 363 | ||
@@ -374,7 +374,7 @@ static int __devexit tsc_remove(struct platform_device *pdev) | |||
374 | 374 | ||
375 | static struct platform_driver tsc_driver = { | 375 | static struct platform_driver tsc_driver = { |
376 | .probe = tsc_probe, | 376 | .probe = tsc_probe, |
377 | .remove = __devexit_p(tsc_remove), | 377 | .remove = tsc_remove, |
378 | .driver.name = "tnetv107x-ts", | 378 | .driver.name = "tnetv107x-ts", |
379 | .driver.owner = THIS_MODULE, | 379 | .driver.owner = THIS_MODULE, |
380 | }; | 380 | }; |
diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index f7eda3d00fa..820a066c3b8 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c | |||
@@ -345,7 +345,7 @@ err0: | |||
345 | return error; | 345 | return error; |
346 | } | 346 | } |
347 | 347 | ||
348 | static int __devexit tps6507x_ts_remove(struct platform_device *pdev) | 348 | static int tps6507x_ts_remove(struct platform_device *pdev) |
349 | { | 349 | { |
350 | struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev); | 350 | struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev); |
351 | struct tps6507x_ts *tsc = tps6507x_dev->ts; | 351 | struct tps6507x_ts *tsc = tps6507x_dev->ts; |
@@ -367,7 +367,7 @@ static struct platform_driver tps6507x_ts_driver = { | |||
367 | .owner = THIS_MODULE, | 367 | .owner = THIS_MODULE, |
368 | }, | 368 | }, |
369 | .probe = tps6507x_ts_probe, | 369 | .probe = tps6507x_ts_probe, |
370 | .remove = __devexit_p(tps6507x_ts_remove), | 370 | .remove = tps6507x_ts_remove, |
371 | }; | 371 | }; |
372 | module_platform_driver(tps6507x_ts_driver); | 372 | module_platform_driver(tps6507x_ts_driver); |
373 | 373 | ||
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c index 5ce3fa8ce64..9c0cdc7ea44 100644 --- a/drivers/input/touchscreen/tsc2005.c +++ b/drivers/input/touchscreen/tsc2005.c | |||
@@ -555,7 +555,7 @@ static void tsc2005_close(struct input_dev *input) | |||
555 | mutex_unlock(&ts->mutex); | 555 | mutex_unlock(&ts->mutex); |
556 | } | 556 | } |
557 | 557 | ||
558 | static void __devinit tsc2005_setup_spi_xfer(struct tsc2005 *ts) | 558 | static void tsc2005_setup_spi_xfer(struct tsc2005 *ts) |
559 | { | 559 | { |
560 | tsc2005_setup_read(&ts->spi_x, TSC2005_REG_X, false); | 560 | tsc2005_setup_read(&ts->spi_x, TSC2005_REG_X, false); |
561 | tsc2005_setup_read(&ts->spi_y, TSC2005_REG_Y, false); | 561 | tsc2005_setup_read(&ts->spi_y, TSC2005_REG_Y, false); |
@@ -569,7 +569,7 @@ static void __devinit tsc2005_setup_spi_xfer(struct tsc2005 *ts) | |||
569 | spi_message_add_tail(&ts->spi_z2.spi_xfer, &ts->spi_read_msg); | 569 | spi_message_add_tail(&ts->spi_z2.spi_xfer, &ts->spi_read_msg); |
570 | } | 570 | } |
571 | 571 | ||
572 | static int __devinit tsc2005_probe(struct spi_device *spi) | 572 | static int tsc2005_probe(struct spi_device *spi) |
573 | { | 573 | { |
574 | const struct tsc2005_platform_data *pdata = spi->dev.platform_data; | 574 | const struct tsc2005_platform_data *pdata = spi->dev.platform_data; |
575 | struct tsc2005 *ts; | 575 | struct tsc2005 *ts; |
@@ -686,7 +686,7 @@ err_free_mem: | |||
686 | return error; | 686 | return error; |
687 | } | 687 | } |
688 | 688 | ||
689 | static int __devexit tsc2005_remove(struct spi_device *spi) | 689 | static int tsc2005_remove(struct spi_device *spi) |
690 | { | 690 | { |
691 | struct tsc2005 *ts = spi_get_drvdata(spi); | 691 | struct tsc2005 *ts = spi_get_drvdata(spi); |
692 | 692 | ||
@@ -745,7 +745,7 @@ static struct spi_driver tsc2005_driver = { | |||
745 | .pm = &tsc2005_pm_ops, | 745 | .pm = &tsc2005_pm_ops, |
746 | }, | 746 | }, |
747 | .probe = tsc2005_probe, | 747 | .probe = tsc2005_probe, |
748 | .remove = __devexit_p(tsc2005_remove), | 748 | .remove = tsc2005_remove, |
749 | }; | 749 | }; |
750 | 750 | ||
751 | module_spi_driver(tsc2005_driver); | 751 | module_spi_driver(tsc2005_driver); |
diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 1473d2382af..0b67ba476b4 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c | |||
@@ -273,7 +273,7 @@ static void tsc2007_close(struct input_dev *input_dev) | |||
273 | tsc2007_stop(ts); | 273 | tsc2007_stop(ts); |
274 | } | 274 | } |
275 | 275 | ||
276 | static int __devinit tsc2007_probe(struct i2c_client *client, | 276 | static int tsc2007_probe(struct i2c_client *client, |
277 | const struct i2c_device_id *id) | 277 | const struct i2c_device_id *id) |
278 | { | 278 | { |
279 | struct tsc2007 *ts; | 279 | struct tsc2007 *ts; |
@@ -366,7 +366,7 @@ static int __devinit tsc2007_probe(struct i2c_client *client, | |||
366 | return err; | 366 | return err; |
367 | } | 367 | } |
368 | 368 | ||
369 | static int __devexit tsc2007_remove(struct i2c_client *client) | 369 | static int tsc2007_remove(struct i2c_client *client) |
370 | { | 370 | { |
371 | struct tsc2007 *ts = i2c_get_clientdata(client); | 371 | struct tsc2007 *ts = i2c_get_clientdata(client); |
372 | struct tsc2007_platform_data *pdata = client->dev.platform_data; | 372 | struct tsc2007_platform_data *pdata = client->dev.platform_data; |
@@ -396,7 +396,7 @@ static struct i2c_driver tsc2007_driver = { | |||
396 | }, | 396 | }, |
397 | .id_table = tsc2007_idtable, | 397 | .id_table = tsc2007_idtable, |
398 | .probe = tsc2007_probe, | 398 | .probe = tsc2007_probe, |
399 | .remove = __devexit_p(tsc2007_remove), | 399 | .remove = tsc2007_remove, |
400 | }; | 400 | }; |
401 | 401 | ||
402 | module_i2c_driver(tsc2007_driver); | 402 | module_i2c_driver(tsc2007_driver); |
diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 46e83ad53f4..1271f97b407 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c | |||
@@ -274,7 +274,7 @@ static void ucb1400_ts_close(struct input_dev *idev) | |||
274 | * Try to probe our interrupt, rather than relying on lots of | 274 | * Try to probe our interrupt, rather than relying on lots of |
275 | * hard-coded machine dependencies. | 275 | * hard-coded machine dependencies. |
276 | */ | 276 | */ |
277 | static int __devinit ucb1400_ts_detect_irq(struct ucb1400_ts *ucb, | 277 | static int ucb1400_ts_detect_irq(struct ucb1400_ts *ucb, |
278 | struct platform_device *pdev) | 278 | struct platform_device *pdev) |
279 | { | 279 | { |
280 | unsigned long mask, timeout; | 280 | unsigned long mask, timeout; |
@@ -318,7 +318,7 @@ static int __devinit ucb1400_ts_detect_irq(struct ucb1400_ts *ucb, | |||
318 | return 0; | 318 | return 0; |
319 | } | 319 | } |
320 | 320 | ||
321 | static int __devinit ucb1400_ts_probe(struct platform_device *pdev) | 321 | static int ucb1400_ts_probe(struct platform_device *pdev) |
322 | { | 322 | { |
323 | struct ucb1400_ts *ucb = pdev->dev.platform_data; | 323 | struct ucb1400_ts *ucb = pdev->dev.platform_data; |
324 | int error, x_res, y_res; | 324 | int error, x_res, y_res; |
@@ -397,7 +397,7 @@ err: | |||
397 | return error; | 397 | return error; |
398 | } | 398 | } |
399 | 399 | ||
400 | static int __devexit ucb1400_ts_remove(struct platform_device *pdev) | 400 | static int ucb1400_ts_remove(struct platform_device *pdev) |
401 | { | 401 | { |
402 | struct ucb1400_ts *ucb = pdev->dev.platform_data; | 402 | struct ucb1400_ts *ucb = pdev->dev.platform_data; |
403 | 403 | ||
@@ -442,7 +442,7 @@ static SIMPLE_DEV_PM_OPS(ucb1400_ts_pm_ops, | |||
442 | 442 | ||
443 | static struct platform_driver ucb1400_ts_driver = { | 443 | static struct platform_driver ucb1400_ts_driver = { |
444 | .probe = ucb1400_ts_probe, | 444 | .probe = ucb1400_ts_probe, |
445 | .remove = __devexit_p(ucb1400_ts_remove), | 445 | .remove = ucb1400_ts_remove, |
446 | .driver = { | 446 | .driver = { |
447 | .name = "ucb1400_ts", | 447 | .name = "ucb1400_ts", |
448 | .owner = THIS_MODULE, | 448 | .owner = THIS_MODULE, |
diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c index 9396b21d0e8..d2ef8f05c66 100644 --- a/drivers/input/touchscreen/w90p910_ts.c +++ b/drivers/input/touchscreen/w90p910_ts.c | |||
@@ -215,7 +215,7 @@ static void w90p910_close(struct input_dev *dev) | |||
215 | clk_disable(w90p910_ts->clk); | 215 | clk_disable(w90p910_ts->clk); |
216 | } | 216 | } |
217 | 217 | ||
218 | static int __devinit w90x900ts_probe(struct platform_device *pdev) | 218 | static int w90x900ts_probe(struct platform_device *pdev) |
219 | { | 219 | { |
220 | struct w90p910_ts *w90p910_ts; | 220 | struct w90p910_ts *w90p910_ts; |
221 | struct input_dev *input_dev; | 221 | struct input_dev *input_dev; |
@@ -301,7 +301,7 @@ fail1: input_free_device(input_dev); | |||
301 | return err; | 301 | return err; |
302 | } | 302 | } |
303 | 303 | ||
304 | static int __devexit w90x900ts_remove(struct platform_device *pdev) | 304 | static int w90x900ts_remove(struct platform_device *pdev) |
305 | { | 305 | { |
306 | struct w90p910_ts *w90p910_ts = platform_get_drvdata(pdev); | 306 | struct w90p910_ts *w90p910_ts = platform_get_drvdata(pdev); |
307 | struct resource *res; | 307 | struct resource *res; |
@@ -325,7 +325,7 @@ static int __devexit w90x900ts_remove(struct platform_device *pdev) | |||
325 | 325 | ||
326 | static struct platform_driver w90x900ts_driver = { | 326 | static struct platform_driver w90x900ts_driver = { |
327 | .probe = w90x900ts_probe, | 327 | .probe = w90x900ts_probe, |
328 | .remove = __devexit_p(w90x900ts_remove), | 328 | .remove = w90x900ts_remove, |
329 | .driver = { | 329 | .driver = { |
330 | .name = "nuc900-ts", | 330 | .name = "nuc900-ts", |
331 | .owner = THIS_MODULE, | 331 | .owner = THIS_MODULE, |
diff --git a/drivers/input/touchscreen/wacom_i2c.c b/drivers/input/touchscreen/wacom_i2c.c index 0c01657132f..bf0d07620ba 100644 --- a/drivers/input/touchscreen/wacom_i2c.c +++ b/drivers/input/touchscreen/wacom_i2c.c | |||
@@ -144,7 +144,7 @@ static void wacom_i2c_close(struct input_dev *dev) | |||
144 | disable_irq(client->irq); | 144 | disable_irq(client->irq); |
145 | } | 145 | } |
146 | 146 | ||
147 | static int __devinit wacom_i2c_probe(struct i2c_client *client, | 147 | static int wacom_i2c_probe(struct i2c_client *client, |
148 | const struct i2c_device_id *id) | 148 | const struct i2c_device_id *id) |
149 | { | 149 | { |
150 | struct wacom_i2c *wac_i2c; | 150 | struct wacom_i2c *wac_i2c; |
@@ -225,7 +225,7 @@ err_free_mem: | |||
225 | return error; | 225 | return error; |
226 | } | 226 | } |
227 | 227 | ||
228 | static int __devexit wacom_i2c_remove(struct i2c_client *client) | 228 | static int wacom_i2c_remove(struct i2c_client *client) |
229 | { | 229 | { |
230 | struct wacom_i2c *wac_i2c = i2c_get_clientdata(client); | 230 | struct wacom_i2c *wac_i2c = i2c_get_clientdata(client); |
231 | 231 | ||
@@ -272,7 +272,7 @@ static struct i2c_driver wacom_i2c_driver = { | |||
272 | }, | 272 | }, |
273 | 273 | ||
274 | .probe = wacom_i2c_probe, | 274 | .probe = wacom_i2c_probe, |
275 | .remove = __devexit_p(wacom_i2c_remove), | 275 | .remove = wacom_i2c_remove, |
276 | .id_table = wacom_i2c_id, | 276 | .id_table = wacom_i2c_id, |
277 | }; | 277 | }; |
278 | module_i2c_driver(wacom_i2c_driver); | 278 | module_i2c_driver(wacom_i2c_driver); |
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c index 52abb98a8ae..f88fab56178 100644 --- a/drivers/input/touchscreen/wm831x-ts.c +++ b/drivers/input/touchscreen/wm831x-ts.c | |||
@@ -233,7 +233,7 @@ static void wm831x_ts_input_close(struct input_dev *idev) | |||
233 | } | 233 | } |
234 | } | 234 | } |
235 | 235 | ||
236 | static __devinit int wm831x_ts_probe(struct platform_device *pdev) | 236 | static int wm831x_ts_probe(struct platform_device *pdev) |
237 | { | 237 | { |
238 | struct wm831x_ts *wm831x_ts; | 238 | struct wm831x_ts *wm831x_ts; |
239 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); | 239 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); |
@@ -245,7 +245,8 @@ static __devinit int wm831x_ts_probe(struct platform_device *pdev) | |||
245 | if (core_pdata) | 245 | if (core_pdata) |
246 | pdata = core_pdata->touch; | 246 | pdata = core_pdata->touch; |
247 | 247 | ||
248 | wm831x_ts = kzalloc(sizeof(struct wm831x_ts), GFP_KERNEL); | 248 | wm831x_ts = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ts), |
249 | GFP_KERNEL); | ||
249 | input_dev = input_allocate_device(); | 250 | input_dev = input_allocate_device(); |
250 | if (!wm831x_ts || !input_dev) { | 251 | if (!wm831x_ts || !input_dev) { |
251 | error = -ENOMEM; | 252 | error = -ENOMEM; |
@@ -376,21 +377,18 @@ err_data_irq: | |||
376 | free_irq(wm831x_ts->data_irq, wm831x_ts); | 377 | free_irq(wm831x_ts->data_irq, wm831x_ts); |
377 | err_alloc: | 378 | err_alloc: |
378 | input_free_device(input_dev); | 379 | input_free_device(input_dev); |
379 | kfree(wm831x_ts); | ||
380 | 380 | ||
381 | return error; | 381 | return error; |
382 | } | 382 | } |
383 | 383 | ||
384 | static __devexit int wm831x_ts_remove(struct platform_device *pdev) | 384 | static int wm831x_ts_remove(struct platform_device *pdev) |
385 | { | 385 | { |
386 | struct wm831x_ts *wm831x_ts = platform_get_drvdata(pdev); | 386 | struct wm831x_ts *wm831x_ts = platform_get_drvdata(pdev); |
387 | 387 | ||
388 | free_irq(wm831x_ts->pd_irq, wm831x_ts); | 388 | free_irq(wm831x_ts->pd_irq, wm831x_ts); |
389 | free_irq(wm831x_ts->data_irq, wm831x_ts); | 389 | free_irq(wm831x_ts->data_irq, wm831x_ts); |
390 | input_unregister_device(wm831x_ts->input_dev); | 390 | input_unregister_device(wm831x_ts->input_dev); |
391 | kfree(wm831x_ts); | ||
392 | 391 | ||
393 | platform_set_drvdata(pdev, NULL); | ||
394 | return 0; | 392 | return 0; |
395 | } | 393 | } |
396 | 394 | ||
@@ -400,7 +398,7 @@ static struct platform_driver wm831x_ts_driver = { | |||
400 | .owner = THIS_MODULE, | 398 | .owner = THIS_MODULE, |
401 | }, | 399 | }, |
402 | .probe = wm831x_ts_probe, | 400 | .probe = wm831x_ts_probe, |
403 | .remove = __devexit_p(wm831x_ts_remove), | 401 | .remove = wm831x_ts_remove, |
404 | }; | 402 | }; |
405 | module_platform_driver(wm831x_ts_driver); | 403 | module_platform_driver(wm831x_ts_driver); |
406 | 404 | ||
diff --git a/drivers/md/faulty.c b/drivers/md/faulty.c index 45135f69509..5e7dc772f5d 100644 --- a/drivers/md/faulty.c +++ b/drivers/md/faulty.c | |||
@@ -315,8 +315,11 @@ static int run(struct mddev *mddev) | |||
315 | } | 315 | } |
316 | conf->nfaults = 0; | 316 | conf->nfaults = 0; |
317 | 317 | ||
318 | rdev_for_each(rdev, mddev) | 318 | rdev_for_each(rdev, mddev) { |
319 | conf->rdev = rdev; | 319 | conf->rdev = rdev; |
320 | disk_stack_limits(mddev->gendisk, rdev->bdev, | ||
321 | rdev->data_offset << 9); | ||
322 | } | ||
320 | 323 | ||
321 | md_set_array_sectors(mddev, faulty_size(mddev, 0, 0)); | 324 | md_set_array_sectors(mddev, faulty_size(mddev, 0, 0)); |
322 | mddev->private = conf; | 325 | mddev->private = conf; |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 8034fbd6190..636bae0405e 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -2710,7 +2710,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) | |||
2710 | || disk_idx < 0) | 2710 | || disk_idx < 0) |
2711 | continue; | 2711 | continue; |
2712 | if (test_bit(Replacement, &rdev->flags)) | 2712 | if (test_bit(Replacement, &rdev->flags)) |
2713 | disk = conf->mirrors + conf->raid_disks + disk_idx; | 2713 | disk = conf->mirrors + mddev->raid_disks + disk_idx; |
2714 | else | 2714 | else |
2715 | disk = conf->mirrors + disk_idx; | 2715 | disk = conf->mirrors + disk_idx; |
2716 | 2716 | ||
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 906ccbd0f7d..d1295aff417 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -1783,7 +1783,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) | |||
1783 | clear_bit(Unmerged, &rdev->flags); | 1783 | clear_bit(Unmerged, &rdev->flags); |
1784 | } | 1784 | } |
1785 | md_integrity_add_rdev(rdev, mddev); | 1785 | md_integrity_add_rdev(rdev, mddev); |
1786 | if (blk_queue_discard(bdev_get_queue(rdev->bdev))) | 1786 | if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev))) |
1787 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); | 1787 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); |
1788 | 1788 | ||
1789 | print_conf(conf); | 1789 | print_conf(conf); |
@@ -3613,11 +3613,14 @@ static int run(struct mddev *mddev) | |||
3613 | discard_supported = true; | 3613 | discard_supported = true; |
3614 | } | 3614 | } |
3615 | 3615 | ||
3616 | if (discard_supported) | 3616 | if (mddev->queue) { |
3617 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); | 3617 | if (discard_supported) |
3618 | else | 3618 | queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, |
3619 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue); | 3619 | mddev->queue); |
3620 | 3620 | else | |
3621 | queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, | ||
3622 | mddev->queue); | ||
3623 | } | ||
3621 | /* need to check that every block has at least one working mirror */ | 3624 | /* need to check that every block has at least one working mirror */ |
3622 | if (!enough(conf, -1)) { | 3625 | if (!enough(conf, -1)) { |
3623 | printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n", | 3626 | printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n", |
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index c94f521f392..bf1ba93f43a 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c | |||
@@ -324,6 +324,7 @@ static struct resource stmpe_keypad_resources[] = { | |||
324 | 324 | ||
325 | static struct mfd_cell stmpe_keypad_cell = { | 325 | static struct mfd_cell stmpe_keypad_cell = { |
326 | .name = "stmpe-keypad", | 326 | .name = "stmpe-keypad", |
327 | .of_compatible = "st,stmpe-keypad", | ||
327 | .resources = stmpe_keypad_resources, | 328 | .resources = stmpe_keypad_resources, |
328 | .num_resources = ARRAY_SIZE(stmpe_keypad_resources), | 329 | .num_resources = ARRAY_SIZE(stmpe_keypad_resources), |
329 | }; | 330 | }; |
@@ -411,6 +412,7 @@ static struct resource stmpe_ts_resources[] = { | |||
411 | 412 | ||
412 | static struct mfd_cell stmpe_ts_cell = { | 413 | static struct mfd_cell stmpe_ts_cell = { |
413 | .name = "stmpe-ts", | 414 | .name = "stmpe-ts", |
415 | .of_compatible = "st,stmpe-ts", | ||
414 | .resources = stmpe_ts_resources, | 416 | .resources = stmpe_ts_resources, |
415 | .num_resources = ARRAY_SIZE(stmpe_ts_resources), | 417 | .num_resources = ARRAY_SIZE(stmpe_ts_resources), |
416 | }; | 418 | }; |
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index dc15d248443..ef8d2a080d1 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -1060,7 +1060,7 @@ static ssize_t bonding_store_primary(struct device *d, | |||
1060 | goto out; | 1060 | goto out; |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | sscanf(buf, "%16s", ifname); /* IFNAMSIZ */ | 1063 | sscanf(buf, "%15s", ifname); /* IFNAMSIZ */ |
1064 | 1064 | ||
1065 | /* check to see if we are clearing primary */ | 1065 | /* check to see if we are clearing primary */ |
1066 | if (!strlen(ifname) || buf[0] == '\n') { | 1066 | if (!strlen(ifname) || buf[0] == '\n') { |
@@ -1237,7 +1237,7 @@ static ssize_t bonding_store_active_slave(struct device *d, | |||
1237 | goto out; | 1237 | goto out; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | sscanf(buf, "%16s", ifname); /* IFNAMSIZ */ | 1240 | sscanf(buf, "%15s", ifname); /* IFNAMSIZ */ |
1241 | 1241 | ||
1242 | /* check to see if we are clearing active */ | 1242 | /* check to see if we are clearing active */ |
1243 | if (!strlen(ifname) || buf[0] == '\n') { | 1243 | if (!strlen(ifname) || buf[0] == '\n') { |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index e2e45ee5df3..6dd0dd076cc 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -137,7 +137,16 @@ | |||
137 | #define LINK_20GTFD LINK_STATUS_SPEED_AND_DUPLEX_20GTFD | 137 | #define LINK_20GTFD LINK_STATUS_SPEED_AND_DUPLEX_20GTFD |
138 | #define LINK_20GXFD LINK_STATUS_SPEED_AND_DUPLEX_20GXFD | 138 | #define LINK_20GXFD LINK_STATUS_SPEED_AND_DUPLEX_20GXFD |
139 | 139 | ||
140 | 140 | #define LINK_UPDATE_MASK \ | |
141 | (LINK_STATUS_SPEED_AND_DUPLEX_MASK | \ | ||
142 | LINK_STATUS_LINK_UP | \ | ||
143 | LINK_STATUS_PHYSICAL_LINK_FLAG | \ | ||
144 | LINK_STATUS_AUTO_NEGOTIATE_COMPLETE | \ | ||
145 | LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK | \ | ||
146 | LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK | \ | ||
147 | LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK | \ | ||
148 | LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE | \ | ||
149 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE) | ||
141 | 150 | ||
142 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 | 151 | #define SFP_EEPROM_CON_TYPE_ADDR 0x2 |
143 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 | 152 | #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7 |
@@ -3295,6 +3304,21 @@ static void bnx2x_serdes_deassert(struct bnx2x *bp, u8 port) | |||
3295 | DEFAULT_PHY_DEV_ADDR); | 3304 | DEFAULT_PHY_DEV_ADDR); |
3296 | } | 3305 | } |
3297 | 3306 | ||
3307 | static void bnx2x_xgxs_specific_func(struct bnx2x_phy *phy, | ||
3308 | struct link_params *params, | ||
3309 | u32 action) | ||
3310 | { | ||
3311 | struct bnx2x *bp = params->bp; | ||
3312 | switch (action) { | ||
3313 | case PHY_INIT: | ||
3314 | /* Set correct devad */ | ||
3315 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + params->port*0x18, 0); | ||
3316 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + params->port*0x18, | ||
3317 | phy->def_md_devad); | ||
3318 | break; | ||
3319 | } | ||
3320 | } | ||
3321 | |||
3298 | static void bnx2x_xgxs_deassert(struct link_params *params) | 3322 | static void bnx2x_xgxs_deassert(struct link_params *params) |
3299 | { | 3323 | { |
3300 | struct bnx2x *bp = params->bp; | 3324 | struct bnx2x *bp = params->bp; |
@@ -3309,10 +3333,8 @@ static void bnx2x_xgxs_deassert(struct link_params *params) | |||
3309 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, val); | 3333 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, val); |
3310 | udelay(500); | 3334 | udelay(500); |
3311 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET, val); | 3335 | REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET, val); |
3312 | 3336 | bnx2x_xgxs_specific_func(¶ms->phy[INT_PHY], params, | |
3313 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + port*0x18, 0); | 3337 | PHY_INIT); |
3314 | REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18, | ||
3315 | params->phy[INT_PHY].def_md_devad); | ||
3316 | } | 3338 | } |
3317 | 3339 | ||
3318 | static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, | 3340 | static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy, |
@@ -3545,14 +3567,11 @@ static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy, | |||
3545 | static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | 3567 | static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, |
3546 | struct link_params *params, | 3568 | struct link_params *params, |
3547 | struct link_vars *vars) { | 3569 | struct link_vars *vars) { |
3548 | u16 val16 = 0, lane, i; | 3570 | u16 lane, i, cl72_ctrl, an_adv = 0; |
3571 | u16 ucode_ver; | ||
3549 | struct bnx2x *bp = params->bp; | 3572 | struct bnx2x *bp = params->bp; |
3550 | static struct bnx2x_reg_set reg_set[] = { | 3573 | static struct bnx2x_reg_set reg_set[] = { |
3551 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, | 3574 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, |
3552 | {MDIO_AN_DEVAD, MDIO_WC_REG_PAR_DET_10G_CTRL, 0}, | ||
3553 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, 0}, | ||
3554 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0xff}, | ||
3555 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0x5555}, | ||
3556 | {MDIO_PMA_DEVAD, MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0}, | 3575 | {MDIO_PMA_DEVAD, MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0}, |
3557 | {MDIO_WC_DEVAD, MDIO_WC_REG_RX66_CONTROL, 0x7415}, | 3576 | {MDIO_WC_DEVAD, MDIO_WC_REG_RX66_CONTROL, 0x7415}, |
3558 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190}, | 3577 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190}, |
@@ -3565,12 +3584,19 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3565 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | 3584 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, |
3566 | reg_set[i].val); | 3585 | reg_set[i].val); |
3567 | 3586 | ||
3587 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
3588 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, &cl72_ctrl); | ||
3589 | cl72_ctrl &= 0xf8ff; | ||
3590 | cl72_ctrl |= 0x3800; | ||
3591 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3592 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, cl72_ctrl); | ||
3593 | |||
3568 | /* Check adding advertisement for 1G KX */ | 3594 | /* Check adding advertisement for 1G KX */ |
3569 | if (((vars->line_speed == SPEED_AUTO_NEG) && | 3595 | if (((vars->line_speed == SPEED_AUTO_NEG) && |
3570 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) || | 3596 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) || |
3571 | (vars->line_speed == SPEED_1000)) { | 3597 | (vars->line_speed == SPEED_1000)) { |
3572 | u32 addr = MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2; | 3598 | u32 addr = MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2; |
3573 | val16 |= (1<<5); | 3599 | an_adv |= (1<<5); |
3574 | 3600 | ||
3575 | /* Enable CL37 1G Parallel Detect */ | 3601 | /* Enable CL37 1G Parallel Detect */ |
3576 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, addr, 0x1); | 3602 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, addr, 0x1); |
@@ -3580,11 +3606,14 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3580 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) || | 3606 | (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) || |
3581 | (vars->line_speed == SPEED_10000)) { | 3607 | (vars->line_speed == SPEED_10000)) { |
3582 | /* Check adding advertisement for 10G KR */ | 3608 | /* Check adding advertisement for 10G KR */ |
3583 | val16 |= (1<<7); | 3609 | an_adv |= (1<<7); |
3584 | /* Enable 10G Parallel Detect */ | 3610 | /* Enable 10G Parallel Detect */ |
3611 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, | ||
3612 | MDIO_AER_BLOCK_AER_REG, 0); | ||
3613 | |||
3585 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3614 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
3586 | MDIO_WC_REG_PAR_DET_10G_CTRL, 1); | 3615 | MDIO_WC_REG_PAR_DET_10G_CTRL, 1); |
3587 | 3616 | bnx2x_set_aer_mmd(params, phy); | |
3588 | DP(NETIF_MSG_LINK, "Advertize 10G\n"); | 3617 | DP(NETIF_MSG_LINK, "Advertize 10G\n"); |
3589 | } | 3618 | } |
3590 | 3619 | ||
@@ -3604,7 +3633,7 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3604 | 3633 | ||
3605 | /* Advertised speeds */ | 3634 | /* Advertised speeds */ |
3606 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3635 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
3607 | MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, val16); | 3636 | MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, an_adv); |
3608 | 3637 | ||
3609 | /* Advertised and set FEC (Forward Error Correction) */ | 3638 | /* Advertised and set FEC (Forward Error Correction) */ |
3610 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, | 3639 | bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD, |
@@ -3628,9 +3657,10 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, | |||
3628 | /* Set KR Autoneg Work-Around flag for Warpcore version older than D108 | 3657 | /* Set KR Autoneg Work-Around flag for Warpcore version older than D108 |
3629 | */ | 3658 | */ |
3630 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | 3659 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, |
3631 | MDIO_WC_REG_UC_INFO_B1_VERSION, &val16); | 3660 | MDIO_WC_REG_UC_INFO_B1_VERSION, &ucode_ver); |
3632 | if (val16 < 0xd108) { | 3661 | if (ucode_ver < 0xd108) { |
3633 | DP(NETIF_MSG_LINK, "Enable AN KR work-around\n"); | 3662 | DP(NETIF_MSG_LINK, "Enable AN KR work-around. WC ver:0x%x\n", |
3663 | ucode_ver); | ||
3634 | vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; | 3664 | vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY; |
3635 | } | 3665 | } |
3636 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | 3666 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, |
@@ -3651,21 +3681,16 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, | |||
3651 | struct link_vars *vars) | 3681 | struct link_vars *vars) |
3652 | { | 3682 | { |
3653 | struct bnx2x *bp = params->bp; | 3683 | struct bnx2x *bp = params->bp; |
3654 | u16 i; | 3684 | u16 val16, i, lane; |
3655 | static struct bnx2x_reg_set reg_set[] = { | 3685 | static struct bnx2x_reg_set reg_set[] = { |
3656 | /* Disable Autoneg */ | 3686 | /* Disable Autoneg */ |
3657 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, | 3687 | {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7}, |
3658 | {MDIO_AN_DEVAD, MDIO_WC_REG_PAR_DET_10G_CTRL, 0}, | ||
3659 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, | 3688 | {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, |
3660 | 0x3f00}, | 3689 | 0x3f00}, |
3661 | {MDIO_AN_DEVAD, MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, 0}, | 3690 | {MDIO_AN_DEVAD, MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, 0}, |
3662 | {MDIO_AN_DEVAD, MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x0}, | 3691 | {MDIO_AN_DEVAD, MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x0}, |
3663 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL3_UP1, 0x1}, | 3692 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL3_UP1, 0x1}, |
3664 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC7, 0xa}, | 3693 | {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC7, 0xa}, |
3665 | /* Disable CL36 PCS Tx */ | ||
3666 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0x0}, | ||
3667 | /* Double Wide Single Data Rate @ pll rate */ | ||
3668 | {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0xFFFF}, | ||
3669 | /* Leave cl72 training enable, needed for KR */ | 3694 | /* Leave cl72 training enable, needed for KR */ |
3670 | {MDIO_PMA_DEVAD, | 3695 | {MDIO_PMA_DEVAD, |
3671 | MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150, | 3696 | MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150, |
@@ -3676,11 +3701,24 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, | |||
3676 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, | 3701 | bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg, |
3677 | reg_set[i].val); | 3702 | reg_set[i].val); |
3678 | 3703 | ||
3679 | /* Leave CL72 enabled */ | 3704 | lane = bnx2x_get_warpcore_lane(phy, params); |
3680 | bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, | 3705 | /* Global registers */ |
3681 | MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, | 3706 | CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK, |
3682 | 0x3800); | 3707 | MDIO_AER_BLOCK_AER_REG, 0); |
3708 | /* Disable CL36 PCS Tx */ | ||
3709 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
3710 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, &val16); | ||
3711 | val16 &= ~(0x0011 << lane); | ||
3712 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3713 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, val16); | ||
3683 | 3714 | ||
3715 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
3716 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, &val16); | ||
3717 | val16 |= (0x0303 << (lane << 1)); | ||
3718 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
3719 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, val16); | ||
3720 | /* Restore AER */ | ||
3721 | bnx2x_set_aer_mmd(params, phy); | ||
3684 | /* Set speed via PMA/PMD register */ | 3722 | /* Set speed via PMA/PMD register */ |
3685 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, | 3723 | bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD, |
3686 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x2040); | 3724 | MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x2040); |
@@ -4303,7 +4341,7 @@ static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy, | |||
4303 | struct link_params *params) | 4341 | struct link_params *params) |
4304 | { | 4342 | { |
4305 | struct bnx2x *bp = params->bp; | 4343 | struct bnx2x *bp = params->bp; |
4306 | u16 val16; | 4344 | u16 val16, lane; |
4307 | bnx2x_sfp_e3_set_transmitter(params, phy, 0); | 4345 | bnx2x_sfp_e3_set_transmitter(params, phy, 0); |
4308 | bnx2x_set_mdio_clk(bp, params->chip_id, params->port); | 4346 | bnx2x_set_mdio_clk(bp, params->chip_id, params->port); |
4309 | bnx2x_set_aer_mmd(params, phy); | 4347 | bnx2x_set_aer_mmd(params, phy); |
@@ -4340,6 +4378,30 @@ static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy, | |||
4340 | MDIO_WC_REG_XGXSBLK1_LANECTRL2, | 4378 | MDIO_WC_REG_XGXSBLK1_LANECTRL2, |
4341 | val16 & 0xff00); | 4379 | val16 & 0xff00); |
4342 | 4380 | ||
4381 | lane = bnx2x_get_warpcore_lane(phy, params); | ||
4382 | /* Disable CL36 PCS Tx */ | ||
4383 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
4384 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, &val16); | ||
4385 | val16 |= (0x11 << lane); | ||
4386 | if (phy->flags & FLAGS_WC_DUAL_MODE) | ||
4387 | val16 |= (0x22 << lane); | ||
4388 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
4389 | MDIO_WC_REG_XGXSBLK1_LANECTRL0, val16); | ||
4390 | |||
4391 | bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD, | ||
4392 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, &val16); | ||
4393 | val16 &= ~(0x0303 << (lane << 1)); | ||
4394 | val16 |= (0x0101 << (lane << 1)); | ||
4395 | if (phy->flags & FLAGS_WC_DUAL_MODE) { | ||
4396 | val16 &= ~(0x0c0c << (lane << 1)); | ||
4397 | val16 |= (0x0404 << (lane << 1)); | ||
4398 | } | ||
4399 | |||
4400 | bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD, | ||
4401 | MDIO_WC_REG_XGXSBLK1_LANECTRL1, val16); | ||
4402 | /* Restore AER */ | ||
4403 | bnx2x_set_aer_mmd(params, phy); | ||
4404 | |||
4343 | } | 4405 | } |
4344 | 4406 | ||
4345 | static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy, | 4407 | static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy, |
@@ -6296,15 +6358,7 @@ static int bnx2x_update_link_down(struct link_params *params, | |||
6296 | vars->mac_type = MAC_TYPE_NONE; | 6358 | vars->mac_type = MAC_TYPE_NONE; |
6297 | 6359 | ||
6298 | /* Update shared memory */ | 6360 | /* Update shared memory */ |
6299 | vars->link_status &= ~(LINK_STATUS_SPEED_AND_DUPLEX_MASK | | 6361 | vars->link_status &= ~LINK_UPDATE_MASK; |
6300 | LINK_STATUS_LINK_UP | | ||
6301 | LINK_STATUS_PHYSICAL_LINK_FLAG | | ||
6302 | LINK_STATUS_AUTO_NEGOTIATE_COMPLETE | | ||
6303 | LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK | | ||
6304 | LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK | | ||
6305 | LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK | | ||
6306 | LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE | | ||
6307 | LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE); | ||
6308 | vars->line_speed = 0; | 6362 | vars->line_speed = 0; |
6309 | bnx2x_update_mng(params, vars->link_status); | 6363 | bnx2x_update_mng(params, vars->link_status); |
6310 | 6364 | ||
@@ -6452,6 +6506,7 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars) | |||
6452 | u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed; | 6506 | u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed; |
6453 | u8 active_external_phy = INT_PHY; | 6507 | u8 active_external_phy = INT_PHY; |
6454 | vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG; | 6508 | vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG; |
6509 | vars->link_status &= ~LINK_UPDATE_MASK; | ||
6455 | for (phy_index = INT_PHY; phy_index < params->num_phys; | 6510 | for (phy_index = INT_PHY; phy_index < params->num_phys; |
6456 | phy_index++) { | 6511 | phy_index++) { |
6457 | phy_vars[phy_index].flow_ctrl = 0; | 6512 | phy_vars[phy_index].flow_ctrl = 0; |
@@ -7579,7 +7634,7 @@ static void bnx2x_warpcore_power_module(struct link_params *params, | |||
7579 | static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | 7634 | static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, |
7580 | struct link_params *params, | 7635 | struct link_params *params, |
7581 | u16 addr, u8 byte_cnt, | 7636 | u16 addr, u8 byte_cnt, |
7582 | u8 *o_buf) | 7637 | u8 *o_buf, u8 is_init) |
7583 | { | 7638 | { |
7584 | int rc = 0; | 7639 | int rc = 0; |
7585 | u8 i, j = 0, cnt = 0; | 7640 | u8 i, j = 0, cnt = 0; |
@@ -7596,10 +7651,10 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
7596 | /* 4 byte aligned address */ | 7651 | /* 4 byte aligned address */ |
7597 | addr32 = addr & (~0x3); | 7652 | addr32 = addr & (~0x3); |
7598 | do { | 7653 | do { |
7599 | if (cnt == I2C_WA_PWR_ITER) { | 7654 | if ((!is_init) && (cnt == I2C_WA_PWR_ITER)) { |
7600 | bnx2x_warpcore_power_module(params, phy, 0); | 7655 | bnx2x_warpcore_power_module(params, phy, 0); |
7601 | /* Note that 100us are not enough here */ | 7656 | /* Note that 100us are not enough here */ |
7602 | usleep_range(1000,1000); | 7657 | usleep_range(1000, 2000); |
7603 | bnx2x_warpcore_power_module(params, phy, 1); | 7658 | bnx2x_warpcore_power_module(params, phy, 1); |
7604 | } | 7659 | } |
7605 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, | 7660 | rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, |
@@ -7719,7 +7774,7 @@ int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, | |||
7719 | break; | 7774 | break; |
7720 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: | 7775 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: |
7721 | rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, addr, | 7776 | rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, addr, |
7722 | byte_cnt, o_buf); | 7777 | byte_cnt, o_buf, 0); |
7723 | break; | 7778 | break; |
7724 | } | 7779 | } |
7725 | return rc; | 7780 | return rc; |
@@ -7923,6 +7978,7 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
7923 | 7978 | ||
7924 | { | 7979 | { |
7925 | u8 val; | 7980 | u8 val; |
7981 | int rc; | ||
7926 | struct bnx2x *bp = params->bp; | 7982 | struct bnx2x *bp = params->bp; |
7927 | u16 timeout; | 7983 | u16 timeout; |
7928 | /* Initialization time after hot-plug may take up to 300ms for | 7984 | /* Initialization time after hot-plug may take up to 300ms for |
@@ -7930,8 +7986,14 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
7930 | */ | 7986 | */ |
7931 | 7987 | ||
7932 | for (timeout = 0; timeout < 60; timeout++) { | 7988 | for (timeout = 0; timeout < 60; timeout++) { |
7933 | if (bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val) | 7989 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) |
7934 | == 0) { | 7990 | rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, |
7991 | params, 1, | ||
7992 | 1, &val, 1); | ||
7993 | else | ||
7994 | rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, | ||
7995 | &val); | ||
7996 | if (rc == 0) { | ||
7935 | DP(NETIF_MSG_LINK, | 7997 | DP(NETIF_MSG_LINK, |
7936 | "SFP+ module initialization took %d ms\n", | 7998 | "SFP+ module initialization took %d ms\n", |
7937 | timeout * 5); | 7999 | timeout * 5); |
@@ -7939,7 +8001,8 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, | |||
7939 | } | 8001 | } |
7940 | usleep_range(5000, 10000); | 8002 | usleep_range(5000, 10000); |
7941 | } | 8003 | } |
7942 | return -EINVAL; | 8004 | rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val); |
8005 | return rc; | ||
7943 | } | 8006 | } |
7944 | 8007 | ||
7945 | static void bnx2x_8727_power_module(struct bnx2x *bp, | 8008 | static void bnx2x_8727_power_module(struct bnx2x *bp, |
@@ -10993,7 +11056,7 @@ static struct bnx2x_phy phy_xgxs = { | |||
10993 | .format_fw_ver = (format_fw_ver_t)NULL, | 11056 | .format_fw_ver = (format_fw_ver_t)NULL, |
10994 | .hw_reset = (hw_reset_t)NULL, | 11057 | .hw_reset = (hw_reset_t)NULL, |
10995 | .set_link_led = (set_link_led_t)NULL, | 11058 | .set_link_led = (set_link_led_t)NULL, |
10996 | .phy_specific_func = (phy_specific_func_t)NULL | 11059 | .phy_specific_func = (phy_specific_func_t)bnx2x_xgxs_specific_func |
10997 | }; | 11060 | }; |
10998 | static struct bnx2x_phy phy_warpcore = { | 11061 | static struct bnx2x_phy phy_warpcore = { |
10999 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, | 11062 | .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT, |
@@ -11465,6 +11528,11 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port, | |||
11465 | phy->media_type = ETH_PHY_BASE_T; | 11528 | phy->media_type = ETH_PHY_BASE_T; |
11466 | break; | 11529 | break; |
11467 | case PORT_HW_CFG_NET_SERDES_IF_XFI: | 11530 | case PORT_HW_CFG_NET_SERDES_IF_XFI: |
11531 | phy->supported &= (SUPPORTED_1000baseT_Full | | ||
11532 | SUPPORTED_10000baseT_Full | | ||
11533 | SUPPORTED_FIBRE | | ||
11534 | SUPPORTED_Pause | | ||
11535 | SUPPORTED_Asym_Pause); | ||
11468 | phy->media_type = ETH_PHY_XFP_FIBER; | 11536 | phy->media_type = ETH_PHY_XFP_FIBER; |
11469 | break; | 11537 | break; |
11470 | case PORT_HW_CFG_NET_SERDES_IF_SFI: | 11538 | case PORT_HW_CFG_NET_SERDES_IF_SFI: |
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index d5648fc666b..bd1fd3d87c2 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | |||
@@ -6794,8 +6794,9 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) | |||
6794 | 6794 | ||
6795 | bnx2x_init_block(bp, BLOCK_DORQ, init_phase); | 6795 | bnx2x_init_block(bp, BLOCK_DORQ, init_phase); |
6796 | 6796 | ||
6797 | bnx2x_init_block(bp, BLOCK_BRB1, init_phase); | ||
6798 | |||
6797 | if (CHIP_IS_E1(bp) || CHIP_IS_E1H(bp)) { | 6799 | if (CHIP_IS_E1(bp) || CHIP_IS_E1H(bp)) { |
6798 | bnx2x_init_block(bp, BLOCK_BRB1, init_phase); | ||
6799 | 6800 | ||
6800 | if (IS_MF(bp)) | 6801 | if (IS_MF(bp)) |
6801 | low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246); | 6802 | low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246); |
@@ -11902,7 +11903,15 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, | |||
11902 | /* disable FCOE L2 queue for E1x */ | 11903 | /* disable FCOE L2 queue for E1x */ |
11903 | if (CHIP_IS_E1x(bp)) | 11904 | if (CHIP_IS_E1x(bp)) |
11904 | bp->flags |= NO_FCOE_FLAG; | 11905 | bp->flags |= NO_FCOE_FLAG; |
11905 | 11906 | /* disable FCOE for 57840 device, until FW supports it */ | |
11907 | switch (ent->driver_data) { | ||
11908 | case BCM57840_O: | ||
11909 | case BCM57840_4_10: | ||
11910 | case BCM57840_2_20: | ||
11911 | case BCM57840_MFO: | ||
11912 | case BCM57840_MF: | ||
11913 | bp->flags |= NO_FCOE_FLAG; | ||
11914 | } | ||
11906 | #endif | 11915 | #endif |
11907 | 11916 | ||
11908 | 11917 | ||
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c index c1cde11b0c6..0df1284df49 100644 --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | |||
@@ -3416,16 +3416,6 @@ static int adap_init0_config(struct adapter *adapter, int reset) | |||
3416 | finicsum, cfcsum); | 3416 | finicsum, cfcsum); |
3417 | 3417 | ||
3418 | /* | 3418 | /* |
3419 | * If we're a pure NIC driver then disable all offloading facilities. | ||
3420 | * This will allow the firmware to optimize aspects of the hardware | ||
3421 | * configuration which will result in improved performance. | ||
3422 | */ | ||
3423 | caps_cmd.ofldcaps = 0; | ||
3424 | caps_cmd.iscsicaps = 0; | ||
3425 | caps_cmd.rdmacaps = 0; | ||
3426 | caps_cmd.fcoecaps = 0; | ||
3427 | |||
3428 | /* | ||
3429 | * And now tell the firmware to use the configuration we just loaded. | 3419 | * And now tell the firmware to use the configuration we just loaded. |
3430 | */ | 3420 | */ |
3431 | caps_cmd.op_to_write = | 3421 | caps_cmd.op_to_write = |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c index 56b20d17d0e..116f0e901be 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | |||
@@ -2673,6 +2673,9 @@ static int ixgbe_get_ts_info(struct net_device *dev, | |||
2673 | case ixgbe_mac_X540: | 2673 | case ixgbe_mac_X540: |
2674 | case ixgbe_mac_82599EB: | 2674 | case ixgbe_mac_82599EB: |
2675 | info->so_timestamping = | 2675 | info->so_timestamping = |
2676 | SOF_TIMESTAMPING_TX_SOFTWARE | | ||
2677 | SOF_TIMESTAMPING_RX_SOFTWARE | | ||
2678 | SOF_TIMESTAMPING_SOFTWARE | | ||
2676 | SOF_TIMESTAMPING_TX_HARDWARE | | 2679 | SOF_TIMESTAMPING_TX_HARDWARE | |
2677 | SOF_TIMESTAMPING_RX_HARDWARE | | 2680 | SOF_TIMESTAMPING_RX_HARDWARE | |
2678 | SOF_TIMESTAMPING_RAW_HARDWARE; | 2681 | SOF_TIMESTAMPING_RAW_HARDWARE; |
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c index 53743f7a2ca..af8b4142088 100644 --- a/drivers/net/ethernet/nxp/lpc_eth.c +++ b/drivers/net/ethernet/nxp/lpc_eth.c | |||
@@ -1524,6 +1524,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev) | |||
1524 | pldat->dma_buff_base_p); | 1524 | pldat->dma_buff_base_p); |
1525 | free_irq(ndev->irq, ndev); | 1525 | free_irq(ndev->irq, ndev); |
1526 | iounmap(pldat->net_base); | 1526 | iounmap(pldat->net_base); |
1527 | mdiobus_unregister(pldat->mii_bus); | ||
1527 | mdiobus_free(pldat->mii_bus); | 1528 | mdiobus_free(pldat->mii_bus); |
1528 | clk_disable(pldat->clk); | 1529 | clk_disable(pldat->clk); |
1529 | clk_put(pldat->clk); | 1530 | clk_put(pldat->clk); |
diff --git a/drivers/net/phy/mdio-bitbang.c b/drivers/net/phy/mdio-bitbang.c index daec9b05d16..6428fcbbdd4 100644 --- a/drivers/net/phy/mdio-bitbang.c +++ b/drivers/net/phy/mdio-bitbang.c | |||
@@ -234,6 +234,7 @@ void free_mdio_bitbang(struct mii_bus *bus) | |||
234 | struct mdiobb_ctrl *ctrl = bus->priv; | 234 | struct mdiobb_ctrl *ctrl = bus->priv; |
235 | 235 | ||
236 | module_put(ctrl->ops->owner); | 236 | module_put(ctrl->ops->owner); |
237 | mdiobus_unregister(bus); | ||
237 | mdiobus_free(bus); | 238 | mdiobus_free(bus); |
238 | } | 239 | } |
239 | EXPORT_SYMBOL(free_mdio_bitbang); | 240 | EXPORT_SYMBOL(free_mdio_bitbang); |
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index ce9d4f2c977..0ae1bcc6da7 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -744,28 +744,43 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx, | |||
744 | 744 | ||
745 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | 745 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { |
746 | const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; | 746 | const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; |
747 | u32 buf_size; | ||
747 | 748 | ||
748 | tbi = tq->buf_info + tq->tx_ring.next2fill; | 749 | buf_offset = 0; |
749 | tbi->map_type = VMXNET3_MAP_PAGE; | 750 | len = skb_frag_size(frag); |
750 | tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag, | 751 | while (len) { |
751 | 0, skb_frag_size(frag), | 752 | tbi = tq->buf_info + tq->tx_ring.next2fill; |
752 | DMA_TO_DEVICE); | 753 | if (len < VMXNET3_MAX_TX_BUF_SIZE) { |
754 | buf_size = len; | ||
755 | dw2 |= len; | ||
756 | } else { | ||
757 | buf_size = VMXNET3_MAX_TX_BUF_SIZE; | ||
758 | /* spec says that for TxDesc.len, 0 == 2^14 */ | ||
759 | } | ||
760 | tbi->map_type = VMXNET3_MAP_PAGE; | ||
761 | tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag, | ||
762 | buf_offset, buf_size, | ||
763 | DMA_TO_DEVICE); | ||
753 | 764 | ||
754 | tbi->len = skb_frag_size(frag); | 765 | tbi->len = buf_size; |
755 | 766 | ||
756 | gdesc = tq->tx_ring.base + tq->tx_ring.next2fill; | 767 | gdesc = tq->tx_ring.base + tq->tx_ring.next2fill; |
757 | BUG_ON(gdesc->txd.gen == tq->tx_ring.gen); | 768 | BUG_ON(gdesc->txd.gen == tq->tx_ring.gen); |
758 | 769 | ||
759 | gdesc->txd.addr = cpu_to_le64(tbi->dma_addr); | 770 | gdesc->txd.addr = cpu_to_le64(tbi->dma_addr); |
760 | gdesc->dword[2] = cpu_to_le32(dw2 | skb_frag_size(frag)); | 771 | gdesc->dword[2] = cpu_to_le32(dw2); |
761 | gdesc->dword[3] = 0; | 772 | gdesc->dword[3] = 0; |
762 | 773 | ||
763 | dev_dbg(&adapter->netdev->dev, | 774 | dev_dbg(&adapter->netdev->dev, |
764 | "txd[%u]: 0x%llu %u %u\n", | 775 | "txd[%u]: 0x%llu %u %u\n", |
765 | tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr), | 776 | tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr), |
766 | le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]); | 777 | le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]); |
767 | vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring); | 778 | vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring); |
768 | dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT; | 779 | dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT; |
780 | |||
781 | len -= buf_size; | ||
782 | buf_offset += buf_size; | ||
783 | } | ||
769 | } | 784 | } |
770 | 785 | ||
771 | ctx->eop_txd = gdesc; | 786 | ctx->eop_txd = gdesc; |
@@ -886,6 +901,18 @@ vmxnet3_prepare_tso(struct sk_buff *skb, | |||
886 | } | 901 | } |
887 | } | 902 | } |
888 | 903 | ||
904 | static int txd_estimate(const struct sk_buff *skb) | ||
905 | { | ||
906 | int count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1; | ||
907 | int i; | ||
908 | |||
909 | for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { | ||
910 | const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i]; | ||
911 | |||
912 | count += VMXNET3_TXD_NEEDED(skb_frag_size(frag)); | ||
913 | } | ||
914 | return count; | ||
915 | } | ||
889 | 916 | ||
890 | /* | 917 | /* |
891 | * Transmits a pkt thru a given tq | 918 | * Transmits a pkt thru a given tq |
@@ -914,9 +941,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, | |||
914 | union Vmxnet3_GenericDesc tempTxDesc; | 941 | union Vmxnet3_GenericDesc tempTxDesc; |
915 | #endif | 942 | #endif |
916 | 943 | ||
917 | /* conservatively estimate # of descriptors to use */ | 944 | count = txd_estimate(skb); |
918 | count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + | ||
919 | skb_shinfo(skb)->nr_frags + 1; | ||
920 | 945 | ||
921 | ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP)); | 946 | ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP)); |
922 | 947 | ||
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 607976c0016..7b4adde93c0 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c | |||
@@ -816,7 +816,7 @@ static void vxlan_cleanup(unsigned long arg) | |||
816 | = container_of(p, struct vxlan_fdb, hlist); | 816 | = container_of(p, struct vxlan_fdb, hlist); |
817 | unsigned long timeout; | 817 | unsigned long timeout; |
818 | 818 | ||
819 | if (f->state == NUD_PERMANENT) | 819 | if (f->state & NUD_PERMANENT) |
820 | continue; | 820 | continue; |
821 | 821 | ||
822 | timeout = f->used + vxlan->age_interval * HZ; | 822 | timeout = f->used + vxlan->age_interval * HZ; |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index 378bd70256b..741918a2027 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -312,6 +312,7 @@ static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc) | |||
312 | } | 312 | } |
313 | 313 | ||
314 | bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); | 314 | bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); |
315 | bf->bf_next = NULL; | ||
315 | list_del(&bf->list); | 316 | list_del(&bf->list); |
316 | 317 | ||
317 | spin_unlock_bh(&sc->tx.txbuflock); | 318 | spin_unlock_bh(&sc->tx.txbuflock); |
@@ -393,7 +394,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
393 | u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first; | 394 | u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first; |
394 | u32 ba[WME_BA_BMP_SIZE >> 5]; | 395 | u32 ba[WME_BA_BMP_SIZE >> 5]; |
395 | int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; | 396 | int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; |
396 | bool rc_update = true; | 397 | bool rc_update = true, isba; |
397 | struct ieee80211_tx_rate rates[4]; | 398 | struct ieee80211_tx_rate rates[4]; |
398 | struct ath_frame_info *fi; | 399 | struct ath_frame_info *fi; |
399 | int nframes; | 400 | int nframes; |
@@ -437,13 +438,17 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
437 | tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; | 438 | tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; |
438 | tid = ATH_AN_2_TID(an, tidno); | 439 | tid = ATH_AN_2_TID(an, tidno); |
439 | seq_first = tid->seq_start; | 440 | seq_first = tid->seq_start; |
441 | isba = ts->ts_flags & ATH9K_TX_BA; | ||
440 | 442 | ||
441 | /* | 443 | /* |
442 | * The hardware occasionally sends a tx status for the wrong TID. | 444 | * The hardware occasionally sends a tx status for the wrong TID. |
443 | * In this case, the BA status cannot be considered valid and all | 445 | * In this case, the BA status cannot be considered valid and all |
444 | * subframes need to be retransmitted | 446 | * subframes need to be retransmitted |
447 | * | ||
448 | * Only BlockAcks have a TID and therefore normal Acks cannot be | ||
449 | * checked | ||
445 | */ | 450 | */ |
446 | if (tidno != ts->tid) | 451 | if (isba && tidno != ts->tid) |
447 | txok = false; | 452 | txok = false; |
448 | 453 | ||
449 | isaggr = bf_isaggr(bf); | 454 | isaggr = bf_isaggr(bf); |
@@ -1774,6 +1779,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, | |||
1774 | list_add_tail(&bf->list, &bf_head); | 1779 | list_add_tail(&bf->list, &bf_head); |
1775 | bf->bf_state.bf_type = 0; | 1780 | bf->bf_state.bf_type = 0; |
1776 | 1781 | ||
1782 | bf->bf_next = NULL; | ||
1777 | bf->bf_lastbf = bf; | 1783 | bf->bf_lastbf = bf; |
1778 | ath_tx_fill_desc(sc, bf, txq, fi->framelen); | 1784 | ath_tx_fill_desc(sc, bf, txq, fi->framelen); |
1779 | ath_tx_txqaddbuf(sc, txq, &bf_head, false); | 1785 | ath_tx_txqaddbuf(sc, txq, &bf_head, false); |
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c index 01dc8891070..59474ae0aec 100644 --- a/drivers/net/wireless/rt2x00/rt2800lib.c +++ b/drivers/net/wireless/rt2x00/rt2800lib.c | |||
@@ -2449,7 +2449,7 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev) | |||
2449 | /* | 2449 | /* |
2450 | * Check if temperature compensation is supported. | 2450 | * Check if temperature compensation is supported. |
2451 | */ | 2451 | */ |
2452 | if (tssi_bounds[4] == 0xff) | 2452 | if (tssi_bounds[4] == 0xff || step == 0xff) |
2453 | return 0; | 2453 | return 0; |
2454 | 2454 | ||
2455 | /* | 2455 | /* |
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index bd4708a422c..20fd974f903 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -149,6 +149,7 @@ qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha) | |||
149 | int | 149 | int |
150 | qla24xx_disable_vp(scsi_qla_host_t *vha) | 150 | qla24xx_disable_vp(scsi_qla_host_t *vha) |
151 | { | 151 | { |
152 | unsigned long flags; | ||
152 | int ret; | 153 | int ret; |
153 | 154 | ||
154 | ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); | 155 | ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); |
@@ -156,7 +157,9 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) | |||
156 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); | 157 | atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); |
157 | 158 | ||
158 | /* Remove port id from vp target map */ | 159 | /* Remove port id from vp target map */ |
160 | spin_lock_irqsave(&vha->hw->vport_slock, flags); | ||
159 | qlt_update_vp_map(vha, RESET_AL_PA); | 161 | qlt_update_vp_map(vha, RESET_AL_PA); |
162 | spin_unlock_irqrestore(&vha->hw->vport_slock, flags); | ||
160 | 163 | ||
161 | qla2x00_mark_vp_devices_dead(vha); | 164 | qla2x00_mark_vp_devices_dead(vha); |
162 | atomic_set(&vha->vp_state, VP_FAILED); | 165 | atomic_set(&vha->vp_state, VP_FAILED); |
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index 0e09d8f433d..62aa5584f64 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c | |||
@@ -557,6 +557,7 @@ static bool qlt_check_fcport_exist(struct scsi_qla_host *vha, | |||
557 | int pmap_len; | 557 | int pmap_len; |
558 | fc_port_t *fcport; | 558 | fc_port_t *fcport; |
559 | int global_resets; | 559 | int global_resets; |
560 | unsigned long flags; | ||
560 | 561 | ||
561 | retry: | 562 | retry: |
562 | global_resets = atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count); | 563 | global_resets = atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count); |
@@ -625,10 +626,10 @@ retry: | |||
625 | sess->s_id.b.area, sess->loop_id, fcport->d_id.b.domain, | 626 | sess->s_id.b.area, sess->loop_id, fcport->d_id.b.domain, |
626 | fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id); | 627 | fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id); |
627 | 628 | ||
628 | sess->s_id = fcport->d_id; | 629 | spin_lock_irqsave(&ha->hardware_lock, flags); |
629 | sess->loop_id = fcport->loop_id; | 630 | ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, |
630 | sess->conf_compl_supported = !!(fcport->flags & | 631 | (fcport->flags & FCF_CONF_COMP_SUPPORTED)); |
631 | FCF_CONF_COMP_SUPPORTED); | 632 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
632 | 633 | ||
633 | res = true; | 634 | res = true; |
634 | 635 | ||
@@ -740,10 +741,9 @@ static struct qla_tgt_sess *qlt_create_sess( | |||
740 | qlt_undelete_sess(sess); | 741 | qlt_undelete_sess(sess); |
741 | 742 | ||
742 | kref_get(&sess->se_sess->sess_kref); | 743 | kref_get(&sess->se_sess->sess_kref); |
743 | sess->s_id = fcport->d_id; | 744 | ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, |
744 | sess->loop_id = fcport->loop_id; | 745 | (fcport->flags & FCF_CONF_COMP_SUPPORTED)); |
745 | sess->conf_compl_supported = !!(fcport->flags & | 746 | |
746 | FCF_CONF_COMP_SUPPORTED); | ||
747 | if (sess->local && !local) | 747 | if (sess->local && !local) |
748 | sess->local = 0; | 748 | sess->local = 0; |
749 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 749 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
@@ -796,8 +796,7 @@ static struct qla_tgt_sess *qlt_create_sess( | |||
796 | */ | 796 | */ |
797 | kref_get(&sess->se_sess->sess_kref); | 797 | kref_get(&sess->se_sess->sess_kref); |
798 | 798 | ||
799 | sess->conf_compl_supported = !!(fcport->flags & | 799 | sess->conf_compl_supported = (fcport->flags & FCF_CONF_COMP_SUPPORTED); |
800 | FCF_CONF_COMP_SUPPORTED); | ||
801 | BUILD_BUG_ON(sizeof(sess->port_name) != sizeof(fcport->port_name)); | 800 | BUILD_BUG_ON(sizeof(sess->port_name) != sizeof(fcport->port_name)); |
802 | memcpy(sess->port_name, fcport->port_name, sizeof(sess->port_name)); | 801 | memcpy(sess->port_name, fcport->port_name, sizeof(sess->port_name)); |
803 | 802 | ||
@@ -869,10 +868,8 @@ void qlt_fc_port_added(struct scsi_qla_host *vha, fc_port_t *fcport) | |||
869 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf007, | 868 | ql_dbg(ql_dbg_tgt_mgt, vha, 0xf007, |
870 | "Reappeared sess %p\n", sess); | 869 | "Reappeared sess %p\n", sess); |
871 | } | 870 | } |
872 | sess->s_id = fcport->d_id; | 871 | ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id, |
873 | sess->loop_id = fcport->loop_id; | 872 | (fcport->flags & FCF_CONF_COMP_SUPPORTED)); |
874 | sess->conf_compl_supported = !!(fcport->flags & | ||
875 | FCF_CONF_COMP_SUPPORTED); | ||
876 | } | 873 | } |
877 | 874 | ||
878 | if (sess && sess->local) { | 875 | if (sess && sess->local) { |
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h index 170af157121..bad749561ec 100644 --- a/drivers/scsi/qla2xxx/qla_target.h +++ b/drivers/scsi/qla2xxx/qla_target.h | |||
@@ -648,6 +648,7 @@ struct qla_tgt_func_tmpl { | |||
648 | 648 | ||
649 | int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *, | 649 | int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *, |
650 | void *, uint8_t *, uint16_t); | 650 | void *, uint8_t *, uint16_t); |
651 | void (*update_sess)(struct qla_tgt_sess *, port_id_t, uint16_t, bool); | ||
651 | struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *, | 652 | struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *, |
652 | const uint16_t); | 653 | const uint16_t); |
653 | struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *, | 654 | struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *, |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c index 2358c16c4c8..3d74f2f39ae 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c | |||
@@ -237,7 +237,7 @@ static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg) | |||
237 | struct tcm_qla2xxx_tpg, se_tpg); | 237 | struct tcm_qla2xxx_tpg, se_tpg); |
238 | struct tcm_qla2xxx_lport *lport = tpg->lport; | 238 | struct tcm_qla2xxx_lport *lport = tpg->lport; |
239 | 239 | ||
240 | return &lport->lport_name[0]; | 240 | return lport->lport_naa_name; |
241 | } | 241 | } |
242 | 242 | ||
243 | static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) | 243 | static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg) |
@@ -1457,6 +1457,78 @@ static int tcm_qla2xxx_check_initiator_node_acl( | |||
1457 | return 0; | 1457 | return 0; |
1458 | } | 1458 | } |
1459 | 1459 | ||
1460 | static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id, | ||
1461 | uint16_t loop_id, bool conf_compl_supported) | ||
1462 | { | ||
1463 | struct qla_tgt *tgt = sess->tgt; | ||
1464 | struct qla_hw_data *ha = tgt->ha; | ||
1465 | struct tcm_qla2xxx_lport *lport = ha->tgt.target_lport_ptr; | ||
1466 | struct se_node_acl *se_nacl = sess->se_sess->se_node_acl; | ||
1467 | struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl, | ||
1468 | struct tcm_qla2xxx_nacl, se_node_acl); | ||
1469 | u32 key; | ||
1470 | |||
1471 | |||
1472 | if (sess->loop_id != loop_id || sess->s_id.b24 != s_id.b24) | ||
1473 | pr_info("Updating session %p from port %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n", | ||
1474 | sess, | ||
1475 | sess->port_name[0], sess->port_name[1], | ||
1476 | sess->port_name[2], sess->port_name[3], | ||
1477 | sess->port_name[4], sess->port_name[5], | ||
1478 | sess->port_name[6], sess->port_name[7], | ||
1479 | sess->loop_id, loop_id, | ||
1480 | sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa, | ||
1481 | s_id.b.domain, s_id.b.area, s_id.b.al_pa); | ||
1482 | |||
1483 | if (sess->loop_id != loop_id) { | ||
1484 | /* | ||
1485 | * Because we can shuffle loop IDs around and we | ||
1486 | * update different sessions non-atomically, we might | ||
1487 | * have overwritten this session's old loop ID | ||
1488 | * already, and we might end up overwriting some other | ||
1489 | * session that will be updated later. So we have to | ||
1490 | * be extra careful and we can't warn about those things... | ||
1491 | */ | ||
1492 | if (lport->lport_loopid_map[sess->loop_id].se_nacl == se_nacl) | ||
1493 | lport->lport_loopid_map[sess->loop_id].se_nacl = NULL; | ||
1494 | |||
1495 | lport->lport_loopid_map[loop_id].se_nacl = se_nacl; | ||
1496 | |||
1497 | sess->loop_id = loop_id; | ||
1498 | } | ||
1499 | |||
1500 | if (sess->s_id.b24 != s_id.b24) { | ||
1501 | key = (((u32) sess->s_id.b.domain << 16) | | ||
1502 | ((u32) sess->s_id.b.area << 8) | | ||
1503 | ((u32) sess->s_id.b.al_pa)); | ||
1504 | |||
1505 | if (btree_lookup32(&lport->lport_fcport_map, key)) | ||
1506 | WARN(btree_remove32(&lport->lport_fcport_map, key) != se_nacl, | ||
1507 | "Found wrong se_nacl when updating s_id %x:%x:%x\n", | ||
1508 | sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa); | ||
1509 | else | ||
1510 | WARN(1, "No lport_fcport_map entry for s_id %x:%x:%x\n", | ||
1511 | sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa); | ||
1512 | |||
1513 | key = (((u32) s_id.b.domain << 16) | | ||
1514 | ((u32) s_id.b.area << 8) | | ||
1515 | ((u32) s_id.b.al_pa)); | ||
1516 | |||
1517 | if (btree_lookup32(&lport->lport_fcport_map, key)) { | ||
1518 | WARN(1, "Already have lport_fcport_map entry for s_id %x:%x:%x\n", | ||
1519 | s_id.b.domain, s_id.b.area, s_id.b.al_pa); | ||
1520 | btree_update32(&lport->lport_fcport_map, key, se_nacl); | ||
1521 | } else { | ||
1522 | btree_insert32(&lport->lport_fcport_map, key, se_nacl, GFP_ATOMIC); | ||
1523 | } | ||
1524 | |||
1525 | sess->s_id = s_id; | ||
1526 | nacl->nport_id = key; | ||
1527 | } | ||
1528 | |||
1529 | sess->conf_compl_supported = conf_compl_supported; | ||
1530 | } | ||
1531 | |||
1460 | /* | 1532 | /* |
1461 | * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path. | 1533 | * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path. |
1462 | */ | 1534 | */ |
@@ -1467,6 +1539,7 @@ static struct qla_tgt_func_tmpl tcm_qla2xxx_template = { | |||
1467 | .free_cmd = tcm_qla2xxx_free_cmd, | 1539 | .free_cmd = tcm_qla2xxx_free_cmd, |
1468 | .free_mcmd = tcm_qla2xxx_free_mcmd, | 1540 | .free_mcmd = tcm_qla2xxx_free_mcmd, |
1469 | .free_session = tcm_qla2xxx_free_session, | 1541 | .free_session = tcm_qla2xxx_free_session, |
1542 | .update_sess = tcm_qla2xxx_update_sess, | ||
1470 | .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl, | 1543 | .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl, |
1471 | .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id, | 1544 | .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id, |
1472 | .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id, | 1545 | .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id, |
@@ -1534,6 +1607,7 @@ static struct se_wwn *tcm_qla2xxx_make_lport( | |||
1534 | lport->lport_wwpn = wwpn; | 1607 | lport->lport_wwpn = wwpn; |
1535 | tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN, | 1608 | tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN, |
1536 | wwpn); | 1609 | wwpn); |
1610 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) wwpn); | ||
1537 | 1611 | ||
1538 | ret = tcm_qla2xxx_init_lport(lport); | 1612 | ret = tcm_qla2xxx_init_lport(lport); |
1539 | if (ret != 0) | 1613 | if (ret != 0) |
@@ -1601,6 +1675,7 @@ static struct se_wwn *tcm_qla2xxx_npiv_make_lport( | |||
1601 | lport->lport_npiv_wwnn = npiv_wwnn; | 1675 | lport->lport_npiv_wwnn = npiv_wwnn; |
1602 | tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], | 1676 | tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0], |
1603 | TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); | 1677 | TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn); |
1678 | sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn); | ||
1604 | 1679 | ||
1605 | /* FIXME: tcm_qla2xxx_npiv_make_lport */ | 1680 | /* FIXME: tcm_qla2xxx_npiv_make_lport */ |
1606 | ret = -ENOSYS; | 1681 | ret = -ENOSYS; |
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.h b/drivers/scsi/qla2xxx/tcm_qla2xxx.h index 82549810335..9ba075fe978 100644 --- a/drivers/scsi/qla2xxx/tcm_qla2xxx.h +++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.h | |||
@@ -61,6 +61,8 @@ struct tcm_qla2xxx_lport { | |||
61 | u64 lport_npiv_wwnn; | 61 | u64 lport_npiv_wwnn; |
62 | /* ASCII formatted WWPN for FC Target Lport */ | 62 | /* ASCII formatted WWPN for FC Target Lport */ |
63 | char lport_name[TCM_QLA2XXX_NAMELEN]; | 63 | char lport_name[TCM_QLA2XXX_NAMELEN]; |
64 | /* ASCII formatted naa WWPN for VPD page 83 etc */ | ||
65 | char lport_naa_name[TCM_QLA2XXX_NAMELEN]; | ||
64 | /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */ | 66 | /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */ |
65 | char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN]; | 67 | char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN]; |
66 | /* map for fc_port pointers in 24-bit FC Port ID space */ | 68 | /* map for fc_port pointers in 24-bit FC Port ID space */ |
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index d6ce2182e67..035c2c76253 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -3719,7 +3719,9 @@ restart: | |||
3719 | */ | 3719 | */ |
3720 | iscsit_thread_check_cpumask(conn, current, 1); | 3720 | iscsit_thread_check_cpumask(conn, current, 1); |
3721 | 3721 | ||
3722 | schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT); | 3722 | wait_event_interruptible(conn->queues_wq, |
3723 | !iscsit_conn_all_queues_empty(conn) || | ||
3724 | ts->status == ISCSI_THREAD_SET_RESET); | ||
3723 | 3725 | ||
3724 | if ((ts->status == ISCSI_THREAD_SET_RESET) || | 3726 | if ((ts->status == ISCSI_THREAD_SET_RESET) || |
3725 | signal_pending(current)) | 3727 | signal_pending(current)) |
diff --git a/drivers/target/iscsi/iscsi_target_core.h b/drivers/target/iscsi/iscsi_target_core.h index 2ba9f9b9435..21048dbf7d1 100644 --- a/drivers/target/iscsi/iscsi_target_core.h +++ b/drivers/target/iscsi/iscsi_target_core.h | |||
@@ -486,6 +486,7 @@ struct iscsi_tmr_req { | |||
486 | }; | 486 | }; |
487 | 487 | ||
488 | struct iscsi_conn { | 488 | struct iscsi_conn { |
489 | wait_queue_head_t queues_wq; | ||
489 | /* Authentication Successful for this connection */ | 490 | /* Authentication Successful for this connection */ |
490 | u8 auth_complete; | 491 | u8 auth_complete; |
491 | /* State connection is currently in */ | 492 | /* State connection is currently in */ |
diff --git a/drivers/target/iscsi/iscsi_target_login.c b/drivers/target/iscsi/iscsi_target_login.c index cdc8a10939c..f8dbec05d5e 100644 --- a/drivers/target/iscsi/iscsi_target_login.c +++ b/drivers/target/iscsi/iscsi_target_login.c | |||
@@ -41,6 +41,7 @@ | |||
41 | 41 | ||
42 | static int iscsi_login_init_conn(struct iscsi_conn *conn) | 42 | static int iscsi_login_init_conn(struct iscsi_conn *conn) |
43 | { | 43 | { |
44 | init_waitqueue_head(&conn->queues_wq); | ||
44 | INIT_LIST_HEAD(&conn->conn_list); | 45 | INIT_LIST_HEAD(&conn->conn_list); |
45 | INIT_LIST_HEAD(&conn->conn_cmd_list); | 46 | INIT_LIST_HEAD(&conn->conn_cmd_list); |
46 | INIT_LIST_HEAD(&conn->immed_queue_list); | 47 | INIT_LIST_HEAD(&conn->immed_queue_list); |
diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index afd98ccd40a..1a91195ab61 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c | |||
@@ -488,7 +488,7 @@ void iscsit_add_cmd_to_immediate_queue( | |||
488 | atomic_set(&conn->check_immediate_queue, 1); | 488 | atomic_set(&conn->check_immediate_queue, 1); |
489 | spin_unlock_bh(&conn->immed_queue_lock); | 489 | spin_unlock_bh(&conn->immed_queue_lock); |
490 | 490 | ||
491 | wake_up_process(conn->thread_set->tx_thread); | 491 | wake_up(&conn->queues_wq); |
492 | } | 492 | } |
493 | 493 | ||
494 | struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *conn) | 494 | struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *conn) |
@@ -562,7 +562,7 @@ void iscsit_add_cmd_to_response_queue( | |||
562 | atomic_inc(&cmd->response_queue_count); | 562 | atomic_inc(&cmd->response_queue_count); |
563 | spin_unlock_bh(&conn->response_queue_lock); | 563 | spin_unlock_bh(&conn->response_queue_lock); |
564 | 564 | ||
565 | wake_up_process(conn->thread_set->tx_thread); | 565 | wake_up(&conn->queues_wq); |
566 | } | 566 | } |
567 | 567 | ||
568 | struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn) | 568 | struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn) |
@@ -616,6 +616,24 @@ static void iscsit_remove_cmd_from_response_queue( | |||
616 | } | 616 | } |
617 | } | 617 | } |
618 | 618 | ||
619 | bool iscsit_conn_all_queues_empty(struct iscsi_conn *conn) | ||
620 | { | ||
621 | bool empty; | ||
622 | |||
623 | spin_lock_bh(&conn->immed_queue_lock); | ||
624 | empty = list_empty(&conn->immed_queue_list); | ||
625 | spin_unlock_bh(&conn->immed_queue_lock); | ||
626 | |||
627 | if (!empty) | ||
628 | return empty; | ||
629 | |||
630 | spin_lock_bh(&conn->response_queue_lock); | ||
631 | empty = list_empty(&conn->response_queue_list); | ||
632 | spin_unlock_bh(&conn->response_queue_lock); | ||
633 | |||
634 | return empty; | ||
635 | } | ||
636 | |||
619 | void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *conn) | 637 | void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *conn) |
620 | { | 638 | { |
621 | struct iscsi_queue_req *qr, *qr_tmp; | 639 | struct iscsi_queue_req *qr, *qr_tmp; |
diff --git a/drivers/target/iscsi/iscsi_target_util.h b/drivers/target/iscsi/iscsi_target_util.h index 44054bd3543..894d0f83792 100644 --- a/drivers/target/iscsi/iscsi_target_util.h +++ b/drivers/target/iscsi/iscsi_target_util.h | |||
@@ -25,6 +25,7 @@ extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_ | |||
25 | extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); | 25 | extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8); |
26 | extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *); | 26 | extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *); |
27 | extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *); | 27 | extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *); |
28 | extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *); | ||
28 | extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *); | 29 | extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *); |
29 | extern void iscsit_release_cmd(struct iscsi_cmd *); | 30 | extern void iscsit_release_cmd(struct iscsi_cmd *); |
30 | extern void iscsit_free_cmd(struct iscsi_cmd *); | 31 | extern void iscsit_free_cmd(struct iscsi_cmd *); |
diff --git a/drivers/target/target_core_configfs.c b/drivers/target/target_core_configfs.c index 015f5be27bf..c123327499a 100644 --- a/drivers/target/target_core_configfs.c +++ b/drivers/target/target_core_configfs.c | |||
@@ -3206,7 +3206,8 @@ static int __init target_core_init_configfs(void) | |||
3206 | if (ret < 0) | 3206 | if (ret < 0) |
3207 | goto out; | 3207 | goto out; |
3208 | 3208 | ||
3209 | if (core_dev_setup_virtual_lun0() < 0) | 3209 | ret = core_dev_setup_virtual_lun0(); |
3210 | if (ret < 0) | ||
3210 | goto out; | 3211 | goto out; |
3211 | 3212 | ||
3212 | return 0; | 3213 | return 0; |
diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index 8d774da1632..9abef9f8eb7 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c | |||
@@ -850,20 +850,20 @@ int se_dev_check_shutdown(struct se_device *dev) | |||
850 | 850 | ||
851 | static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) | 851 | static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size) |
852 | { | 852 | { |
853 | u32 tmp, aligned_max_sectors; | 853 | u32 aligned_max_sectors; |
854 | u32 alignment; | ||
854 | /* | 855 | /* |
855 | * Limit max_sectors to a PAGE_SIZE aligned value for modern | 856 | * Limit max_sectors to a PAGE_SIZE aligned value for modern |
856 | * transport_allocate_data_tasks() operation. | 857 | * transport_allocate_data_tasks() operation. |
857 | */ | 858 | */ |
858 | tmp = rounddown((max_sectors * block_size), PAGE_SIZE); | 859 | alignment = max(1ul, PAGE_SIZE / block_size); |
859 | aligned_max_sectors = (tmp / block_size); | 860 | aligned_max_sectors = rounddown(max_sectors, alignment); |
860 | if (max_sectors != aligned_max_sectors) { | 861 | |
861 | printk(KERN_INFO "Rounding down aligned max_sectors from %u" | 862 | if (max_sectors != aligned_max_sectors) |
862 | " to %u\n", max_sectors, aligned_max_sectors); | 863 | pr_info("Rounding down aligned max_sectors from %u to %u\n", |
863 | return aligned_max_sectors; | 864 | max_sectors, aligned_max_sectors); |
864 | } | ||
865 | 865 | ||
866 | return max_sectors; | 866 | return aligned_max_sectors; |
867 | } | 867 | } |
868 | 868 | ||
869 | void se_dev_set_default_attribs( | 869 | void se_dev_set_default_attribs( |
diff --git a/drivers/target/target_core_sbc.c b/drivers/target/target_core_sbc.c index 868f8aa04f1..a6e27d967c7 100644 --- a/drivers/target/target_core_sbc.c +++ b/drivers/target/target_core_sbc.c | |||
@@ -135,6 +135,12 @@ static int sbc_emulate_verify(struct se_cmd *cmd) | |||
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
137 | 137 | ||
138 | static int sbc_emulate_noop(struct se_cmd *cmd) | ||
139 | { | ||
140 | target_complete_cmd(cmd, GOOD); | ||
141 | return 0; | ||
142 | } | ||
143 | |||
138 | static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors) | 144 | static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors) |
139 | { | 145 | { |
140 | return cmd->se_dev->se_sub_dev->se_dev_attrib.block_size * sectors; | 146 | return cmd->se_dev->se_sub_dev->se_dev_attrib.block_size * sectors; |
@@ -531,6 +537,18 @@ int sbc_parse_cdb(struct se_cmd *cmd, struct spc_ops *ops) | |||
531 | size = 0; | 537 | size = 0; |
532 | cmd->execute_cmd = sbc_emulate_verify; | 538 | cmd->execute_cmd = sbc_emulate_verify; |
533 | break; | 539 | break; |
540 | case REZERO_UNIT: | ||
541 | case SEEK_6: | ||
542 | case SEEK_10: | ||
543 | /* | ||
544 | * There are still clients out there which use these old SCSI-2 | ||
545 | * commands. This mainly happens when running VMs with legacy | ||
546 | * guest systems, connected via SCSI command pass-through to | ||
547 | * iSCSI targets. Make them happy and return status GOOD. | ||
548 | */ | ||
549 | size = 0; | ||
550 | cmd->execute_cmd = sbc_emulate_noop; | ||
551 | break; | ||
534 | default: | 552 | default: |
535 | ret = spc_parse_cdb(cmd, &size); | 553 | ret = spc_parse_cdb(cmd, &size); |
536 | if (ret) | 554 | if (ret) |
diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c index 9229bd9ad61..6fd434d3d7e 100644 --- a/drivers/target/target_core_spc.c +++ b/drivers/target/target_core_spc.c | |||
@@ -605,6 +605,8 @@ static int spc_emulate_inquiry(struct se_cmd *cmd) | |||
605 | unsigned char buf[SE_INQUIRY_BUF]; | 605 | unsigned char buf[SE_INQUIRY_BUF]; |
606 | int p, ret; | 606 | int p, ret; |
607 | 607 | ||
608 | memset(buf, 0, SE_INQUIRY_BUF); | ||
609 | |||
608 | if (dev == tpg->tpg_virt_lun0.lun_se_dev) | 610 | if (dev == tpg->tpg_virt_lun0.lun_se_dev) |
609 | buf[0] = 0x3f; /* Not connected */ | 611 | buf[0] = 0x3f; /* Not connected */ |
610 | else | 612 | else |
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 1c59a3c23b2..be75c4331a9 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
@@ -140,15 +140,15 @@ void core_tmr_abort_task( | |||
140 | printk("ABORT_TASK: Found referenced %s task_tag: %u\n", | 140 | printk("ABORT_TASK: Found referenced %s task_tag: %u\n", |
141 | se_cmd->se_tfo->get_fabric_name(), ref_tag); | 141 | se_cmd->se_tfo->get_fabric_name(), ref_tag); |
142 | 142 | ||
143 | spin_lock_irq(&se_cmd->t_state_lock); | 143 | spin_lock(&se_cmd->t_state_lock); |
144 | if (se_cmd->transport_state & CMD_T_COMPLETE) { | 144 | if (se_cmd->transport_state & CMD_T_COMPLETE) { |
145 | printk("ABORT_TASK: ref_tag: %u already complete, skipping\n", ref_tag); | 145 | printk("ABORT_TASK: ref_tag: %u already complete, skipping\n", ref_tag); |
146 | spin_unlock_irq(&se_cmd->t_state_lock); | 146 | spin_unlock(&se_cmd->t_state_lock); |
147 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); | 147 | spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags); |
148 | goto out; | 148 | goto out; |
149 | } | 149 | } |
150 | se_cmd->transport_state |= CMD_T_ABORTED; | 150 | se_cmd->transport_state |= CMD_T_ABORTED; |
151 | spin_unlock_irq(&se_cmd->t_state_lock); | 151 | spin_unlock(&se_cmd->t_state_lock); |
152 | 152 | ||
153 | list_del_init(&se_cmd->se_cmd_list); | 153 | list_del_init(&se_cmd->se_cmd_list); |
154 | kref_get(&se_cmd->cmd_kref); | 154 | kref_get(&se_cmd->cmd_kref); |
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index c33baff86aa..9097155e9eb 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1616,7 +1616,6 @@ static void target_complete_tmr_failure(struct work_struct *work) | |||
1616 | 1616 | ||
1617 | se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; | 1617 | se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST; |
1618 | se_cmd->se_tfo->queue_tm_rsp(se_cmd); | 1618 | se_cmd->se_tfo->queue_tm_rsp(se_cmd); |
1619 | transport_generic_free_cmd(se_cmd, 0); | ||
1620 | } | 1619 | } |
1621 | 1620 | ||
1622 | /** | 1621 | /** |
diff --git a/drivers/thermal/exynos_thermal.c b/drivers/thermal/exynos_thermal.c index fd03e8581af..6dd29e4ce36 100644 --- a/drivers/thermal/exynos_thermal.c +++ b/drivers/thermal/exynos_thermal.c | |||
@@ -815,7 +815,7 @@ static struct platform_device_id exynos_tmu_driver_ids[] = { | |||
815 | }, | 815 | }, |
816 | { }, | 816 | { }, |
817 | }; | 817 | }; |
818 | MODULE_DEVICE_TABLE(platform, exynos4_tmu_driver_ids); | 818 | MODULE_DEVICE_TABLE(platform, exynos_tmu_driver_ids); |
819 | 819 | ||
820 | static inline struct exynos_tmu_platform_data *exynos_get_driver_data( | 820 | static inline struct exynos_tmu_platform_data *exynos_get_driver_data( |
821 | struct platform_device *pdev) | 821 | struct platform_device *pdev) |
diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c index d4452716aaa..f7a1b574a30 100644 --- a/drivers/thermal/rcar_thermal.c +++ b/drivers/thermal/rcar_thermal.c | |||
@@ -210,7 +210,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) | |||
210 | goto error_free_priv; | 210 | goto error_free_priv; |
211 | } | 211 | } |
212 | 212 | ||
213 | zone = thermal_zone_device_register("rcar_thermal", 0, priv, | 213 | zone = thermal_zone_device_register("rcar_thermal", 0, 0, priv, |
214 | &rcar_thermal_zone_ops, 0, 0); | 214 | &rcar_thermal_zone_ops, 0, 0); |
215 | if (IS_ERR(zone)) { | 215 | if (IS_ERR(zone)) { |
216 | dev_err(&pdev->dev, "thermal zone device is NULL\n"); | 216 | dev_err(&pdev->dev, "thermal zone device is NULL\n"); |
diff --git a/drivers/video/xen-fbfront.c b/drivers/video/xen-fbfront.c index b7f5173ff9e..917bb568168 100644 --- a/drivers/video/xen-fbfront.c +++ b/drivers/video/xen-fbfront.c | |||
@@ -641,7 +641,6 @@ static void xenfb_backend_changed(struct xenbus_device *dev, | |||
641 | case XenbusStateReconfiguring: | 641 | case XenbusStateReconfiguring: |
642 | case XenbusStateReconfigured: | 642 | case XenbusStateReconfigured: |
643 | case XenbusStateUnknown: | 643 | case XenbusStateUnknown: |
644 | case XenbusStateClosed: | ||
645 | break; | 644 | break; |
646 | 645 | ||
647 | case XenbusStateInitWait: | 646 | case XenbusStateInitWait: |
@@ -670,6 +669,10 @@ InitWait: | |||
670 | info->feature_resize = val; | 669 | info->feature_resize = val; |
671 | break; | 670 | break; |
672 | 671 | ||
672 | case XenbusStateClosed: | ||
673 | if (dev->state == XenbusStateClosed) | ||
674 | break; | ||
675 | /* Missed the backend's CLOSING state -- fallthrough */ | ||
673 | case XenbusStateClosing: | 676 | case XenbusStateClosing: |
674 | xenbus_frontend_closed(dev); | 677 | xenbus_frontend_closed(dev); |
675 | break; | 678 | break; |
diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c index 610bfc6be17..2e22df2f7a3 100644 --- a/drivers/xen/gntdev.c +++ b/drivers/xen/gntdev.c | |||
@@ -105,6 +105,21 @@ static void gntdev_print_maps(struct gntdev_priv *priv, | |||
105 | #endif | 105 | #endif |
106 | } | 106 | } |
107 | 107 | ||
108 | static void gntdev_free_map(struct grant_map *map) | ||
109 | { | ||
110 | if (map == NULL) | ||
111 | return; | ||
112 | |||
113 | if (map->pages) | ||
114 | free_xenballooned_pages(map->count, map->pages); | ||
115 | kfree(map->pages); | ||
116 | kfree(map->grants); | ||
117 | kfree(map->map_ops); | ||
118 | kfree(map->unmap_ops); | ||
119 | kfree(map->kmap_ops); | ||
120 | kfree(map); | ||
121 | } | ||
122 | |||
108 | static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) | 123 | static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) |
109 | { | 124 | { |
110 | struct grant_map *add; | 125 | struct grant_map *add; |
@@ -142,12 +157,7 @@ static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) | |||
142 | return add; | 157 | return add; |
143 | 158 | ||
144 | err: | 159 | err: |
145 | kfree(add->pages); | 160 | gntdev_free_map(add); |
146 | kfree(add->grants); | ||
147 | kfree(add->map_ops); | ||
148 | kfree(add->unmap_ops); | ||
149 | kfree(add->kmap_ops); | ||
150 | kfree(add); | ||
151 | return NULL; | 161 | return NULL; |
152 | } | 162 | } |
153 | 163 | ||
@@ -198,17 +208,9 @@ static void gntdev_put_map(struct grant_map *map) | |||
198 | evtchn_put(map->notify.event); | 208 | evtchn_put(map->notify.event); |
199 | } | 209 | } |
200 | 210 | ||
201 | if (map->pages) { | 211 | if (map->pages && !use_ptemod) |
202 | if (!use_ptemod) | 212 | unmap_grant_pages(map, 0, map->count); |
203 | unmap_grant_pages(map, 0, map->count); | 213 | gntdev_free_map(map); |
204 | |||
205 | free_xenballooned_pages(map->count, map->pages); | ||
206 | } | ||
207 | kfree(map->pages); | ||
208 | kfree(map->grants); | ||
209 | kfree(map->map_ops); | ||
210 | kfree(map->unmap_ops); | ||
211 | kfree(map); | ||
212 | } | 214 | } |
213 | 215 | ||
214 | /* ------------------------------------------------------------------ */ | 216 | /* ------------------------------------------------------------------ */ |
diff --git a/drivers/xen/xenbus/xenbus_dev_frontend.c b/drivers/xen/xenbus/xenbus_dev_frontend.c index 89f76252a16..ac727028e65 100644 --- a/drivers/xen/xenbus/xenbus_dev_frontend.c +++ b/drivers/xen/xenbus/xenbus_dev_frontend.c | |||
@@ -458,7 +458,7 @@ static ssize_t xenbus_file_write(struct file *filp, | |||
458 | goto out; | 458 | goto out; |
459 | 459 | ||
460 | /* Can't write a xenbus message larger we can buffer */ | 460 | /* Can't write a xenbus message larger we can buffer */ |
461 | if ((len + u->len) > sizeof(u->u.buffer)) { | 461 | if (len > sizeof(u->u.buffer) - u->len) { |
462 | /* On error, dump existing buffer */ | 462 | /* On error, dump existing buffer */ |
463 | u->len = 0; | 463 | u->len = 0; |
464 | rc = -EINVAL; | 464 | rc = -EINVAL; |
@@ -75,6 +75,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) | |||
75 | unsigned int sz = sizeof(struct bio) + extra_size; | 75 | unsigned int sz = sizeof(struct bio) + extra_size; |
76 | struct kmem_cache *slab = NULL; | 76 | struct kmem_cache *slab = NULL; |
77 | struct bio_slab *bslab, *new_bio_slabs; | 77 | struct bio_slab *bslab, *new_bio_slabs; |
78 | unsigned int new_bio_slab_max; | ||
78 | unsigned int i, entry = -1; | 79 | unsigned int i, entry = -1; |
79 | 80 | ||
80 | mutex_lock(&bio_slab_lock); | 81 | mutex_lock(&bio_slab_lock); |
@@ -97,12 +98,13 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) | |||
97 | goto out_unlock; | 98 | goto out_unlock; |
98 | 99 | ||
99 | if (bio_slab_nr == bio_slab_max && entry == -1) { | 100 | if (bio_slab_nr == bio_slab_max && entry == -1) { |
100 | bio_slab_max <<= 1; | 101 | new_bio_slab_max = bio_slab_max << 1; |
101 | new_bio_slabs = krealloc(bio_slabs, | 102 | new_bio_slabs = krealloc(bio_slabs, |
102 | bio_slab_max * sizeof(struct bio_slab), | 103 | new_bio_slab_max * sizeof(struct bio_slab), |
103 | GFP_KERNEL); | 104 | GFP_KERNEL); |
104 | if (!new_bio_slabs) | 105 | if (!new_bio_slabs) |
105 | goto out_unlock; | 106 | goto out_unlock; |
107 | bio_slab_max = new_bio_slab_max; | ||
106 | bio_slabs = new_bio_slabs; | 108 | bio_slabs = new_bio_slabs; |
107 | } | 109 | } |
108 | if (entry == -1) | 110 | if (entry == -1) |
diff --git a/fs/ceph/export.c b/fs/ceph/export.c index 02ce90972d8..9349bb37a2f 100644 --- a/fs/ceph/export.c +++ b/fs/ceph/export.c | |||
@@ -90,6 +90,8 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, | |||
90 | *max_len = handle_length; | 90 | *max_len = handle_length; |
91 | type = 255; | 91 | type = 255; |
92 | } | 92 | } |
93 | if (dentry) | ||
94 | dput(dentry); | ||
93 | return type; | 95 | return type; |
94 | } | 96 | } |
95 | 97 | ||
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 4facdd29a35..3a100e7a62a 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -725,6 +725,10 @@ repeat_in_this_group: | |||
725 | "inode=%lu", ino + 1); | 725 | "inode=%lu", ino + 1); |
726 | continue; | 726 | continue; |
727 | } | 727 | } |
728 | BUFFER_TRACE(inode_bitmap_bh, "get_write_access"); | ||
729 | err = ext4_journal_get_write_access(handle, inode_bitmap_bh); | ||
730 | if (err) | ||
731 | goto fail; | ||
728 | ext4_lock_group(sb, group); | 732 | ext4_lock_group(sb, group); |
729 | ret2 = ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data); | 733 | ret2 = ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data); |
730 | ext4_unlock_group(sb, group); | 734 | ext4_unlock_group(sb, group); |
@@ -738,6 +742,11 @@ repeat_in_this_group: | |||
738 | goto out; | 742 | goto out; |
739 | 743 | ||
740 | got: | 744 | got: |
745 | BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata"); | ||
746 | err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh); | ||
747 | if (err) | ||
748 | goto fail; | ||
749 | |||
741 | /* We may have to initialize the block bitmap if it isn't already */ | 750 | /* We may have to initialize the block bitmap if it isn't already */ |
742 | if (ext4_has_group_desc_csum(sb) && | 751 | if (ext4_has_group_desc_csum(sb) && |
743 | gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { | 752 | gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { |
@@ -771,11 +780,6 @@ got: | |||
771 | goto fail; | 780 | goto fail; |
772 | } | 781 | } |
773 | 782 | ||
774 | BUFFER_TRACE(inode_bitmap_bh, "get_write_access"); | ||
775 | err = ext4_journal_get_write_access(handle, inode_bitmap_bh); | ||
776 | if (err) | ||
777 | goto fail; | ||
778 | |||
779 | BUFFER_TRACE(group_desc_bh, "get_write_access"); | 783 | BUFFER_TRACE(group_desc_bh, "get_write_access"); |
780 | err = ext4_journal_get_write_access(handle, group_desc_bh); | 784 | err = ext4_journal_get_write_access(handle, group_desc_bh); |
781 | if (err) | 785 | if (err) |
@@ -823,11 +827,6 @@ got: | |||
823 | } | 827 | } |
824 | ext4_unlock_group(sb, group); | 828 | ext4_unlock_group(sb, group); |
825 | 829 | ||
826 | BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata"); | ||
827 | err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh); | ||
828 | if (err) | ||
829 | goto fail; | ||
830 | |||
831 | BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata"); | 830 | BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata"); |
832 | err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh); | 831 | err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh); |
833 | if (err) | 832 | if (err) |
@@ -900,7 +900,7 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags) | |||
900 | return __close_fd(files, fd); | 900 | return __close_fd(files, fd); |
901 | 901 | ||
902 | if (fd >= rlimit(RLIMIT_NOFILE)) | 902 | if (fd >= rlimit(RLIMIT_NOFILE)) |
903 | return -EMFILE; | 903 | return -EBADF; |
904 | 904 | ||
905 | spin_lock(&files->file_lock); | 905 | spin_lock(&files->file_lock); |
906 | err = expand_files(files, fd); | 906 | err = expand_files(files, fd); |
@@ -926,7 +926,7 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags) | |||
926 | return -EINVAL; | 926 | return -EINVAL; |
927 | 927 | ||
928 | if (newfd >= rlimit(RLIMIT_NOFILE)) | 928 | if (newfd >= rlimit(RLIMIT_NOFILE)) |
929 | return -EMFILE; | 929 | return -EBADF; |
930 | 930 | ||
931 | spin_lock(&files->file_lock); | 931 | spin_lock(&files->file_lock); |
932 | err = expand_files(files, newfd); | 932 | err = expand_files(files, newfd); |
diff --git a/fs/nfs/dns_resolve.c b/fs/nfs/dns_resolve.c index 31c26c4dcc2..ca4b11ec87a 100644 --- a/fs/nfs/dns_resolve.c +++ b/fs/nfs/dns_resolve.c | |||
@@ -217,7 +217,7 @@ static int nfs_dns_parse(struct cache_detail *cd, char *buf, int buflen) | |||
217 | { | 217 | { |
218 | char buf1[NFS_DNS_HOSTNAME_MAXLEN+1]; | 218 | char buf1[NFS_DNS_HOSTNAME_MAXLEN+1]; |
219 | struct nfs_dns_ent key, *item; | 219 | struct nfs_dns_ent key, *item; |
220 | unsigned long ttl; | 220 | unsigned int ttl; |
221 | ssize_t len; | 221 | ssize_t len; |
222 | int ret = -EINVAL; | 222 | int ret = -EINVAL; |
223 | 223 | ||
@@ -240,7 +240,8 @@ static int nfs_dns_parse(struct cache_detail *cd, char *buf, int buflen) | |||
240 | key.namelen = len; | 240 | key.namelen = len; |
241 | memset(&key.h, 0, sizeof(key.h)); | 241 | memset(&key.h, 0, sizeof(key.h)); |
242 | 242 | ||
243 | ttl = get_expiry(&buf); | 243 | if (get_uint(&buf, &ttl) < 0) |
244 | goto out; | ||
244 | if (ttl == 0) | 245 | if (ttl == 0) |
245 | goto out; | 246 | goto out; |
246 | key.h.expiry_time = ttl + seconds_since_boot(); | 247 | key.h.expiry_time = ttl + seconds_since_boot(); |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 5c7325c5c5e..6fa01aea248 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -685,7 +685,10 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync) | |||
685 | if (ctx->cred != NULL) | 685 | if (ctx->cred != NULL) |
686 | put_rpccred(ctx->cred); | 686 | put_rpccred(ctx->cred); |
687 | dput(ctx->dentry); | 687 | dput(ctx->dentry); |
688 | nfs_sb_deactive(sb); | 688 | if (is_sync) |
689 | nfs_sb_deactive(sb); | ||
690 | else | ||
691 | nfs_sb_deactive_async(sb); | ||
689 | kfree(ctx->mdsthreshold); | 692 | kfree(ctx->mdsthreshold); |
690 | kfree(ctx); | 693 | kfree(ctx); |
691 | } | 694 | } |
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h index 59b133c5d65..05521cadac2 100644 --- a/fs/nfs/internal.h +++ b/fs/nfs/internal.h | |||
@@ -351,10 +351,12 @@ extern int __init register_nfs_fs(void); | |||
351 | extern void __exit unregister_nfs_fs(void); | 351 | extern void __exit unregister_nfs_fs(void); |
352 | extern void nfs_sb_active(struct super_block *sb); | 352 | extern void nfs_sb_active(struct super_block *sb); |
353 | extern void nfs_sb_deactive(struct super_block *sb); | 353 | extern void nfs_sb_deactive(struct super_block *sb); |
354 | extern void nfs_sb_deactive_async(struct super_block *sb); | ||
354 | 355 | ||
355 | /* namespace.c */ | 356 | /* namespace.c */ |
357 | #define NFS_PATH_CANONICAL 1 | ||
356 | extern char *nfs_path(char **p, struct dentry *dentry, | 358 | extern char *nfs_path(char **p, struct dentry *dentry, |
357 | char *buffer, ssize_t buflen); | 359 | char *buffer, ssize_t buflen, unsigned flags); |
358 | extern struct vfsmount *nfs_d_automount(struct path *path); | 360 | extern struct vfsmount *nfs_d_automount(struct path *path); |
359 | struct vfsmount *nfs_submount(struct nfs_server *, struct dentry *, | 361 | struct vfsmount *nfs_submount(struct nfs_server *, struct dentry *, |
360 | struct nfs_fh *, struct nfs_fattr *); | 362 | struct nfs_fh *, struct nfs_fattr *); |
@@ -498,7 +500,7 @@ static inline char *nfs_devname(struct dentry *dentry, | |||
498 | char *buffer, ssize_t buflen) | 500 | char *buffer, ssize_t buflen) |
499 | { | 501 | { |
500 | char *dummy; | 502 | char *dummy; |
501 | return nfs_path(&dummy, dentry, buffer, buflen); | 503 | return nfs_path(&dummy, dentry, buffer, buflen, NFS_PATH_CANONICAL); |
502 | } | 504 | } |
503 | 505 | ||
504 | /* | 506 | /* |
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 8e65c7f1f87..015f71f8f62 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -181,7 +181,7 @@ int nfs_mount(struct nfs_mount_request *info) | |||
181 | else | 181 | else |
182 | msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC_MNT]; | 182 | msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC_MNT]; |
183 | 183 | ||
184 | status = rpc_call_sync(mnt_clnt, &msg, 0); | 184 | status = rpc_call_sync(mnt_clnt, &msg, RPC_TASK_SOFT|RPC_TASK_TIMEOUT); |
185 | rpc_shutdown_client(mnt_clnt); | 185 | rpc_shutdown_client(mnt_clnt); |
186 | 186 | ||
187 | if (status < 0) | 187 | if (status < 0) |
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c index 655925373b9..dd057bc6b65 100644 --- a/fs/nfs/namespace.c +++ b/fs/nfs/namespace.c | |||
@@ -33,6 +33,7 @@ int nfs_mountpoint_expiry_timeout = 500 * HZ; | |||
33 | * @dentry - pointer to dentry | 33 | * @dentry - pointer to dentry |
34 | * @buffer - result buffer | 34 | * @buffer - result buffer |
35 | * @buflen - length of buffer | 35 | * @buflen - length of buffer |
36 | * @flags - options (see below) | ||
36 | * | 37 | * |
37 | * Helper function for constructing the server pathname | 38 | * Helper function for constructing the server pathname |
38 | * by arbitrary hashed dentry. | 39 | * by arbitrary hashed dentry. |
@@ -40,8 +41,14 @@ int nfs_mountpoint_expiry_timeout = 500 * HZ; | |||
40 | * This is mainly for use in figuring out the path on the | 41 | * This is mainly for use in figuring out the path on the |
41 | * server side when automounting on top of an existing partition | 42 | * server side when automounting on top of an existing partition |
42 | * and in generating /proc/mounts and friends. | 43 | * and in generating /proc/mounts and friends. |
44 | * | ||
45 | * Supported flags: | ||
46 | * NFS_PATH_CANONICAL: ensure there is exactly one slash after | ||
47 | * the original device (export) name | ||
48 | * (if unset, the original name is returned verbatim) | ||
43 | */ | 49 | */ |
44 | char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen) | 50 | char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen, |
51 | unsigned flags) | ||
45 | { | 52 | { |
46 | char *end; | 53 | char *end; |
47 | int namelen; | 54 | int namelen; |
@@ -74,7 +81,7 @@ rename_retry: | |||
74 | rcu_read_unlock(); | 81 | rcu_read_unlock(); |
75 | goto rename_retry; | 82 | goto rename_retry; |
76 | } | 83 | } |
77 | if (*end != '/') { | 84 | if ((flags & NFS_PATH_CANONICAL) && *end != '/') { |
78 | if (--buflen < 0) { | 85 | if (--buflen < 0) { |
79 | spin_unlock(&dentry->d_lock); | 86 | spin_unlock(&dentry->d_lock); |
80 | rcu_read_unlock(); | 87 | rcu_read_unlock(); |
@@ -91,9 +98,11 @@ rename_retry: | |||
91 | return end; | 98 | return end; |
92 | } | 99 | } |
93 | namelen = strlen(base); | 100 | namelen = strlen(base); |
94 | /* Strip off excess slashes in base string */ | 101 | if (flags & NFS_PATH_CANONICAL) { |
95 | while (namelen > 0 && base[namelen - 1] == '/') | 102 | /* Strip off excess slashes in base string */ |
96 | namelen--; | 103 | while (namelen > 0 && base[namelen - 1] == '/') |
104 | namelen--; | ||
105 | } | ||
97 | buflen -= namelen; | 106 | buflen -= namelen; |
98 | if (buflen < 0) { | 107 | if (buflen < 0) { |
99 | spin_unlock(&dentry->d_lock); | 108 | spin_unlock(&dentry->d_lock); |
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 79fbb61ce20..1e09eb78543 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
@@ -81,7 +81,8 @@ static char *nfs_path_component(const char *nfspath, const char *end) | |||
81 | static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) | 81 | static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen) |
82 | { | 82 | { |
83 | char *limit; | 83 | char *limit; |
84 | char *path = nfs_path(&limit, dentry, buffer, buflen); | 84 | char *path = nfs_path(&limit, dentry, buffer, buflen, |
85 | NFS_PATH_CANONICAL); | ||
85 | if (!IS_ERR(path)) { | 86 | if (!IS_ERR(path)) { |
86 | char *path_component = nfs_path_component(path, limit); | 87 | char *path_component = nfs_path_component(path, limit); |
87 | if (path_component) | 88 | if (path_component) |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 68b21d81b7a..5eec4429970 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -339,8 +339,7 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc | |||
339 | dprintk("%s ERROR: %d Reset session\n", __func__, | 339 | dprintk("%s ERROR: %d Reset session\n", __func__, |
340 | errorcode); | 340 | errorcode); |
341 | nfs4_schedule_session_recovery(clp->cl_session, errorcode); | 341 | nfs4_schedule_session_recovery(clp->cl_session, errorcode); |
342 | exception->retry = 1; | 342 | goto wait_on_recovery; |
343 | break; | ||
344 | #endif /* defined(CONFIG_NFS_V4_1) */ | 343 | #endif /* defined(CONFIG_NFS_V4_1) */ |
345 | case -NFS4ERR_FILE_OPEN: | 344 | case -NFS4ERR_FILE_OPEN: |
346 | if (exception->timeout > HZ) { | 345 | if (exception->timeout > HZ) { |
@@ -1572,9 +1571,11 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) | |||
1572 | data->timestamp = jiffies; | 1571 | data->timestamp = jiffies; |
1573 | if (nfs4_setup_sequence(data->o_arg.server, | 1572 | if (nfs4_setup_sequence(data->o_arg.server, |
1574 | &data->o_arg.seq_args, | 1573 | &data->o_arg.seq_args, |
1575 | &data->o_res.seq_res, task)) | 1574 | &data->o_res.seq_res, |
1576 | return; | 1575 | task) != 0) |
1577 | rpc_call_start(task); | 1576 | nfs_release_seqid(data->o_arg.seqid); |
1577 | else | ||
1578 | rpc_call_start(task); | ||
1578 | return; | 1579 | return; |
1579 | unlock_no_action: | 1580 | unlock_no_action: |
1580 | rcu_read_unlock(); | 1581 | rcu_read_unlock(); |
@@ -1748,7 +1749,7 @@ static int nfs4_opendata_access(struct rpc_cred *cred, | |||
1748 | 1749 | ||
1749 | /* even though OPEN succeeded, access is denied. Close the file */ | 1750 | /* even though OPEN succeeded, access is denied. Close the file */ |
1750 | nfs4_close_state(state, fmode); | 1751 | nfs4_close_state(state, fmode); |
1751 | return -NFS4ERR_ACCESS; | 1752 | return -EACCES; |
1752 | } | 1753 | } |
1753 | 1754 | ||
1754 | /* | 1755 | /* |
@@ -2196,7 +2197,7 @@ static void nfs4_free_closedata(void *data) | |||
2196 | nfs4_put_open_state(calldata->state); | 2197 | nfs4_put_open_state(calldata->state); |
2197 | nfs_free_seqid(calldata->arg.seqid); | 2198 | nfs_free_seqid(calldata->arg.seqid); |
2198 | nfs4_put_state_owner(sp); | 2199 | nfs4_put_state_owner(sp); |
2199 | nfs_sb_deactive(sb); | 2200 | nfs_sb_deactive_async(sb); |
2200 | kfree(calldata); | 2201 | kfree(calldata); |
2201 | } | 2202 | } |
2202 | 2203 | ||
@@ -2296,9 +2297,10 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) | |||
2296 | if (nfs4_setup_sequence(NFS_SERVER(inode), | 2297 | if (nfs4_setup_sequence(NFS_SERVER(inode), |
2297 | &calldata->arg.seq_args, | 2298 | &calldata->arg.seq_args, |
2298 | &calldata->res.seq_res, | 2299 | &calldata->res.seq_res, |
2299 | task)) | 2300 | task) != 0) |
2300 | goto out; | 2301 | nfs_release_seqid(calldata->arg.seqid); |
2301 | rpc_call_start(task); | 2302 | else |
2303 | rpc_call_start(task); | ||
2302 | out: | 2304 | out: |
2303 | dprintk("%s: done!\n", __func__); | 2305 | dprintk("%s: done!\n", __func__); |
2304 | } | 2306 | } |
@@ -4529,6 +4531,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data) | |||
4529 | if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN) | 4531 | if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN) |
4530 | rpc_restart_call_prepare(task); | 4532 | rpc_restart_call_prepare(task); |
4531 | } | 4533 | } |
4534 | nfs_release_seqid(calldata->arg.seqid); | ||
4532 | } | 4535 | } |
4533 | 4536 | ||
4534 | static void nfs4_locku_prepare(struct rpc_task *task, void *data) | 4537 | static void nfs4_locku_prepare(struct rpc_task *task, void *data) |
@@ -4545,9 +4548,11 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data) | |||
4545 | calldata->timestamp = jiffies; | 4548 | calldata->timestamp = jiffies; |
4546 | if (nfs4_setup_sequence(calldata->server, | 4549 | if (nfs4_setup_sequence(calldata->server, |
4547 | &calldata->arg.seq_args, | 4550 | &calldata->arg.seq_args, |
4548 | &calldata->res.seq_res, task)) | 4551 | &calldata->res.seq_res, |
4549 | return; | 4552 | task) != 0) |
4550 | rpc_call_start(task); | 4553 | nfs_release_seqid(calldata->arg.seqid); |
4554 | else | ||
4555 | rpc_call_start(task); | ||
4551 | } | 4556 | } |
4552 | 4557 | ||
4553 | static const struct rpc_call_ops nfs4_locku_ops = { | 4558 | static const struct rpc_call_ops nfs4_locku_ops = { |
@@ -4692,7 +4697,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) | |||
4692 | /* Do we need to do an open_to_lock_owner? */ | 4697 | /* Do we need to do an open_to_lock_owner? */ |
4693 | if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) { | 4698 | if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) { |
4694 | if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0) | 4699 | if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0) |
4695 | return; | 4700 | goto out_release_lock_seqid; |
4696 | data->arg.open_stateid = &state->stateid; | 4701 | data->arg.open_stateid = &state->stateid; |
4697 | data->arg.new_lock_owner = 1; | 4702 | data->arg.new_lock_owner = 1; |
4698 | data->res.open_seqid = data->arg.open_seqid; | 4703 | data->res.open_seqid = data->arg.open_seqid; |
@@ -4701,10 +4706,15 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) | |||
4701 | data->timestamp = jiffies; | 4706 | data->timestamp = jiffies; |
4702 | if (nfs4_setup_sequence(data->server, | 4707 | if (nfs4_setup_sequence(data->server, |
4703 | &data->arg.seq_args, | 4708 | &data->arg.seq_args, |
4704 | &data->res.seq_res, task)) | 4709 | &data->res.seq_res, |
4710 | task) == 0) { | ||
4711 | rpc_call_start(task); | ||
4705 | return; | 4712 | return; |
4706 | rpc_call_start(task); | 4713 | } |
4707 | dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status); | 4714 | nfs_release_seqid(data->arg.open_seqid); |
4715 | out_release_lock_seqid: | ||
4716 | nfs_release_seqid(data->arg.lock_seqid); | ||
4717 | dprintk("%s: done!, ret = %d\n", __func__, task->tk_status); | ||
4708 | } | 4718 | } |
4709 | 4719 | ||
4710 | static void nfs4_recover_lock_prepare(struct rpc_task *task, void *calldata) | 4720 | static void nfs4_recover_lock_prepare(struct rpc_task *task, void *calldata) |
@@ -5667,7 +5677,7 @@ static void nfs4_add_and_init_slots(struct nfs4_slot_table *tbl, | |||
5667 | tbl->slots = new; | 5677 | tbl->slots = new; |
5668 | tbl->max_slots = max_slots; | 5678 | tbl->max_slots = max_slots; |
5669 | } | 5679 | } |
5670 | tbl->highest_used_slotid = -1; /* no slot is currently used */ | 5680 | tbl->highest_used_slotid = NFS4_NO_SLOT; |
5671 | for (i = 0; i < tbl->max_slots; i++) | 5681 | for (i = 0; i < tbl->max_slots; i++) |
5672 | tbl->slots[i].seq_nr = ivalue; | 5682 | tbl->slots[i].seq_nr = ivalue; |
5673 | spin_unlock(&tbl->slot_tbl_lock); | 5683 | spin_unlock(&tbl->slot_tbl_lock); |
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index fe624c91bd0..2878f97bd78 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c | |||
@@ -925,8 +925,8 @@ pnfs_find_alloc_layout(struct inode *ino, | |||
925 | if (likely(nfsi->layout == NULL)) { /* Won the race? */ | 925 | if (likely(nfsi->layout == NULL)) { /* Won the race? */ |
926 | nfsi->layout = new; | 926 | nfsi->layout = new; |
927 | return new; | 927 | return new; |
928 | } | 928 | } else if (new != NULL) |
929 | pnfs_free_layout_hdr(new); | 929 | pnfs_free_layout_hdr(new); |
930 | out_existing: | 930 | out_existing: |
931 | pnfs_get_layout_hdr(nfsi->layout); | 931 | pnfs_get_layout_hdr(nfsi->layout); |
932 | return nfsi->layout; | 932 | return nfsi->layout; |
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index e831bce4976..652d3f7176a 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/parser.h> | 54 | #include <linux/parser.h> |
55 | #include <linux/nsproxy.h> | 55 | #include <linux/nsproxy.h> |
56 | #include <linux/rcupdate.h> | 56 | #include <linux/rcupdate.h> |
57 | #include <linux/kthread.h> | ||
57 | 58 | ||
58 | #include <asm/uaccess.h> | 59 | #include <asm/uaccess.h> |
59 | 60 | ||
@@ -415,6 +416,54 @@ void nfs_sb_deactive(struct super_block *sb) | |||
415 | } | 416 | } |
416 | EXPORT_SYMBOL_GPL(nfs_sb_deactive); | 417 | EXPORT_SYMBOL_GPL(nfs_sb_deactive); |
417 | 418 | ||
419 | static int nfs_deactivate_super_async_work(void *ptr) | ||
420 | { | ||
421 | struct super_block *sb = ptr; | ||
422 | |||
423 | deactivate_super(sb); | ||
424 | module_put_and_exit(0); | ||
425 | return 0; | ||
426 | } | ||
427 | |||
428 | /* | ||
429 | * same effect as deactivate_super, but will do final unmount in kthread | ||
430 | * context | ||
431 | */ | ||
432 | static void nfs_deactivate_super_async(struct super_block *sb) | ||
433 | { | ||
434 | struct task_struct *task; | ||
435 | char buf[INET6_ADDRSTRLEN + 1]; | ||
436 | struct nfs_server *server = NFS_SB(sb); | ||
437 | struct nfs_client *clp = server->nfs_client; | ||
438 | |||
439 | if (!atomic_add_unless(&sb->s_active, -1, 1)) { | ||
440 | rcu_read_lock(); | ||
441 | snprintf(buf, sizeof(buf), | ||
442 | rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR)); | ||
443 | rcu_read_unlock(); | ||
444 | |||
445 | __module_get(THIS_MODULE); | ||
446 | task = kthread_run(nfs_deactivate_super_async_work, sb, | ||
447 | "%s-deactivate-super", buf); | ||
448 | if (IS_ERR(task)) { | ||
449 | pr_err("%s: kthread_run: %ld\n", | ||
450 | __func__, PTR_ERR(task)); | ||
451 | /* make synchronous call and hope for the best */ | ||
452 | deactivate_super(sb); | ||
453 | module_put(THIS_MODULE); | ||
454 | } | ||
455 | } | ||
456 | } | ||
457 | |||
458 | void nfs_sb_deactive_async(struct super_block *sb) | ||
459 | { | ||
460 | struct nfs_server *server = NFS_SB(sb); | ||
461 | |||
462 | if (atomic_dec_and_test(&server->active)) | ||
463 | nfs_deactivate_super_async(sb); | ||
464 | } | ||
465 | EXPORT_SYMBOL_GPL(nfs_sb_deactive_async); | ||
466 | |||
418 | /* | 467 | /* |
419 | * Deliver file system statistics to userspace | 468 | * Deliver file system statistics to userspace |
420 | */ | 469 | */ |
@@ -771,7 +820,7 @@ int nfs_show_devname(struct seq_file *m, struct dentry *root) | |||
771 | int err = 0; | 820 | int err = 0; |
772 | if (!page) | 821 | if (!page) |
773 | return -ENOMEM; | 822 | return -ENOMEM; |
774 | devname = nfs_path(&dummy, root, page, PAGE_SIZE); | 823 | devname = nfs_path(&dummy, root, page, PAGE_SIZE, 0); |
775 | if (IS_ERR(devname)) | 824 | if (IS_ERR(devname)) |
776 | err = PTR_ERR(devname); | 825 | err = PTR_ERR(devname); |
777 | else | 826 | else |
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index 13cea637eff..3f79c77153b 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
@@ -95,7 +95,7 @@ static void nfs_async_unlink_release(void *calldata) | |||
95 | 95 | ||
96 | nfs_dec_sillycount(data->dir); | 96 | nfs_dec_sillycount(data->dir); |
97 | nfs_free_unlinkdata(data); | 97 | nfs_free_unlinkdata(data); |
98 | nfs_sb_deactive(sb); | 98 | nfs_sb_deactive_async(sb); |
99 | } | 99 | } |
100 | 100 | ||
101 | static void nfs_unlink_prepare(struct rpc_task *task, void *calldata) | 101 | static void nfs_unlink_prepare(struct rpc_task *task, void *calldata) |
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h new file mode 100644 index 00000000000..227c62424f3 --- /dev/null +++ b/include/linux/hashtable.h | |||
@@ -0,0 +1,192 @@ | |||
1 | /* | ||
2 | * Statically sized hash table implementation | ||
3 | * (C) 2012 Sasha Levin <levinsasha928@gmail.com> | ||
4 | */ | ||
5 | |||
6 | #ifndef _LINUX_HASHTABLE_H | ||
7 | #define _LINUX_HASHTABLE_H | ||
8 | |||
9 | #include <linux/list.h> | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/hash.h> | ||
13 | #include <linux/rculist.h> | ||
14 | |||
15 | #define DEFINE_HASHTABLE(name, bits) \ | ||
16 | struct hlist_head name[1 << (bits)] = \ | ||
17 | { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT } | ||
18 | |||
19 | #define DECLARE_HASHTABLE(name, bits) \ | ||
20 | struct hlist_head name[1 << (bits)] | ||
21 | |||
22 | #define HASH_SIZE(name) (ARRAY_SIZE(name)) | ||
23 | #define HASH_BITS(name) ilog2(HASH_SIZE(name)) | ||
24 | |||
25 | /* Use hash_32 when possible to allow for fast 32bit hashing in 64bit kernels. */ | ||
26 | #define hash_min(val, bits) \ | ||
27 | (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits)) | ||
28 | |||
29 | static inline void __hash_init(struct hlist_head *ht, unsigned int sz) | ||
30 | { | ||
31 | unsigned int i; | ||
32 | |||
33 | for (i = 0; i < sz; i++) | ||
34 | INIT_HLIST_HEAD(&ht[i]); | ||
35 | } | ||
36 | |||
37 | /** | ||
38 | * hash_init - initialize a hash table | ||
39 | * @hashtable: hashtable to be initialized | ||
40 | * | ||
41 | * Calculates the size of the hashtable from the given parameter, otherwise | ||
42 | * same as hash_init_size. | ||
43 | * | ||
44 | * This has to be a macro since HASH_BITS() will not work on pointers since | ||
45 | * it calculates the size during preprocessing. | ||
46 | */ | ||
47 | #define hash_init(hashtable) __hash_init(hashtable, HASH_SIZE(hashtable)) | ||
48 | |||
49 | /** | ||
50 | * hash_add - add an object to a hashtable | ||
51 | * @hashtable: hashtable to add to | ||
52 | * @node: the &struct hlist_node of the object to be added | ||
53 | * @key: the key of the object to be added | ||
54 | */ | ||
55 | #define hash_add(hashtable, node, key) \ | ||
56 | hlist_add_head(node, &hashtable[hash_min(key, HASH_BITS(hashtable))]) | ||
57 | |||
58 | /** | ||
59 | * hash_add_rcu - add an object to a rcu enabled hashtable | ||
60 | * @hashtable: hashtable to add to | ||
61 | * @node: the &struct hlist_node of the object to be added | ||
62 | * @key: the key of the object to be added | ||
63 | */ | ||
64 | #define hash_add_rcu(hashtable, node, key) \ | ||
65 | hlist_add_head_rcu(node, &hashtable[hash_min(key, HASH_BITS(hashtable))]) | ||
66 | |||
67 | /** | ||
68 | * hash_hashed - check whether an object is in any hashtable | ||
69 | * @node: the &struct hlist_node of the object to be checked | ||
70 | */ | ||
71 | static inline bool hash_hashed(struct hlist_node *node) | ||
72 | { | ||
73 | return !hlist_unhashed(node); | ||
74 | } | ||
75 | |||
76 | static inline bool __hash_empty(struct hlist_head *ht, unsigned int sz) | ||
77 | { | ||
78 | unsigned int i; | ||
79 | |||
80 | for (i = 0; i < sz; i++) | ||
81 | if (!hlist_empty(&ht[i])) | ||
82 | return false; | ||
83 | |||
84 | return true; | ||
85 | } | ||
86 | |||
87 | /** | ||
88 | * hash_empty - check whether a hashtable is empty | ||
89 | * @hashtable: hashtable to check | ||
90 | * | ||
91 | * This has to be a macro since HASH_BITS() will not work on pointers since | ||
92 | * it calculates the size during preprocessing. | ||
93 | */ | ||
94 | #define hash_empty(hashtable) __hash_empty(hashtable, HASH_SIZE(hashtable)) | ||
95 | |||
96 | /** | ||
97 | * hash_del - remove an object from a hashtable | ||
98 | * @node: &struct hlist_node of the object to remove | ||
99 | */ | ||
100 | static inline void hash_del(struct hlist_node *node) | ||
101 | { | ||
102 | hlist_del_init(node); | ||
103 | } | ||
104 | |||
105 | /** | ||
106 | * hash_del_rcu - remove an object from a rcu enabled hashtable | ||
107 | * @node: &struct hlist_node of the object to remove | ||
108 | */ | ||
109 | static inline void hash_del_rcu(struct hlist_node *node) | ||
110 | { | ||
111 | hlist_del_init_rcu(node); | ||
112 | } | ||
113 | |||
114 | /** | ||
115 | * hash_for_each - iterate over a hashtable | ||
116 | * @name: hashtable to iterate | ||
117 | * @bkt: integer to use as bucket loop cursor | ||
118 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
119 | * @obj: the type * to use as a loop cursor for each entry | ||
120 | * @member: the name of the hlist_node within the struct | ||
121 | */ | ||
122 | #define hash_for_each(name, bkt, node, obj, member) \ | ||
123 | for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ | ||
124 | hlist_for_each_entry(obj, node, &name[bkt], member) | ||
125 | |||
126 | /** | ||
127 | * hash_for_each_rcu - iterate over a rcu enabled hashtable | ||
128 | * @name: hashtable to iterate | ||
129 | * @bkt: integer to use as bucket loop cursor | ||
130 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
131 | * @obj: the type * to use as a loop cursor for each entry | ||
132 | * @member: the name of the hlist_node within the struct | ||
133 | */ | ||
134 | #define hash_for_each_rcu(name, bkt, node, obj, member) \ | ||
135 | for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ | ||
136 | hlist_for_each_entry_rcu(obj, node, &name[bkt], member) | ||
137 | |||
138 | /** | ||
139 | * hash_for_each_safe - iterate over a hashtable safe against removal of | ||
140 | * hash entry | ||
141 | * @name: hashtable to iterate | ||
142 | * @bkt: integer to use as bucket loop cursor | ||
143 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
144 | * @tmp: a &struct used for temporary storage | ||
145 | * @obj: the type * to use as a loop cursor for each entry | ||
146 | * @member: the name of the hlist_node within the struct | ||
147 | */ | ||
148 | #define hash_for_each_safe(name, bkt, node, tmp, obj, member) \ | ||
149 | for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\ | ||
150 | hlist_for_each_entry_safe(obj, node, tmp, &name[bkt], member) | ||
151 | |||
152 | /** | ||
153 | * hash_for_each_possible - iterate over all possible objects hashing to the | ||
154 | * same bucket | ||
155 | * @name: hashtable to iterate | ||
156 | * @obj: the type * to use as a loop cursor for each entry | ||
157 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
158 | * @member: the name of the hlist_node within the struct | ||
159 | * @key: the key of the objects to iterate over | ||
160 | */ | ||
161 | #define hash_for_each_possible(name, obj, node, member, key) \ | ||
162 | hlist_for_each_entry(obj, node, &name[hash_min(key, HASH_BITS(name))], member) | ||
163 | |||
164 | /** | ||
165 | * hash_for_each_possible_rcu - iterate over all possible objects hashing to the | ||
166 | * same bucket in an rcu enabled hashtable | ||
167 | * in a rcu enabled hashtable | ||
168 | * @name: hashtable to iterate | ||
169 | * @obj: the type * to use as a loop cursor for each entry | ||
170 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
171 | * @member: the name of the hlist_node within the struct | ||
172 | * @key: the key of the objects to iterate over | ||
173 | */ | ||
174 | #define hash_for_each_possible_rcu(name, obj, node, member, key) \ | ||
175 | hlist_for_each_entry_rcu(obj, node, &name[hash_min(key, HASH_BITS(name))], member) | ||
176 | |||
177 | /** | ||
178 | * hash_for_each_possible_safe - iterate over all possible objects hashing to the | ||
179 | * same bucket safe against removals | ||
180 | * @name: hashtable to iterate | ||
181 | * @obj: the type * to use as a loop cursor for each entry | ||
182 | * @node: the &struct list_head to use as a loop cursor for each entry | ||
183 | * @tmp: a &struct used for temporary storage | ||
184 | * @member: the name of the hlist_node within the struct | ||
185 | * @key: the key of the objects to iterate over | ||
186 | */ | ||
187 | #define hash_for_each_possible_safe(name, obj, node, tmp, member, key) \ | ||
188 | hlist_for_each_entry_safe(obj, node, tmp, \ | ||
189 | &name[hash_min(key, HASH_BITS(name))], member) | ||
190 | |||
191 | |||
192 | #endif | ||
diff --git a/include/linux/input.h b/include/linux/input.h index cab994ba6d9..82ce323b998 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -112,6 +112,11 @@ struct input_value { | |||
112 | * @h_list: list of input handles associated with the device. When | 112 | * @h_list: list of input handles associated with the device. When |
113 | * accessing the list dev->mutex must be held | 113 | * accessing the list dev->mutex must be held |
114 | * @node: used to place the device onto input_dev_list | 114 | * @node: used to place the device onto input_dev_list |
115 | * @num_vals: number of values queued in the current frame | ||
116 | * @max_vals: maximum number of values queued in a frame | ||
117 | * @vals: array of values queued in the current frame | ||
118 | * @devres_managed: indicates that devices is managed with devres framework | ||
119 | * and needs not be explicitly unregistered or freed. | ||
115 | */ | 120 | */ |
116 | struct input_dev { | 121 | struct input_dev { |
117 | const char *name; | 122 | const char *name; |
@@ -180,6 +185,8 @@ struct input_dev { | |||
180 | unsigned int num_vals; | 185 | unsigned int num_vals; |
181 | unsigned int max_vals; | 186 | unsigned int max_vals; |
182 | struct input_value *vals; | 187 | struct input_value *vals; |
188 | |||
189 | bool devres_managed; | ||
183 | }; | 190 | }; |
184 | #define to_input_dev(d) container_of(d, struct input_dev, dev) | 191 | #define to_input_dev(d) container_of(d, struct input_dev, dev) |
185 | 192 | ||
@@ -323,7 +330,8 @@ struct input_handle { | |||
323 | struct list_head h_node; | 330 | struct list_head h_node; |
324 | }; | 331 | }; |
325 | 332 | ||
326 | struct input_dev *input_allocate_device(void); | 333 | struct input_dev __must_check *input_allocate_device(void); |
334 | struct input_dev __must_check *devm_input_allocate_device(struct device *); | ||
327 | void input_free_device(struct input_dev *dev); | 335 | void input_free_device(struct input_dev *dev); |
328 | 336 | ||
329 | static inline struct input_dev *input_get_device(struct input_dev *dev) | 337 | static inline struct input_dev *input_get_device(struct input_dev *dev) |
diff --git a/include/linux/input/bu21013.h b/include/linux/input/bu21013.h index 05e03284b92..6230d76bde5 100644 --- a/include/linux/input/bu21013.h +++ b/include/linux/input/bu21013.h | |||
@@ -9,13 +9,10 @@ | |||
9 | 9 | ||
10 | /** | 10 | /** |
11 | * struct bu21013_platform_device - Handle the platform data | 11 | * struct bu21013_platform_device - Handle the platform data |
12 | * @cs_en: pointer to the cs enable function | ||
13 | * @cs_dis: pointer to the cs disable function | ||
14 | * @irq_read_val: pointer to read the pen irq value function | ||
15 | * @touch_x_max: touch x max | 12 | * @touch_x_max: touch x max |
16 | * @touch_y_max: touch y max | 13 | * @touch_y_max: touch y max |
17 | * @cs_pin: chip select pin | 14 | * @cs_pin: chip select pin |
18 | * @irq: irq pin | 15 | * @touch_pin: touch gpio pin |
19 | * @ext_clk: external clock flag | 16 | * @ext_clk: external clock flag |
20 | * @x_flip: x flip flag | 17 | * @x_flip: x flip flag |
21 | * @y_flip: y flip flag | 18 | * @y_flip: y flip flag |
@@ -24,13 +21,10 @@ | |||
24 | * This is used to handle the platform data | 21 | * This is used to handle the platform data |
25 | */ | 22 | */ |
26 | struct bu21013_platform_device { | 23 | struct bu21013_platform_device { |
27 | int (*cs_en)(int reset_pin); | ||
28 | int (*cs_dis)(int reset_pin); | ||
29 | int (*irq_read_val)(void); | ||
30 | int touch_x_max; | 24 | int touch_x_max; |
31 | int touch_y_max; | 25 | int touch_y_max; |
32 | unsigned int cs_pin; | 26 | unsigned int cs_pin; |
33 | unsigned int irq; | 27 | unsigned int touch_pin; |
34 | bool ext_clk; | 28 | bool ext_clk; |
35 | bool x_flip; | 29 | bool x_flip; |
36 | bool y_flip; | 30 | bool y_flip; |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 93bfc9f9815..ecc554374e4 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -42,19 +42,8 @@ | |||
42 | */ | 42 | */ |
43 | #define KVM_MEMSLOT_INVALID (1UL << 16) | 43 | #define KVM_MEMSLOT_INVALID (1UL << 16) |
44 | 44 | ||
45 | /* | 45 | /* Two fragments for cross MMIO pages. */ |
46 | * If we support unaligned MMIO, at most one fragment will be split into two: | 46 | #define KVM_MAX_MMIO_FRAGMENTS 2 |
47 | */ | ||
48 | #ifdef KVM_UNALIGNED_MMIO | ||
49 | # define KVM_EXTRA_MMIO_FRAGMENTS 1 | ||
50 | #else | ||
51 | # define KVM_EXTRA_MMIO_FRAGMENTS 0 | ||
52 | #endif | ||
53 | |||
54 | #define KVM_USER_MMIO_SIZE 8 | ||
55 | |||
56 | #define KVM_MAX_MMIO_FRAGMENTS \ | ||
57 | (KVM_MMIO_SIZE / KVM_USER_MMIO_SIZE + KVM_EXTRA_MMIO_FRAGMENTS) | ||
58 | 47 | ||
59 | /* | 48 | /* |
60 | * For the normal pfn, the highest 12 bits should be zero, | 49 | * For the normal pfn, the highest 12 bits should be zero, |
diff --git a/include/linux/raid/Kbuild b/include/linux/raid/Kbuild index 2415a64c5e5..e69de29bb2d 100644 --- a/include/linux/raid/Kbuild +++ b/include/linux/raid/Kbuild | |||
@@ -1,2 +0,0 @@ | |||
1 | header-y += md_p.h | ||
2 | header-y += md_u.h | ||
diff --git a/include/linux/raid/md_u.h b/include/linux/raid/md_u.h index fb1abb3367e..358c04bfbe2 100644 --- a/include/linux/raid/md_u.h +++ b/include/linux/raid/md_u.h | |||
@@ -11,149 +11,10 @@ | |||
11 | (for example /usr/src/linux/COPYING); if not, write to the Free | 11 | (for example /usr/src/linux/COPYING); if not, write to the Free |
12 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 12 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
13 | */ | 13 | */ |
14 | |||
15 | #ifndef _MD_U_H | 14 | #ifndef _MD_U_H |
16 | #define _MD_U_H | 15 | #define _MD_U_H |
17 | 16 | ||
18 | /* | 17 | #include <uapi/linux/raid/md_u.h> |
19 | * Different major versions are not compatible. | ||
20 | * Different minor versions are only downward compatible. | ||
21 | * Different patchlevel versions are downward and upward compatible. | ||
22 | */ | ||
23 | #define MD_MAJOR_VERSION 0 | ||
24 | #define MD_MINOR_VERSION 90 | ||
25 | /* | ||
26 | * MD_PATCHLEVEL_VERSION indicates kernel functionality. | ||
27 | * >=1 means different superblock formats are selectable using SET_ARRAY_INFO | ||
28 | * and major_version/minor_version accordingly | ||
29 | * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT | ||
30 | * in the super status byte | ||
31 | * >=3 means that bitmap superblock version 4 is supported, which uses | ||
32 | * little-ending representation rather than host-endian | ||
33 | */ | ||
34 | #define MD_PATCHLEVEL_VERSION 3 | ||
35 | |||
36 | /* ioctls */ | ||
37 | |||
38 | /* status */ | ||
39 | #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) | ||
40 | #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) | ||
41 | #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) | ||
42 | #define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) | ||
43 | #define RAID_AUTORUN _IO (MD_MAJOR, 0x14) | ||
44 | #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) | ||
45 | |||
46 | /* configuration */ | ||
47 | #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) | ||
48 | #define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t) | ||
49 | #define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22) | ||
50 | #define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t) | ||
51 | #define SET_DISK_INFO _IO (MD_MAJOR, 0x24) | ||
52 | #define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25) | ||
53 | #define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26) | ||
54 | #define PROTECT_ARRAY _IO (MD_MAJOR, 0x27) | ||
55 | #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) | ||
56 | #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) | ||
57 | #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) | ||
58 | #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int) | ||
59 | 18 | ||
60 | /* usage */ | ||
61 | #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) | ||
62 | /* 0x31 was START_ARRAY */ | ||
63 | #define STOP_ARRAY _IO (MD_MAJOR, 0x32) | ||
64 | #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) | ||
65 | #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) | ||
66 | |||
67 | /* 63 partitions with the alternate major number (mdp) */ | ||
68 | #define MdpMinorShift 6 | ||
69 | #ifdef __KERNEL__ | ||
70 | extern int mdp_major; | 19 | extern int mdp_major; |
71 | #endif | ||
72 | |||
73 | typedef struct mdu_version_s { | ||
74 | int major; | ||
75 | int minor; | ||
76 | int patchlevel; | ||
77 | } mdu_version_t; | ||
78 | |||
79 | typedef struct mdu_array_info_s { | ||
80 | /* | ||
81 | * Generic constant information | ||
82 | */ | ||
83 | int major_version; | ||
84 | int minor_version; | ||
85 | int patch_version; | ||
86 | int ctime; | ||
87 | int level; | ||
88 | int size; | ||
89 | int nr_disks; | ||
90 | int raid_disks; | ||
91 | int md_minor; | ||
92 | int not_persistent; | ||
93 | |||
94 | /* | ||
95 | * Generic state information | ||
96 | */ | ||
97 | int utime; /* 0 Superblock update time */ | ||
98 | int state; /* 1 State bits (clean, ...) */ | ||
99 | int active_disks; /* 2 Number of currently active disks */ | ||
100 | int working_disks; /* 3 Number of working disks */ | ||
101 | int failed_disks; /* 4 Number of failed disks */ | ||
102 | int spare_disks; /* 5 Number of spare disks */ | ||
103 | |||
104 | /* | ||
105 | * Personality information | ||
106 | */ | ||
107 | int layout; /* 0 the array's physical layout */ | ||
108 | int chunk_size; /* 1 chunk size in bytes */ | ||
109 | |||
110 | } mdu_array_info_t; | ||
111 | |||
112 | /* non-obvious values for 'level' */ | ||
113 | #define LEVEL_MULTIPATH (-4) | ||
114 | #define LEVEL_LINEAR (-1) | ||
115 | #define LEVEL_FAULTY (-5) | ||
116 | |||
117 | /* we need a value for 'no level specified' and 0 | ||
118 | * means 'raid0', so we need something else. This is | ||
119 | * for internal use only | ||
120 | */ | ||
121 | #define LEVEL_NONE (-1000000) | ||
122 | |||
123 | typedef struct mdu_disk_info_s { | ||
124 | /* | ||
125 | * configuration/status of one particular disk | ||
126 | */ | ||
127 | int number; | ||
128 | int major; | ||
129 | int minor; | ||
130 | int raid_disk; | ||
131 | int state; | ||
132 | |||
133 | } mdu_disk_info_t; | ||
134 | |||
135 | typedef struct mdu_start_info_s { | ||
136 | /* | ||
137 | * configuration/status of one particular disk | ||
138 | */ | ||
139 | int major; | ||
140 | int minor; | ||
141 | int raid_disk; | ||
142 | int state; | ||
143 | |||
144 | } mdu_start_info_t; | ||
145 | |||
146 | typedef struct mdu_bitmap_file_s | ||
147 | { | ||
148 | char pathname[4096]; | ||
149 | } mdu_bitmap_file_t; | ||
150 | |||
151 | typedef struct mdu_param_s | ||
152 | { | ||
153 | int personality; /* 1,2,3,4 */ | ||
154 | int chunk_size; /* in bytes */ | ||
155 | int max_fault; /* unused for now */ | ||
156 | } mdu_param_t; | ||
157 | |||
158 | #endif | 20 | #endif |
159 | |||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index f8cd4cf3fad..7d5b6000378 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -2652,6 +2652,15 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); | |||
2652 | unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); | 2652 | unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); |
2653 | 2653 | ||
2654 | /** | 2654 | /** |
2655 | * ieee80211_get_mesh_hdrlen - get mesh extension header length | ||
2656 | * @meshhdr: the mesh extension header, only the flags field | ||
2657 | * (first byte) will be accessed | ||
2658 | * Returns the length of the extension header, which is always at | ||
2659 | * least 6 bytes and at most 18 if address 5 and 6 are present. | ||
2660 | */ | ||
2661 | unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr); | ||
2662 | |||
2663 | /** | ||
2655 | * DOC: Data path helpers | 2664 | * DOC: Data path helpers |
2656 | * | 2665 | * |
2657 | * In addition to generic utilities, cfg80211 also offers | 2666 | * In addition to generic utilities, cfg80211 also offers |
diff --git a/include/sound/core.h b/include/sound/core.h index bc056687f64..93896ad1fcd 100644 --- a/include/sound/core.h +++ b/include/sound/core.h | |||
@@ -132,6 +132,7 @@ struct snd_card { | |||
132 | int shutdown; /* this card is going down */ | 132 | int shutdown; /* this card is going down */ |
133 | int free_on_last_close; /* free in context of file_release */ | 133 | int free_on_last_close; /* free in context of file_release */ |
134 | wait_queue_head_t shutdown_sleep; | 134 | wait_queue_head_t shutdown_sleep; |
135 | atomic_t refcount; /* refcount for disconnection */ | ||
135 | struct device *dev; /* device assigned to this card */ | 136 | struct device *dev; /* device assigned to this card */ |
136 | struct device *card_dev; /* cardX object for sysfs */ | 137 | struct device *card_dev; /* cardX object for sysfs */ |
137 | 138 | ||
@@ -189,6 +190,7 @@ struct snd_minor { | |||
189 | const struct file_operations *f_ops; /* file operations */ | 190 | const struct file_operations *f_ops; /* file operations */ |
190 | void *private_data; /* private data for f_ops->open */ | 191 | void *private_data; /* private data for f_ops->open */ |
191 | struct device *dev; /* device for sysfs */ | 192 | struct device *dev; /* device for sysfs */ |
193 | struct snd_card *card_ptr; /* assigned card instance */ | ||
192 | }; | 194 | }; |
193 | 195 | ||
194 | /* return a device pointer linked to each sound device as a parent */ | 196 | /* return a device pointer linked to each sound device as a parent */ |
@@ -295,6 +297,7 @@ int snd_card_info_done(void); | |||
295 | int snd_component_add(struct snd_card *card, const char *component); | 297 | int snd_component_add(struct snd_card *card, const char *component); |
296 | int snd_card_file_add(struct snd_card *card, struct file *file); | 298 | int snd_card_file_add(struct snd_card *card, struct file *file); |
297 | int snd_card_file_remove(struct snd_card *card, struct file *file); | 299 | int snd_card_file_remove(struct snd_card *card, struct file *file); |
300 | void snd_card_unref(struct snd_card *card); | ||
298 | 301 | ||
299 | #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) | 302 | #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) |
300 | 303 | ||
diff --git a/include/trace/events/xen.h b/include/trace/events/xen.h index 15ba03bdd7c..d06b6da5c1e 100644 --- a/include/trace/events/xen.h +++ b/include/trace/events/xen.h | |||
@@ -377,6 +377,14 @@ DECLARE_EVENT_CLASS(xen_mmu_pgd, | |||
377 | DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_pin); | 377 | DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_pin); |
378 | DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_unpin); | 378 | DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_unpin); |
379 | 379 | ||
380 | TRACE_EVENT(xen_mmu_flush_tlb_all, | ||
381 | TP_PROTO(int x), | ||
382 | TP_ARGS(x), | ||
383 | TP_STRUCT__entry(__array(char, x, 0)), | ||
384 | TP_fast_assign((void)x), | ||
385 | TP_printk("%s", "") | ||
386 | ); | ||
387 | |||
380 | TRACE_EVENT(xen_mmu_flush_tlb, | 388 | TRACE_EVENT(xen_mmu_flush_tlb, |
381 | TP_PROTO(int x), | 389 | TP_PROTO(int x), |
382 | TP_ARGS(x), | 390 | TP_ARGS(x), |
diff --git a/include/uapi/linux/raid/Kbuild b/include/uapi/linux/raid/Kbuild index aafaa5aa54d..e2c3d25405d 100644 --- a/include/uapi/linux/raid/Kbuild +++ b/include/uapi/linux/raid/Kbuild | |||
@@ -1 +1,3 @@ | |||
1 | # UAPI Header export list | 1 | # UAPI Header export list |
2 | header-y += md_p.h | ||
3 | header-y += md_u.h | ||
diff --git a/include/linux/raid/md_p.h b/include/uapi/linux/raid/md_p.h index ee753536ab7..ee753536ab7 100644 --- a/include/linux/raid/md_p.h +++ b/include/uapi/linux/raid/md_p.h | |||
diff --git a/include/uapi/linux/raid/md_u.h b/include/uapi/linux/raid/md_u.h new file mode 100644 index 00000000000..4133e744e4e --- /dev/null +++ b/include/uapi/linux/raid/md_u.h | |||
@@ -0,0 +1,155 @@ | |||
1 | /* | ||
2 | md_u.h : user <=> kernel API between Linux raidtools and RAID drivers | ||
3 | Copyright (C) 1998 Ingo Molnar | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2, or (at your option) | ||
8 | any later version. | ||
9 | |||
10 | You should have received a copy of the GNU General Public License | ||
11 | (for example /usr/src/linux/COPYING); if not, write to the Free | ||
12 | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
13 | */ | ||
14 | |||
15 | #ifndef _UAPI_MD_U_H | ||
16 | #define _UAPI_MD_U_H | ||
17 | |||
18 | /* | ||
19 | * Different major versions are not compatible. | ||
20 | * Different minor versions are only downward compatible. | ||
21 | * Different patchlevel versions are downward and upward compatible. | ||
22 | */ | ||
23 | #define MD_MAJOR_VERSION 0 | ||
24 | #define MD_MINOR_VERSION 90 | ||
25 | /* | ||
26 | * MD_PATCHLEVEL_VERSION indicates kernel functionality. | ||
27 | * >=1 means different superblock formats are selectable using SET_ARRAY_INFO | ||
28 | * and major_version/minor_version accordingly | ||
29 | * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT | ||
30 | * in the super status byte | ||
31 | * >=3 means that bitmap superblock version 4 is supported, which uses | ||
32 | * little-ending representation rather than host-endian | ||
33 | */ | ||
34 | #define MD_PATCHLEVEL_VERSION 3 | ||
35 | |||
36 | /* ioctls */ | ||
37 | |||
38 | /* status */ | ||
39 | #define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t) | ||
40 | #define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t) | ||
41 | #define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t) | ||
42 | #define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13) | ||
43 | #define RAID_AUTORUN _IO (MD_MAJOR, 0x14) | ||
44 | #define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t) | ||
45 | |||
46 | /* configuration */ | ||
47 | #define CLEAR_ARRAY _IO (MD_MAJOR, 0x20) | ||
48 | #define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t) | ||
49 | #define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22) | ||
50 | #define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t) | ||
51 | #define SET_DISK_INFO _IO (MD_MAJOR, 0x24) | ||
52 | #define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25) | ||
53 | #define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26) | ||
54 | #define PROTECT_ARRAY _IO (MD_MAJOR, 0x27) | ||
55 | #define HOT_ADD_DISK _IO (MD_MAJOR, 0x28) | ||
56 | #define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29) | ||
57 | #define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a) | ||
58 | #define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int) | ||
59 | |||
60 | /* usage */ | ||
61 | #define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t) | ||
62 | /* 0x31 was START_ARRAY */ | ||
63 | #define STOP_ARRAY _IO (MD_MAJOR, 0x32) | ||
64 | #define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33) | ||
65 | #define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34) | ||
66 | |||
67 | /* 63 partitions with the alternate major number (mdp) */ | ||
68 | #define MdpMinorShift 6 | ||
69 | |||
70 | typedef struct mdu_version_s { | ||
71 | int major; | ||
72 | int minor; | ||
73 | int patchlevel; | ||
74 | } mdu_version_t; | ||
75 | |||
76 | typedef struct mdu_array_info_s { | ||
77 | /* | ||
78 | * Generic constant information | ||
79 | */ | ||
80 | int major_version; | ||
81 | int minor_version; | ||
82 | int patch_version; | ||
83 | int ctime; | ||
84 | int level; | ||
85 | int size; | ||
86 | int nr_disks; | ||
87 | int raid_disks; | ||
88 | int md_minor; | ||
89 | int not_persistent; | ||
90 | |||
91 | /* | ||
92 | * Generic state information | ||
93 | */ | ||
94 | int utime; /* 0 Superblock update time */ | ||
95 | int state; /* 1 State bits (clean, ...) */ | ||
96 | int active_disks; /* 2 Number of currently active disks */ | ||
97 | int working_disks; /* 3 Number of working disks */ | ||
98 | int failed_disks; /* 4 Number of failed disks */ | ||
99 | int spare_disks; /* 5 Number of spare disks */ | ||
100 | |||
101 | /* | ||
102 | * Personality information | ||
103 | */ | ||
104 | int layout; /* 0 the array's physical layout */ | ||
105 | int chunk_size; /* 1 chunk size in bytes */ | ||
106 | |||
107 | } mdu_array_info_t; | ||
108 | |||
109 | /* non-obvious values for 'level' */ | ||
110 | #define LEVEL_MULTIPATH (-4) | ||
111 | #define LEVEL_LINEAR (-1) | ||
112 | #define LEVEL_FAULTY (-5) | ||
113 | |||
114 | /* we need a value for 'no level specified' and 0 | ||
115 | * means 'raid0', so we need something else. This is | ||
116 | * for internal use only | ||
117 | */ | ||
118 | #define LEVEL_NONE (-1000000) | ||
119 | |||
120 | typedef struct mdu_disk_info_s { | ||
121 | /* | ||
122 | * configuration/status of one particular disk | ||
123 | */ | ||
124 | int number; | ||
125 | int major; | ||
126 | int minor; | ||
127 | int raid_disk; | ||
128 | int state; | ||
129 | |||
130 | } mdu_disk_info_t; | ||
131 | |||
132 | typedef struct mdu_start_info_s { | ||
133 | /* | ||
134 | * configuration/status of one particular disk | ||
135 | */ | ||
136 | int major; | ||
137 | int minor; | ||
138 | int raid_disk; | ||
139 | int state; | ||
140 | |||
141 | } mdu_start_info_t; | ||
142 | |||
143 | typedef struct mdu_bitmap_file_s | ||
144 | { | ||
145 | char pathname[4096]; | ||
146 | } mdu_bitmap_file_t; | ||
147 | |||
148 | typedef struct mdu_param_s | ||
149 | { | ||
150 | int personality; /* 1,2,3,4 */ | ||
151 | int chunk_size; /* in bytes */ | ||
152 | int max_fault; /* unused for now */ | ||
153 | } mdu_param_t; | ||
154 | |||
155 | #endif /* _UAPI_MD_U_H */ | ||
diff --git a/init/main.c b/init/main.c index 9cf77ab138a..e33e09df3cb 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -442,9 +442,11 @@ void __init __weak smp_setup_processor_id(void) | |||
442 | { | 442 | { |
443 | } | 443 | } |
444 | 444 | ||
445 | # if THREAD_SIZE >= PAGE_SIZE | ||
445 | void __init __weak thread_info_cache_init(void) | 446 | void __init __weak thread_info_cache_init(void) |
446 | { | 447 | { |
447 | } | 448 | } |
449 | #endif | ||
448 | 450 | ||
449 | /* | 451 | /* |
450 | * Set up kernel memory allocators | 452 | * Set up kernel memory allocators |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 159aa8bef9e..3ef1759403b 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -2300,10 +2300,11 @@ restart: | |||
2300 | mutex_unlock(&con->mutex); | 2300 | mutex_unlock(&con->mutex); |
2301 | return; | 2301 | return; |
2302 | } else { | 2302 | } else { |
2303 | con->ops->put(con); | ||
2304 | dout("con_work %p FAILED to back off %lu\n", con, | 2303 | dout("con_work %p FAILED to back off %lu\n", con, |
2305 | con->delay); | 2304 | con->delay); |
2305 | set_bit(CON_FLAG_BACKOFF, &con->flags); | ||
2306 | } | 2306 | } |
2307 | goto done; | ||
2307 | } | 2308 | } |
2308 | 2309 | ||
2309 | if (con->state == CON_STATE_STANDBY) { | 2310 | if (con->state == CON_STATE_STANDBY) { |
@@ -2749,7 +2750,8 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) | |||
2749 | msg = con->ops->alloc_msg(con, hdr, skip); | 2750 | msg = con->ops->alloc_msg(con, hdr, skip); |
2750 | mutex_lock(&con->mutex); | 2751 | mutex_lock(&con->mutex); |
2751 | if (con->state != CON_STATE_OPEN) { | 2752 | if (con->state != CON_STATE_OPEN) { |
2752 | ceph_msg_put(msg); | 2753 | if (msg) |
2754 | ceph_msg_put(msg); | ||
2753 | return -EAGAIN; | 2755 | return -EAGAIN; |
2754 | } | 2756 | } |
2755 | con->in_msg = msg; | 2757 | con->in_msg = msg; |
diff --git a/net/ipv4/netfilter/iptable_nat.c b/net/ipv4/netfilter/iptable_nat.c index 9e0ffaf1d94..a82047282db 100644 --- a/net/ipv4/netfilter/iptable_nat.c +++ b/net/ipv4/netfilter/iptable_nat.c | |||
@@ -184,7 +184,8 @@ nf_nat_ipv4_out(unsigned int hooknum, | |||
184 | 184 | ||
185 | if ((ct->tuplehash[dir].tuple.src.u3.ip != | 185 | if ((ct->tuplehash[dir].tuple.src.u3.ip != |
186 | ct->tuplehash[!dir].tuple.dst.u3.ip) || | 186 | ct->tuplehash[!dir].tuple.dst.u3.ip) || |
187 | (ct->tuplehash[dir].tuple.src.u.all != | 187 | (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP && |
188 | ct->tuplehash[dir].tuple.src.u.all != | ||
188 | ct->tuplehash[!dir].tuple.dst.u.all)) | 189 | ct->tuplehash[!dir].tuple.dst.u.all)) |
189 | if (nf_xfrm_me_harder(skb, AF_INET) < 0) | 190 | if (nf_xfrm_me_harder(skb, AF_INET) < 0) |
190 | ret = NF_DROP; | 191 | ret = NF_DROP; |
@@ -221,6 +222,7 @@ nf_nat_ipv4_local_fn(unsigned int hooknum, | |||
221 | } | 222 | } |
222 | #ifdef CONFIG_XFRM | 223 | #ifdef CONFIG_XFRM |
223 | else if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) && | 224 | else if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) && |
225 | ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP && | ||
224 | ct->tuplehash[dir].tuple.dst.u.all != | 226 | ct->tuplehash[dir].tuple.dst.u.all != |
225 | ct->tuplehash[!dir].tuple.src.u.all) | 227 | ct->tuplehash[!dir].tuple.src.u.all) |
226 | if (nf_xfrm_me_harder(skb, AF_INET) < 0) | 228 | if (nf_xfrm_me_harder(skb, AF_INET) < 0) |
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c index 813b43a76fe..834857f3c87 100644 --- a/net/ipv4/tcp_illinois.c +++ b/net/ipv4/tcp_illinois.c | |||
@@ -313,11 +313,13 @@ static void tcp_illinois_info(struct sock *sk, u32 ext, | |||
313 | .tcpv_rttcnt = ca->cnt_rtt, | 313 | .tcpv_rttcnt = ca->cnt_rtt, |
314 | .tcpv_minrtt = ca->base_rtt, | 314 | .tcpv_minrtt = ca->base_rtt, |
315 | }; | 315 | }; |
316 | u64 t = ca->sum_rtt; | ||
317 | 316 | ||
318 | do_div(t, ca->cnt_rtt); | 317 | if (info.tcpv_rttcnt > 0) { |
319 | info.tcpv_rtt = t; | 318 | u64 t = ca->sum_rtt; |
320 | 319 | ||
320 | do_div(t, info.tcpv_rttcnt); | ||
321 | info.tcpv_rtt = t; | ||
322 | } | ||
321 | nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info); | 323 | nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info); |
322 | } | 324 | } |
323 | } | 325 | } |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 1db66398358..2c2b13a999e 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4529,6 +4529,9 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size) | |||
4529 | struct tcphdr *th; | 4529 | struct tcphdr *th; |
4530 | bool fragstolen; | 4530 | bool fragstolen; |
4531 | 4531 | ||
4532 | if (size == 0) | ||
4533 | return 0; | ||
4534 | |||
4532 | skb = alloc_skb(size + sizeof(*th), sk->sk_allocation); | 4535 | skb = alloc_skb(size + sizeof(*th), sk->sk_allocation); |
4533 | if (!skb) | 4536 | if (!skb) |
4534 | goto err; | 4537 | goto err; |
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index 4c752a6e0bc..53bc5847bfa 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c | |||
@@ -864,7 +864,7 @@ static int parse_nl_addr(struct genl_info *info, struct inetpeer_addr *addr, | |||
864 | } | 864 | } |
865 | a = info->attrs[TCP_METRICS_ATTR_ADDR_IPV6]; | 865 | a = info->attrs[TCP_METRICS_ATTR_ADDR_IPV6]; |
866 | if (a) { | 866 | if (a) { |
867 | if (nla_len(a) != sizeof(sizeof(struct in6_addr))) | 867 | if (nla_len(a) != sizeof(struct in6_addr)) |
868 | return -EINVAL; | 868 | return -EINVAL; |
869 | addr->family = AF_INET6; | 869 | addr->family = AF_INET6; |
870 | memcpy(addr->addr.a6, nla_data(a), sizeof(addr->addr.a6)); | 870 | memcpy(addr->addr.a6, nla_data(a), sizeof(addr->addr.a6)); |
diff --git a/net/ipv6/netfilter/ip6table_nat.c b/net/ipv6/netfilter/ip6table_nat.c index e418bd6350a..d57dab17a18 100644 --- a/net/ipv6/netfilter/ip6table_nat.c +++ b/net/ipv6/netfilter/ip6table_nat.c | |||
@@ -186,7 +186,8 @@ nf_nat_ipv6_out(unsigned int hooknum, | |||
186 | 186 | ||
187 | if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.src.u3, | 187 | if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.src.u3, |
188 | &ct->tuplehash[!dir].tuple.dst.u3) || | 188 | &ct->tuplehash[!dir].tuple.dst.u3) || |
189 | (ct->tuplehash[dir].tuple.src.u.all != | 189 | (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 && |
190 | ct->tuplehash[dir].tuple.src.u.all != | ||
190 | ct->tuplehash[!dir].tuple.dst.u.all)) | 191 | ct->tuplehash[!dir].tuple.dst.u.all)) |
191 | if (nf_xfrm_me_harder(skb, AF_INET6) < 0) | 192 | if (nf_xfrm_me_harder(skb, AF_INET6) < 0) |
192 | ret = NF_DROP; | 193 | ret = NF_DROP; |
@@ -222,6 +223,7 @@ nf_nat_ipv6_local_fn(unsigned int hooknum, | |||
222 | } | 223 | } |
223 | #ifdef CONFIG_XFRM | 224 | #ifdef CONFIG_XFRM |
224 | else if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && | 225 | else if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) && |
226 | ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 && | ||
225 | ct->tuplehash[dir].tuple.dst.u.all != | 227 | ct->tuplehash[dir].tuple.dst.u.all != |
226 | ct->tuplehash[!dir].tuple.src.u.all) | 228 | ct->tuplehash[!dir].tuple.src.u.all) |
227 | if (nf_xfrm_me_harder(skb, AF_INET6)) | 229 | if (nf_xfrm_me_harder(skb, AF_INET6)) |
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c index 18bd9bbbd1c..22c8ea95118 100644 --- a/net/ipv6/netfilter/nf_conntrack_reasm.c +++ b/net/ipv6/netfilter/nf_conntrack_reasm.c | |||
@@ -85,7 +85,7 @@ static struct ctl_table nf_ct_frag6_sysctl_table[] = { | |||
85 | { } | 85 | { } |
86 | }; | 86 | }; |
87 | 87 | ||
88 | static int __net_init nf_ct_frag6_sysctl_register(struct net *net) | 88 | static int nf_ct_frag6_sysctl_register(struct net *net) |
89 | { | 89 | { |
90 | struct ctl_table *table; | 90 | struct ctl_table *table; |
91 | struct ctl_table_header *hdr; | 91 | struct ctl_table_header *hdr; |
@@ -127,7 +127,7 @@ static void __net_exit nf_ct_frags6_sysctl_unregister(struct net *net) | |||
127 | } | 127 | } |
128 | 128 | ||
129 | #else | 129 | #else |
130 | static int __net_init nf_ct_frag6_sysctl_register(struct net *net) | 130 | static int nf_ct_frag6_sysctl_register(struct net *net) |
131 | { | 131 | { |
132 | return 0; | 132 | return 0; |
133 | } | 133 | } |
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c index 37b8b8ba31f..76125c57ee6 100644 --- a/net/l2tp/l2tp_eth.c +++ b/net/l2tp/l2tp_eth.c | |||
@@ -291,6 +291,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p | |||
291 | 291 | ||
292 | out_del_dev: | 292 | out_del_dev: |
293 | free_netdev(dev); | 293 | free_netdev(dev); |
294 | spriv->dev = NULL; | ||
294 | out_del_session: | 295 | out_del_session: |
295 | l2tp_session_delete(session); | 296 | l2tp_session_delete(session); |
296 | out: | 297 | out: |
diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 5f3620f0bc0..bf87c70ac6c 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c | |||
@@ -1108,7 +1108,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, | |||
1108 | sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH; | 1108 | sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH; |
1109 | sdata->u.ibss.ibss_join_req = jiffies; | 1109 | sdata->u.ibss.ibss_join_req = jiffies; |
1110 | 1110 | ||
1111 | memcpy(sdata->u.ibss.ssid, params->ssid, IEEE80211_MAX_SSID_LEN); | 1111 | memcpy(sdata->u.ibss.ssid, params->ssid, params->ssid_len); |
1112 | sdata->u.ibss.ssid_len = params->ssid_len; | 1112 | sdata->u.ibss.ssid_len = params->ssid_len; |
1113 | 1113 | ||
1114 | mutex_unlock(&sdata->u.ibss.mtx); | 1114 | mutex_unlock(&sdata->u.ibss.mtx); |
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 61c621e9273..00ade7feb2e 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c | |||
@@ -531,6 +531,11 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx) | |||
531 | 531 | ||
532 | if (ieee80211_is_action(hdr->frame_control)) { | 532 | if (ieee80211_is_action(hdr->frame_control)) { |
533 | u8 category; | 533 | u8 category; |
534 | |||
535 | /* make sure category field is present */ | ||
536 | if (rx->skb->len < IEEE80211_MIN_ACTION_SIZE) | ||
537 | return RX_DROP_MONITOR; | ||
538 | |||
534 | mgmt = (struct ieee80211_mgmt *)hdr; | 539 | mgmt = (struct ieee80211_mgmt *)hdr; |
535 | category = mgmt->u.action.category; | 540 | category = mgmt->u.action.category; |
536 | if (category != WLAN_CATEGORY_MESH_ACTION && | 541 | if (category != WLAN_CATEGORY_MESH_ACTION && |
@@ -883,14 +888,16 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) | |||
883 | */ | 888 | */ |
884 | if (rx->sta && rx->sdata->vif.type == NL80211_IFTYPE_STATION && | 889 | if (rx->sta && rx->sdata->vif.type == NL80211_IFTYPE_STATION && |
885 | ieee80211_is_data_present(hdr->frame_control)) { | 890 | ieee80211_is_data_present(hdr->frame_control)) { |
886 | u16 ethertype; | 891 | unsigned int hdrlen; |
887 | u8 *payload; | 892 | __be16 ethertype; |
888 | 893 | ||
889 | payload = rx->skb->data + | 894 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
890 | ieee80211_hdrlen(hdr->frame_control); | 895 | |
891 | ethertype = (payload[6] << 8) | payload[7]; | 896 | if (rx->skb->len < hdrlen + 8) |
892 | if (cpu_to_be16(ethertype) == | 897 | return RX_DROP_MONITOR; |
893 | rx->sdata->control_port_protocol) | 898 | |
899 | skb_copy_bits(rx->skb, hdrlen + 6, ðertype, 2); | ||
900 | if (ethertype == rx->sdata->control_port_protocol) | ||
894 | return RX_CONTINUE; | 901 | return RX_CONTINUE; |
895 | } | 902 | } |
896 | 903 | ||
@@ -1462,11 +1469,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) | |||
1462 | 1469 | ||
1463 | hdr = (struct ieee80211_hdr *)rx->skb->data; | 1470 | hdr = (struct ieee80211_hdr *)rx->skb->data; |
1464 | fc = hdr->frame_control; | 1471 | fc = hdr->frame_control; |
1472 | |||
1473 | if (ieee80211_is_ctl(fc)) | ||
1474 | return RX_CONTINUE; | ||
1475 | |||
1465 | sc = le16_to_cpu(hdr->seq_ctrl); | 1476 | sc = le16_to_cpu(hdr->seq_ctrl); |
1466 | frag = sc & IEEE80211_SCTL_FRAG; | 1477 | frag = sc & IEEE80211_SCTL_FRAG; |
1467 | 1478 | ||
1468 | if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || | 1479 | if (likely((!ieee80211_has_morefrags(fc) && frag == 0) || |
1469 | (rx->skb)->len < 24 || | ||
1470 | is_multicast_ether_addr(hdr->addr1))) { | 1480 | is_multicast_ether_addr(hdr->addr1))) { |
1471 | /* not fragmented */ | 1481 | /* not fragmented */ |
1472 | goto out; | 1482 | goto out; |
@@ -1889,6 +1899,20 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1889 | 1899 | ||
1890 | hdr = (struct ieee80211_hdr *) skb->data; | 1900 | hdr = (struct ieee80211_hdr *) skb->data; |
1891 | hdrlen = ieee80211_hdrlen(hdr->frame_control); | 1901 | hdrlen = ieee80211_hdrlen(hdr->frame_control); |
1902 | |||
1903 | /* make sure fixed part of mesh header is there, also checks skb len */ | ||
1904 | if (!pskb_may_pull(rx->skb, hdrlen + 6)) | ||
1905 | return RX_DROP_MONITOR; | ||
1906 | |||
1907 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); | ||
1908 | |||
1909 | /* make sure full mesh header is there, also checks skb len */ | ||
1910 | if (!pskb_may_pull(rx->skb, | ||
1911 | hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr))) | ||
1912 | return RX_DROP_MONITOR; | ||
1913 | |||
1914 | /* reload pointers */ | ||
1915 | hdr = (struct ieee80211_hdr *) skb->data; | ||
1892 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); | 1916 | mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen); |
1893 | 1917 | ||
1894 | /* frame is in RMC, don't forward */ | 1918 | /* frame is in RMC, don't forward */ |
@@ -1897,7 +1921,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1897 | mesh_rmc_check(hdr->addr3, mesh_hdr, rx->sdata)) | 1921 | mesh_rmc_check(hdr->addr3, mesh_hdr, rx->sdata)) |
1898 | return RX_DROP_MONITOR; | 1922 | return RX_DROP_MONITOR; |
1899 | 1923 | ||
1900 | if (!ieee80211_is_data(hdr->frame_control)) | 1924 | if (!ieee80211_is_data(hdr->frame_control) || |
1925 | !(status->rx_flags & IEEE80211_RX_RA_MATCH)) | ||
1901 | return RX_CONTINUE; | 1926 | return RX_CONTINUE; |
1902 | 1927 | ||
1903 | if (!mesh_hdr->ttl) | 1928 | if (!mesh_hdr->ttl) |
@@ -1911,9 +1936,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1911 | if (is_multicast_ether_addr(hdr->addr1)) { | 1936 | if (is_multicast_ether_addr(hdr->addr1)) { |
1912 | mpp_addr = hdr->addr3; | 1937 | mpp_addr = hdr->addr3; |
1913 | proxied_addr = mesh_hdr->eaddr1; | 1938 | proxied_addr = mesh_hdr->eaddr1; |
1914 | } else { | 1939 | } else if (mesh_hdr->flags & MESH_FLAGS_AE_A5_A6) { |
1940 | /* has_a4 already checked in ieee80211_rx_mesh_check */ | ||
1915 | mpp_addr = hdr->addr4; | 1941 | mpp_addr = hdr->addr4; |
1916 | proxied_addr = mesh_hdr->eaddr2; | 1942 | proxied_addr = mesh_hdr->eaddr2; |
1943 | } else { | ||
1944 | return RX_DROP_MONITOR; | ||
1917 | } | 1945 | } |
1918 | 1946 | ||
1919 | rcu_read_lock(); | 1947 | rcu_read_lock(); |
@@ -1941,12 +1969,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) | |||
1941 | } | 1969 | } |
1942 | skb_set_queue_mapping(skb, q); | 1970 | skb_set_queue_mapping(skb, q); |
1943 | 1971 | ||
1944 | if (!(status->rx_flags & IEEE80211_RX_RA_MATCH)) | ||
1945 | goto out; | ||
1946 | |||
1947 | if (!--mesh_hdr->ttl) { | 1972 | if (!--mesh_hdr->ttl) { |
1948 | IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); | 1973 | IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl); |
1949 | return RX_DROP_MONITOR; | 1974 | goto out; |
1950 | } | 1975 | } |
1951 | 1976 | ||
1952 | if (!ifmsh->mshcfg.dot11MeshForwarding) | 1977 | if (!ifmsh->mshcfg.dot11MeshForwarding) |
@@ -2353,6 +2378,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
2353 | } | 2378 | } |
2354 | break; | 2379 | break; |
2355 | case WLAN_CATEGORY_SELF_PROTECTED: | 2380 | case WLAN_CATEGORY_SELF_PROTECTED: |
2381 | if (len < (IEEE80211_MIN_ACTION_SIZE + | ||
2382 | sizeof(mgmt->u.action.u.self_prot.action_code))) | ||
2383 | break; | ||
2384 | |||
2356 | switch (mgmt->u.action.u.self_prot.action_code) { | 2385 | switch (mgmt->u.action.u.self_prot.action_code) { |
2357 | case WLAN_SP_MESH_PEERING_OPEN: | 2386 | case WLAN_SP_MESH_PEERING_OPEN: |
2358 | case WLAN_SP_MESH_PEERING_CLOSE: | 2387 | case WLAN_SP_MESH_PEERING_CLOSE: |
@@ -2371,6 +2400,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) | |||
2371 | } | 2400 | } |
2372 | break; | 2401 | break; |
2373 | case WLAN_CATEGORY_MESH_ACTION: | 2402 | case WLAN_CATEGORY_MESH_ACTION: |
2403 | if (len < (IEEE80211_MIN_ACTION_SIZE + | ||
2404 | sizeof(mgmt->u.action.u.mesh_action.action_code))) | ||
2405 | break; | ||
2406 | |||
2374 | if (!ieee80211_vif_is_mesh(&sdata->vif)) | 2407 | if (!ieee80211_vif_is_mesh(&sdata->vif)) |
2375 | break; | 2408 | break; |
2376 | if (mesh_action_is_path_sel(mgmt) && | 2409 | if (mesh_action_is_path_sel(mgmt) && |
@@ -2913,10 +2946,15 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, | |||
2913 | if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc)) | 2946 | if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc)) |
2914 | local->dot11ReceivedFragmentCount++; | 2947 | local->dot11ReceivedFragmentCount++; |
2915 | 2948 | ||
2916 | if (ieee80211_is_mgmt(fc)) | 2949 | if (ieee80211_is_mgmt(fc)) { |
2917 | err = skb_linearize(skb); | 2950 | /* drop frame if too short for header */ |
2918 | else | 2951 | if (skb->len < ieee80211_hdrlen(fc)) |
2952 | err = -ENOBUFS; | ||
2953 | else | ||
2954 | err = skb_linearize(skb); | ||
2955 | } else { | ||
2919 | err = !pskb_may_pull(skb, ieee80211_hdrlen(fc)); | 2956 | err = !pskb_may_pull(skb, ieee80211_hdrlen(fc)); |
2957 | } | ||
2920 | 2958 | ||
2921 | if (err) { | 2959 | if (err) { |
2922 | dev_kfree_skb(skb); | 2960 | dev_kfree_skb(skb); |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 94e58687397..239391807ca 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -643,13 +643,41 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, | |||
643 | break; | 643 | break; |
644 | } | 644 | } |
645 | 645 | ||
646 | if (id != WLAN_EID_VENDOR_SPECIFIC && | 646 | switch (id) { |
647 | id != WLAN_EID_QUIET && | 647 | case WLAN_EID_SSID: |
648 | test_bit(id, seen_elems)) { | 648 | case WLAN_EID_SUPP_RATES: |
649 | elems->parse_error = true; | 649 | case WLAN_EID_FH_PARAMS: |
650 | left -= elen; | 650 | case WLAN_EID_DS_PARAMS: |
651 | pos += elen; | 651 | case WLAN_EID_CF_PARAMS: |
652 | continue; | 652 | case WLAN_EID_TIM: |
653 | case WLAN_EID_IBSS_PARAMS: | ||
654 | case WLAN_EID_CHALLENGE: | ||
655 | case WLAN_EID_RSN: | ||
656 | case WLAN_EID_ERP_INFO: | ||
657 | case WLAN_EID_EXT_SUPP_RATES: | ||
658 | case WLAN_EID_HT_CAPABILITY: | ||
659 | case WLAN_EID_HT_OPERATION: | ||
660 | case WLAN_EID_VHT_CAPABILITY: | ||
661 | case WLAN_EID_VHT_OPERATION: | ||
662 | case WLAN_EID_MESH_ID: | ||
663 | case WLAN_EID_MESH_CONFIG: | ||
664 | case WLAN_EID_PEER_MGMT: | ||
665 | case WLAN_EID_PREQ: | ||
666 | case WLAN_EID_PREP: | ||
667 | case WLAN_EID_PERR: | ||
668 | case WLAN_EID_RANN: | ||
669 | case WLAN_EID_CHANNEL_SWITCH: | ||
670 | case WLAN_EID_EXT_CHANSWITCH_ANN: | ||
671 | case WLAN_EID_COUNTRY: | ||
672 | case WLAN_EID_PWR_CONSTRAINT: | ||
673 | case WLAN_EID_TIMEOUT_INTERVAL: | ||
674 | if (test_bit(id, seen_elems)) { | ||
675 | elems->parse_error = true; | ||
676 | left -= elen; | ||
677 | pos += elen; | ||
678 | continue; | ||
679 | } | ||
680 | break; | ||
653 | } | 681 | } |
654 | 682 | ||
655 | if (calc_crc && id < 64 && (filter & (1ULL << id))) | 683 | if (calc_crc && id < 64 && (filter & (1ULL << id))) |
diff --git a/net/netfilter/nf_conntrack_h323_main.c b/net/netfilter/nf_conntrack_h323_main.c index 1b30b0dee70..962795e839a 100644 --- a/net/netfilter/nf_conntrack_h323_main.c +++ b/net/netfilter/nf_conntrack_h323_main.c | |||
@@ -753,7 +753,8 @@ static int callforward_do_filter(const union nf_inet_addr *src, | |||
753 | flowi4_to_flowi(&fl1), false)) { | 753 | flowi4_to_flowi(&fl1), false)) { |
754 | if (!afinfo->route(&init_net, (struct dst_entry **)&rt2, | 754 | if (!afinfo->route(&init_net, (struct dst_entry **)&rt2, |
755 | flowi4_to_flowi(&fl2), false)) { | 755 | flowi4_to_flowi(&fl2), false)) { |
756 | if (rt1->rt_gateway == rt2->rt_gateway && | 756 | if (rt_nexthop(rt1, fl1.daddr) == |
757 | rt_nexthop(rt2, fl2.daddr) && | ||
757 | rt1->dst.dev == rt2->dst.dev) | 758 | rt1->dst.dev == rt2->dst.dev) |
758 | ret = 1; | 759 | ret = 1; |
759 | dst_release(&rt2->dst); | 760 | dst_release(&rt2->dst); |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 59d16ea927f..a60d1f8b41c 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -974,7 +974,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, | |||
974 | void *addr_buf; | 974 | void *addr_buf; |
975 | struct sctp_af *af; | 975 | struct sctp_af *af; |
976 | 976 | ||
977 | SCTP_DEBUG_PRINTK("sctp_setsocktopt_bindx: sk %p addrs %p" | 977 | SCTP_DEBUG_PRINTK("sctp_setsockopt_bindx: sk %p addrs %p" |
978 | " addrs_size %d opt %d\n", sk, addrs, addrs_size, op); | 978 | " addrs_size %d opt %d\n", sk, addrs, addrs_size, op); |
979 | 979 | ||
980 | if (unlikely(addrs_size <= 0)) | 980 | if (unlikely(addrs_size <= 0)) |
diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c index 5a3d675d2f2..a9c0bbccad6 100644 --- a/net/sunrpc/backchannel_rqst.c +++ b/net/sunrpc/backchannel_rqst.c | |||
@@ -172,7 +172,7 @@ out_free: | |||
172 | xprt_free_allocation(req); | 172 | xprt_free_allocation(req); |
173 | 173 | ||
174 | dprintk("RPC: setup backchannel transport failed\n"); | 174 | dprintk("RPC: setup backchannel transport failed\n"); |
175 | return -1; | 175 | return -ENOMEM; |
176 | } | 176 | } |
177 | EXPORT_SYMBOL_GPL(xprt_setup_backchannel); | 177 | EXPORT_SYMBOL_GPL(xprt_setup_backchannel); |
178 | 178 | ||
diff --git a/net/wireless/core.c b/net/wireless/core.c index 443d4d7deea..3f725305208 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -526,8 +526,7 @@ int wiphy_register(struct wiphy *wiphy) | |||
526 | for (i = 0; i < sband->n_channels; i++) { | 526 | for (i = 0; i < sband->n_channels; i++) { |
527 | sband->channels[i].orig_flags = | 527 | sband->channels[i].orig_flags = |
528 | sband->channels[i].flags; | 528 | sband->channels[i].flags; |
529 | sband->channels[i].orig_mag = | 529 | sband->channels[i].orig_mag = INT_MAX; |
530 | sband->channels[i].max_antenna_gain; | ||
531 | sband->channels[i].orig_mpwr = | 530 | sband->channels[i].orig_mpwr = |
532 | sband->channels[i].max_power; | 531 | sband->channels[i].max_power; |
533 | sband->channels[i].band = band; | 532 | sband->channels[i].band = band; |
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 3b8cbbc214d..bcc7d7ee5a5 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -908,7 +908,7 @@ static void handle_channel(struct wiphy *wiphy, | |||
908 | map_regdom_flags(reg_rule->flags) | bw_flags; | 908 | map_regdom_flags(reg_rule->flags) | bw_flags; |
909 | chan->max_antenna_gain = chan->orig_mag = | 909 | chan->max_antenna_gain = chan->orig_mag = |
910 | (int) MBI_TO_DBI(power_rule->max_antenna_gain); | 910 | (int) MBI_TO_DBI(power_rule->max_antenna_gain); |
911 | chan->max_power = chan->orig_mpwr = | 911 | chan->max_reg_power = chan->max_power = chan->orig_mpwr = |
912 | (int) MBM_TO_DBM(power_rule->max_eirp); | 912 | (int) MBM_TO_DBM(power_rule->max_eirp); |
913 | return; | 913 | return; |
914 | } | 914 | } |
@@ -1331,7 +1331,8 @@ static void handle_channel_custom(struct wiphy *wiphy, | |||
1331 | 1331 | ||
1332 | chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags; | 1332 | chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags; |
1333 | chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain); | 1333 | chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain); |
1334 | chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp); | 1334 | chan->max_reg_power = chan->max_power = |
1335 | (int) MBM_TO_DBM(power_rule->max_eirp); | ||
1335 | } | 1336 | } |
1336 | 1337 | ||
1337 | static void handle_band_custom(struct wiphy *wiphy, enum ieee80211_band band, | 1338 | static void handle_band_custom(struct wiphy *wiphy, enum ieee80211_band band, |
diff --git a/net/wireless/util.c b/net/wireless/util.c index ef35f4ef2aa..2762e832998 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -309,23 +309,21 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb) | |||
309 | } | 309 | } |
310 | EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb); | 310 | EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb); |
311 | 311 | ||
312 | static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr) | 312 | unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr) |
313 | { | 313 | { |
314 | int ae = meshhdr->flags & MESH_FLAGS_AE; | 314 | int ae = meshhdr->flags & MESH_FLAGS_AE; |
315 | /* 7.1.3.5a.2 */ | 315 | /* 802.11-2012, 8.2.4.7.3 */ |
316 | switch (ae) { | 316 | switch (ae) { |
317 | default: | ||
317 | case 0: | 318 | case 0: |
318 | return 6; | 319 | return 6; |
319 | case MESH_FLAGS_AE_A4: | 320 | case MESH_FLAGS_AE_A4: |
320 | return 12; | 321 | return 12; |
321 | case MESH_FLAGS_AE_A5_A6: | 322 | case MESH_FLAGS_AE_A5_A6: |
322 | return 18; | 323 | return 18; |
323 | case (MESH_FLAGS_AE_A4 | MESH_FLAGS_AE_A5_A6): | ||
324 | return 24; | ||
325 | default: | ||
326 | return 6; | ||
327 | } | 324 | } |
328 | } | 325 | } |
326 | EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen); | ||
329 | 327 | ||
330 | int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, | 328 | int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, |
331 | enum nl80211_iftype iftype) | 329 | enum nl80211_iftype iftype) |
@@ -373,6 +371,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, | |||
373 | /* make sure meshdr->flags is on the linear part */ | 371 | /* make sure meshdr->flags is on the linear part */ |
374 | if (!pskb_may_pull(skb, hdrlen + 1)) | 372 | if (!pskb_may_pull(skb, hdrlen + 1)) |
375 | return -1; | 373 | return -1; |
374 | if (meshdr->flags & MESH_FLAGS_AE_A4) | ||
375 | return -1; | ||
376 | if (meshdr->flags & MESH_FLAGS_AE_A5_A6) { | 376 | if (meshdr->flags & MESH_FLAGS_AE_A5_A6) { |
377 | skb_copy_bits(skb, hdrlen + | 377 | skb_copy_bits(skb, hdrlen + |
378 | offsetof(struct ieee80211s_hdr, eaddr1), | 378 | offsetof(struct ieee80211s_hdr, eaddr1), |
@@ -397,6 +397,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, | |||
397 | /* make sure meshdr->flags is on the linear part */ | 397 | /* make sure meshdr->flags is on the linear part */ |
398 | if (!pskb_may_pull(skb, hdrlen + 1)) | 398 | if (!pskb_may_pull(skb, hdrlen + 1)) |
399 | return -1; | 399 | return -1; |
400 | if (meshdr->flags & MESH_FLAGS_AE_A5_A6) | ||
401 | return -1; | ||
400 | if (meshdr->flags & MESH_FLAGS_AE_A4) | 402 | if (meshdr->flags & MESH_FLAGS_AE_A4) |
401 | skb_copy_bits(skb, hdrlen + | 403 | skb_copy_bits(skb, hdrlen + |
402 | offsetof(struct ieee80211s_hdr, eaddr1), | 404 | offsetof(struct ieee80211s_hdr, eaddr1), |
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index c40ae573346..ad11dc99479 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c | |||
@@ -100,12 +100,15 @@ static int snd_compr_open(struct inode *inode, struct file *f) | |||
100 | 100 | ||
101 | if (dirn != compr->direction) { | 101 | if (dirn != compr->direction) { |
102 | pr_err("this device doesn't support this direction\n"); | 102 | pr_err("this device doesn't support this direction\n"); |
103 | snd_card_unref(compr->card); | ||
103 | return -EINVAL; | 104 | return -EINVAL; |
104 | } | 105 | } |
105 | 106 | ||
106 | data = kzalloc(sizeof(*data), GFP_KERNEL); | 107 | data = kzalloc(sizeof(*data), GFP_KERNEL); |
107 | if (!data) | 108 | if (!data) { |
109 | snd_card_unref(compr->card); | ||
108 | return -ENOMEM; | 110 | return -ENOMEM; |
111 | } | ||
109 | data->stream.ops = compr->ops; | 112 | data->stream.ops = compr->ops; |
110 | data->stream.direction = dirn; | 113 | data->stream.direction = dirn; |
111 | data->stream.private_data = compr->private_data; | 114 | data->stream.private_data = compr->private_data; |
@@ -113,6 +116,7 @@ static int snd_compr_open(struct inode *inode, struct file *f) | |||
113 | runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); | 116 | runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); |
114 | if (!runtime) { | 117 | if (!runtime) { |
115 | kfree(data); | 118 | kfree(data); |
119 | snd_card_unref(compr->card); | ||
116 | return -ENOMEM; | 120 | return -ENOMEM; |
117 | } | 121 | } |
118 | runtime->state = SNDRV_PCM_STATE_OPEN; | 122 | runtime->state = SNDRV_PCM_STATE_OPEN; |
@@ -126,7 +130,8 @@ static int snd_compr_open(struct inode *inode, struct file *f) | |||
126 | kfree(runtime); | 130 | kfree(runtime); |
127 | kfree(data); | 131 | kfree(data); |
128 | } | 132 | } |
129 | return ret; | 133 | snd_card_unref(compr->card); |
134 | return 0; | ||
130 | } | 135 | } |
131 | 136 | ||
132 | static int snd_compr_free(struct inode *inode, struct file *f) | 137 | static int snd_compr_free(struct inode *inode, struct file *f) |
diff --git a/sound/core/control.c b/sound/core/control.c index 7e86a5b9f3b..8c7c2c9bba6 100644 --- a/sound/core/control.c +++ b/sound/core/control.c | |||
@@ -86,6 +86,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file) | |||
86 | write_lock_irqsave(&card->ctl_files_rwlock, flags); | 86 | write_lock_irqsave(&card->ctl_files_rwlock, flags); |
87 | list_add_tail(&ctl->list, &card->ctl_files); | 87 | list_add_tail(&ctl->list, &card->ctl_files); |
88 | write_unlock_irqrestore(&card->ctl_files_rwlock, flags); | 88 | write_unlock_irqrestore(&card->ctl_files_rwlock, flags); |
89 | snd_card_unref(card); | ||
89 | return 0; | 90 | return 0; |
90 | 91 | ||
91 | __error: | 92 | __error: |
@@ -93,6 +94,8 @@ static int snd_ctl_open(struct inode *inode, struct file *file) | |||
93 | __error2: | 94 | __error2: |
94 | snd_card_file_remove(card, file); | 95 | snd_card_file_remove(card, file); |
95 | __error1: | 96 | __error1: |
97 | if (card) | ||
98 | snd_card_unref(card); | ||
96 | return err; | 99 | return err; |
97 | } | 100 | } |
98 | 101 | ||
@@ -1434,6 +1437,8 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer, | |||
1434 | spin_unlock_irq(&ctl->read_lock); | 1437 | spin_unlock_irq(&ctl->read_lock); |
1435 | schedule(); | 1438 | schedule(); |
1436 | remove_wait_queue(&ctl->change_sleep, &wait); | 1439 | remove_wait_queue(&ctl->change_sleep, &wait); |
1440 | if (ctl->card->shutdown) | ||
1441 | return -ENODEV; | ||
1437 | if (signal_pending(current)) | 1442 | if (signal_pending(current)) |
1438 | return -ERESTARTSYS; | 1443 | return -ERESTARTSYS; |
1439 | spin_lock_irq(&ctl->read_lock); | 1444 | spin_lock_irq(&ctl->read_lock); |
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c index 75ea16f35b1..3f7f6628cf7 100644 --- a/sound/core/hwdep.c +++ b/sound/core/hwdep.c | |||
@@ -100,8 +100,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) | |||
100 | if (hw == NULL) | 100 | if (hw == NULL) |
101 | return -ENODEV; | 101 | return -ENODEV; |
102 | 102 | ||
103 | if (!try_module_get(hw->card->module)) | 103 | if (!try_module_get(hw->card->module)) { |
104 | snd_card_unref(hw->card); | ||
104 | return -EFAULT; | 105 | return -EFAULT; |
106 | } | ||
105 | 107 | ||
106 | init_waitqueue_entry(&wait, current); | 108 | init_waitqueue_entry(&wait, current); |
107 | add_wait_queue(&hw->open_wait, &wait); | 109 | add_wait_queue(&hw->open_wait, &wait); |
@@ -129,6 +131,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) | |||
129 | mutex_unlock(&hw->open_mutex); | 131 | mutex_unlock(&hw->open_mutex); |
130 | schedule(); | 132 | schedule(); |
131 | mutex_lock(&hw->open_mutex); | 133 | mutex_lock(&hw->open_mutex); |
134 | if (hw->card->shutdown) { | ||
135 | err = -ENODEV; | ||
136 | break; | ||
137 | } | ||
132 | if (signal_pending(current)) { | 138 | if (signal_pending(current)) { |
133 | err = -ERESTARTSYS; | 139 | err = -ERESTARTSYS; |
134 | break; | 140 | break; |
@@ -148,6 +154,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) | |||
148 | mutex_unlock(&hw->open_mutex); | 154 | mutex_unlock(&hw->open_mutex); |
149 | if (err < 0) | 155 | if (err < 0) |
150 | module_put(hw->card->module); | 156 | module_put(hw->card->module); |
157 | snd_card_unref(hw->card); | ||
151 | return err; | 158 | return err; |
152 | } | 159 | } |
153 | 160 | ||
@@ -459,12 +466,15 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device) | |||
459 | mutex_unlock(®ister_mutex); | 466 | mutex_unlock(®ister_mutex); |
460 | return -EINVAL; | 467 | return -EINVAL; |
461 | } | 468 | } |
469 | mutex_lock(&hwdep->open_mutex); | ||
470 | wake_up(&hwdep->open_wait); | ||
462 | #ifdef CONFIG_SND_OSSEMUL | 471 | #ifdef CONFIG_SND_OSSEMUL |
463 | if (hwdep->ossreg) | 472 | if (hwdep->ossreg) |
464 | snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device); | 473 | snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device); |
465 | #endif | 474 | #endif |
466 | snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device); | 475 | snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device); |
467 | list_del_init(&hwdep->list); | 476 | list_del_init(&hwdep->list); |
477 | mutex_unlock(&hwdep->open_mutex); | ||
468 | mutex_unlock(®ister_mutex); | 478 | mutex_unlock(®ister_mutex); |
469 | return 0; | 479 | return 0; |
470 | } | 480 | } |
diff --git a/sound/core/init.c b/sound/core/init.c index d8ec849af12..7b012d15c2c 100644 --- a/sound/core/init.c +++ b/sound/core/init.c | |||
@@ -213,6 +213,7 @@ int snd_card_create(int idx, const char *xid, | |||
213 | spin_lock_init(&card->files_lock); | 213 | spin_lock_init(&card->files_lock); |
214 | INIT_LIST_HEAD(&card->files_list); | 214 | INIT_LIST_HEAD(&card->files_list); |
215 | init_waitqueue_head(&card->shutdown_sleep); | 215 | init_waitqueue_head(&card->shutdown_sleep); |
216 | atomic_set(&card->refcount, 0); | ||
216 | #ifdef CONFIG_PM | 217 | #ifdef CONFIG_PM |
217 | mutex_init(&card->power_lock); | 218 | mutex_init(&card->power_lock); |
218 | init_waitqueue_head(&card->power_sleep); | 219 | init_waitqueue_head(&card->power_sleep); |
@@ -446,21 +447,36 @@ static int snd_card_do_free(struct snd_card *card) | |||
446 | return 0; | 447 | return 0; |
447 | } | 448 | } |
448 | 449 | ||
450 | /** | ||
451 | * snd_card_unref - release the reference counter | ||
452 | * @card: the card instance | ||
453 | * | ||
454 | * Decrements the reference counter. When it reaches to zero, wake up | ||
455 | * the sleeper and call the destructor if needed. | ||
456 | */ | ||
457 | void snd_card_unref(struct snd_card *card) | ||
458 | { | ||
459 | if (atomic_dec_and_test(&card->refcount)) { | ||
460 | wake_up(&card->shutdown_sleep); | ||
461 | if (card->free_on_last_close) | ||
462 | snd_card_do_free(card); | ||
463 | } | ||
464 | } | ||
465 | EXPORT_SYMBOL(snd_card_unref); | ||
466 | |||
449 | int snd_card_free_when_closed(struct snd_card *card) | 467 | int snd_card_free_when_closed(struct snd_card *card) |
450 | { | 468 | { |
451 | int free_now = 0; | 469 | int ret; |
452 | int ret = snd_card_disconnect(card); | ||
453 | if (ret) | ||
454 | return ret; | ||
455 | 470 | ||
456 | spin_lock(&card->files_lock); | 471 | atomic_inc(&card->refcount); |
457 | if (list_empty(&card->files_list)) | 472 | ret = snd_card_disconnect(card); |
458 | free_now = 1; | 473 | if (ret) { |
459 | else | 474 | atomic_dec(&card->refcount); |
460 | card->free_on_last_close = 1; | 475 | return ret; |
461 | spin_unlock(&card->files_lock); | 476 | } |
462 | 477 | ||
463 | if (free_now) | 478 | card->free_on_last_close = 1; |
479 | if (atomic_dec_and_test(&card->refcount)) | ||
464 | snd_card_do_free(card); | 480 | snd_card_do_free(card); |
465 | return 0; | 481 | return 0; |
466 | } | 482 | } |
@@ -474,7 +490,7 @@ int snd_card_free(struct snd_card *card) | |||
474 | return ret; | 490 | return ret; |
475 | 491 | ||
476 | /* wait, until all devices are ready for the free operation */ | 492 | /* wait, until all devices are ready for the free operation */ |
477 | wait_event(card->shutdown_sleep, list_empty(&card->files_list)); | 493 | wait_event(card->shutdown_sleep, !atomic_read(&card->refcount)); |
478 | snd_card_do_free(card); | 494 | snd_card_do_free(card); |
479 | return 0; | 495 | return 0; |
480 | } | 496 | } |
@@ -886,6 +902,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file) | |||
886 | return -ENODEV; | 902 | return -ENODEV; |
887 | } | 903 | } |
888 | list_add(&mfile->list, &card->files_list); | 904 | list_add(&mfile->list, &card->files_list); |
905 | atomic_inc(&card->refcount); | ||
889 | spin_unlock(&card->files_lock); | 906 | spin_unlock(&card->files_lock); |
890 | return 0; | 907 | return 0; |
891 | } | 908 | } |
@@ -908,7 +925,6 @@ EXPORT_SYMBOL(snd_card_file_add); | |||
908 | int snd_card_file_remove(struct snd_card *card, struct file *file) | 925 | int snd_card_file_remove(struct snd_card *card, struct file *file) |
909 | { | 926 | { |
910 | struct snd_monitor_file *mfile, *found = NULL; | 927 | struct snd_monitor_file *mfile, *found = NULL; |
911 | int last_close = 0; | ||
912 | 928 | ||
913 | spin_lock(&card->files_lock); | 929 | spin_lock(&card->files_lock); |
914 | list_for_each_entry(mfile, &card->files_list, list) { | 930 | list_for_each_entry(mfile, &card->files_list, list) { |
@@ -923,19 +939,13 @@ int snd_card_file_remove(struct snd_card *card, struct file *file) | |||
923 | break; | 939 | break; |
924 | } | 940 | } |
925 | } | 941 | } |
926 | if (list_empty(&card->files_list)) | ||
927 | last_close = 1; | ||
928 | spin_unlock(&card->files_lock); | 942 | spin_unlock(&card->files_lock); |
929 | if (last_close) { | ||
930 | wake_up(&card->shutdown_sleep); | ||
931 | if (card->free_on_last_close) | ||
932 | snd_card_do_free(card); | ||
933 | } | ||
934 | if (!found) { | 943 | if (!found) { |
935 | snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); | 944 | snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file); |
936 | return -ENOENT; | 945 | return -ENOENT; |
937 | } | 946 | } |
938 | kfree(found); | 947 | kfree(found); |
948 | snd_card_unref(card); | ||
939 | return 0; | 949 | return 0; |
940 | } | 950 | } |
941 | 951 | ||
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c index 29f6ded0255..a9a2e63c022 100644 --- a/sound/core/oss/mixer_oss.c +++ b/sound/core/oss/mixer_oss.c | |||
@@ -52,14 +52,19 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) | |||
52 | SNDRV_OSS_DEVICE_TYPE_MIXER); | 52 | SNDRV_OSS_DEVICE_TYPE_MIXER); |
53 | if (card == NULL) | 53 | if (card == NULL) |
54 | return -ENODEV; | 54 | return -ENODEV; |
55 | if (card->mixer_oss == NULL) | 55 | if (card->mixer_oss == NULL) { |
56 | snd_card_unref(card); | ||
56 | return -ENODEV; | 57 | return -ENODEV; |
58 | } | ||
57 | err = snd_card_file_add(card, file); | 59 | err = snd_card_file_add(card, file); |
58 | if (err < 0) | 60 | if (err < 0) { |
61 | snd_card_unref(card); | ||
59 | return err; | 62 | return err; |
63 | } | ||
60 | fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL); | 64 | fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL); |
61 | if (fmixer == NULL) { | 65 | if (fmixer == NULL) { |
62 | snd_card_file_remove(card, file); | 66 | snd_card_file_remove(card, file); |
67 | snd_card_unref(card); | ||
63 | return -ENOMEM; | 68 | return -ENOMEM; |
64 | } | 69 | } |
65 | fmixer->card = card; | 70 | fmixer->card = card; |
@@ -68,6 +73,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) | |||
68 | if (!try_module_get(card->module)) { | 73 | if (!try_module_get(card->module)) { |
69 | kfree(fmixer); | 74 | kfree(fmixer); |
70 | snd_card_file_remove(card, file); | 75 | snd_card_file_remove(card, file); |
76 | snd_card_unref(card); | ||
71 | return -EFAULT; | 77 | return -EFAULT; |
72 | } | 78 | } |
73 | return 0; | 79 | return 0; |
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 08fde0060fd..f337b66a020 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c | |||
@@ -2441,6 +2441,10 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) | |||
2441 | mutex_unlock(&pcm->open_mutex); | 2441 | mutex_unlock(&pcm->open_mutex); |
2442 | schedule(); | 2442 | schedule(); |
2443 | mutex_lock(&pcm->open_mutex); | 2443 | mutex_lock(&pcm->open_mutex); |
2444 | if (pcm->card->shutdown) { | ||
2445 | err = -ENODEV; | ||
2446 | break; | ||
2447 | } | ||
2444 | if (signal_pending(current)) { | 2448 | if (signal_pending(current)) { |
2445 | err = -ERESTARTSYS; | 2449 | err = -ERESTARTSYS; |
2446 | break; | 2450 | break; |
@@ -2457,6 +2461,8 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) | |||
2457 | __error2: | 2461 | __error2: |
2458 | snd_card_file_remove(pcm->card, file); | 2462 | snd_card_file_remove(pcm->card, file); |
2459 | __error1: | 2463 | __error1: |
2464 | if (pcm) | ||
2465 | snd_card_unref(pcm->card); | ||
2460 | return err; | 2466 | return err; |
2461 | } | 2467 | } |
2462 | 2468 | ||
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index f2991940b27..030102caeee 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -1086,11 +1086,19 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) | |||
1086 | if (list_empty(&pcm->list)) | 1086 | if (list_empty(&pcm->list)) |
1087 | goto unlock; | 1087 | goto unlock; |
1088 | 1088 | ||
1089 | mutex_lock(&pcm->open_mutex); | ||
1090 | wake_up(&pcm->open_wait); | ||
1089 | list_del_init(&pcm->list); | 1091 | list_del_init(&pcm->list); |
1090 | for (cidx = 0; cidx < 2; cidx++) | 1092 | for (cidx = 0; cidx < 2; cidx++) |
1091 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) | 1093 | for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) { |
1092 | if (substream->runtime) | 1094 | snd_pcm_stream_lock_irq(substream); |
1095 | if (substream->runtime) { | ||
1093 | substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED; | 1096 | substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED; |
1097 | wake_up(&substream->runtime->sleep); | ||
1098 | wake_up(&substream->runtime->tsleep); | ||
1099 | } | ||
1100 | snd_pcm_stream_unlock_irq(substream); | ||
1101 | } | ||
1094 | list_for_each_entry(notify, &snd_pcm_notify_list, list) { | 1102 | list_for_each_entry(notify, &snd_pcm_notify_list, list) { |
1095 | notify->n_disconnect(pcm); | 1103 | notify->n_disconnect(pcm); |
1096 | } | 1104 | } |
@@ -1110,6 +1118,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) | |||
1110 | pcm->streams[cidx].chmap_kctl = NULL; | 1118 | pcm->streams[cidx].chmap_kctl = NULL; |
1111 | } | 1119 | } |
1112 | } | 1120 | } |
1121 | mutex_unlock(&pcm->open_mutex); | ||
1113 | unlock: | 1122 | unlock: |
1114 | mutex_unlock(®ister_mutex); | 1123 | mutex_unlock(®ister_mutex); |
1115 | return 0; | 1124 | return 0; |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 5e12e5bacbb..6e8872de5ba 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -369,6 +369,14 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime) | |||
369 | return usecs; | 369 | return usecs; |
370 | } | 370 | } |
371 | 371 | ||
372 | static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state) | ||
373 | { | ||
374 | snd_pcm_stream_lock_irq(substream); | ||
375 | if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED) | ||
376 | substream->runtime->status->state = state; | ||
377 | snd_pcm_stream_unlock_irq(substream); | ||
378 | } | ||
379 | |||
372 | static int snd_pcm_hw_params(struct snd_pcm_substream *substream, | 380 | static int snd_pcm_hw_params(struct snd_pcm_substream *substream, |
373 | struct snd_pcm_hw_params *params) | 381 | struct snd_pcm_hw_params *params) |
374 | { | 382 | { |
@@ -452,7 +460,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, | |||
452 | runtime->boundary *= 2; | 460 | runtime->boundary *= 2; |
453 | 461 | ||
454 | snd_pcm_timer_resolution_change(substream); | 462 | snd_pcm_timer_resolution_change(substream); |
455 | runtime->status->state = SNDRV_PCM_STATE_SETUP; | 463 | snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP); |
456 | 464 | ||
457 | if (pm_qos_request_active(&substream->latency_pm_qos_req)) | 465 | if (pm_qos_request_active(&substream->latency_pm_qos_req)) |
458 | pm_qos_remove_request(&substream->latency_pm_qos_req); | 466 | pm_qos_remove_request(&substream->latency_pm_qos_req); |
@@ -464,7 +472,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, | |||
464 | /* hardware might be unusable from this time, | 472 | /* hardware might be unusable from this time, |
465 | so we force application to retry to set | 473 | so we force application to retry to set |
466 | the correct hardware parameter settings */ | 474 | the correct hardware parameter settings */ |
467 | runtime->status->state = SNDRV_PCM_STATE_OPEN; | 475 | snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); |
468 | if (substream->ops->hw_free != NULL) | 476 | if (substream->ops->hw_free != NULL) |
469 | substream->ops->hw_free(substream); | 477 | substream->ops->hw_free(substream); |
470 | return err; | 478 | return err; |
@@ -512,7 +520,7 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream) | |||
512 | return -EBADFD; | 520 | return -EBADFD; |
513 | if (substream->ops->hw_free) | 521 | if (substream->ops->hw_free) |
514 | result = substream->ops->hw_free(substream); | 522 | result = substream->ops->hw_free(substream); |
515 | runtime->status->state = SNDRV_PCM_STATE_OPEN; | 523 | snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN); |
516 | pm_qos_remove_request(&substream->latency_pm_qos_req); | 524 | pm_qos_remove_request(&substream->latency_pm_qos_req); |
517 | return result; | 525 | return result; |
518 | } | 526 | } |
@@ -1320,7 +1328,7 @@ static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state) | |||
1320 | { | 1328 | { |
1321 | struct snd_pcm_runtime *runtime = substream->runtime; | 1329 | struct snd_pcm_runtime *runtime = substream->runtime; |
1322 | runtime->control->appl_ptr = runtime->status->hw_ptr; | 1330 | runtime->control->appl_ptr = runtime->status->hw_ptr; |
1323 | runtime->status->state = SNDRV_PCM_STATE_PREPARED; | 1331 | snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED); |
1324 | } | 1332 | } |
1325 | 1333 | ||
1326 | static struct action_ops snd_pcm_action_prepare = { | 1334 | static struct action_ops snd_pcm_action_prepare = { |
@@ -1510,6 +1518,10 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, | |||
1510 | down_read(&snd_pcm_link_rwsem); | 1518 | down_read(&snd_pcm_link_rwsem); |
1511 | snd_pcm_stream_lock_irq(substream); | 1519 | snd_pcm_stream_lock_irq(substream); |
1512 | remove_wait_queue(&to_check->sleep, &wait); | 1520 | remove_wait_queue(&to_check->sleep, &wait); |
1521 | if (card->shutdown) { | ||
1522 | result = -ENODEV; | ||
1523 | break; | ||
1524 | } | ||
1513 | if (tout == 0) { | 1525 | if (tout == 0) { |
1514 | if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) | 1526 | if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) |
1515 | result = -ESTRPIPE; | 1527 | result = -ESTRPIPE; |
@@ -1634,6 +1646,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) | |||
1634 | write_unlock_irq(&snd_pcm_link_rwlock); | 1646 | write_unlock_irq(&snd_pcm_link_rwlock); |
1635 | up_write(&snd_pcm_link_rwsem); | 1647 | up_write(&snd_pcm_link_rwsem); |
1636 | _nolock: | 1648 | _nolock: |
1649 | snd_card_unref(substream1->pcm->card); | ||
1637 | fput_light(file, fput_needed); | 1650 | fput_light(file, fput_needed); |
1638 | if (res < 0) | 1651 | if (res < 0) |
1639 | kfree(group); | 1652 | kfree(group); |
@@ -2108,7 +2121,9 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file) | |||
2108 | return err; | 2121 | return err; |
2109 | pcm = snd_lookup_minor_data(iminor(inode), | 2122 | pcm = snd_lookup_minor_data(iminor(inode), |
2110 | SNDRV_DEVICE_TYPE_PCM_PLAYBACK); | 2123 | SNDRV_DEVICE_TYPE_PCM_PLAYBACK); |
2111 | return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK); | 2124 | err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK); |
2125 | snd_card_unref(pcm->card); | ||
2126 | return err; | ||
2112 | } | 2127 | } |
2113 | 2128 | ||
2114 | static int snd_pcm_capture_open(struct inode *inode, struct file *file) | 2129 | static int snd_pcm_capture_open(struct inode *inode, struct file *file) |
@@ -2119,7 +2134,9 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file) | |||
2119 | return err; | 2134 | return err; |
2120 | pcm = snd_lookup_minor_data(iminor(inode), | 2135 | pcm = snd_lookup_minor_data(iminor(inode), |
2121 | SNDRV_DEVICE_TYPE_PCM_CAPTURE); | 2136 | SNDRV_DEVICE_TYPE_PCM_CAPTURE); |
2122 | return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE); | 2137 | err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE); |
2138 | snd_card_unref(pcm->card); | ||
2139 | return err; | ||
2123 | } | 2140 | } |
2124 | 2141 | ||
2125 | static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) | 2142 | static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) |
@@ -2156,6 +2173,10 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) | |||
2156 | mutex_unlock(&pcm->open_mutex); | 2173 | mutex_unlock(&pcm->open_mutex); |
2157 | schedule(); | 2174 | schedule(); |
2158 | mutex_lock(&pcm->open_mutex); | 2175 | mutex_lock(&pcm->open_mutex); |
2176 | if (pcm->card->shutdown) { | ||
2177 | err = -ENODEV; | ||
2178 | break; | ||
2179 | } | ||
2159 | if (signal_pending(current)) { | 2180 | if (signal_pending(current)) { |
2160 | err = -ERESTARTSYS; | 2181 | err = -ERESTARTSYS; |
2161 | break; | 2182 | break; |
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index ebf6e49ad3d..1bb95aeea08 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -379,8 +379,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
379 | if (rmidi == NULL) | 379 | if (rmidi == NULL) |
380 | return -ENODEV; | 380 | return -ENODEV; |
381 | 381 | ||
382 | if (!try_module_get(rmidi->card->module)) | 382 | if (!try_module_get(rmidi->card->module)) { |
383 | snd_card_unref(rmidi->card); | ||
383 | return -ENXIO; | 384 | return -ENXIO; |
385 | } | ||
384 | 386 | ||
385 | mutex_lock(&rmidi->open_mutex); | 387 | mutex_lock(&rmidi->open_mutex); |
386 | card = rmidi->card; | 388 | card = rmidi->card; |
@@ -422,6 +424,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
422 | mutex_unlock(&rmidi->open_mutex); | 424 | mutex_unlock(&rmidi->open_mutex); |
423 | schedule(); | 425 | schedule(); |
424 | mutex_lock(&rmidi->open_mutex); | 426 | mutex_lock(&rmidi->open_mutex); |
427 | if (rmidi->card->shutdown) { | ||
428 | err = -ENODEV; | ||
429 | break; | ||
430 | } | ||
425 | if (signal_pending(current)) { | 431 | if (signal_pending(current)) { |
426 | err = -ERESTARTSYS; | 432 | err = -ERESTARTSYS; |
427 | break; | 433 | break; |
@@ -440,6 +446,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
440 | #endif | 446 | #endif |
441 | file->private_data = rawmidi_file; | 447 | file->private_data = rawmidi_file; |
442 | mutex_unlock(&rmidi->open_mutex); | 448 | mutex_unlock(&rmidi->open_mutex); |
449 | snd_card_unref(rmidi->card); | ||
443 | return 0; | 450 | return 0; |
444 | 451 | ||
445 | __error: | 452 | __error: |
@@ -447,6 +454,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) | |||
447 | __error_card: | 454 | __error_card: |
448 | mutex_unlock(&rmidi->open_mutex); | 455 | mutex_unlock(&rmidi->open_mutex); |
449 | module_put(rmidi->card->module); | 456 | module_put(rmidi->card->module); |
457 | snd_card_unref(rmidi->card); | ||
450 | return err; | 458 | return err; |
451 | } | 459 | } |
452 | 460 | ||
@@ -991,6 +999,8 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun | |||
991 | spin_unlock_irq(&runtime->lock); | 999 | spin_unlock_irq(&runtime->lock); |
992 | schedule(); | 1000 | schedule(); |
993 | remove_wait_queue(&runtime->sleep, &wait); | 1001 | remove_wait_queue(&runtime->sleep, &wait); |
1002 | if (rfile->rmidi->card->shutdown) | ||
1003 | return -ENODEV; | ||
994 | if (signal_pending(current)) | 1004 | if (signal_pending(current)) |
995 | return result > 0 ? result : -ERESTARTSYS; | 1005 | return result > 0 ? result : -ERESTARTSYS; |
996 | if (!runtime->avail) | 1006 | if (!runtime->avail) |
@@ -1234,6 +1244,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, | |||
1234 | spin_unlock_irq(&runtime->lock); | 1244 | spin_unlock_irq(&runtime->lock); |
1235 | timeout = schedule_timeout(30 * HZ); | 1245 | timeout = schedule_timeout(30 * HZ); |
1236 | remove_wait_queue(&runtime->sleep, &wait); | 1246 | remove_wait_queue(&runtime->sleep, &wait); |
1247 | if (rfile->rmidi->card->shutdown) | ||
1248 | return -ENODEV; | ||
1237 | if (signal_pending(current)) | 1249 | if (signal_pending(current)) |
1238 | return result > 0 ? result : -ERESTARTSYS; | 1250 | return result > 0 ? result : -ERESTARTSYS; |
1239 | if (!runtime->avail && !timeout) | 1251 | if (!runtime->avail && !timeout) |
@@ -1609,9 +1621,20 @@ static int snd_rawmidi_dev_register(struct snd_device *device) | |||
1609 | static int snd_rawmidi_dev_disconnect(struct snd_device *device) | 1621 | static int snd_rawmidi_dev_disconnect(struct snd_device *device) |
1610 | { | 1622 | { |
1611 | struct snd_rawmidi *rmidi = device->device_data; | 1623 | struct snd_rawmidi *rmidi = device->device_data; |
1624 | int dir; | ||
1612 | 1625 | ||
1613 | mutex_lock(®ister_mutex); | 1626 | mutex_lock(®ister_mutex); |
1627 | mutex_lock(&rmidi->open_mutex); | ||
1628 | wake_up(&rmidi->open_wait); | ||
1614 | list_del_init(&rmidi->list); | 1629 | list_del_init(&rmidi->list); |
1630 | for (dir = 0; dir < 2; dir++) { | ||
1631 | struct snd_rawmidi_substream *s; | ||
1632 | list_for_each_entry(s, &rmidi->streams[dir].substreams, list) { | ||
1633 | if (s->runtime) | ||
1634 | wake_up(&s->runtime->sleep); | ||
1635 | } | ||
1636 | } | ||
1637 | |||
1615 | #ifdef CONFIG_SND_OSSEMUL | 1638 | #ifdef CONFIG_SND_OSSEMUL |
1616 | if (rmidi->ossreg) { | 1639 | if (rmidi->ossreg) { |
1617 | if ((int)rmidi->device == midi_map[rmidi->card->number]) { | 1640 | if ((int)rmidi->device == midi_map[rmidi->card->number]) { |
@@ -1626,6 +1649,7 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device) | |||
1626 | } | 1649 | } |
1627 | #endif /* CONFIG_SND_OSSEMUL */ | 1650 | #endif /* CONFIG_SND_OSSEMUL */ |
1628 | snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device); | 1651 | snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device); |
1652 | mutex_unlock(&rmidi->open_mutex); | ||
1629 | mutex_unlock(®ister_mutex); | 1653 | mutex_unlock(®ister_mutex); |
1630 | return 0; | 1654 | return 0; |
1631 | } | 1655 | } |
diff --git a/sound/core/sound.c b/sound/core/sound.c index 643976000ce..89780c323f1 100644 --- a/sound/core/sound.c +++ b/sound/core/sound.c | |||
@@ -98,6 +98,10 @@ static void snd_request_other(int minor) | |||
98 | * | 98 | * |
99 | * Checks that a minor device with the specified type is registered, and returns | 99 | * Checks that a minor device with the specified type is registered, and returns |
100 | * its user data pointer. | 100 | * its user data pointer. |
101 | * | ||
102 | * This function increments the reference counter of the card instance | ||
103 | * if an associated instance with the given minor number and type is found. | ||
104 | * The caller must call snd_card_unref() appropriately later. | ||
101 | */ | 105 | */ |
102 | void *snd_lookup_minor_data(unsigned int minor, int type) | 106 | void *snd_lookup_minor_data(unsigned int minor, int type) |
103 | { | 107 | { |
@@ -108,9 +112,11 @@ void *snd_lookup_minor_data(unsigned int minor, int type) | |||
108 | return NULL; | 112 | return NULL; |
109 | mutex_lock(&sound_mutex); | 113 | mutex_lock(&sound_mutex); |
110 | mreg = snd_minors[minor]; | 114 | mreg = snd_minors[minor]; |
111 | if (mreg && mreg->type == type) | 115 | if (mreg && mreg->type == type) { |
112 | private_data = mreg->private_data; | 116 | private_data = mreg->private_data; |
113 | else | 117 | if (mreg->card_ptr) |
118 | atomic_inc(&mreg->card_ptr->refcount); | ||
119 | } else | ||
114 | private_data = NULL; | 120 | private_data = NULL; |
115 | mutex_unlock(&sound_mutex); | 121 | mutex_unlock(&sound_mutex); |
116 | return private_data; | 122 | return private_data; |
@@ -275,6 +281,7 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev, | |||
275 | preg->device = dev; | 281 | preg->device = dev; |
276 | preg->f_ops = f_ops; | 282 | preg->f_ops = f_ops; |
277 | preg->private_data = private_data; | 283 | preg->private_data = private_data; |
284 | preg->card_ptr = card; | ||
278 | mutex_lock(&sound_mutex); | 285 | mutex_lock(&sound_mutex); |
279 | #ifdef CONFIG_SND_DYNAMIC_MINORS | 286 | #ifdef CONFIG_SND_DYNAMIC_MINORS |
280 | minor = snd_find_free_minor(type); | 287 | minor = snd_find_free_minor(type); |
diff --git a/sound/core/sound_oss.c b/sound/core/sound_oss.c index e9528333e36..e1d79ee3590 100644 --- a/sound/core/sound_oss.c +++ b/sound/core/sound_oss.c | |||
@@ -40,6 +40,9 @@ | |||
40 | static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; | 40 | static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS]; |
41 | static DEFINE_MUTEX(sound_oss_mutex); | 41 | static DEFINE_MUTEX(sound_oss_mutex); |
42 | 42 | ||
43 | /* NOTE: This function increments the refcount of the associated card like | ||
44 | * snd_lookup_minor_data(); the caller must call snd_card_unref() appropriately | ||
45 | */ | ||
43 | void *snd_lookup_oss_minor_data(unsigned int minor, int type) | 46 | void *snd_lookup_oss_minor_data(unsigned int minor, int type) |
44 | { | 47 | { |
45 | struct snd_minor *mreg; | 48 | struct snd_minor *mreg; |
@@ -49,9 +52,11 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type) | |||
49 | return NULL; | 52 | return NULL; |
50 | mutex_lock(&sound_oss_mutex); | 53 | mutex_lock(&sound_oss_mutex); |
51 | mreg = snd_oss_minors[minor]; | 54 | mreg = snd_oss_minors[minor]; |
52 | if (mreg && mreg->type == type) | 55 | if (mreg && mreg->type == type) { |
53 | private_data = mreg->private_data; | 56 | private_data = mreg->private_data; |
54 | else | 57 | if (mreg->card_ptr) |
58 | atomic_inc(&mreg->card_ptr->refcount); | ||
59 | } else | ||
55 | private_data = NULL; | 60 | private_data = NULL; |
56 | mutex_unlock(&sound_oss_mutex); | 61 | mutex_unlock(&sound_oss_mutex); |
57 | return private_data; | 62 | return private_data; |
@@ -123,6 +128,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, | |||
123 | preg->device = dev; | 128 | preg->device = dev; |
124 | preg->f_ops = f_ops; | 129 | preg->f_ops = f_ops; |
125 | preg->private_data = private_data; | 130 | preg->private_data = private_data; |
131 | preg->card_ptr = card; | ||
126 | mutex_lock(&sound_oss_mutex); | 132 | mutex_lock(&sound_oss_mutex); |
127 | snd_oss_minors[minor] = preg; | 133 | snd_oss_minors[minor] = preg; |
128 | minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); | 134 | minor_unit = SNDRV_MINOR_OSS_DEVICE(minor); |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 770013ff556..9ba8af05617 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1763,6 +1763,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | |||
1763 | "HP", STAC_HP_ZEPHYR), | 1763 | "HP", STAC_HP_ZEPHYR), |
1764 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660, | 1764 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660, |
1765 | "HP Mini", STAC_92HD83XXX_HP_LED), | 1765 | "HP Mini", STAC_92HD83XXX_HP_LED), |
1766 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E, | ||
1767 | "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED), | ||
1766 | {} /* terminator */ | 1768 | {} /* terminator */ |
1767 | }; | 1769 | }; |
1768 | 1770 | ||
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 3050a527925..245d874891b 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -2859,7 +2859,12 @@ static int snd_vt1724_resume(struct device *dev) | |||
2859 | ice->set_spdif_clock(ice, 0); | 2859 | ice->set_spdif_clock(ice, 0); |
2860 | } else { | 2860 | } else { |
2861 | /* internal on-card clock */ | 2861 | /* internal on-card clock */ |
2862 | snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1); | 2862 | int rate; |
2863 | if (ice->cur_rate) | ||
2864 | rate = ice->cur_rate; | ||
2865 | else | ||
2866 | rate = ice->pro_rate_default; | ||
2867 | snd_vt1724_set_pro_rate(ice, rate, 1); | ||
2863 | } | 2868 | } |
2864 | 2869 | ||
2865 | update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); | 2870 | update_spdif_bits(ice, ice->pm_saved_spdif_ctrl); |
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 68f2cd1a920..5a6aeaf552a 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c | |||
@@ -464,9 +464,9 @@ static __devinit int asoc_dmic_probe(struct platform_device *pdev) | |||
464 | 464 | ||
465 | mutex_init(&dmic->mutex); | 465 | mutex_init(&dmic->mutex); |
466 | 466 | ||
467 | dmic->fclk = clk_get(dmic->dev, "dmic_fck"); | 467 | dmic->fclk = clk_get(dmic->dev, "fck"); |
468 | if (IS_ERR(dmic->fclk)) { | 468 | if (IS_ERR(dmic->fclk)) { |
469 | dev_err(dmic->dev, "cant get dmic_fck\n"); | 469 | dev_err(dmic->dev, "cant get fck\n"); |
470 | return -ENODEV; | 470 | return -ENODEV; |
471 | } | 471 | } |
472 | 472 | ||
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c index 677b567935f..1ff6bb9ade5 100644 --- a/sound/soc/omap/zoom2.c +++ b/sound/soc/omap/zoom2.c | |||
@@ -21,15 +21,14 @@ | |||
21 | 21 | ||
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/gpio.h> | ||
24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
25 | #include <sound/pcm.h> | 26 | #include <sound/pcm.h> |
26 | #include <sound/soc.h> | 27 | #include <sound/soc.h> |
27 | 28 | ||
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
29 | #include <mach/hardware.h> | ||
30 | #include <mach/gpio.h> | ||
31 | #include <mach/board-zoom.h> | ||
32 | #include <linux/platform_data/asoc-ti-mcbsp.h> | 30 | #include <linux/platform_data/asoc-ti-mcbsp.h> |
31 | #include <linux/platform_data/gpio-omap.h> | ||
33 | 32 | ||
34 | /* Register descriptions for twl4030 codec part */ | 33 | /* Register descriptions for twl4030 codec part */ |
35 | #include <linux/mfd/twl4030-audio.h> | 34 | #include <linux/mfd/twl4030-audio.h> |
diff --git a/sound/usb/card.c b/sound/usb/card.c index 561bb74fd36..282f0fc9fed 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -339,7 +339,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
339 | } | 339 | } |
340 | 340 | ||
341 | mutex_init(&chip->mutex); | 341 | mutex_init(&chip->mutex); |
342 | mutex_init(&chip->shutdown_mutex); | 342 | init_rwsem(&chip->shutdown_rwsem); |
343 | chip->index = idx; | 343 | chip->index = idx; |
344 | chip->dev = dev; | 344 | chip->dev = dev; |
345 | chip->card = card; | 345 | chip->card = card; |
@@ -560,7 +560,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
560 | 560 | ||
561 | card = chip->card; | 561 | card = chip->card; |
562 | mutex_lock(®ister_mutex); | 562 | mutex_lock(®ister_mutex); |
563 | mutex_lock(&chip->shutdown_mutex); | 563 | down_write(&chip->shutdown_rwsem); |
564 | chip->shutdown = 1; | 564 | chip->shutdown = 1; |
565 | chip->num_interfaces--; | 565 | chip->num_interfaces--; |
566 | if (chip->num_interfaces <= 0) { | 566 | if (chip->num_interfaces <= 0) { |
@@ -582,11 +582,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
582 | snd_usb_mixer_disconnect(p); | 582 | snd_usb_mixer_disconnect(p); |
583 | } | 583 | } |
584 | usb_chip[chip->index] = NULL; | 584 | usb_chip[chip->index] = NULL; |
585 | mutex_unlock(&chip->shutdown_mutex); | 585 | up_write(&chip->shutdown_rwsem); |
586 | mutex_unlock(®ister_mutex); | 586 | mutex_unlock(®ister_mutex); |
587 | snd_card_free_when_closed(card); | 587 | snd_card_free_when_closed(card); |
588 | } else { | 588 | } else { |
589 | mutex_unlock(&chip->shutdown_mutex); | 589 | up_write(&chip->shutdown_rwsem); |
590 | mutex_unlock(®ister_mutex); | 590 | mutex_unlock(®ister_mutex); |
591 | } | 591 | } |
592 | } | 592 | } |
@@ -618,16 +618,20 @@ int snd_usb_autoresume(struct snd_usb_audio *chip) | |||
618 | { | 618 | { |
619 | int err = -ENODEV; | 619 | int err = -ENODEV; |
620 | 620 | ||
621 | down_read(&chip->shutdown_rwsem); | ||
621 | if (!chip->shutdown && !chip->probing) | 622 | if (!chip->shutdown && !chip->probing) |
622 | err = usb_autopm_get_interface(chip->pm_intf); | 623 | err = usb_autopm_get_interface(chip->pm_intf); |
624 | up_read(&chip->shutdown_rwsem); | ||
623 | 625 | ||
624 | return err; | 626 | return err; |
625 | } | 627 | } |
626 | 628 | ||
627 | void snd_usb_autosuspend(struct snd_usb_audio *chip) | 629 | void snd_usb_autosuspend(struct snd_usb_audio *chip) |
628 | { | 630 | { |
631 | down_read(&chip->shutdown_rwsem); | ||
629 | if (!chip->shutdown && !chip->probing) | 632 | if (!chip->shutdown && !chip->probing) |
630 | usb_autopm_put_interface(chip->pm_intf); | 633 | usb_autopm_put_interface(chip->pm_intf); |
634 | up_read(&chip->shutdown_rwsem); | ||
631 | } | 635 | } |
632 | 636 | ||
633 | static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) | 637 | static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) |
diff --git a/sound/usb/card.h b/sound/usb/card.h index afa4f9e9b27..814cb357ff8 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h | |||
@@ -126,6 +126,7 @@ struct snd_usb_substream { | |||
126 | struct snd_usb_endpoint *sync_endpoint; | 126 | struct snd_usb_endpoint *sync_endpoint; |
127 | unsigned long flags; | 127 | unsigned long flags; |
128 | bool need_setup_ep; /* (re)configure EP at prepare? */ | 128 | bool need_setup_ep; /* (re)configure EP at prepare? */ |
129 | unsigned int speed; /* USB_SPEED_XXX */ | ||
129 | 130 | ||
130 | u64 formats; /* format bitmasks (all or'ed) */ | 131 | u64 formats; /* format bitmasks (all or'ed) */ |
131 | unsigned int num_formats; /* number of supported audio formats (list) */ | 132 | unsigned int num_formats; /* number of supported audio formats (list) */ |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index fe56c9da38e..298070e8f2d 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -287,25 +287,32 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v | |||
287 | unsigned char buf[2]; | 287 | unsigned char buf[2]; |
288 | int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; | 288 | int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; |
289 | int timeout = 10; | 289 | int timeout = 10; |
290 | int err; | 290 | int idx = 0, err; |
291 | 291 | ||
292 | err = snd_usb_autoresume(cval->mixer->chip); | 292 | err = snd_usb_autoresume(cval->mixer->chip); |
293 | if (err < 0) | 293 | if (err < 0) |
294 | return -EIO; | 294 | return -EIO; |
295 | down_read(&chip->shutdown_rwsem); | ||
295 | while (timeout-- > 0) { | 296 | while (timeout-- > 0) { |
297 | if (chip->shutdown) | ||
298 | break; | ||
299 | idx = snd_usb_ctrl_intf(chip) | (cval->id << 8); | ||
296 | if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request, | 300 | if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request, |
297 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 301 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
298 | validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), | 302 | validx, idx, buf, val_len) >= val_len) { |
299 | buf, val_len) >= val_len) { | ||
300 | *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len)); | 303 | *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len)); |
301 | snd_usb_autosuspend(cval->mixer->chip); | 304 | err = 0; |
302 | return 0; | 305 | goto out; |
303 | } | 306 | } |
304 | } | 307 | } |
305 | snd_usb_autosuspend(cval->mixer->chip); | ||
306 | snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", | 308 | snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", |
307 | request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type); | 309 | request, validx, idx, cval->val_type); |
308 | return -EINVAL; | 310 | err = -EINVAL; |
311 | |||
312 | out: | ||
313 | up_read(&chip->shutdown_rwsem); | ||
314 | snd_usb_autosuspend(cval->mixer->chip); | ||
315 | return err; | ||
309 | } | 316 | } |
310 | 317 | ||
311 | static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) | 318 | static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) |
@@ -313,7 +320,7 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v | |||
313 | struct snd_usb_audio *chip = cval->mixer->chip; | 320 | struct snd_usb_audio *chip = cval->mixer->chip; |
314 | unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */ | 321 | unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */ |
315 | unsigned char *val; | 322 | unsigned char *val; |
316 | int ret, size; | 323 | int idx = 0, ret, size; |
317 | __u8 bRequest; | 324 | __u8 bRequest; |
318 | 325 | ||
319 | if (request == UAC_GET_CUR) { | 326 | if (request == UAC_GET_CUR) { |
@@ -330,16 +337,22 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v | |||
330 | if (ret) | 337 | if (ret) |
331 | goto error; | 338 | goto error; |
332 | 339 | ||
333 | ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest, | 340 | down_read(&chip->shutdown_rwsem); |
341 | if (chip->shutdown) | ||
342 | ret = -ENODEV; | ||
343 | else { | ||
344 | idx = snd_usb_ctrl_intf(chip) | (cval->id << 8); | ||
345 | ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest, | ||
334 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 346 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
335 | validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), | 347 | validx, idx, buf, size); |
336 | buf, size); | 348 | } |
349 | up_read(&chip->shutdown_rwsem); | ||
337 | snd_usb_autosuspend(chip); | 350 | snd_usb_autosuspend(chip); |
338 | 351 | ||
339 | if (ret < 0) { | 352 | if (ret < 0) { |
340 | error: | 353 | error: |
341 | snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", | 354 | snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n", |
342 | request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type); | 355 | request, validx, idx, cval->val_type); |
343 | return ret; | 356 | return ret; |
344 | } | 357 | } |
345 | 358 | ||
@@ -417,7 +430,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, | |||
417 | { | 430 | { |
418 | struct snd_usb_audio *chip = cval->mixer->chip; | 431 | struct snd_usb_audio *chip = cval->mixer->chip; |
419 | unsigned char buf[2]; | 432 | unsigned char buf[2]; |
420 | int val_len, err, timeout = 10; | 433 | int idx = 0, val_len, err, timeout = 10; |
421 | 434 | ||
422 | if (cval->mixer->protocol == UAC_VERSION_1) { | 435 | if (cval->mixer->protocol == UAC_VERSION_1) { |
423 | val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; | 436 | val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; |
@@ -440,19 +453,27 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, | |||
440 | err = snd_usb_autoresume(chip); | 453 | err = snd_usb_autoresume(chip); |
441 | if (err < 0) | 454 | if (err < 0) |
442 | return -EIO; | 455 | return -EIO; |
443 | while (timeout-- > 0) | 456 | down_read(&chip->shutdown_rwsem); |
457 | while (timeout-- > 0) { | ||
458 | if (chip->shutdown) | ||
459 | break; | ||
460 | idx = snd_usb_ctrl_intf(chip) | (cval->id << 8); | ||
444 | if (snd_usb_ctl_msg(chip->dev, | 461 | if (snd_usb_ctl_msg(chip->dev, |
445 | usb_sndctrlpipe(chip->dev, 0), request, | 462 | usb_sndctrlpipe(chip->dev, 0), request, |
446 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, | 463 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, |
447 | validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), | 464 | validx, idx, buf, val_len) >= 0) { |
448 | buf, val_len) >= 0) { | 465 | err = 0; |
449 | snd_usb_autosuspend(chip); | 466 | goto out; |
450 | return 0; | ||
451 | } | 467 | } |
452 | snd_usb_autosuspend(chip); | 468 | } |
453 | snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n", | 469 | snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n", |
454 | request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type, buf[0], buf[1]); | 470 | request, validx, idx, cval->val_type, buf[0], buf[1]); |
455 | return -EINVAL; | 471 | err = -EINVAL; |
472 | |||
473 | out: | ||
474 | up_read(&chip->shutdown_rwsem); | ||
475 | snd_usb_autosuspend(chip); | ||
476 | return err; | ||
456 | } | 477 | } |
457 | 478 | ||
458 | static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value) | 479 | static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value) |
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 690000db0ec..ae2b7143522 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c | |||
@@ -283,6 +283,11 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
283 | if (value > 1) | 283 | if (value > 1) |
284 | return -EINVAL; | 284 | return -EINVAL; |
285 | changed = value != mixer->audigy2nx_leds[index]; | 285 | changed = value != mixer->audigy2nx_leds[index]; |
286 | down_read(&mixer->chip->shutdown_rwsem); | ||
287 | if (mixer->chip->shutdown) { | ||
288 | err = -ENODEV; | ||
289 | goto out; | ||
290 | } | ||
286 | if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) | 291 | if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) |
287 | err = snd_usb_ctl_msg(mixer->chip->dev, | 292 | err = snd_usb_ctl_msg(mixer->chip->dev, |
288 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, | 293 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, |
@@ -299,6 +304,8 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
299 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, | 304 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, |
300 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 305 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, |
301 | value, index + 2, NULL, 0); | 306 | value, index + 2, NULL, 0); |
307 | out: | ||
308 | up_read(&mixer->chip->shutdown_rwsem); | ||
302 | if (err < 0) | 309 | if (err < 0) |
303 | return err; | 310 | return err; |
304 | mixer->audigy2nx_leds[index] = value; | 311 | mixer->audigy2nx_leds[index] = value; |
@@ -392,11 +399,16 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry, | |||
392 | 399 | ||
393 | for (i = 0; jacks[i].name; ++i) { | 400 | for (i = 0; jacks[i].name; ++i) { |
394 | snd_iprintf(buffer, "%s: ", jacks[i].name); | 401 | snd_iprintf(buffer, "%s: ", jacks[i].name); |
395 | err = snd_usb_ctl_msg(mixer->chip->dev, | 402 | down_read(&mixer->chip->shutdown_rwsem); |
403 | if (mixer->chip->shutdown) | ||
404 | err = 0; | ||
405 | else | ||
406 | err = snd_usb_ctl_msg(mixer->chip->dev, | ||
396 | usb_rcvctrlpipe(mixer->chip->dev, 0), | 407 | usb_rcvctrlpipe(mixer->chip->dev, 0), |
397 | UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS | | 408 | UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS | |
398 | USB_RECIP_INTERFACE, 0, | 409 | USB_RECIP_INTERFACE, 0, |
399 | jacks[i].unitid << 8, buf, 3); | 410 | jacks[i].unitid << 8, buf, 3); |
411 | up_read(&mixer->chip->shutdown_rwsem); | ||
400 | if (err == 3 && (buf[0] == 3 || buf[0] == 6)) | 412 | if (err == 3 && (buf[0] == 3 || buf[0] == 6)) |
401 | snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]); | 413 | snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]); |
402 | else | 414 | else |
@@ -426,10 +438,15 @@ static int snd_xonar_u1_switch_put(struct snd_kcontrol *kcontrol, | |||
426 | else | 438 | else |
427 | new_status = old_status & ~0x02; | 439 | new_status = old_status & ~0x02; |
428 | changed = new_status != old_status; | 440 | changed = new_status != old_status; |
429 | err = snd_usb_ctl_msg(mixer->chip->dev, | 441 | down_read(&mixer->chip->shutdown_rwsem); |
442 | if (mixer->chip->shutdown) | ||
443 | err = -ENODEV; | ||
444 | else | ||
445 | err = snd_usb_ctl_msg(mixer->chip->dev, | ||
430 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x08, | 446 | usb_sndctrlpipe(mixer->chip->dev, 0), 0x08, |
431 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, | 447 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, |
432 | 50, 0, &new_status, 1); | 448 | 50, 0, &new_status, 1); |
449 | up_read(&mixer->chip->shutdown_rwsem); | ||
433 | if (err < 0) | 450 | if (err < 0) |
434 | return err; | 451 | return err; |
435 | mixer->xonar_u1_status = new_status; | 452 | mixer->xonar_u1_status = new_status; |
@@ -468,11 +485,17 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol, | |||
468 | u8 bRequest = (kcontrol->private_value >> 16) & 0xff; | 485 | u8 bRequest = (kcontrol->private_value >> 16) & 0xff; |
469 | u16 wIndex = kcontrol->private_value & 0xffff; | 486 | u16 wIndex = kcontrol->private_value & 0xffff; |
470 | u8 tmp; | 487 | u8 tmp; |
488 | int ret; | ||
471 | 489 | ||
472 | int ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, | 490 | down_read(&mixer->chip->shutdown_rwsem); |
491 | if (mixer->chip->shutdown) | ||
492 | ret = -ENODEV; | ||
493 | else | ||
494 | ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest, | ||
473 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 495 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
474 | 0, cpu_to_le16(wIndex), | 496 | 0, cpu_to_le16(wIndex), |
475 | &tmp, sizeof(tmp), 1000); | 497 | &tmp, sizeof(tmp), 1000); |
498 | up_read(&mixer->chip->shutdown_rwsem); | ||
476 | 499 | ||
477 | if (ret < 0) { | 500 | if (ret < 0) { |
478 | snd_printk(KERN_ERR | 501 | snd_printk(KERN_ERR |
@@ -493,11 +516,17 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol, | |||
493 | u8 bRequest = (kcontrol->private_value >> 16) & 0xff; | 516 | u8 bRequest = (kcontrol->private_value >> 16) & 0xff; |
494 | u16 wIndex = kcontrol->private_value & 0xffff; | 517 | u16 wIndex = kcontrol->private_value & 0xffff; |
495 | u16 wValue = ucontrol->value.integer.value[0]; | 518 | u16 wValue = ucontrol->value.integer.value[0]; |
519 | int ret; | ||
496 | 520 | ||
497 | int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest, | 521 | down_read(&mixer->chip->shutdown_rwsem); |
522 | if (mixer->chip->shutdown) | ||
523 | ret = -ENODEV; | ||
524 | else | ||
525 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest, | ||
498 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | 526 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, |
499 | cpu_to_le16(wValue), cpu_to_le16(wIndex), | 527 | cpu_to_le16(wValue), cpu_to_le16(wIndex), |
500 | NULL, 0, 1000); | 528 | NULL, 0, 1000); |
529 | up_read(&mixer->chip->shutdown_rwsem); | ||
501 | 530 | ||
502 | if (ret < 0) { | 531 | if (ret < 0) { |
503 | snd_printk(KERN_ERR | 532 | snd_printk(KERN_ERR |
@@ -656,11 +685,16 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl, | |||
656 | return -EINVAL; | 685 | return -EINVAL; |
657 | 686 | ||
658 | 687 | ||
659 | err = snd_usb_ctl_msg(chip->dev, | 688 | down_read(&mixer->chip->shutdown_rwsem); |
689 | if (mixer->chip->shutdown) | ||
690 | err = -ENODEV; | ||
691 | else | ||
692 | err = snd_usb_ctl_msg(chip->dev, | ||
660 | usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, | 693 | usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, |
661 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 694 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
662 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), | 695 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), |
663 | value, val_len); | 696 | value, val_len); |
697 | up_read(&mixer->chip->shutdown_rwsem); | ||
664 | if (err < 0) | 698 | if (err < 0) |
665 | return err; | 699 | return err; |
666 | 700 | ||
@@ -703,11 +737,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, | |||
703 | 737 | ||
704 | if (!pval->is_cached) { | 738 | if (!pval->is_cached) { |
705 | /* Read current value */ | 739 | /* Read current value */ |
706 | err = snd_usb_ctl_msg(chip->dev, | 740 | down_read(&mixer->chip->shutdown_rwsem); |
741 | if (mixer->chip->shutdown) | ||
742 | err = -ENODEV; | ||
743 | else | ||
744 | err = snd_usb_ctl_msg(chip->dev, | ||
707 | usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, | 745 | usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR, |
708 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, | 746 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, |
709 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), | 747 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), |
710 | value, val_len); | 748 | value, val_len); |
749 | up_read(&mixer->chip->shutdown_rwsem); | ||
711 | if (err < 0) | 750 | if (err < 0) |
712 | return err; | 751 | return err; |
713 | 752 | ||
@@ -719,11 +758,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, | |||
719 | if (cur_val != new_val) { | 758 | if (cur_val != new_val) { |
720 | value[0] = new_val; | 759 | value[0] = new_val; |
721 | value[1] = 0; | 760 | value[1] = 0; |
722 | err = snd_usb_ctl_msg(chip->dev, | 761 | down_read(&mixer->chip->shutdown_rwsem); |
762 | if (mixer->chip->shutdown) | ||
763 | err = -ENODEV; | ||
764 | else | ||
765 | err = snd_usb_ctl_msg(chip->dev, | ||
723 | usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR, | 766 | usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR, |
724 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, | 767 | USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, |
725 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), | 768 | validx << 8, snd_usb_ctrl_intf(chip) | (id << 8), |
726 | value, val_len); | 769 | value, val_len); |
770 | up_read(&mixer->chip->shutdown_rwsem); | ||
727 | if (err < 0) | 771 | if (err < 0) |
728 | return err; | 772 | return err; |
729 | 773 | ||
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 55e19e1b80e..37428f74dbb 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -71,6 +71,8 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream | |||
71 | unsigned int hwptr_done; | 71 | unsigned int hwptr_done; |
72 | 72 | ||
73 | subs = (struct snd_usb_substream *)substream->runtime->private_data; | 73 | subs = (struct snd_usb_substream *)substream->runtime->private_data; |
74 | if (subs->stream->chip->shutdown) | ||
75 | return SNDRV_PCM_POS_XRUN; | ||
74 | spin_lock(&subs->lock); | 76 | spin_lock(&subs->lock); |
75 | hwptr_done = subs->hwptr_done; | 77 | hwptr_done = subs->hwptr_done; |
76 | substream->runtime->delay = snd_usb_pcm_delay(subs, | 78 | substream->runtime->delay = snd_usb_pcm_delay(subs, |
@@ -444,7 +446,6 @@ static int configure_endpoint(struct snd_usb_substream *subs) | |||
444 | { | 446 | { |
445 | int ret; | 447 | int ret; |
446 | 448 | ||
447 | mutex_lock(&subs->stream->chip->shutdown_mutex); | ||
448 | /* format changed */ | 449 | /* format changed */ |
449 | stop_endpoints(subs, 0, 0, 0); | 450 | stop_endpoints(subs, 0, 0, 0); |
450 | ret = snd_usb_endpoint_set_params(subs->data_endpoint, | 451 | ret = snd_usb_endpoint_set_params(subs->data_endpoint, |
@@ -455,7 +456,7 @@ static int configure_endpoint(struct snd_usb_substream *subs) | |||
455 | subs->cur_audiofmt, | 456 | subs->cur_audiofmt, |
456 | subs->sync_endpoint); | 457 | subs->sync_endpoint); |
457 | if (ret < 0) | 458 | if (ret < 0) |
458 | goto unlock; | 459 | return ret; |
459 | 460 | ||
460 | if (subs->sync_endpoint) | 461 | if (subs->sync_endpoint) |
461 | ret = snd_usb_endpoint_set_params(subs->data_endpoint, | 462 | ret = snd_usb_endpoint_set_params(subs->data_endpoint, |
@@ -465,9 +466,6 @@ static int configure_endpoint(struct snd_usb_substream *subs) | |||
465 | subs->cur_rate, | 466 | subs->cur_rate, |
466 | subs->cur_audiofmt, | 467 | subs->cur_audiofmt, |
467 | NULL); | 468 | NULL); |
468 | |||
469 | unlock: | ||
470 | mutex_unlock(&subs->stream->chip->shutdown_mutex); | ||
471 | return ret; | 469 | return ret; |
472 | } | 470 | } |
473 | 471 | ||
@@ -505,7 +503,13 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, | |||
505 | return -EINVAL; | 503 | return -EINVAL; |
506 | } | 504 | } |
507 | 505 | ||
508 | if ((ret = set_format(subs, fmt)) < 0) | 506 | down_read(&subs->stream->chip->shutdown_rwsem); |
507 | if (subs->stream->chip->shutdown) | ||
508 | ret = -ENODEV; | ||
509 | else | ||
510 | ret = set_format(subs, fmt); | ||
511 | up_read(&subs->stream->chip->shutdown_rwsem); | ||
512 | if (ret < 0) | ||
509 | return ret; | 513 | return ret; |
510 | 514 | ||
511 | subs->interface = fmt->iface; | 515 | subs->interface = fmt->iface; |
@@ -527,10 +531,12 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) | |||
527 | subs->cur_audiofmt = NULL; | 531 | subs->cur_audiofmt = NULL; |
528 | subs->cur_rate = 0; | 532 | subs->cur_rate = 0; |
529 | subs->period_bytes = 0; | 533 | subs->period_bytes = 0; |
530 | mutex_lock(&subs->stream->chip->shutdown_mutex); | 534 | down_read(&subs->stream->chip->shutdown_rwsem); |
531 | stop_endpoints(subs, 0, 1, 1); | 535 | if (!subs->stream->chip->shutdown) { |
532 | deactivate_endpoints(subs); | 536 | stop_endpoints(subs, 0, 1, 1); |
533 | mutex_unlock(&subs->stream->chip->shutdown_mutex); | 537 | deactivate_endpoints(subs); |
538 | } | ||
539 | up_read(&subs->stream->chip->shutdown_rwsem); | ||
534 | return snd_pcm_lib_free_vmalloc_buffer(substream); | 540 | return snd_pcm_lib_free_vmalloc_buffer(substream); |
535 | } | 541 | } |
536 | 542 | ||
@@ -552,12 +558,19 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) | |||
552 | return -ENXIO; | 558 | return -ENXIO; |
553 | } | 559 | } |
554 | 560 | ||
555 | if (snd_BUG_ON(!subs->data_endpoint)) | 561 | down_read(&subs->stream->chip->shutdown_rwsem); |
556 | return -EIO; | 562 | if (subs->stream->chip->shutdown) { |
563 | ret = -ENODEV; | ||
564 | goto unlock; | ||
565 | } | ||
566 | if (snd_BUG_ON(!subs->data_endpoint)) { | ||
567 | ret = -EIO; | ||
568 | goto unlock; | ||
569 | } | ||
557 | 570 | ||
558 | ret = set_format(subs, subs->cur_audiofmt); | 571 | ret = set_format(subs, subs->cur_audiofmt); |
559 | if (ret < 0) | 572 | if (ret < 0) |
560 | return ret; | 573 | goto unlock; |
561 | 574 | ||
562 | iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface); | 575 | iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface); |
563 | alts = &iface->altsetting[subs->cur_audiofmt->altset_idx]; | 576 | alts = &iface->altsetting[subs->cur_audiofmt->altset_idx]; |
@@ -567,12 +580,12 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) | |||
567 | subs->cur_audiofmt, | 580 | subs->cur_audiofmt, |
568 | subs->cur_rate); | 581 | subs->cur_rate); |
569 | if (ret < 0) | 582 | if (ret < 0) |
570 | return ret; | 583 | goto unlock; |
571 | 584 | ||
572 | if (subs->need_setup_ep) { | 585 | if (subs->need_setup_ep) { |
573 | ret = configure_endpoint(subs); | 586 | ret = configure_endpoint(subs); |
574 | if (ret < 0) | 587 | if (ret < 0) |
575 | return ret; | 588 | goto unlock; |
576 | subs->need_setup_ep = false; | 589 | subs->need_setup_ep = false; |
577 | } | 590 | } |
578 | 591 | ||
@@ -592,9 +605,11 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) | |||
592 | /* for playback, submit the URBs now; otherwise, the first hwptr_done | 605 | /* for playback, submit the URBs now; otherwise, the first hwptr_done |
593 | * updates for all URBs would happen at the same time when starting */ | 606 | * updates for all URBs would happen at the same time when starting */ |
594 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) | 607 | if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) |
595 | return start_endpoints(subs, 1); | 608 | ret = start_endpoints(subs, 1); |
596 | 609 | ||
597 | return 0; | 610 | unlock: |
611 | up_read(&subs->stream->chip->shutdown_rwsem); | ||
612 | return ret; | ||
598 | } | 613 | } |
599 | 614 | ||
600 | static struct snd_pcm_hardware snd_usb_hardware = | 615 | static struct snd_pcm_hardware snd_usb_hardware = |
@@ -647,7 +662,7 @@ static int hw_check_valid_format(struct snd_usb_substream *subs, | |||
647 | return 0; | 662 | return 0; |
648 | } | 663 | } |
649 | /* check whether the period time is >= the data packet interval */ | 664 | /* check whether the period time is >= the data packet interval */ |
650 | if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL) { | 665 | if (subs->speed != USB_SPEED_FULL) { |
651 | ptime = 125 * (1 << fp->datainterval); | 666 | ptime = 125 * (1 << fp->datainterval); |
652 | if (ptime > pt->max || (ptime == pt->max && pt->openmax)) { | 667 | if (ptime > pt->max || (ptime == pt->max && pt->openmax)) { |
653 | hwc_debug(" > check: ptime %u > max %u\n", ptime, pt->max); | 668 | hwc_debug(" > check: ptime %u > max %u\n", ptime, pt->max); |
@@ -925,7 +940,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre | |||
925 | return err; | 940 | return err; |
926 | 941 | ||
927 | param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME; | 942 | param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME; |
928 | if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL) | 943 | if (subs->speed == USB_SPEED_FULL) |
929 | /* full speed devices have fixed data packet interval */ | 944 | /* full speed devices have fixed data packet interval */ |
930 | ptmin = 1000; | 945 | ptmin = 1000; |
931 | if (ptmin == 1000) | 946 | if (ptmin == 1000) |
diff --git a/sound/usb/proc.c b/sound/usb/proc.c index ebc1a5b5b3f..d218f763501 100644 --- a/sound/usb/proc.c +++ b/sound/usb/proc.c | |||
@@ -108,7 +108,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s | |||
108 | } | 108 | } |
109 | snd_iprintf(buffer, "\n"); | 109 | snd_iprintf(buffer, "\n"); |
110 | } | 110 | } |
111 | if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL) | 111 | if (subs->speed != USB_SPEED_FULL) |
112 | snd_iprintf(buffer, " Data packet interval: %d us\n", | 112 | snd_iprintf(buffer, " Data packet interval: %d us\n", |
113 | 125 * (1 << fp->datainterval)); | 113 | 125 * (1 << fp->datainterval)); |
114 | // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); | 114 | // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize); |
@@ -124,7 +124,7 @@ static void proc_dump_ep_status(struct snd_usb_substream *subs, | |||
124 | return; | 124 | return; |
125 | snd_iprintf(buffer, " Packet Size = %d\n", ep->curpacksize); | 125 | snd_iprintf(buffer, " Packet Size = %d\n", ep->curpacksize); |
126 | snd_iprintf(buffer, " Momentary freq = %u Hz (%#x.%04x)\n", | 126 | snd_iprintf(buffer, " Momentary freq = %u Hz (%#x.%04x)\n", |
127 | snd_usb_get_speed(subs->dev) == USB_SPEED_FULL | 127 | subs->speed == USB_SPEED_FULL |
128 | ? get_full_speed_hz(ep->freqm) | 128 | ? get_full_speed_hz(ep->freqm) |
129 | : get_high_speed_hz(ep->freqm), | 129 | : get_high_speed_hz(ep->freqm), |
130 | ep->freqm >> 16, ep->freqm & 0xffff); | 130 | ep->freqm >> 16, ep->freqm & 0xffff); |
diff --git a/sound/usb/stream.c b/sound/usb/stream.c index 083ed81160e..1de0c8c002a 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c | |||
@@ -90,6 +90,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as, | |||
90 | subs->direction = stream; | 90 | subs->direction = stream; |
91 | subs->dev = as->chip->dev; | 91 | subs->dev = as->chip->dev; |
92 | subs->txfr_quirk = as->chip->txfr_quirk; | 92 | subs->txfr_quirk = as->chip->txfr_quirk; |
93 | subs->speed = snd_usb_get_speed(subs->dev); | ||
93 | 94 | ||
94 | snd_usb_set_pcm_ops(as->pcm, stream); | 95 | snd_usb_set_pcm_ops(as->pcm, stream); |
95 | 96 | ||
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index b8233ebe250..ef42797f56f 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -37,7 +37,7 @@ struct snd_usb_audio { | |||
37 | struct usb_interface *pm_intf; | 37 | struct usb_interface *pm_intf; |
38 | u32 usb_id; | 38 | u32 usb_id; |
39 | struct mutex mutex; | 39 | struct mutex mutex; |
40 | struct mutex shutdown_mutex; | 40 | struct rw_semaphore shutdown_rwsem; |
41 | unsigned int shutdown:1; | 41 | unsigned int shutdown:1; |
42 | unsigned int probing:1; | 42 | unsigned int probing:1; |
43 | unsigned int autosuspended:1; | 43 | unsigned int autosuspended:1; |