diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/input/keyboard | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff) |
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/corgikbd.c | 29 | ||||
-rw-r--r-- | drivers/input/keyboard/spitzkbd.c | 29 |
2 files changed, 30 insertions, 28 deletions
diff --git a/drivers/input/keyboard/corgikbd.c b/drivers/input/keyboard/corgikbd.c index d00d14bb637a..64672d491222 100644 --- a/drivers/input/keyboard/corgikbd.c +++ b/drivers/input/keyboard/corgikbd.c | |||
@@ -259,17 +259,17 @@ static void corgikbd_hinge_timer(unsigned long data) | |||
259 | } | 259 | } |
260 | 260 | ||
261 | #ifdef CONFIG_PM | 261 | #ifdef CONFIG_PM |
262 | static int corgikbd_suspend(struct device *dev, pm_message_t state) | 262 | static int corgikbd_suspend(struct platform_device *dev, pm_message_t state) |
263 | { | 263 | { |
264 | struct corgikbd *corgikbd = dev_get_drvdata(dev); | 264 | struct corgikbd *corgikbd = platform_get_drvdata(dev); |
265 | corgikbd->suspended = 1; | 265 | corgikbd->suspended = 1; |
266 | 266 | ||
267 | return 0; | 267 | return 0; |
268 | } | 268 | } |
269 | 269 | ||
270 | static int corgikbd_resume(struct device *dev) | 270 | static int corgikbd_resume(struct platform_device *dev) |
271 | { | 271 | { |
272 | struct corgikbd *corgikbd = dev_get_drvdata(dev); | 272 | struct corgikbd *corgikbd = platform_get_drvdata(dev); |
273 | 273 | ||
274 | /* Upon resume, ignore the suspend key for a short while */ | 274 | /* Upon resume, ignore the suspend key for a short while */ |
275 | corgikbd->suspend_jiffies=jiffies; | 275 | corgikbd->suspend_jiffies=jiffies; |
@@ -282,7 +282,7 @@ static int corgikbd_resume(struct device *dev) | |||
282 | #define corgikbd_resume NULL | 282 | #define corgikbd_resume NULL |
283 | #endif | 283 | #endif |
284 | 284 | ||
285 | static int __init corgikbd_probe(struct device *dev) | 285 | static int __init corgikbd_probe(struct platform_device *pdev) |
286 | { | 286 | { |
287 | struct corgikbd *corgikbd; | 287 | struct corgikbd *corgikbd; |
288 | struct input_dev *input_dev; | 288 | struct input_dev *input_dev; |
@@ -296,7 +296,7 @@ static int __init corgikbd_probe(struct device *dev) | |||
296 | return -ENOMEM; | 296 | return -ENOMEM; |
297 | } | 297 | } |
298 | 298 | ||
299 | dev_set_drvdata(dev, corgikbd); | 299 | platform_set_drvdata(pdev, corgikbd); |
300 | 300 | ||
301 | corgikbd->input = input_dev; | 301 | corgikbd->input = input_dev; |
302 | spin_lock_init(&corgikbd->lock); | 302 | spin_lock_init(&corgikbd->lock); |
@@ -321,7 +321,7 @@ static int __init corgikbd_probe(struct device *dev) | |||
321 | input_dev->id.vendor = 0x0001; | 321 | input_dev->id.vendor = 0x0001; |
322 | input_dev->id.product = 0x0001; | 322 | input_dev->id.product = 0x0001; |
323 | input_dev->id.version = 0x0100; | 323 | input_dev->id.version = 0x0100; |
324 | input_dev->cdev.dev = dev; | 324 | input_dev->cdev.dev = &pdev->dev; |
325 | input_dev->private = corgikbd; | 325 | input_dev->private = corgikbd; |
326 | 326 | ||
327 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); | 327 | input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_PWR) | BIT(EV_SW); |
@@ -356,10 +356,10 @@ static int __init corgikbd_probe(struct device *dev) | |||
356 | return 0; | 356 | return 0; |
357 | } | 357 | } |
358 | 358 | ||
359 | static int corgikbd_remove(struct device *dev) | 359 | static int corgikbd_remove(struct platform_device *pdev) |
360 | { | 360 | { |
361 | int i; | 361 | int i; |
362 | struct corgikbd *corgikbd = dev_get_drvdata(dev); | 362 | struct corgikbd *corgikbd = platform_get_drvdata(pdev); |
363 | 363 | ||
364 | for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) | 364 | for (i = 0; i < CORGI_KEY_SENSE_NUM; i++) |
365 | free_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd); | 365 | free_irq(CORGI_IRQ_GPIO_KEY_SENSE(i), corgikbd); |
@@ -374,23 +374,24 @@ static int corgikbd_remove(struct device *dev) | |||
374 | return 0; | 374 | return 0; |
375 | } | 375 | } |
376 | 376 | ||
377 | static struct device_driver corgikbd_driver = { | 377 | static struct platform_driver corgikbd_driver = { |
378 | .name = "corgi-keyboard", | ||
379 | .bus = &platform_bus_type, | ||
380 | .probe = corgikbd_probe, | 378 | .probe = corgikbd_probe, |
381 | .remove = corgikbd_remove, | 379 | .remove = corgikbd_remove, |
382 | .suspend = corgikbd_suspend, | 380 | .suspend = corgikbd_suspend, |
383 | .resume = corgikbd_resume, | 381 | .resume = corgikbd_resume, |
382 | .driver = { | ||
383 | .name = "corgi-keyboard", | ||
384 | }, | ||
384 | }; | 385 | }; |
385 | 386 | ||
386 | static int __devinit corgikbd_init(void) | 387 | static int __devinit corgikbd_init(void) |
387 | { | 388 | { |
388 | return driver_register(&corgikbd_driver); | 389 | return platform_driver_register(&corgikbd_driver); |
389 | } | 390 | } |
390 | 391 | ||
391 | static void __exit corgikbd_exit(void) | 392 | static void __exit corgikbd_exit(void) |
392 | { | 393 | { |
393 | driver_unregister(&corgikbd_driver); | 394 | platform_driver_unregister(&corgikbd_driver); |
394 | } | 395 | } |
395 | 396 | ||
396 | module_init(corgikbd_init); | 397 | module_init(corgikbd_init); |
diff --git a/drivers/input/keyboard/spitzkbd.c b/drivers/input/keyboard/spitzkbd.c index 0fa38a559cdf..6a15fe3bc527 100644 --- a/drivers/input/keyboard/spitzkbd.c +++ b/drivers/input/keyboard/spitzkbd.c | |||
@@ -309,10 +309,10 @@ static void spitzkbd_hinge_timer(unsigned long data) | |||
309 | } | 309 | } |
310 | 310 | ||
311 | #ifdef CONFIG_PM | 311 | #ifdef CONFIG_PM |
312 | static int spitzkbd_suspend(struct device *dev, pm_message_t state) | 312 | static int spitzkbd_suspend(struct platform_device *dev, pm_message_t state) |
313 | { | 313 | { |
314 | int i; | 314 | int i; |
315 | struct spitzkbd *spitzkbd = dev_get_drvdata(dev); | 315 | struct spitzkbd *spitzkbd = platform_get_drvdata(dev); |
316 | spitzkbd->suspended = 1; | 316 | spitzkbd->suspended = 1; |
317 | 317 | ||
318 | /* Set Strobe lines as inputs - *except* strobe line 0 leave this | 318 | /* Set Strobe lines as inputs - *except* strobe line 0 leave this |
@@ -323,10 +323,10 @@ static int spitzkbd_suspend(struct device *dev, pm_message_t state) | |||
323 | return 0; | 323 | return 0; |
324 | } | 324 | } |
325 | 325 | ||
326 | static int spitzkbd_resume(struct device *dev) | 326 | static int spitzkbd_resume(struct platform_device *dev) |
327 | { | 327 | { |
328 | int i; | 328 | int i; |
329 | struct spitzkbd *spitzkbd = dev_get_drvdata(dev); | 329 | struct spitzkbd *spitzkbd = platform_get_drvdata(dev); |
330 | 330 | ||
331 | for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++) | 331 | for (i = 0; i < SPITZ_KEY_STROBE_NUM; i++) |
332 | pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH); | 332 | pxa_gpio_mode(spitz_strobes[i] | GPIO_OUT | GPIO_DFLT_HIGH); |
@@ -342,7 +342,7 @@ static int spitzkbd_resume(struct device *dev) | |||
342 | #define spitzkbd_resume NULL | 342 | #define spitzkbd_resume NULL |
343 | #endif | 343 | #endif |
344 | 344 | ||
345 | static int __init spitzkbd_probe(struct device *dev) | 345 | static int __init spitzkbd_probe(struct platform_device *dev) |
346 | { | 346 | { |
347 | struct spitzkbd *spitzkbd; | 347 | struct spitzkbd *spitzkbd; |
348 | struct input_dev *input_dev; | 348 | struct input_dev *input_dev; |
@@ -358,7 +358,7 @@ static int __init spitzkbd_probe(struct device *dev) | |||
358 | return -ENOMEM; | 358 | return -ENOMEM; |
359 | } | 359 | } |
360 | 360 | ||
361 | dev_set_drvdata(dev, spitzkbd); | 361 | platform_set_drvdata(dev, spitzkbd); |
362 | strcpy(spitzkbd->phys, "spitzkbd/input0"); | 362 | strcpy(spitzkbd->phys, "spitzkbd/input0"); |
363 | 363 | ||
364 | spin_lock_init(&spitzkbd->lock); | 364 | spin_lock_init(&spitzkbd->lock); |
@@ -380,7 +380,7 @@ static int __init spitzkbd_probe(struct device *dev) | |||
380 | input_dev->private = spitzkbd; | 380 | input_dev->private = spitzkbd; |
381 | input_dev->name = "Spitz Keyboard"; | 381 | input_dev->name = "Spitz Keyboard"; |
382 | input_dev->phys = spitzkbd->phys; | 382 | input_dev->phys = spitzkbd->phys; |
383 | input_dev->cdev.dev = dev; | 383 | input_dev->cdev.dev = &dev->dev; |
384 | 384 | ||
385 | input_dev->id.bustype = BUS_HOST; | 385 | input_dev->id.bustype = BUS_HOST; |
386 | input_dev->id.vendor = 0x0001; | 386 | input_dev->id.vendor = 0x0001; |
@@ -437,10 +437,10 @@ static int __init spitzkbd_probe(struct device *dev) | |||
437 | return 0; | 437 | return 0; |
438 | } | 438 | } |
439 | 439 | ||
440 | static int spitzkbd_remove(struct device *dev) | 440 | static int spitzkbd_remove(struct platform_device *dev) |
441 | { | 441 | { |
442 | int i; | 442 | int i; |
443 | struct spitzkbd *spitzkbd = dev_get_drvdata(dev); | 443 | struct spitzkbd *spitzkbd = platform_get_drvdata(dev); |
444 | 444 | ||
445 | for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) | 445 | for (i = 0; i < SPITZ_KEY_SENSE_NUM; i++) |
446 | free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd); | 446 | free_irq(IRQ_GPIO(spitz_senses[i]), spitzkbd); |
@@ -460,23 +460,24 @@ static int spitzkbd_remove(struct device *dev) | |||
460 | return 0; | 460 | return 0; |
461 | } | 461 | } |
462 | 462 | ||
463 | static struct device_driver spitzkbd_driver = { | 463 | static struct platform_driver spitzkbd_driver = { |
464 | .name = "spitz-keyboard", | ||
465 | .bus = &platform_bus_type, | ||
466 | .probe = spitzkbd_probe, | 464 | .probe = spitzkbd_probe, |
467 | .remove = spitzkbd_remove, | 465 | .remove = spitzkbd_remove, |
468 | .suspend = spitzkbd_suspend, | 466 | .suspend = spitzkbd_suspend, |
469 | .resume = spitzkbd_resume, | 467 | .resume = spitzkbd_resume, |
468 | .driver = { | ||
469 | .name = "spitz-keyboard", | ||
470 | }, | ||
470 | }; | 471 | }; |
471 | 472 | ||
472 | static int __devinit spitzkbd_init(void) | 473 | static int __devinit spitzkbd_init(void) |
473 | { | 474 | { |
474 | return driver_register(&spitzkbd_driver); | 475 | return platform_driver_register(&spitzkbd_driver); |
475 | } | 476 | } |
476 | 477 | ||
477 | static void __exit spitzkbd_exit(void) | 478 | static void __exit spitzkbd_exit(void) |
478 | { | 479 | { |
479 | driver_unregister(&spitzkbd_driver); | 480 | platform_driver_unregister(&spitzkbd_driver); |
480 | } | 481 | } |
481 | 482 | ||
482 | module_init(spitzkbd_init); | 483 | module_init(spitzkbd_init); |