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/pxa2xx_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/pxa2xx_udc.c')
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index ee9cd7869d9..91bf18b8191 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -2433,7 +2433,7 @@ static struct pxa2xx_udc memory = { | |||
2433 | /* | 2433 | /* |
2434 | * probe - binds to the platform device | 2434 | * probe - binds to the platform device |
2435 | */ | 2435 | */ |
2436 | static int __init pxa2xx_udc_probe(struct device *_dev) | 2436 | static int __init pxa2xx_udc_probe(struct platform_device *pdev) |
2437 | { | 2437 | { |
2438 | struct pxa2xx_udc *dev = &memory; | 2438 | struct pxa2xx_udc *dev = &memory; |
2439 | int retval, out_dma = 1; | 2439 | int retval, out_dma = 1; |
@@ -2496,19 +2496,19 @@ static int __init pxa2xx_udc_probe(struct device *_dev) | |||
2496 | #endif | 2496 | #endif |
2497 | 2497 | ||
2498 | /* other non-static parts of init */ | 2498 | /* other non-static parts of init */ |
2499 | dev->dev = _dev; | 2499 | dev->dev = &pdev->dev; |
2500 | dev->mach = _dev->platform_data; | 2500 | dev->mach = pdev->dev.platform_data; |
2501 | 2501 | ||
2502 | init_timer(&dev->timer); | 2502 | init_timer(&dev->timer); |
2503 | dev->timer.function = udc_watchdog; | 2503 | dev->timer.function = udc_watchdog; |
2504 | dev->timer.data = (unsigned long) dev; | 2504 | dev->timer.data = (unsigned long) dev; |
2505 | 2505 | ||
2506 | device_initialize(&dev->gadget.dev); | 2506 | device_initialize(&dev->gadget.dev); |
2507 | dev->gadget.dev.parent = _dev; | 2507 | dev->gadget.dev.parent = &pdev->dev; |
2508 | dev->gadget.dev.dma_mask = _dev->dma_mask; | 2508 | dev->gadget.dev.dma_mask = pdev->dev.dma_mask; |
2509 | 2509 | ||
2510 | the_controller = dev; | 2510 | the_controller = dev; |
2511 | dev_set_drvdata(_dev, dev); | 2511 | platform_set_drvdata(pdev, dev); |
2512 | 2512 | ||
2513 | udc_disable(dev); | 2513 | udc_disable(dev); |
2514 | udc_reinit(dev); | 2514 | udc_reinit(dev); |
@@ -2560,14 +2560,14 @@ lubbock_fail0: | |||
2560 | return 0; | 2560 | return 0; |
2561 | } | 2561 | } |
2562 | 2562 | ||
2563 | static void pxa2xx_udc_shutdown(struct device *_dev) | 2563 | static void pxa2xx_udc_shutdown(struct platform_device *_dev) |
2564 | { | 2564 | { |
2565 | pullup_off(); | 2565 | pullup_off(); |
2566 | } | 2566 | } |
2567 | 2567 | ||
2568 | static int __exit pxa2xx_udc_remove(struct device *_dev) | 2568 | static int __exit pxa2xx_udc_remove(struct platform_device *pdev) |
2569 | { | 2569 | { |
2570 | struct pxa2xx_udc *dev = dev_get_drvdata(_dev); | 2570 | struct pxa2xx_udc *dev = platform_get_drvdata(pdev); |
2571 | 2571 | ||
2572 | udc_disable(dev); | 2572 | udc_disable(dev); |
2573 | remove_proc_files(); | 2573 | remove_proc_files(); |
@@ -2581,7 +2581,7 @@ static int __exit pxa2xx_udc_remove(struct device *_dev) | |||
2581 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); | 2581 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); |
2582 | free_irq(LUBBOCK_USB_IRQ, dev); | 2582 | free_irq(LUBBOCK_USB_IRQ, dev); |
2583 | } | 2583 | } |
2584 | dev_set_drvdata(_dev, NULL); | 2584 | platform_set_drvdata(pdev, NULL); |
2585 | the_controller = NULL; | 2585 | the_controller = NULL; |
2586 | return 0; | 2586 | return 0; |
2587 | } | 2587 | } |
@@ -2602,9 +2602,9 @@ static int __exit pxa2xx_udc_remove(struct device *_dev) | |||
2602 | * VBUS IRQs should probably be ignored so that the PXA device just acts | 2602 | * VBUS IRQs should probably be ignored so that the PXA device just acts |
2603 | * "dead" to USB hosts until system resume. | 2603 | * "dead" to USB hosts until system resume. |
2604 | */ | 2604 | */ |
2605 | static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state) | 2605 | static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) |
2606 | { | 2606 | { |
2607 | struct pxa2xx_udc *udc = dev_get_drvdata(dev); | 2607 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); |
2608 | 2608 | ||
2609 | if (!udc->mach->udc_command) | 2609 | if (!udc->mach->udc_command) |
2610 | WARN("USB host won't detect disconnect!\n"); | 2610 | WARN("USB host won't detect disconnect!\n"); |
@@ -2613,9 +2613,9 @@ static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state) | |||
2613 | return 0; | 2613 | return 0; |
2614 | } | 2614 | } |
2615 | 2615 | ||
2616 | static int pxa2xx_udc_resume(struct device *dev) | 2616 | static int pxa2xx_udc_resume(struct platform_device *dev) |
2617 | { | 2617 | { |
2618 | struct pxa2xx_udc *udc = dev_get_drvdata(dev); | 2618 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); |
2619 | 2619 | ||
2620 | pullup(udc, 1); | 2620 | pullup(udc, 1); |
2621 | 2621 | ||
@@ -2629,27 +2629,28 @@ static int pxa2xx_udc_resume(struct device *dev) | |||
2629 | 2629 | ||
2630 | /*-------------------------------------------------------------------------*/ | 2630 | /*-------------------------------------------------------------------------*/ |
2631 | 2631 | ||
2632 | static struct device_driver udc_driver = { | 2632 | static struct platform_driver udc_driver = { |
2633 | .name = "pxa2xx-udc", | ||
2634 | .owner = THIS_MODULE, | ||
2635 | .bus = &platform_bus_type, | ||
2636 | .probe = pxa2xx_udc_probe, | 2633 | .probe = pxa2xx_udc_probe, |
2637 | .shutdown = pxa2xx_udc_shutdown, | 2634 | .shutdown = pxa2xx_udc_shutdown, |
2638 | .remove = __exit_p(pxa2xx_udc_remove), | 2635 | .remove = __exit_p(pxa2xx_udc_remove), |
2639 | .suspend = pxa2xx_udc_suspend, | 2636 | .suspend = pxa2xx_udc_suspend, |
2640 | .resume = pxa2xx_udc_resume, | 2637 | .resume = pxa2xx_udc_resume, |
2638 | .driver = { | ||
2639 | .owner = THIS_MODULE, | ||
2640 | .name = "pxa2xx-udc", | ||
2641 | }, | ||
2641 | }; | 2642 | }; |
2642 | 2643 | ||
2643 | static int __init udc_init(void) | 2644 | static int __init udc_init(void) |
2644 | { | 2645 | { |
2645 | printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); | 2646 | printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); |
2646 | return driver_register(&udc_driver); | 2647 | return platform_driver_register(&udc_driver); |
2647 | } | 2648 | } |
2648 | module_init(udc_init); | 2649 | module_init(udc_init); |
2649 | 2650 | ||
2650 | static void __exit udc_exit(void) | 2651 | static void __exit udc_exit(void) |
2651 | { | 2652 | { |
2652 | driver_unregister(&udc_driver); | 2653 | platform_driver_unregister(&udc_driver); |
2653 | } | 2654 | } |
2654 | module_exit(udc_exit); | 2655 | module_exit(udc_exit); |
2655 | 2656 | ||