aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
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
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')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c76
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c31
-rw-r--r--drivers/usb/gadget/omap_udc.c61
-rw-r--r--drivers/usb/gadget/pxa2xx_udc.c41
4 files changed, 106 insertions, 103 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 975ace3f5b1e..6b93dbbf3246 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -897,7 +897,7 @@ dummy_gadget_release (struct device *dev)
897#endif 897#endif
898} 898}
899 899
900static int dummy_udc_probe (struct device *dev) 900static int dummy_udc_probe (struct platform_device *dev)
901{ 901{
902 struct dummy *dum = the_controller; 902 struct dummy *dum = the_controller;
903 int rc; 903 int rc;
@@ -910,7 +910,7 @@ static int dummy_udc_probe (struct device *dev)
910 dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0); 910 dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0);
911 911
912 strcpy (dum->gadget.dev.bus_id, "gadget"); 912 strcpy (dum->gadget.dev.bus_id, "gadget");
913 dum->gadget.dev.parent = dev; 913 dum->gadget.dev.parent = &dev->dev;
914 dum->gadget.dev.release = dummy_gadget_release; 914 dum->gadget.dev.release = dummy_gadget_release;
915 rc = device_register (&dum->gadget.dev); 915 rc = device_register (&dum->gadget.dev);
916 if (rc < 0) 916 if (rc < 0)
@@ -920,26 +920,26 @@ static int dummy_udc_probe (struct device *dev)
920 usb_bus_get (&dummy_to_hcd (dum)->self); 920 usb_bus_get (&dummy_to_hcd (dum)->self);
921#endif 921#endif
922 922
923 dev_set_drvdata (dev, dum); 923 platform_set_drvdata (dev, dum);
924 device_create_file (&dum->gadget.dev, &dev_attr_function); 924 device_create_file (&dum->gadget.dev, &dev_attr_function);
925 return rc; 925 return rc;
926} 926}
927 927
928static int dummy_udc_remove (struct device *dev) 928static int dummy_udc_remove (struct platform_device *dev)
929{ 929{
930 struct dummy *dum = dev_get_drvdata (dev); 930 struct dummy *dum = platform_get_drvdata (dev);
931 931
932 dev_set_drvdata (dev, NULL); 932 platform_set_drvdata (dev, NULL);
933 device_remove_file (&dum->gadget.dev, &dev_attr_function); 933 device_remove_file (&dum->gadget.dev, &dev_attr_function);
934 device_unregister (&dum->gadget.dev); 934 device_unregister (&dum->gadget.dev);
935 return 0; 935 return 0;
936} 936}
937 937
938static int dummy_udc_suspend (struct device *dev, pm_message_t state) 938static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state)
939{ 939{
940 struct dummy *dum = dev_get_drvdata(dev); 940 struct dummy *dum = platform_get_drvdata(dev);
941 941
942 dev_dbg (dev, "%s\n", __FUNCTION__); 942 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
943 spin_lock_irq (&dum->lock); 943 spin_lock_irq (&dum->lock);
944 dum->udc_suspended = 1; 944 dum->udc_suspended = 1;
945 set_link_state (dum); 945 set_link_state (dum);
@@ -950,29 +950,30 @@ static int dummy_udc_suspend (struct device *dev, pm_message_t state)
950 return 0; 950 return 0;
951} 951}
952 952
953static int dummy_udc_resume (struct device *dev) 953static int dummy_udc_resume (struct platform_device *dev)
954{ 954{
955 struct dummy *dum = dev_get_drvdata(dev); 955 struct dummy *dum = platform_get_drvdata(dev);
956 956
957 dev_dbg (dev, "%s\n", __FUNCTION__); 957 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
958 spin_lock_irq (&dum->lock); 958 spin_lock_irq (&dum->lock);
959 dum->udc_suspended = 0; 959 dum->udc_suspended = 0;
960 set_link_state (dum); 960 set_link_state (dum);
961 spin_unlock_irq (&dum->lock); 961 spin_unlock_irq (&dum->lock);
962 962
963 dev->power.power_state = PMSG_ON; 963 dev->dev.power.power_state = PMSG_ON;
964 usb_hcd_poll_rh_status (dummy_to_hcd (dum)); 964 usb_hcd_poll_rh_status (dummy_to_hcd (dum));
965 return 0; 965 return 0;
966} 966}
967 967
968static struct device_driver dummy_udc_driver = { 968static struct platform_driver dummy_udc_driver = {
969 .name = (char *) gadget_name,
970 .owner = THIS_MODULE,
971 .bus = &platform_bus_type,
972 .probe = dummy_udc_probe, 969 .probe = dummy_udc_probe,
973 .remove = dummy_udc_remove, 970 .remove = dummy_udc_remove,
974 .suspend = dummy_udc_suspend, 971 .suspend = dummy_udc_suspend,
975 .resume = dummy_udc_resume, 972 .resume = dummy_udc_resume,
973 .driver = {
974 .name = (char *) gadget_name,
975 .owner = THIS_MODULE,
976 },
976}; 977};
977 978
978/*-------------------------------------------------------------------------*/ 979/*-------------------------------------------------------------------------*/
@@ -1899,14 +1900,14 @@ static const struct hc_driver dummy_hcd = {
1899 .bus_resume = dummy_bus_resume, 1900 .bus_resume = dummy_bus_resume,
1900}; 1901};
1901 1902
1902static int dummy_hcd_probe (struct device *dev) 1903static int dummy_hcd_probe (struct platform_device *dev)
1903{ 1904{
1904 struct usb_hcd *hcd; 1905 struct usb_hcd *hcd;
1905 int retval; 1906 int retval;
1906 1907
1907 dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); 1908 dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc);
1908 1909
1909 hcd = usb_create_hcd (&dummy_hcd, dev, dev->bus_id); 1910 hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id);
1910 if (!hcd) 1911 if (!hcd)
1911 return -ENOMEM; 1912 return -ENOMEM;
1912 the_controller = hcd_to_dummy (hcd); 1913 the_controller = hcd_to_dummy (hcd);
@@ -1919,48 +1920,49 @@ static int dummy_hcd_probe (struct device *dev)
1919 return retval; 1920 return retval;
1920} 1921}
1921 1922
1922static int dummy_hcd_remove (struct device *dev) 1923static int dummy_hcd_remove (struct platform_device *dev)
1923{ 1924{
1924 struct usb_hcd *hcd; 1925 struct usb_hcd *hcd;
1925 1926
1926 hcd = dev_get_drvdata (dev); 1927 hcd = platform_get_drvdata (dev);
1927 usb_remove_hcd (hcd); 1928 usb_remove_hcd (hcd);
1928 usb_put_hcd (hcd); 1929 usb_put_hcd (hcd);
1929 the_controller = NULL; 1930 the_controller = NULL;
1930 return 0; 1931 return 0;
1931} 1932}
1932 1933
1933static int dummy_hcd_suspend (struct device *dev, pm_message_t state) 1934static int dummy_hcd_suspend (struct platform_device *dev, pm_message_t state)
1934{ 1935{
1935 struct usb_hcd *hcd; 1936 struct usb_hcd *hcd;
1936 1937
1937 dev_dbg (dev, "%s\n", __FUNCTION__); 1938 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
1938 hcd = dev_get_drvdata (dev); 1939 hcd = platform_get_drvdata (dev);
1939 1940
1940 hcd->state = HC_STATE_SUSPENDED; 1941 hcd->state = HC_STATE_SUSPENDED;
1941 return 0; 1942 return 0;
1942} 1943}
1943 1944
1944static int dummy_hcd_resume (struct device *dev) 1945static int dummy_hcd_resume (struct platform_device *dev)
1945{ 1946{
1946 struct usb_hcd *hcd; 1947 struct usb_hcd *hcd;
1947 1948
1948 dev_dbg (dev, "%s\n", __FUNCTION__); 1949 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
1949 hcd = dev_get_drvdata (dev); 1950 hcd = platform_get_drvdata (dev);
1950 hcd->state = HC_STATE_RUNNING; 1951 hcd->state = HC_STATE_RUNNING;
1951 1952
1952 usb_hcd_poll_rh_status (hcd); 1953 usb_hcd_poll_rh_status (hcd);
1953 return 0; 1954 return 0;
1954} 1955}
1955 1956
1956static struct device_driver dummy_hcd_driver = { 1957static struct platform_driver dummy_hcd_driver = {
1957 .name = (char *) driver_name,
1958 .owner = THIS_MODULE,
1959 .bus = &platform_bus_type,
1960 .probe = dummy_hcd_probe, 1958 .probe = dummy_hcd_probe,
1961 .remove = dummy_hcd_remove, 1959 .remove = dummy_hcd_remove,
1962 .suspend = dummy_hcd_suspend, 1960 .suspend = dummy_hcd_suspend,
1963 .resume = dummy_hcd_resume, 1961 .resume = dummy_hcd_resume,
1962 .driver = {
1963 .name = (char *) driver_name,
1964 .owner = THIS_MODULE,
1965 },
1964}; 1966};
1965 1967
1966/*-------------------------------------------------------------------------*/ 1968/*-------------------------------------------------------------------------*/
@@ -1996,11 +1998,11 @@ static int __init init (void)
1996 if (usb_disabled ()) 1998 if (usb_disabled ())
1997 return -ENODEV; 1999 return -ENODEV;
1998 2000
1999 retval = driver_register (&dummy_hcd_driver); 2001 retval = platform_driver_register (&dummy_hcd_driver);
2000 if (retval < 0) 2002 if (retval < 0)
2001 return retval; 2003 return retval;
2002 2004
2003 retval = driver_register (&dummy_udc_driver); 2005 retval = platform_driver_register (&dummy_udc_driver);
2004 if (retval < 0) 2006 if (retval < 0)
2005 goto err_register_udc_driver; 2007 goto err_register_udc_driver;
2006 2008
@@ -2016,9 +2018,9 @@ static int __init init (void)
2016err_register_udc: 2018err_register_udc:
2017 platform_device_unregister (&the_hcd_pdev); 2019 platform_device_unregister (&the_hcd_pdev);
2018err_register_hcd: 2020err_register_hcd:
2019 driver_unregister (&dummy_udc_driver); 2021 platform_driver_unregister (&dummy_udc_driver);
2020err_register_udc_driver: 2022err_register_udc_driver:
2021 driver_unregister (&dummy_hcd_driver); 2023 platform_driver_unregister (&dummy_hcd_driver);
2022 return retval; 2024 return retval;
2023} 2025}
2024module_init (init); 2026module_init (init);
@@ -2027,7 +2029,7 @@ static void __exit cleanup (void)
2027{ 2029{
2028 platform_device_unregister (&the_udc_pdev); 2030 platform_device_unregister (&the_udc_pdev);
2029 platform_device_unregister (&the_hcd_pdev); 2031 platform_device_unregister (&the_hcd_pdev);
2030 driver_unregister (&dummy_udc_driver); 2032 platform_driver_unregister (&dummy_udc_driver);
2031 driver_unregister (&dummy_hcd_driver); 2033 platform_driver_unregister (&dummy_hcd_driver);
2032} 2034}
2033module_exit (cleanup); 2035module_exit (cleanup);
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 */
2088static int lh7a40x_udc_probe(struct device *_dev) 2088static 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
2122static int lh7a40x_udc_remove(struct device *_dev) 2122static 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
2143static struct device_driver udc_driver = { 2143static 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
2154static int __init udc_init(void) 2155static 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
2160static void __exit udc_exit(void) 2161static void __exit udc_exit(void)
2161{ 2162{
2162 driver_unregister(&udc_driver); 2163 platform_driver_unregister(&udc_driver);
2163} 2164}
2164 2165
2165module_init(udc_init); 2166module_init(udc_init);
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
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
index ee9cd7869d92..91bf18b8191f 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 */
2436static int __init pxa2xx_udc_probe(struct device *_dev) 2436static 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
2563static void pxa2xx_udc_shutdown(struct device *_dev) 2563static void pxa2xx_udc_shutdown(struct platform_device *_dev)
2564{ 2564{
2565 pullup_off(); 2565 pullup_off();
2566} 2566}
2567 2567
2568static int __exit pxa2xx_udc_remove(struct device *_dev) 2568static 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 */
2605static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state) 2605static 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
2616static int pxa2xx_udc_resume(struct device *dev) 2616static 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
2632static struct device_driver udc_driver = { 2632static 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
2643static int __init udc_init(void) 2644static 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}
2648module_init(udc_init); 2649module_init(udc_init);
2649 2650
2650static void __exit udc_exit(void) 2651static void __exit udc_exit(void)
2651{ 2652{
2652 driver_unregister(&udc_driver); 2653 platform_driver_unregister(&udc_driver);
2653} 2654}
2654module_exit(udc_exit); 2655module_exit(udc_exit);
2655 2656