From 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 Mon Sep 17 00:00:00 2001 From: Russell King Date: Wed, 9 Nov 2005 22:32:44 +0000 Subject: [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 Acked-by: Greg Kroah-Hartman --- drivers/input/serio/i8042.c | 19 ++++++++++--------- drivers/input/serio/rpckbd.c | 21 +++++++++++---------- 2 files changed, 21 insertions(+), 19 deletions(-) (limited to 'drivers/input/serio') diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index 01e186422021..ac86c1d1d83e 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -912,7 +912,7 @@ static long i8042_panic_blink(long count) * Here we try to restore the original BIOS settings */ -static int i8042_suspend(struct device *dev, pm_message_t state) +static int i8042_suspend(struct platform_device *dev, pm_message_t state) { del_timer_sync(&i8042_timer); i8042_controller_reset(); @@ -925,7 +925,7 @@ static int i8042_suspend(struct device *dev, pm_message_t state) * Here we try to reset everything back to a state in which suspended */ -static int i8042_resume(struct device *dev) +static int i8042_resume(struct platform_device *dev) { int i; @@ -964,17 +964,18 @@ static int i8042_resume(struct device *dev) * because otherwise BIOSes will be confused. */ -static void i8042_shutdown(struct device *dev) +static void i8042_shutdown(struct platform_device *dev) { i8042_controller_cleanup(); } -static struct device_driver i8042_driver = { - .name = "i8042", - .bus = &platform_bus_type, +static struct platform_driver i8042_driver = { .suspend = i8042_suspend, .resume = i8042_resume, .shutdown = i8042_shutdown, + .driver = { + .name = "i8042", + }, }; static int __init i8042_create_kbd_port(void) @@ -1078,7 +1079,7 @@ static int __init i8042_init(void) goto err_platform_exit; } - err = driver_register(&i8042_driver); + err = platform_driver_register(&i8042_driver); if (err) goto err_controller_cleanup; @@ -1126,7 +1127,7 @@ static int __init i8042_init(void) err_unregister_device: platform_device_unregister(i8042_platform_device); err_unregister_driver: - driver_unregister(&i8042_driver); + platform_driver_unregister(&i8042_driver); err_controller_cleanup: i8042_controller_cleanup(); err_platform_exit: @@ -1148,7 +1149,7 @@ static void __exit i8042_exit(void) del_timer_sync(&i8042_timer); platform_device_unregister(i8042_platform_device); - driver_unregister(&i8042_driver); + platform_driver_unregister(&i8042_driver); i8042_platform_exit(); diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c index 52c49258f8a4..a3bd11589bc3 100644 --- a/drivers/input/serio/rpckbd.c +++ b/drivers/input/serio/rpckbd.c @@ -107,7 +107,7 @@ static void rpckbd_close(struct serio *port) * Allocate and initialize serio structure for subsequent registration * with serio core. */ -static int __devinit rpckbd_probe(struct device *dev) +static int __devinit rpckbd_probe(struct platform_device *dev) { struct serio *serio; @@ -120,37 +120,38 @@ static int __devinit rpckbd_probe(struct device *dev) serio->write = rpckbd_write; serio->open = rpckbd_open; serio->close = rpckbd_close; - serio->dev.parent = dev; + serio->dev.parent = &dev->dev; strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); - dev_set_drvdata(dev, serio); + platform_set_drvdata(dev, serio); serio_register_port(serio); return 0; } -static int __devexit rpckbd_remove(struct device *dev) +static int __devexit rpckbd_remove(struct platform_device *dev) { - struct serio *serio = dev_get_drvdata(dev); + struct serio *serio = platform_get_drvdata(dev); serio_unregister_port(serio); return 0; } -static struct device_driver rpckbd_driver = { - .name = "kart", - .bus = &platform_bus_type, +static struct platform_driver rpckbd_driver = { .probe = rpckbd_probe, .remove = __devexit_p(rpckbd_remove), + .driver = { + .name = "kart", + }, }; static int __init rpckbd_init(void) { - return driver_register(&rpckbd_driver); + return platform_driver_register(&rpckbd_driver); } static void __exit rpckbd_exit(void) { - driver_unregister(&rpckbd_driver); + platform_driver_unregister(&rpckbd_driver); } module_init(rpckbd_init); -- cgit v1.2.3