aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/omap_udc.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-09 17:32:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-09 17:32:44 -0500
commit3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch)
treed8825be54cefb6ad6707478d719c8e30605bee7b /drivers/usb/gadget/omap_udc.c
parent00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (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/omap_udc.c')
-rw-r--r--drivers/usb/gadget/omap_udc.c61
1 files changed, 30 insertions, 31 deletions
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
index 387692a3611e..a8972d7c97be 100644
--- a/drivers/usb/gadget/omap_udc.c
+++ b/drivers/usb/gadget/omap_udc.c
@@ -2707,18 +2707,17 @@ omap_udc_setup(struct platform_device *odev, struct otg_transceiver *xceiv)
2707 return 0; 2707 return 0;
2708} 2708}
2709 2709
2710static int __init omap_udc_probe(struct device *dev) 2710static int __init omap_udc_probe(struct platform_device *pdev)
2711{ 2711{
2712 struct platform_device *odev = to_platform_device(dev);
2713 int status = -ENODEV; 2712 int status = -ENODEV;
2714 int hmc; 2713 int hmc;
2715 struct otg_transceiver *xceiv = NULL; 2714 struct otg_transceiver *xceiv = NULL;
2716 const char *type = NULL; 2715 const char *type = NULL;
2717 struct omap_usb_config *config = dev->platform_data; 2716 struct omap_usb_config *config = pdev->dev.platform_data;
2718 2717
2719 /* NOTE: "knows" the order of the resources! */ 2718 /* NOTE: "knows" the order of the resources! */
2720 if (!request_mem_region(odev->resource[0].start, 2719 if (!request_mem_region(pdev->resource[0].start,
2721 odev->resource[0].end - odev->resource[0].start + 1, 2720 pdev->resource[0].end - pdev->resource[0].start + 1,
2722 driver_name)) { 2721 driver_name)) {
2723 DBG("request_mem_region failed\n"); 2722 DBG("request_mem_region failed\n");
2724 return -EBUSY; 2723 return -EBUSY;
@@ -2803,7 +2802,7 @@ bad_on_1710:
2803 INFO("hmc mode %d, %s transceiver\n", hmc, type); 2802 INFO("hmc mode %d, %s transceiver\n", hmc, type);
2804 2803
2805 /* a "gadget" abstracts/virtualizes the controller */ 2804 /* a "gadget" abstracts/virtualizes the controller */
2806 status = omap_udc_setup(odev, xceiv); 2805 status = omap_udc_setup(pdev, xceiv);
2807 if (status) { 2806 if (status) {
2808 goto cleanup0; 2807 goto cleanup0;
2809 } 2808 }
@@ -2821,28 +2820,28 @@ bad_on_1710:
2821 udc->clr_halt = UDC_RESET_EP; 2820 udc->clr_halt = UDC_RESET_EP;
2822 2821
2823 /* USB general purpose IRQ: ep0, state changes, dma, etc */ 2822 /* USB general purpose IRQ: ep0, state changes, dma, etc */
2824 status = request_irq(odev->resource[1].start, omap_udc_irq, 2823 status = request_irq(pdev->resource[1].start, omap_udc_irq,
2825 SA_SAMPLE_RANDOM, driver_name, udc); 2824 SA_SAMPLE_RANDOM, driver_name, udc);
2826 if (status != 0) { 2825 if (status != 0) {
2827 ERR( "can't get irq %ld, err %d\n", 2826 ERR( "can't get irq %ld, err %d\n",
2828 odev->resource[1].start, status); 2827 pdev->resource[1].start, status);
2829 goto cleanup1; 2828 goto cleanup1;
2830 } 2829 }
2831 2830
2832 /* USB "non-iso" IRQ (PIO for all but ep0) */ 2831 /* USB "non-iso" IRQ (PIO for all but ep0) */
2833 status = request_irq(odev->resource[2].start, omap_udc_pio_irq, 2832 status = request_irq(pdev->resource[2].start, omap_udc_pio_irq,
2834 SA_SAMPLE_RANDOM, "omap_udc pio", udc); 2833 SA_SAMPLE_RANDOM, "omap_udc pio", udc);
2835 if (status != 0) { 2834 if (status != 0) {
2836 ERR( "can't get irq %ld, err %d\n", 2835 ERR( "can't get irq %ld, err %d\n",
2837 odev->resource[2].start, status); 2836 pdev->resource[2].start, status);
2838 goto cleanup2; 2837 goto cleanup2;
2839 } 2838 }
2840#ifdef USE_ISO 2839#ifdef USE_ISO
2841 status = request_irq(odev->resource[3].start, omap_udc_iso_irq, 2840 status = request_irq(pdev->resource[3].start, omap_udc_iso_irq,
2842 SA_INTERRUPT, "omap_udc iso", udc); 2841 SA_INTERRUPT, "omap_udc iso", udc);
2843 if (status != 0) { 2842 if (status != 0) {
2844 ERR("can't get irq %ld, err %d\n", 2843 ERR("can't get irq %ld, err %d\n",
2845 odev->resource[3].start, status); 2844 pdev->resource[3].start, status);
2846 goto cleanup3; 2845 goto cleanup3;
2847 } 2846 }
2848#endif 2847#endif
@@ -2853,11 +2852,11 @@ bad_on_1710:
2853 2852
2854#ifdef USE_ISO 2853#ifdef USE_ISO
2855cleanup3: 2854cleanup3:
2856 free_irq(odev->resource[2].start, udc); 2855 free_irq(pdev->resource[2].start, udc);
2857#endif 2856#endif
2858 2857
2859cleanup2: 2858cleanup2:
2860 free_irq(odev->resource[1].start, udc); 2859 free_irq(pdev->resource[1].start, udc);
2861 2860
2862cleanup1: 2861cleanup1:
2863 kfree (udc); 2862 kfree (udc);
@@ -2866,14 +2865,13 @@ cleanup1:
2866cleanup0: 2865cleanup0:
2867 if (xceiv) 2866 if (xceiv)
2868 put_device(xceiv->dev); 2867 put_device(xceiv->dev);
2869 release_mem_region(odev->resource[0].start, 2868 release_mem_region(pdev->resource[0].start,
2870 odev->resource[0].end - odev->resource[0].start + 1); 2869 pdev->resource[0].end - pdev->resource[0].start + 1);
2871 return status; 2870 return status;
2872} 2871}
2873 2872
2874static int __exit omap_udc_remove(struct device *dev) 2873static int __exit omap_udc_remove(struct platform_device *pdev)
2875{ 2874{
2876 struct platform_device *odev = to_platform_device(dev);
2877 DECLARE_COMPLETION(done); 2875 DECLARE_COMPLETION(done);
2878 2876
2879 if (!udc) 2877 if (!udc)
@@ -2891,13 +2889,13 @@ static int __exit omap_udc_remove(struct device *dev)
2891 remove_proc_file(); 2889 remove_proc_file();
2892 2890
2893#ifdef USE_ISO 2891#ifdef USE_ISO
2894 free_irq(odev->resource[3].start, udc); 2892 free_irq(pdev->resource[3].start, udc);
2895#endif 2893#endif
2896 free_irq(odev->resource[2].start, udc); 2894 free_irq(pdev->resource[2].start, udc);
2897 free_irq(odev->resource[1].start, udc); 2895 free_irq(pdev->resource[1].start, udc);
2898 2896
2899 release_mem_region(odev->resource[0].start, 2897 release_mem_region(pdev->resource[0].start,
2900 odev->resource[0].end - odev->resource[0].start + 1); 2898 pdev->resource[0].end - pdev->resource[0].start + 1);
2901 2899
2902 device_unregister(&udc->gadget.dev); 2900 device_unregister(&udc->gadget.dev);
2903 wait_for_completion(&done); 2901 wait_for_completion(&done);
@@ -2915,7 +2913,7 @@ static int __exit omap_udc_remove(struct device *dev)
2915 * may involve talking to an external transceiver (e.g. isp1301). 2913 * may involve talking to an external transceiver (e.g. isp1301).
2916 */ 2914 */
2917 2915
2918static int omap_udc_suspend(struct device *dev, pm_message_t message) 2916static int omap_udc_suspend(struct platform_device *dev, pm_message_t message)
2919{ 2917{
2920 u32 devstat; 2918 u32 devstat;
2921 2919
@@ -2935,7 +2933,7 @@ static int omap_udc_suspend(struct device *dev, pm_message_t message)
2935 return 0; 2933 return 0;
2936} 2934}
2937 2935
2938static int omap_udc_resume(struct device *dev) 2936static int omap_udc_resume(struct platform_device *dev)
2939{ 2937{
2940 DBG("resume + wakeup/SRP\n"); 2938 DBG("resume + wakeup/SRP\n");
2941 omap_pullup(&udc->gadget, 1); 2939 omap_pullup(&udc->gadget, 1);
@@ -2947,14 +2945,15 @@ static int omap_udc_resume(struct device *dev)
2947 2945
2948/*-------------------------------------------------------------------------*/ 2946/*-------------------------------------------------------------------------*/
2949 2947
2950static struct device_driver udc_driver = { 2948static struct platform_driver udc_driver = {
2951 .name = (char *) driver_name,
2952 .owner = THIS_MODULE,
2953 .bus = &platform_bus_type,
2954 .probe = omap_udc_probe, 2949 .probe = omap_udc_probe,
2955 .remove = __exit_p(omap_udc_remove), 2950 .remove = __exit_p(omap_udc_remove),
2956 .suspend = omap_udc_suspend, 2951 .suspend = omap_udc_suspend,
2957 .resume = omap_udc_resume, 2952 .resume = omap_udc_resume,
2953 .driver = {
2954 .owner = THIS_MODULE,
2955 .name = (char *) driver_name,
2956 },
2958}; 2957};
2959 2958
2960static int __init udc_init(void) 2959static int __init udc_init(void)
@@ -2965,13 +2964,13 @@ static int __init udc_init(void)
2965#endif 2964#endif
2966 "%s\n", driver_desc, 2965 "%s\n", driver_desc,
2967 use_dma ? " (dma)" : ""); 2966 use_dma ? " (dma)" : "");
2968 return driver_register(&udc_driver); 2967 return platform_driver_register(&udc_driver);
2969} 2968}
2970module_init(udc_init); 2969module_init(udc_init);
2971 2970
2972static void __exit udc_exit(void) 2971static void __exit udc_exit(void)
2973{ 2972{
2974 driver_unregister(&udc_driver); 2973 platform_driver_unregister(&udc_driver);
2975} 2974}
2976module_exit(udc_exit); 2975module_exit(udc_exit);
2977 2976