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/usb/host/ohci-pxa27x.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) (limited to 'drivers/usb/host/ohci-pxa27x.c') diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 59e2056..9d65ec3 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -290,9 +290,8 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { /*-------------------------------------------------------------------------*/ -static int ohci_hcd_pxa27x_drv_probe(struct device *dev) +static int ohci_hcd_pxa27x_drv_probe(struct platform_device *pdev) { - struct platform_device *pdev = to_platform_device(dev); int ret; pr_debug ("In ohci_hcd_pxa27x_drv_probe"); @@ -304,41 +303,39 @@ static int ohci_hcd_pxa27x_drv_probe(struct device *dev) return ret; } -static int ohci_hcd_pxa27x_drv_remove(struct device *dev) +static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev) { - struct platform_device *pdev = to_platform_device(dev); - struct usb_hcd *hcd = dev_get_drvdata(dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); usb_hcd_pxa27x_remove(hcd, pdev); return 0; } -static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state) +static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *dev, pm_message_t state) { -// struct platform_device *pdev = to_platform_device(dev); -// struct usb_hcd *hcd = dev_get_drvdata(dev); +// struct usb_hcd *hcd = platform_get_drvdata(dev); printk("%s: not implemented yet\n", __FUNCTION__); return 0; } -static int ohci_hcd_pxa27x_drv_resume(struct device *dev) +static int ohci_hcd_pxa27x_drv_resume(struct platform_device *dev) { -// struct platform_device *pdev = to_platform_device(dev); -// struct usb_hcd *hcd = dev_get_drvdata(dev); +// struct usb_hcd *hcd = platform_get_drvdata(dev); printk("%s: not implemented yet\n", __FUNCTION__); return 0; } -static struct device_driver ohci_hcd_pxa27x_driver = { - .name = "pxa27x-ohci", - .bus = &platform_bus_type, +static struct platform_driver ohci_hcd_pxa27x_driver = { .probe = ohci_hcd_pxa27x_drv_probe, .remove = ohci_hcd_pxa27x_drv_remove, .suspend = ohci_hcd_pxa27x_drv_suspend, - .resume = ohci_hcd_pxa27x_drv_resume, + .resume = ohci_hcd_pxa27x_drv_resume, + .driver = { + .name = "pxa27x-ohci", + }, }; static int __init ohci_hcd_pxa27x_init (void) @@ -347,12 +344,12 @@ static int __init ohci_hcd_pxa27x_init (void) pr_debug ("block sizes: ed %d td %d\n", sizeof (struct ed), sizeof (struct td)); - return driver_register(&ohci_hcd_pxa27x_driver); + return platform_driver_register(&ohci_hcd_pxa27x_driver); } static void __exit ohci_hcd_pxa27x_cleanup (void) { - driver_unregister(&ohci_hcd_pxa27x_driver); + platform_driver_unregister(&ohci_hcd_pxa27x_driver); } module_init (ohci_hcd_pxa27x_init); -- cgit v1.1