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/usb/gadget/lh7a40x_udc.c | |
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/usb/gadget/lh7a40x_udc.c')
-rw-r--r-- | drivers/usb/gadget/lh7a40x_udc.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c index bc6269f10cbb..e02fea5a5433 100644 --- a/drivers/usb/gadget/lh7a40x_udc.c +++ b/drivers/usb/gadget/lh7a40x_udc.c | |||
@@ -2085,21 +2085,21 @@ static struct lh7a40x_udc memory = { | |||
2085 | /* | 2085 | /* |
2086 | * probe - binds to the platform device | 2086 | * probe - binds to the platform device |
2087 | */ | 2087 | */ |
2088 | static int lh7a40x_udc_probe(struct device *_dev) | 2088 | static int lh7a40x_udc_probe(struct platform_device *pdev) |
2089 | { | 2089 | { |
2090 | struct lh7a40x_udc *dev = &memory; | 2090 | struct lh7a40x_udc *dev = &memory; |
2091 | int retval; | 2091 | int retval; |
2092 | 2092 | ||
2093 | DEBUG("%s: %p\n", __FUNCTION__, _dev); | 2093 | DEBUG("%s: %p\n", __FUNCTION__, pdev); |
2094 | 2094 | ||
2095 | spin_lock_init(&dev->lock); | 2095 | spin_lock_init(&dev->lock); |
2096 | dev->dev = _dev; | 2096 | dev->dev = &pdev->dev; |
2097 | 2097 | ||
2098 | device_initialize(&dev->gadget.dev); | 2098 | device_initialize(&dev->gadget.dev); |
2099 | dev->gadget.dev.parent = _dev; | 2099 | dev->gadget.dev.parent = &pdev->dev; |
2100 | 2100 | ||
2101 | the_controller = dev; | 2101 | the_controller = dev; |
2102 | dev_set_drvdata(_dev, dev); | 2102 | platform_set_drvdata(pdev, dev); |
2103 | 2103 | ||
2104 | udc_disable(dev); | 2104 | udc_disable(dev); |
2105 | udc_reinit(dev); | 2105 | udc_reinit(dev); |
@@ -2119,11 +2119,11 @@ static int lh7a40x_udc_probe(struct device *_dev) | |||
2119 | return retval; | 2119 | return retval; |
2120 | } | 2120 | } |
2121 | 2121 | ||
2122 | static int lh7a40x_udc_remove(struct device *_dev) | 2122 | static int lh7a40x_udc_remove(struct platform_device *pdev) |
2123 | { | 2123 | { |
2124 | struct lh7a40x_udc *dev = _dev->driver_data; | 2124 | struct lh7a40x_udc *dev = platform_get_drvdata(pdev); |
2125 | 2125 | ||
2126 | DEBUG("%s: %p\n", __FUNCTION__, dev); | 2126 | DEBUG("%s: %p\n", __FUNCTION__, pdev); |
2127 | 2127 | ||
2128 | udc_disable(dev); | 2128 | udc_disable(dev); |
2129 | remove_proc_files(); | 2129 | remove_proc_files(); |
@@ -2131,7 +2131,7 @@ static int lh7a40x_udc_remove(struct device *_dev) | |||
2131 | 2131 | ||
2132 | free_irq(IRQ_USBINTR, dev); | 2132 | free_irq(IRQ_USBINTR, dev); |
2133 | 2133 | ||
2134 | dev_set_drvdata(_dev, 0); | 2134 | platform_set_drvdata(pdev, 0); |
2135 | 2135 | ||
2136 | the_controller = 0; | 2136 | the_controller = 0; |
2137 | 2137 | ||
@@ -2140,26 +2140,27 @@ static int lh7a40x_udc_remove(struct device *_dev) | |||
2140 | 2140 | ||
2141 | /*-------------------------------------------------------------------------*/ | 2141 | /*-------------------------------------------------------------------------*/ |
2142 | 2142 | ||
2143 | static struct device_driver udc_driver = { | 2143 | static struct platform_driver udc_driver = { |
2144 | .name = (char *)driver_name, | ||
2145 | .owner = THIS_MODULE, | ||
2146 | .bus = &platform_bus_type, | ||
2147 | .probe = lh7a40x_udc_probe, | 2144 | .probe = lh7a40x_udc_probe, |
2148 | .remove = lh7a40x_udc_remove | 2145 | .remove = lh7a40x_udc_remove |
2149 | /* FIXME power management support */ | 2146 | /* FIXME power management support */ |
2150 | /* .suspend = ... disable UDC */ | 2147 | /* .suspend = ... disable UDC */ |
2151 | /* .resume = ... re-enable UDC */ | 2148 | /* .resume = ... re-enable UDC */ |
2149 | .driver = { | ||
2150 | .name = (char *)driver_name, | ||
2151 | .owner = THIS_MODULE, | ||
2152 | }, | ||
2152 | }; | 2153 | }; |
2153 | 2154 | ||
2154 | static int __init udc_init(void) | 2155 | static int __init udc_init(void) |
2155 | { | 2156 | { |
2156 | DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION); | 2157 | DEBUG("%s: %s version %s\n", __FUNCTION__, driver_name, DRIVER_VERSION); |
2157 | return driver_register(&udc_driver); | 2158 | return platform_driver_register(&udc_driver); |
2158 | } | 2159 | } |
2159 | 2160 | ||
2160 | static void __exit udc_exit(void) | 2161 | static void __exit udc_exit(void) |
2161 | { | 2162 | { |
2162 | driver_unregister(&udc_driver); | 2163 | platform_driver_unregister(&udc_driver); |
2163 | } | 2164 | } |
2164 | 2165 | ||
2165 | module_init(udc_init); | 2166 | module_init(udc_init); |