aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
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 904519085334..1e407745c115 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -896,7 +896,7 @@ dummy_gadget_release (struct device *dev)
896#endif 896#endif
897} 897}
898 898
899static int dummy_udc_probe (struct device *dev) 899static int dummy_udc_probe (struct platform_device *dev)
900{ 900{
901 struct dummy *dum = the_controller; 901 struct dummy *dum = the_controller;
902 int rc; 902 int rc;
@@ -909,7 +909,7 @@ static int dummy_udc_probe (struct device *dev)
909 dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0); 909 dum->gadget.is_otg = (dummy_to_hcd(dum)->self.otg_port != 0);
910 910
911 strcpy (dum->gadget.dev.bus_id, "gadget"); 911 strcpy (dum->gadget.dev.bus_id, "gadget");
912 dum->gadget.dev.parent = dev; 912 dum->gadget.dev.parent = &dev->dev;
913 dum->gadget.dev.release = dummy_gadget_release; 913 dum->gadget.dev.release = dummy_gadget_release;
914 rc = device_register (&dum->gadget.dev); 914 rc = device_register (&dum->gadget.dev);
915 if (rc < 0) 915 if (rc < 0)
@@ -919,26 +919,26 @@ static int dummy_udc_probe (struct device *dev)
919 usb_bus_get (&dummy_to_hcd (dum)->self); 919 usb_bus_get (&dummy_to_hcd (dum)->self);
920#endif 920#endif
921 921
922 dev_set_drvdata (dev, dum); 922 platform_set_drvdata (dev, dum);
923 device_create_file (&dum->gadget.dev, &dev_attr_function); 923 device_create_file (&dum->gadget.dev, &dev_attr_function);
924 return rc; 924 return rc;
925} 925}
926 926
927static int dummy_udc_remove (struct device *dev) 927static int dummy_udc_remove (struct platform_device *dev)
928{ 928{
929 struct dummy *dum = dev_get_drvdata (dev); 929 struct dummy *dum = platform_get_drvdata (dev);
930 930
931 dev_set_drvdata (dev, NULL); 931 platform_set_drvdata (dev, NULL);
932 device_remove_file (&dum->gadget.dev, &dev_attr_function); 932 device_remove_file (&dum->gadget.dev, &dev_attr_function);
933 device_unregister (&dum->gadget.dev); 933 device_unregister (&dum->gadget.dev);
934 return 0; 934 return 0;
935} 935}
936 936
937static int dummy_udc_suspend (struct device *dev, pm_message_t state) 937static int dummy_udc_suspend (struct platform_device *dev, pm_message_t state)
938{ 938{
939 struct dummy *dum = dev_get_drvdata(dev); 939 struct dummy *dum = platform_get_drvdata(dev);
940 940
941 dev_dbg (dev, "%s\n", __FUNCTION__); 941 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
942 spin_lock_irq (&dum->lock); 942 spin_lock_irq (&dum->lock);
943 dum->udc_suspended = 1; 943 dum->udc_suspended = 1;
944 set_link_state (dum); 944 set_link_state (dum);
@@ -949,29 +949,30 @@ static int dummy_udc_suspend (struct device *dev, pm_message_t state)
949 return 0; 949 return 0;
950} 950}
951 951
952static int dummy_udc_resume (struct device *dev) 952static int dummy_udc_resume (struct platform_device *dev)
953{ 953{
954 struct dummy *dum = dev_get_drvdata(dev); 954 struct dummy *dum = platform_get_drvdata(dev);
955 955
956 dev_dbg (dev, "%s\n", __FUNCTION__); 956 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
957 spin_lock_irq (&dum->lock); 957 spin_lock_irq (&dum->lock);
958 dum->udc_suspended = 0; 958 dum->udc_suspended = 0;
959 set_link_state (dum); 959 set_link_state (dum);
960 spin_unlock_irq (&dum->lock); 960 spin_unlock_irq (&dum->lock);
961 961
962 dev->power.power_state = PMSG_ON; 962 dev->dev.power.power_state = PMSG_ON;
963 usb_hcd_poll_rh_status (dummy_to_hcd (dum)); 963 usb_hcd_poll_rh_status (dummy_to_hcd (dum));
964 return 0; 964 return 0;
965} 965}
966 966
967static struct device_driver dummy_udc_driver = { 967static struct platform_driver dummy_udc_driver = {
968 .name = (char *) gadget_name,
969 .owner = THIS_MODULE,
970 .bus = &platform_bus_type,
971 .probe = dummy_udc_probe, 968 .probe = dummy_udc_probe,
972 .remove = dummy_udc_remove, 969 .remove = dummy_udc_remove,
973 .suspend = dummy_udc_suspend, 970 .suspend = dummy_udc_suspend,
974 .resume = dummy_udc_resume, 971 .resume = dummy_udc_resume,
972 .driver = {
973 .name = (char *) gadget_name,
974 .owner = THIS_MODULE,
975 },
975}; 976};
976 977
977/*-------------------------------------------------------------------------*/ 978/*-------------------------------------------------------------------------*/
@@ -1898,14 +1899,14 @@ static const struct hc_driver dummy_hcd = {
1898 .bus_resume = dummy_bus_resume, 1899 .bus_resume = dummy_bus_resume,
1899}; 1900};
1900 1901
1901static int dummy_hcd_probe (struct device *dev) 1902static int dummy_hcd_probe (struct platform_device *dev)
1902{ 1903{
1903 struct usb_hcd *hcd; 1904 struct usb_hcd *hcd;
1904 int retval; 1905 int retval;
1905 1906
1906 dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc); 1907 dev_info (dev, "%s, driver " DRIVER_VERSION "\n", driver_desc);
1907 1908
1908 hcd = usb_create_hcd (&dummy_hcd, dev, dev->bus_id); 1909 hcd = usb_create_hcd (&dummy_hcd, &dev->dev, dev->dev.bus_id);
1909 if (!hcd) 1910 if (!hcd)
1910 return -ENOMEM; 1911 return -ENOMEM;
1911 the_controller = hcd_to_dummy (hcd); 1912 the_controller = hcd_to_dummy (hcd);
@@ -1918,48 +1919,49 @@ static int dummy_hcd_probe (struct device *dev)
1918 return retval; 1919 return retval;
1919} 1920}
1920 1921
1921static int dummy_hcd_remove (struct device *dev) 1922static int dummy_hcd_remove (struct platform_device *dev)
1922{ 1923{
1923 struct usb_hcd *hcd; 1924 struct usb_hcd *hcd;
1924 1925
1925 hcd = dev_get_drvdata (dev); 1926 hcd = platform_get_drvdata (dev);
1926 usb_remove_hcd (hcd); 1927 usb_remove_hcd (hcd);
1927 usb_put_hcd (hcd); 1928 usb_put_hcd (hcd);
1928 the_controller = NULL; 1929 the_controller = NULL;
1929 return 0; 1930 return 0;
1930} 1931}
1931 1932
1932static int dummy_hcd_suspend (struct device *dev, pm_message_t state) 1933static int dummy_hcd_suspend (struct platform_device *dev, pm_message_t state)
1933{ 1934{
1934 struct usb_hcd *hcd; 1935 struct usb_hcd *hcd;
1935 1936
1936 dev_dbg (dev, "%s\n", __FUNCTION__); 1937 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
1937 hcd = dev_get_drvdata (dev); 1938 hcd = platform_get_drvdata (dev);
1938 1939
1939 hcd->state = HC_STATE_SUSPENDED; 1940 hcd->state = HC_STATE_SUSPENDED;
1940 return 0; 1941 return 0;
1941} 1942}
1942 1943
1943static int dummy_hcd_resume (struct device *dev) 1944static int dummy_hcd_resume (struct platform_device *dev)
1944{ 1945{
1945 struct usb_hcd *hcd; 1946 struct usb_hcd *hcd;
1946 1947
1947 dev_dbg (dev, "%s\n", __FUNCTION__); 1948 dev_dbg (&dev->dev, "%s\n", __FUNCTION__);
1948 hcd = dev_get_drvdata (dev); 1949 hcd = platform_get_drvdata (dev);
1949 hcd->state = HC_STATE_RUNNING; 1950 hcd->state = HC_STATE_RUNNING;
1950 1951
1951 usb_hcd_poll_rh_status (hcd); 1952 usb_hcd_poll_rh_status (hcd);
1952 return 0; 1953 return 0;
1953} 1954}
1954 1955
1955static struct device_driver dummy_hcd_driver = { 1956static struct platform_driver dummy_hcd_driver = {
1956 .name = (char *) driver_name,
1957 .owner = THIS_MODULE,
1958 .bus = &platform_bus_type,
1959 .probe = dummy_hcd_probe, 1957 .probe = dummy_hcd_probe,
1960 .remove = dummy_hcd_remove, 1958 .remove = dummy_hcd_remove,
1961 .suspend = dummy_hcd_suspend, 1959 .suspend = dummy_hcd_suspend,
1962 .resume = dummy_hcd_resume, 1960 .resume = dummy_hcd_resume,
1961 .driver = {
1962 .name = (char *) driver_name,
1963 .owner = THIS_MODULE,
1964 },
1963}; 1965};
1964 1966
1965/*-------------------------------------------------------------------------*/ 1967/*-------------------------------------------------------------------------*/
@@ -1995,11 +1997,11 @@ static int __init init (void)
1995 if (usb_disabled ()) 1997 if (usb_disabled ())
1996 return -ENODEV; 1998 return -ENODEV;
1997 1999
1998 retval = driver_register (&dummy_hcd_driver); 2000 retval = platform_driver_register (&dummy_hcd_driver);
1999 if (retval < 0) 2001 if (retval < 0)
2000 return retval; 2002 return retval;
2001 2003
2002 retval = driver_register (&dummy_udc_driver); 2004 retval = platform_driver_register (&dummy_udc_driver);
2003 if (retval < 0) 2005 if (retval < 0)
2004 goto err_register_udc_driver; 2006 goto err_register_udc_driver;
2005 2007
@@ -2015,9 +2017,9 @@ static int __init init (void)
2015err_register_udc: 2017err_register_udc:
2016 platform_device_unregister (&the_hcd_pdev); 2018 platform_device_unregister (&the_hcd_pdev);
2017err_register_hcd: 2019err_register_hcd:
2018 driver_unregister (&dummy_udc_driver); 2020 platform_driver_unregister (&dummy_udc_driver);
2019err_register_udc_driver: 2021err_register_udc_driver:
2020 driver_unregister (&dummy_hcd_driver); 2022 platform_driver_unregister (&dummy_hcd_driver);
2021 return retval; 2023 return retval;
2022} 2024}
2023module_init (init); 2025module_init (init);
@@ -2026,7 +2028,7 @@ static void __exit cleanup (void)
2026{ 2028{
2027 platform_device_unregister (&the_udc_pdev); 2029 platform_device_unregister (&the_udc_pdev);
2028 platform_device_unregister (&the_hcd_pdev); 2030 platform_device_unregister (&the_hcd_pdev);
2029 driver_unregister (&dummy_udc_driver); 2031 platform_driver_unregister (&dummy_udc_driver);
2030 driver_unregister (&dummy_hcd_driver); 2032 platform_driver_unregister (&dummy_hcd_driver);
2031} 2033}
2032module_exit (cleanup); 2034module_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 510d28a924db..bb028c5b8952 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa2xx_udc.c
@@ -2432,7 +2432,7 @@ static struct pxa2xx_udc memory = {
2432/* 2432/*
2433 * probe - binds to the platform device 2433 * probe - binds to the platform device
2434 */ 2434 */
2435static int __init pxa2xx_udc_probe(struct device *_dev) 2435static int __init pxa2xx_udc_probe(struct platform_device *pdev)
2436{ 2436{
2437 struct pxa2xx_udc *dev = &memory; 2437 struct pxa2xx_udc *dev = &memory;
2438 int retval, out_dma = 1; 2438 int retval, out_dma = 1;
@@ -2495,19 +2495,19 @@ static int __init pxa2xx_udc_probe(struct device *_dev)
2495#endif 2495#endif
2496 2496
2497 /* other non-static parts of init */ 2497 /* other non-static parts of init */
2498 dev->dev = _dev; 2498 dev->dev = &pdev->dev;
2499 dev->mach = _dev->platform_data; 2499 dev->mach = pdev->dev.platform_data;
2500 2500
2501 init_timer(&dev->timer); 2501 init_timer(&dev->timer);
2502 dev->timer.function = udc_watchdog; 2502 dev->timer.function = udc_watchdog;
2503 dev->timer.data = (unsigned long) dev; 2503 dev->timer.data = (unsigned long) dev;
2504 2504
2505 device_initialize(&dev->gadget.dev); 2505 device_initialize(&dev->gadget.dev);
2506 dev->gadget.dev.parent = _dev; 2506 dev->gadget.dev.parent = &pdev->dev;
2507 dev->gadget.dev.dma_mask = _dev->dma_mask; 2507 dev->gadget.dev.dma_mask = pdev->dev.dma_mask;
2508 2508
2509 the_controller = dev; 2509 the_controller = dev;
2510 dev_set_drvdata(_dev, dev); 2510 platform_set_drvdata(pdev, dev);
2511 2511
2512 udc_disable(dev); 2512 udc_disable(dev);
2513 udc_reinit(dev); 2513 udc_reinit(dev);
@@ -2559,14 +2559,14 @@ lubbock_fail0:
2559 return 0; 2559 return 0;
2560} 2560}
2561 2561
2562static void pxa2xx_udc_shutdown(struct device *_dev) 2562static void pxa2xx_udc_shutdown(struct platform_device *_dev)
2563{ 2563{
2564 pullup_off(); 2564 pullup_off();
2565} 2565}
2566 2566
2567static int __exit pxa2xx_udc_remove(struct device *_dev) 2567static int __exit pxa2xx_udc_remove(struct platform_device *pdev)
2568{ 2568{
2569 struct pxa2xx_udc *dev = dev_get_drvdata(_dev); 2569 struct pxa2xx_udc *dev = platform_get_drvdata(pdev);
2570 2570
2571 udc_disable(dev); 2571 udc_disable(dev);
2572 remove_proc_files(); 2572 remove_proc_files();
@@ -2580,7 +2580,7 @@ static int __exit pxa2xx_udc_remove(struct device *_dev)
2580 free_irq(LUBBOCK_USB_DISC_IRQ, dev); 2580 free_irq(LUBBOCK_USB_DISC_IRQ, dev);
2581 free_irq(LUBBOCK_USB_IRQ, dev); 2581 free_irq(LUBBOCK_USB_IRQ, dev);
2582 } 2582 }
2583 dev_set_drvdata(_dev, NULL); 2583 platform_set_drvdata(pdev, NULL);
2584 the_controller = NULL; 2584 the_controller = NULL;
2585 return 0; 2585 return 0;
2586} 2586}
@@ -2601,9 +2601,9 @@ static int __exit pxa2xx_udc_remove(struct device *_dev)
2601 * VBUS IRQs should probably be ignored so that the PXA device just acts 2601 * VBUS IRQs should probably be ignored so that the PXA device just acts
2602 * "dead" to USB hosts until system resume. 2602 * "dead" to USB hosts until system resume.
2603 */ 2603 */
2604static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state) 2604static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
2605{ 2605{
2606 struct pxa2xx_udc *udc = dev_get_drvdata(dev); 2606 struct pxa2xx_udc *udc = platform_get_drvdata(dev);
2607 2607
2608 if (!udc->mach->udc_command) 2608 if (!udc->mach->udc_command)
2609 WARN("USB host won't detect disconnect!\n"); 2609 WARN("USB host won't detect disconnect!\n");
@@ -2612,9 +2612,9 @@ static int pxa2xx_udc_suspend(struct device *dev, pm_message_t state)
2612 return 0; 2612 return 0;
2613} 2613}
2614 2614
2615static int pxa2xx_udc_resume(struct device *dev) 2615static int pxa2xx_udc_resume(struct platform_device *dev)
2616{ 2616{
2617 struct pxa2xx_udc *udc = dev_get_drvdata(dev); 2617 struct pxa2xx_udc *udc = platform_get_drvdata(dev);
2618 2618
2619 pullup(udc, 1); 2619 pullup(udc, 1);
2620 2620
@@ -2628,27 +2628,28 @@ static int pxa2xx_udc_resume(struct device *dev)
2628 2628
2629/*-------------------------------------------------------------------------*/ 2629/*-------------------------------------------------------------------------*/
2630 2630
2631static struct device_driver udc_driver = { 2631static struct platform_driver udc_driver = {
2632 .name = "pxa2xx-udc",
2633 .owner = THIS_MODULE,
2634 .bus = &platform_bus_type,
2635 .probe = pxa2xx_udc_probe, 2632 .probe = pxa2xx_udc_probe,
2636 .shutdown = pxa2xx_udc_shutdown, 2633 .shutdown = pxa2xx_udc_shutdown,
2637 .remove = __exit_p(pxa2xx_udc_remove), 2634 .remove = __exit_p(pxa2xx_udc_remove),
2638 .suspend = pxa2xx_udc_suspend, 2635 .suspend = pxa2xx_udc_suspend,
2639 .resume = pxa2xx_udc_resume, 2636 .resume = pxa2xx_udc_resume,
2637 .driver = {
2638 .owner = THIS_MODULE,
2639 .name = "pxa2xx-udc",
2640 },
2640}; 2641};
2641 2642
2642static int __init udc_init(void) 2643static int __init udc_init(void)
2643{ 2644{
2644 printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION); 2645 printk(KERN_INFO "%s: version %s\n", driver_name, DRIVER_VERSION);
2645 return driver_register(&udc_driver); 2646 return platform_driver_register(&udc_driver);
2646} 2647}
2647module_init(udc_init); 2648module_init(udc_init);
2648 2649
2649static void __exit udc_exit(void) 2650static void __exit udc_exit(void)
2650{ 2651{
2651 driver_unregister(&udc_driver); 2652 platform_driver_unregister(&udc_driver);
2652} 2653}
2653module_exit(udc_exit); 2654module_exit(udc_exit);
2654 2655