diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-09 21:46:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-09 21:46:02 -0400 |
commit | f4f9b8fc73f9aa93744f0e91e18f367d7766f523 (patch) | |
tree | 90d02c6722b0ffd8252ac438370600aaf8d814e7 /drivers/input/misc/max8925_onkey.c | |
parent | 9894e6d9c020b754dd962960e9f7eac18282f69f (diff) | |
parent | a292241cccb7e20e8b997a9a44177e7c98141859 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov:
"A big update to the Atmel touchscreen driver, devm support for polled
input devices, several drivers have been converted to using managed
resources, and assorted driver fixes"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (87 commits)
Input: synaptics - fix resolution for manually provided min/max
Input: atmel_mxt_ts - fix invalid return from mxt_get_bootloader_version
Input: max8997_haptic - add error handling for regulator and pwm
Input: elantech - don't set bit 1 of reg_10 when the no_hw_res quirk is set
Input: elantech - deal with clickpads reporting right button events
Input: edt-ft5x06 - fix an i2c write for M09 support
Input: omap-keypad - remove platform data support
ARM: OMAP2+: remove unused omap4-keypad file and code
Input: ab8500-ponkey - switch to using managed resources
Input: max8925_onkey - switch to using managed resources
Input: 88pm860x-ts - switch to using managed resources
Input: 88pm860x_onkey - switch to using managed resources
Input: intel-mid-touch - switch to using managed resources
Input: wacom - process outbound for newer Cintiqs
Input: wacom - set stylus_in_proximity when pen is in range
DTS: ARM: OMAP3-N900: Add tsc2005 support
Input: tsc2005 - add DT support
Input: add common DT binding for touchscreens
Input: jornada680_kbd - switch top using managed resources
Input: adp5520-keys - switch to using managed resources
...
Diffstat (limited to 'drivers/input/misc/max8925_onkey.c')
-rw-r--r-- | drivers/input/misc/max8925_onkey.c | 55 |
1 files changed, 18 insertions, 37 deletions
diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c index eef41cfc054d..3809618e6a5d 100644 --- a/drivers/input/misc/max8925_onkey.c +++ b/drivers/input/misc/max8925_onkey.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/mfd/max8925.h> | 27 | #include <linux/mfd/max8925.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/device.h> | ||
29 | 30 | ||
30 | #define SW_INPUT (1 << 7) /* 0/1 -- up/down */ | 31 | #define SW_INPUT (1 << 7) /* 0/1 -- up/down */ |
31 | #define HARDRESET_EN (1 << 7) | 32 | #define HARDRESET_EN (1 << 7) |
@@ -81,12 +82,14 @@ static int max8925_onkey_probe(struct platform_device *pdev) | |||
81 | return -EINVAL; | 82 | return -EINVAL; |
82 | } | 83 | } |
83 | 84 | ||
84 | info = kzalloc(sizeof(struct max8925_onkey_info), GFP_KERNEL); | 85 | info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_onkey_info), |
85 | input = input_allocate_device(); | 86 | GFP_KERNEL); |
86 | if (!info || !input) { | 87 | if (!info) |
87 | error = -ENOMEM; | 88 | return -ENOMEM; |
88 | goto err_free_mem; | 89 | |
89 | } | 90 | input = devm_input_allocate_device(&pdev->dev); |
91 | if (!input) | ||
92 | return -ENOMEM; | ||
90 | 93 | ||
91 | info->idev = input; | 94 | info->idev = input; |
92 | info->i2c = chip->i2c; | 95 | info->i2c = chip->i2c; |
@@ -100,55 +103,34 @@ static int max8925_onkey_probe(struct platform_device *pdev) | |||
100 | input->dev.parent = &pdev->dev; | 103 | input->dev.parent = &pdev->dev; |
101 | input_set_capability(input, EV_KEY, KEY_POWER); | 104 | input_set_capability(input, EV_KEY, KEY_POWER); |
102 | 105 | ||
103 | error = request_threaded_irq(irq[0], NULL, max8925_onkey_handler, | 106 | error = devm_request_threaded_irq(&pdev->dev, irq[0], NULL, |
104 | IRQF_ONESHOT, "onkey-down", info); | 107 | max8925_onkey_handler, IRQF_ONESHOT, |
108 | "onkey-down", info); | ||
105 | if (error < 0) { | 109 | if (error < 0) { |
106 | dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n", | 110 | dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n", |
107 | irq[0], error); | 111 | irq[0], error); |
108 | goto err_free_mem; | 112 | return error; |
109 | } | 113 | } |
110 | 114 | ||
111 | error = request_threaded_irq(irq[1], NULL, max8925_onkey_handler, | 115 | error = devm_request_threaded_irq(&pdev->dev, irq[1], NULL, |
112 | IRQF_ONESHOT, "onkey-up", info); | 116 | max8925_onkey_handler, IRQF_ONESHOT, |
117 | "onkey-up", info); | ||
113 | if (error < 0) { | 118 | if (error < 0) { |
114 | dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n", | 119 | dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n", |
115 | irq[1], error); | 120 | irq[1], error); |
116 | goto err_free_irq0; | 121 | return error; |
117 | } | 122 | } |
118 | 123 | ||
119 | error = input_register_device(info->idev); | 124 | error = input_register_device(info->idev); |
120 | if (error) { | 125 | if (error) { |
121 | dev_err(chip->dev, "Can't register input device: %d\n", error); | 126 | dev_err(chip->dev, "Can't register input device: %d\n", error); |
122 | goto err_free_irq1; | 127 | return error; |
123 | } | 128 | } |
124 | 129 | ||
125 | platform_set_drvdata(pdev, info); | 130 | platform_set_drvdata(pdev, info); |
126 | device_init_wakeup(&pdev->dev, 1); | 131 | device_init_wakeup(&pdev->dev, 1); |
127 | 132 | ||
128 | return 0; | 133 | return 0; |
129 | |||
130 | err_free_irq1: | ||
131 | free_irq(irq[1], info); | ||
132 | err_free_irq0: | ||
133 | free_irq(irq[0], info); | ||
134 | err_free_mem: | ||
135 | input_free_device(input); | ||
136 | kfree(info); | ||
137 | |||
138 | return error; | ||
139 | } | ||
140 | |||
141 | static int max8925_onkey_remove(struct platform_device *pdev) | ||
142 | { | ||
143 | struct max8925_onkey_info *info = platform_get_drvdata(pdev); | ||
144 | struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); | ||
145 | |||
146 | free_irq(info->irq[0] + chip->irq_base, info); | ||
147 | free_irq(info->irq[1] + chip->irq_base, info); | ||
148 | input_unregister_device(info->idev); | ||
149 | kfree(info); | ||
150 | |||
151 | return 0; | ||
152 | } | 134 | } |
153 | 135 | ||
154 | #ifdef CONFIG_PM_SLEEP | 136 | #ifdef CONFIG_PM_SLEEP |
@@ -190,7 +172,6 @@ static struct platform_driver max8925_onkey_driver = { | |||
190 | .pm = &max8925_onkey_pm_ops, | 172 | .pm = &max8925_onkey_pm_ops, |
191 | }, | 173 | }, |
192 | .probe = max8925_onkey_probe, | 174 | .probe = max8925_onkey_probe, |
193 | .remove = max8925_onkey_remove, | ||
194 | }; | 175 | }; |
195 | module_platform_driver(max8925_onkey_driver); | 176 | module_platform_driver(max8925_onkey_driver); |
196 | 177 | ||