diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-05-23 12:20:21 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-05-23 12:34:13 -0400 |
commit | 35c4b1227e1f3ea8b8536834aaa96c2cc7c0cfa0 (patch) | |
tree | 4eb6b6dc23e75a80e75667299d248278be402d22 /drivers/input/misc | |
parent | d52014556d8a1f3be57db4f04d6fdce06af87493 (diff) |
Input: misc - use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.
Also, unnecessary dev_set_drvdata() is removed, because the driver core
clears the driver data to NULL after device_release or on probe failure.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc')
-rw-r--r-- | drivers/input/misc/sgi_btns.c | 7 | ||||
-rw-r--r-- | drivers/input/misc/sparcspkr.c | 14 |
2 files changed, 7 insertions, 14 deletions
diff --git a/drivers/input/misc/sgi_btns.c b/drivers/input/misc/sgi_btns.c index ad6415ceaf5f..95cf299ef9a3 100644 --- a/drivers/input/misc/sgi_btns.c +++ b/drivers/input/misc/sgi_btns.c | |||
@@ -128,7 +128,7 @@ static int sgi_buttons_probe(struct platform_device *pdev) | |||
128 | __clear_bit(KEY_RESERVED, input->keybit); | 128 | __clear_bit(KEY_RESERVED, input->keybit); |
129 | 129 | ||
130 | bdev->poll_dev = poll_dev; | 130 | bdev->poll_dev = poll_dev; |
131 | dev_set_drvdata(&pdev->dev, bdev); | 131 | platform_set_drvdata(pdev, bdev); |
132 | 132 | ||
133 | error = input_register_polled_device(poll_dev); | 133 | error = input_register_polled_device(poll_dev); |
134 | if (error) | 134 | if (error) |
@@ -139,19 +139,16 @@ static int sgi_buttons_probe(struct platform_device *pdev) | |||
139 | err_free_mem: | 139 | err_free_mem: |
140 | input_free_polled_device(poll_dev); | 140 | input_free_polled_device(poll_dev); |
141 | kfree(bdev); | 141 | kfree(bdev); |
142 | dev_set_drvdata(&pdev->dev, NULL); | ||
143 | return error; | 142 | return error; |
144 | } | 143 | } |
145 | 144 | ||
146 | static int sgi_buttons_remove(struct platform_device *pdev) | 145 | static int sgi_buttons_remove(struct platform_device *pdev) |
147 | { | 146 | { |
148 | struct device *dev = &pdev->dev; | 147 | struct buttons_dev *bdev = platform_get_drvdata(pdev); |
149 | struct buttons_dev *bdev = dev_get_drvdata(dev); | ||
150 | 148 | ||
151 | input_unregister_polled_device(bdev->poll_dev); | 149 | input_unregister_polled_device(bdev->poll_dev); |
152 | input_free_polled_device(bdev->poll_dev); | 150 | input_free_polled_device(bdev->poll_dev); |
153 | kfree(bdev); | 151 | kfree(bdev); |
154 | dev_set_drvdata(dev, NULL); | ||
155 | 152 | ||
156 | return 0; | 153 | return 0; |
157 | } | 154 | } |
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c index a53586a7fbdb..65fd3150919b 100644 --- a/drivers/input/misc/sparcspkr.c +++ b/drivers/input/misc/sparcspkr.c | |||
@@ -175,7 +175,7 @@ static int sparcspkr_probe(struct device *dev) | |||
175 | 175 | ||
176 | static void sparcspkr_shutdown(struct platform_device *dev) | 176 | static void sparcspkr_shutdown(struct platform_device *dev) |
177 | { | 177 | { |
178 | struct sparcspkr_state *state = dev_get_drvdata(&dev->dev); | 178 | struct sparcspkr_state *state = platform_get_drvdata(dev); |
179 | struct input_dev *input_dev = state->input_dev; | 179 | struct input_dev *input_dev = state->input_dev; |
180 | 180 | ||
181 | /* turn off the speaker */ | 181 | /* turn off the speaker */ |
@@ -211,7 +211,7 @@ static int bbc_beep_probe(struct platform_device *op) | |||
211 | if (!info->regs) | 211 | if (!info->regs) |
212 | goto out_free; | 212 | goto out_free; |
213 | 213 | ||
214 | dev_set_drvdata(&op->dev, state); | 214 | platform_set_drvdata(op, state); |
215 | 215 | ||
216 | err = sparcspkr_probe(&op->dev); | 216 | err = sparcspkr_probe(&op->dev); |
217 | if (err) | 217 | if (err) |
@@ -220,7 +220,6 @@ static int bbc_beep_probe(struct platform_device *op) | |||
220 | return 0; | 220 | return 0; |
221 | 221 | ||
222 | out_clear_drvdata: | 222 | out_clear_drvdata: |
223 | dev_set_drvdata(&op->dev, NULL); | ||
224 | of_iounmap(&op->resource[0], info->regs, 6); | 223 | of_iounmap(&op->resource[0], info->regs, 6); |
225 | 224 | ||
226 | out_free: | 225 | out_free: |
@@ -231,7 +230,7 @@ out_err: | |||
231 | 230 | ||
232 | static int bbc_remove(struct platform_device *op) | 231 | static int bbc_remove(struct platform_device *op) |
233 | { | 232 | { |
234 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); | 233 | struct sparcspkr_state *state = platform_get_drvdata(op); |
235 | struct input_dev *input_dev = state->input_dev; | 234 | struct input_dev *input_dev = state->input_dev; |
236 | struct bbc_beep_info *info = &state->u.bbc; | 235 | struct bbc_beep_info *info = &state->u.bbc; |
237 | 236 | ||
@@ -242,7 +241,6 @@ static int bbc_remove(struct platform_device *op) | |||
242 | 241 | ||
243 | of_iounmap(&op->resource[0], info->regs, 6); | 242 | of_iounmap(&op->resource[0], info->regs, 6); |
244 | 243 | ||
245 | dev_set_drvdata(&op->dev, NULL); | ||
246 | kfree(state); | 244 | kfree(state); |
247 | 245 | ||
248 | return 0; | 246 | return 0; |
@@ -290,7 +288,7 @@ static int grover_beep_probe(struct platform_device *op) | |||
290 | if (!info->enable_reg) | 288 | if (!info->enable_reg) |
291 | goto out_unmap_freq_regs; | 289 | goto out_unmap_freq_regs; |
292 | 290 | ||
293 | dev_set_drvdata(&op->dev, state); | 291 | platform_set_drvdata(op, state); |
294 | 292 | ||
295 | err = sparcspkr_probe(&op->dev); | 293 | err = sparcspkr_probe(&op->dev); |
296 | if (err) | 294 | if (err) |
@@ -299,7 +297,6 @@ static int grover_beep_probe(struct platform_device *op) | |||
299 | return 0; | 297 | return 0; |
300 | 298 | ||
301 | out_clear_drvdata: | 299 | out_clear_drvdata: |
302 | dev_set_drvdata(&op->dev, NULL); | ||
303 | of_iounmap(&op->resource[3], info->enable_reg, 1); | 300 | of_iounmap(&op->resource[3], info->enable_reg, 1); |
304 | 301 | ||
305 | out_unmap_freq_regs: | 302 | out_unmap_freq_regs: |
@@ -312,7 +309,7 @@ out_err: | |||
312 | 309 | ||
313 | static int grover_remove(struct platform_device *op) | 310 | static int grover_remove(struct platform_device *op) |
314 | { | 311 | { |
315 | struct sparcspkr_state *state = dev_get_drvdata(&op->dev); | 312 | struct sparcspkr_state *state = platform_get_drvdata(op); |
316 | struct grover_beep_info *info = &state->u.grover; | 313 | struct grover_beep_info *info = &state->u.grover; |
317 | struct input_dev *input_dev = state->input_dev; | 314 | struct input_dev *input_dev = state->input_dev; |
318 | 315 | ||
@@ -324,7 +321,6 @@ static int grover_remove(struct platform_device *op) | |||
324 | of_iounmap(&op->resource[3], info->enable_reg, 1); | 321 | of_iounmap(&op->resource[3], info->enable_reg, 1); |
325 | of_iounmap(&op->resource[2], info->freq_regs, 2); | 322 | of_iounmap(&op->resource[2], info->freq_regs, 2); |
326 | 323 | ||
327 | dev_set_drvdata(&op->dev, NULL); | ||
328 | kfree(state); | 324 | kfree(state); |
329 | 325 | ||
330 | return 0; | 326 | return 0; |