aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
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
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')
-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
-rw-r--r--drivers/usb/host/isp116x-hcd.c37
-rw-r--r--drivers/usb/host/ohci-au1xxx.c31
-rw-r--r--drivers/usb/host/ohci-lh7a404.c31
-rw-r--r--drivers/usb/host/ohci-omap.c35
-rw-r--r--drivers/usb/host/ohci-ppc-soc.c21
-rw-r--r--drivers/usb/host/ohci-pxa27x.c31
-rw-r--r--drivers/usb/host/ohci-s3c2410.c21
-rw-r--r--drivers/usb/host/sl811-hcd.c61
12 files changed, 230 insertions, 247 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
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index f9c3f5b8dd1c..82f64986bc22 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1633,17 +1633,15 @@ static struct hc_driver isp116x_hc_driver = {
1633 1633
1634/*----------------------------------------------------------------*/ 1634/*----------------------------------------------------------------*/
1635 1635
1636static int __init_or_module isp116x_remove(struct device *dev) 1636static int __init_or_module isp116x_remove(struct platform_device *pdev)
1637{ 1637{
1638 struct usb_hcd *hcd = dev_get_drvdata(dev); 1638 struct usb_hcd *hcd = platform_get_drvdata(pdev);
1639 struct isp116x *isp116x; 1639 struct isp116x *isp116x;
1640 struct platform_device *pdev;
1641 struct resource *res; 1640 struct resource *res;
1642 1641
1643 if (!hcd) 1642 if (!hcd)
1644 return 0; 1643 return 0;
1645 isp116x = hcd_to_isp116x(hcd); 1644 isp116x = hcd_to_isp116x(hcd);
1646 pdev = container_of(dev, struct platform_device, dev);
1647 remove_debug_file(isp116x); 1645 remove_debug_file(isp116x);
1648 usb_remove_hcd(hcd); 1646 usb_remove_hcd(hcd);
1649 1647
@@ -1660,18 +1658,16 @@ static int __init_or_module isp116x_remove(struct device *dev)
1660 1658
1661#define resource_len(r) (((r)->end - (r)->start) + 1) 1659#define resource_len(r) (((r)->end - (r)->start) + 1)
1662 1660
1663static int __init isp116x_probe(struct device *dev) 1661static int __init isp116x_probe(struct platform_device *pdev)
1664{ 1662{
1665 struct usb_hcd *hcd; 1663 struct usb_hcd *hcd;
1666 struct isp116x *isp116x; 1664 struct isp116x *isp116x;
1667 struct platform_device *pdev;
1668 struct resource *addr, *data; 1665 struct resource *addr, *data;
1669 void __iomem *addr_reg; 1666 void __iomem *addr_reg;
1670 void __iomem *data_reg; 1667 void __iomem *data_reg;
1671 int irq; 1668 int irq;
1672 int ret = 0; 1669 int ret = 0;
1673 1670
1674 pdev = container_of(dev, struct platform_device, dev);
1675 if (pdev->num_resources < 3) { 1671 if (pdev->num_resources < 3) {
1676 ret = -ENODEV; 1672 ret = -ENODEV;
1677 goto err1; 1673 goto err1;
@@ -1685,7 +1681,7 @@ static int __init isp116x_probe(struct device *dev)
1685 goto err1; 1681 goto err1;
1686 } 1682 }
1687 1683
1688 if (dev->dma_mask) { 1684 if (pdev->dev.dma_mask) {
1689 DBG("DMA not supported\n"); 1685 DBG("DMA not supported\n");
1690 ret = -EINVAL; 1686 ret = -EINVAL;
1691 goto err1; 1687 goto err1;
@@ -1711,7 +1707,7 @@ static int __init isp116x_probe(struct device *dev)
1711 } 1707 }
1712 1708
1713 /* allocate and initialize hcd */ 1709 /* allocate and initialize hcd */
1714 hcd = usb_create_hcd(&isp116x_hc_driver, dev, dev->bus_id); 1710 hcd = usb_create_hcd(&isp116x_hc_driver, &pdev->dev, pdev->dev.bus_id);
1715 if (!hcd) { 1711 if (!hcd) {
1716 ret = -ENOMEM; 1712 ret = -ENOMEM;
1717 goto err5; 1713 goto err5;
@@ -1723,7 +1719,7 @@ static int __init isp116x_probe(struct device *dev)
1723 isp116x->addr_reg = addr_reg; 1719 isp116x->addr_reg = addr_reg;
1724 spin_lock_init(&isp116x->lock); 1720 spin_lock_init(&isp116x->lock);
1725 INIT_LIST_HEAD(&isp116x->async); 1721 INIT_LIST_HEAD(&isp116x->async);
1726 isp116x->board = dev->platform_data; 1722 isp116x->board = pdev->dev.platform_data;
1727 1723
1728 if (!isp116x->board) { 1724 if (!isp116x->board) {
1729 ERR("Platform data structure not initialized\n"); 1725 ERR("Platform data structure not initialized\n");
@@ -1764,13 +1760,13 @@ static int __init isp116x_probe(struct device *dev)
1764/* 1760/*
1765 Suspend of platform device 1761 Suspend of platform device
1766*/ 1762*/
1767static int isp116x_suspend(struct device *dev, pm_message_t state) 1763static int isp116x_suspend(struct platform_device *dev, pm_message_t state)
1768{ 1764{
1769 int ret = 0; 1765 int ret = 0;
1770 1766
1771 VDBG("%s: state %x\n", __func__, state); 1767 VDBG("%s: state %x\n", __func__, state);
1772 1768
1773 dev->power.power_state = state; 1769 dev->dev.power.power_state = state;
1774 1770
1775 return ret; 1771 return ret;
1776} 1772}
@@ -1778,13 +1774,13 @@ static int isp116x_suspend(struct device *dev, pm_message_t state)
1778/* 1774/*
1779 Resume platform device 1775 Resume platform device
1780*/ 1776*/
1781static int isp116x_resume(struct device *dev) 1777static int isp116x_resume(struct platform_device *dev)
1782{ 1778{
1783 int ret = 0; 1779 int ret = 0;
1784 1780
1785 VDBG("%s: state %x\n", __func__, dev->power.power_state); 1781 VDBG("%s: state %x\n", __func__, dev->dev.power.power_state);
1786 1782
1787 dev->power.power_state = PMSG_ON; 1783 dev->dev.power.power_state = PMSG_ON;
1788 1784
1789 return ret; 1785 return ret;
1790} 1786}
@@ -1796,13 +1792,14 @@ static int isp116x_resume(struct device *dev)
1796 1792
1797#endif 1793#endif
1798 1794
1799static struct device_driver isp116x_driver = { 1795static struct platform_driver isp116x_driver = {
1800 .name = (char *)hcd_name,
1801 .bus = &platform_bus_type,
1802 .probe = isp116x_probe, 1796 .probe = isp116x_probe,
1803 .remove = isp116x_remove, 1797 .remove = isp116x_remove,
1804 .suspend = isp116x_suspend, 1798 .suspend = isp116x_suspend,
1805 .resume = isp116x_resume, 1799 .resume = isp116x_resume,
1800 .driver = {
1801 .name = (char *)hcd_name,
1802 },
1806}; 1803};
1807 1804
1808/*-----------------------------------------------------------------*/ 1805/*-----------------------------------------------------------------*/
@@ -1813,14 +1810,14 @@ static int __init isp116x_init(void)
1813 return -ENODEV; 1810 return -ENODEV;
1814 1811
1815 INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); 1812 INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION);
1816 return driver_register(&isp116x_driver); 1813 return platform_driver_register(&isp116x_driver);
1817} 1814}
1818 1815
1819module_init(isp116x_init); 1816module_init(isp116x_init);
1820 1817
1821static void __exit isp116x_cleanup(void) 1818static void __exit isp116x_cleanup(void)
1822{ 1819{
1823 driver_unregister(&isp116x_driver); 1820 platform_driver_unregister(&isp116x_driver);
1824} 1821}
1825 1822
1826module_exit(isp116x_cleanup); 1823module_exit(isp116x_cleanup);
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index f0c78cf14b6c..d9cf3b327d96 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -225,9 +225,8 @@ static const struct hc_driver ohci_au1xxx_hc_driver = {
225 225
226/*-------------------------------------------------------------------------*/ 226/*-------------------------------------------------------------------------*/
227 227
228static int ohci_hcd_au1xxx_drv_probe(struct device *dev) 228static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev)
229{ 229{
230 struct platform_device *pdev = to_platform_device(dev);
231 int ret; 230 int ret;
232 231
233 pr_debug ("In ohci_hcd_au1xxx_drv_probe"); 232 pr_debug ("In ohci_hcd_au1xxx_drv_probe");
@@ -239,39 +238,37 @@ static int ohci_hcd_au1xxx_drv_probe(struct device *dev)
239 return ret; 238 return ret;
240} 239}
241 240
242static int ohci_hcd_au1xxx_drv_remove(struct device *dev) 241static int ohci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
243{ 242{
244 struct platform_device *pdev = to_platform_device(dev); 243 struct usb_hcd *hcd = platform_get_drvdata(pdev);
245 struct usb_hcd *hcd = dev_get_drvdata(dev);
246 244
247 usb_hcd_au1xxx_remove(hcd, pdev); 245 usb_hcd_au1xxx_remove(hcd, pdev);
248 return 0; 246 return 0;
249} 247}
250 /*TBD*/ 248 /*TBD*/
251/*static int ohci_hcd_au1xxx_drv_suspend(struct device *dev) 249/*static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *dev)
252{ 250{
253 struct platform_device *pdev = to_platform_device(dev); 251 struct usb_hcd *hcd = platform_get_drvdata(dev);
254 struct usb_hcd *hcd = dev_get_drvdata(dev);
255 252
256 return 0; 253 return 0;
257} 254}
258static int ohci_hcd_au1xxx_drv_resume(struct device *dev) 255static int ohci_hcd_au1xxx_drv_resume(struct platform_device *dev)
259{ 256{
260 struct platform_device *pdev = to_platform_device(dev); 257 struct usb_hcd *hcd = platform_get_drvdata(dev);
261 struct usb_hcd *hcd = dev_get_drvdata(dev);
262 258
263 return 0; 259 return 0;
264} 260}
265*/ 261*/
266 262
267static struct device_driver ohci_hcd_au1xxx_driver = { 263static struct platform_driver ohci_hcd_au1xxx_driver = {
268 .name = "au1xxx-ohci",
269 .owner = THIS_MODULE,
270 .bus = &platform_bus_type,
271 .probe = ohci_hcd_au1xxx_drv_probe, 264 .probe = ohci_hcd_au1xxx_drv_probe,
272 .remove = ohci_hcd_au1xxx_drv_remove, 265 .remove = ohci_hcd_au1xxx_drv_remove,
273 /*.suspend = ohci_hcd_au1xxx_drv_suspend, */ 266 /*.suspend = ohci_hcd_au1xxx_drv_suspend, */
274 /*.resume = ohci_hcd_au1xxx_drv_resume, */ 267 /*.resume = ohci_hcd_au1xxx_drv_resume, */
268 .driver = {
269 .name = "au1xxx-ohci",
270 .owner = THIS_MODULE,
271 },
275}; 272};
276 273
277static int __init ohci_hcd_au1xxx_init (void) 274static int __init ohci_hcd_au1xxx_init (void)
@@ -280,12 +277,12 @@ static int __init ohci_hcd_au1xxx_init (void)
280 pr_debug ("block sizes: ed %d td %d\n", 277 pr_debug ("block sizes: ed %d td %d\n",
281 sizeof (struct ed), sizeof (struct td)); 278 sizeof (struct ed), sizeof (struct td));
282 279
283 return driver_register(&ohci_hcd_au1xxx_driver); 280 return platform_driver_register(&ohci_hcd_au1xxx_driver);
284} 281}
285 282
286static void __exit ohci_hcd_au1xxx_cleanup (void) 283static void __exit ohci_hcd_au1xxx_cleanup (void)
287{ 284{
288 driver_unregister(&ohci_hcd_au1xxx_driver); 285 platform_driver_unregister(&ohci_hcd_au1xxx_driver);
289} 286}
290 287
291module_init (ohci_hcd_au1xxx_init); 288module_init (ohci_hcd_au1xxx_init);
diff --git a/drivers/usb/host/ohci-lh7a404.c b/drivers/usb/host/ohci-lh7a404.c
index 336c766c6e29..081ec3f5cff4 100644
--- a/drivers/usb/host/ohci-lh7a404.c
+++ b/drivers/usb/host/ohci-lh7a404.c
@@ -204,9 +204,8 @@ static const struct hc_driver ohci_lh7a404_hc_driver = {
204 204
205/*-------------------------------------------------------------------------*/ 205/*-------------------------------------------------------------------------*/
206 206
207static int ohci_hcd_lh7a404_drv_probe(struct device *dev) 207static int ohci_hcd_lh7a404_drv_probe(struct platform_device *pdev)
208{ 208{
209 struct platform_device *pdev = to_platform_device(dev);
210 int ret; 209 int ret;
211 210
212 pr_debug ("In ohci_hcd_lh7a404_drv_probe"); 211 pr_debug ("In ohci_hcd_lh7a404_drv_probe");
@@ -218,40 +217,38 @@ static int ohci_hcd_lh7a404_drv_probe(struct device *dev)
218 return ret; 217 return ret;
219} 218}
220 219
221static int ohci_hcd_lh7a404_drv_remove(struct device *dev) 220static int ohci_hcd_lh7a404_drv_remove(struct platform_device *pdev)
222{ 221{
223 struct platform_device *pdev = to_platform_device(dev); 222 struct usb_hcd *hcd = platform_get_drvdata(dev);
224 struct usb_hcd *hcd = dev_get_drvdata(dev);
225 223
226 usb_hcd_lh7a404_remove(hcd, pdev); 224 usb_hcd_lh7a404_remove(hcd, pdev);
227 return 0; 225 return 0;
228} 226}
229 /*TBD*/ 227 /*TBD*/
230/*static int ohci_hcd_lh7a404_drv_suspend(struct device *dev) 228/*static int ohci_hcd_lh7a404_drv_suspend(struct platform_device *dev)
231{ 229{
232 struct platform_device *pdev = to_platform_device(dev); 230 struct usb_hcd *hcd = platform_get_drvdata(dev);
233 struct usb_hcd *hcd = dev_get_drvdata(dev);
234 231
235 return 0; 232 return 0;
236} 233}
237static int ohci_hcd_lh7a404_drv_resume(struct device *dev) 234static int ohci_hcd_lh7a404_drv_resume(struct platform_device *dev)
238{ 235{
239 struct platform_device *pdev = to_platform_device(dev); 236 struct usb_hcd *hcd = platform_get_drvdata(dev);
240 struct usb_hcd *hcd = dev_get_drvdata(dev);
241 237
242 238
243 return 0; 239 return 0;
244} 240}
245*/ 241*/
246 242
247static struct device_driver ohci_hcd_lh7a404_driver = { 243static struct platform_driver ohci_hcd_lh7a404_driver = {
248 .name = "lh7a404-ohci",
249 .owner = THIS_MODULE,
250 .bus = &platform_bus_type,
251 .probe = ohci_hcd_lh7a404_drv_probe, 244 .probe = ohci_hcd_lh7a404_drv_probe,
252 .remove = ohci_hcd_lh7a404_drv_remove, 245 .remove = ohci_hcd_lh7a404_drv_remove,
253 /*.suspend = ohci_hcd_lh7a404_drv_suspend, */ 246 /*.suspend = ohci_hcd_lh7a404_drv_suspend, */
254 /*.resume = ohci_hcd_lh7a404_drv_resume, */ 247 /*.resume = ohci_hcd_lh7a404_drv_resume, */
248 .driver = {
249 .name = "lh7a404-ohci",
250 .owner = THIS_MODULE,
251 },
255}; 252};
256 253
257static int __init ohci_hcd_lh7a404_init (void) 254static int __init ohci_hcd_lh7a404_init (void)
@@ -260,12 +257,12 @@ static int __init ohci_hcd_lh7a404_init (void)
260 pr_debug ("block sizes: ed %d td %d\n", 257 pr_debug ("block sizes: ed %d td %d\n",
261 sizeof (struct ed), sizeof (struct td)); 258 sizeof (struct ed), sizeof (struct td));
262 259
263 return driver_register(&ohci_hcd_lh7a404_driver); 260 return platform_driver_register(&ohci_hcd_lh7a404_driver);
264} 261}
265 262
266static void __exit ohci_hcd_lh7a404_cleanup (void) 263static void __exit ohci_hcd_lh7a404_cleanup (void)
267{ 264{
268 driver_unregister(&ohci_hcd_lh7a404_driver); 265 platform_driver_unregister(&ohci_hcd_lh7a404_driver);
269} 266}
270 267
271module_init (ohci_hcd_lh7a404_init); 268module_init (ohci_hcd_lh7a404_init);
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index e46cc540cf4d..c9e29d808711 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -433,24 +433,22 @@ static const struct hc_driver ohci_omap_hc_driver = {
433 433
434/*-------------------------------------------------------------------------*/ 434/*-------------------------------------------------------------------------*/
435 435
436static int ohci_hcd_omap_drv_probe(struct device *dev) 436static int ohci_hcd_omap_drv_probe(struct platform_device *dev)
437{ 437{
438 return usb_hcd_omap_probe(&ohci_omap_hc_driver, 438 return usb_hcd_omap_probe(&ohci_omap_hc_driver, dev);
439 to_platform_device(dev));
440} 439}
441 440
442static int ohci_hcd_omap_drv_remove(struct device *dev) 441static int ohci_hcd_omap_drv_remove(struct platform_device *dev)
443{ 442{
444 struct platform_device *pdev = to_platform_device(dev); 443 struct usb_hcd *hcd = platform_get_drvdata(dev);
445 struct usb_hcd *hcd = dev_get_drvdata(dev);
446 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 444 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
447 445
448 usb_hcd_omap_remove(hcd, pdev); 446 usb_hcd_omap_remove(hcd, dev);
449 if (ohci->transceiver) { 447 if (ohci->transceiver) {
450 (void) otg_set_host(ohci->transceiver, 0); 448 (void) otg_set_host(ohci->transceiver, 0);
451 put_device(ohci->transceiver->dev); 449 put_device(ohci->transceiver->dev);
452 } 450 }
453 dev_set_drvdata(dev, NULL); 451 platform_set_drvdata(dev, NULL);
454 452
455 return 0; 453 return 0;
456} 454}
@@ -459,9 +457,9 @@ static int ohci_hcd_omap_drv_remove(struct device *dev)
459 457
460#ifdef CONFIG_PM 458#ifdef CONFIG_PM
461 459
462static int ohci_omap_suspend(struct device *dev, pm_message_t message) 460static int ohci_omap_suspend(struct platform_device *dev, pm_message_t message)
463{ 461{
464 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); 462 struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev));
465 463
466 if (time_before(jiffies, ohci->next_statechange)) 464 if (time_before(jiffies, ohci->next_statechange))
467 msleep(5); 465 msleep(5);
@@ -473,9 +471,9 @@ static int ohci_omap_suspend(struct device *dev, pm_message_t message)
473 return 0; 471 return 0;
474} 472}
475 473
476static int ohci_omap_resume(struct device *dev) 474static int ohci_omap_resume(struct platform_device *dev)
477{ 475{
478 struct ohci_hcd *ohci = hcd_to_ohci(dev_get_drvdata(dev)); 476 struct ohci_hcd *ohci = hcd_to_ohci(platform_get_drvdata(dev));
479 477
480 if (time_before(jiffies, ohci->next_statechange)) 478 if (time_before(jiffies, ohci->next_statechange))
481 msleep(5); 479 msleep(5);
@@ -494,16 +492,17 @@ static int ohci_omap_resume(struct device *dev)
494/* 492/*
495 * Driver definition to register with the OMAP bus 493 * Driver definition to register with the OMAP bus
496 */ 494 */
497static struct device_driver ohci_hcd_omap_driver = { 495static struct platform_driver ohci_hcd_omap_driver = {
498 .name = "ohci",
499 .owner = THIS_MODULE,
500 .bus = &platform_bus_type,
501 .probe = ohci_hcd_omap_drv_probe, 496 .probe = ohci_hcd_omap_drv_probe,
502 .remove = ohci_hcd_omap_drv_remove, 497 .remove = ohci_hcd_omap_drv_remove,
503#ifdef CONFIG_PM 498#ifdef CONFIG_PM
504 .suspend = ohci_omap_suspend, 499 .suspend = ohci_omap_suspend,
505 .resume = ohci_omap_resume, 500 .resume = ohci_omap_resume,
506#endif 501#endif
502 .driver = {
503 .owner = THIS_MODULE,
504 .name = "ohci",
505 },
507}; 506};
508 507
509static int __init ohci_hcd_omap_init (void) 508static int __init ohci_hcd_omap_init (void)
@@ -515,12 +514,12 @@ static int __init ohci_hcd_omap_init (void)
515 pr_debug("%s: block sizes: ed %Zd td %Zd\n", hcd_name, 514 pr_debug("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
516 sizeof (struct ed), sizeof (struct td)); 515 sizeof (struct ed), sizeof (struct td));
517 516
518 return driver_register(&ohci_hcd_omap_driver); 517 return platform_driver_register(&ohci_hcd_omap_driver);
519} 518}
520 519
521static void __exit ohci_hcd_omap_cleanup (void) 520static void __exit ohci_hcd_omap_cleanup (void)
522{ 521{
523 driver_unregister(&ohci_hcd_omap_driver); 522 platform_driver_unregister(&ohci_hcd_omap_driver);
524} 523}
525 524
526module_init (ohci_hcd_omap_init); 525module_init (ohci_hcd_omap_init);
diff --git a/drivers/usb/host/ohci-ppc-soc.c b/drivers/usb/host/ohci-ppc-soc.c
index 92cf6f4a1374..18755766e406 100644
--- a/drivers/usb/host/ohci-ppc-soc.c
+++ b/drivers/usb/host/ohci-ppc-soc.c
@@ -172,9 +172,8 @@ static const struct hc_driver ohci_ppc_soc_hc_driver = {
172 .start_port_reset = ohci_start_port_reset, 172 .start_port_reset = ohci_start_port_reset,
173}; 173};
174 174
175static int ohci_hcd_ppc_soc_drv_probe(struct device *dev) 175static int ohci_hcd_ppc_soc_drv_probe(struct platform_device *pdev)
176{ 176{
177 struct platform_device *pdev = to_platform_device(dev);
178 int ret; 177 int ret;
179 178
180 if (usb_disabled()) 179 if (usb_disabled())
@@ -184,25 +183,25 @@ static int ohci_hcd_ppc_soc_drv_probe(struct device *dev)
184 return ret; 183 return ret;
185} 184}
186 185
187static int ohci_hcd_ppc_soc_drv_remove(struct device *dev) 186static int ohci_hcd_ppc_soc_drv_remove(struct platform_device *pdev)
188{ 187{
189 struct platform_device *pdev = to_platform_device(dev); 188 struct usb_hcd *hcd = platform_get_drvdata(dev);
190 struct usb_hcd *hcd = dev_get_drvdata(dev);
191 189
192 usb_hcd_ppc_soc_remove(hcd, pdev); 190 usb_hcd_ppc_soc_remove(hcd, pdev);
193 return 0; 191 return 0;
194} 192}
195 193
196static struct device_driver ohci_hcd_ppc_soc_driver = { 194static struct platform_driver ohci_hcd_ppc_soc_driver = {
197 .name = "ppc-soc-ohci",
198 .owner = THIS_MODULE,
199 .bus = &platform_bus_type,
200 .probe = ohci_hcd_ppc_soc_drv_probe, 195 .probe = ohci_hcd_ppc_soc_drv_probe,
201 .remove = ohci_hcd_ppc_soc_drv_remove, 196 .remove = ohci_hcd_ppc_soc_drv_remove,
202#ifdef CONFIG_PM 197#ifdef CONFIG_PM
203 /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/ 198 /*.suspend = ohci_hcd_ppc_soc_drv_suspend,*/
204 /*.resume = ohci_hcd_ppc_soc_drv_resume,*/ 199 /*.resume = ohci_hcd_ppc_soc_drv_resume,*/
205#endif 200#endif
201 .driver = {
202 .name = "ppc-soc-ohci",
203 .owner = THIS_MODULE,
204 },
206}; 205};
207 206
208static int __init ohci_hcd_ppc_soc_init(void) 207static int __init ohci_hcd_ppc_soc_init(void)
@@ -211,12 +210,12 @@ static int __init ohci_hcd_ppc_soc_init(void)
211 pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed), 210 pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed),
212 sizeof(struct td)); 211 sizeof(struct td));
213 212
214 return driver_register(&ohci_hcd_ppc_soc_driver); 213 return platform_driver_register(&ohci_hcd_ppc_soc_driver);
215} 214}
216 215
217static void __exit ohci_hcd_ppc_soc_cleanup(void) 216static void __exit ohci_hcd_ppc_soc_cleanup(void)
218{ 217{
219 driver_unregister(&ohci_hcd_ppc_soc_driver); 218 platform_driver_unregister(&ohci_hcd_ppc_soc_driver);
220} 219}
221 220
222module_init(ohci_hcd_ppc_soc_init); 221module_init(ohci_hcd_ppc_soc_init);
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 59e20568e8f9..9d65ec307990 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -290,9 +290,8 @@ static const struct hc_driver ohci_pxa27x_hc_driver = {
290 290
291/*-------------------------------------------------------------------------*/ 291/*-------------------------------------------------------------------------*/
292 292
293static int ohci_hcd_pxa27x_drv_probe(struct device *dev) 293static int ohci_hcd_pxa27x_drv_probe(struct platform_device *pdev)
294{ 294{
295 struct platform_device *pdev = to_platform_device(dev);
296 int ret; 295 int ret;
297 296
298 pr_debug ("In ohci_hcd_pxa27x_drv_probe"); 297 pr_debug ("In ohci_hcd_pxa27x_drv_probe");
@@ -304,41 +303,39 @@ static int ohci_hcd_pxa27x_drv_probe(struct device *dev)
304 return ret; 303 return ret;
305} 304}
306 305
307static int ohci_hcd_pxa27x_drv_remove(struct device *dev) 306static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev)
308{ 307{
309 struct platform_device *pdev = to_platform_device(dev); 308 struct usb_hcd *hcd = platform_get_drvdata(pdev);
310 struct usb_hcd *hcd = dev_get_drvdata(dev);
311 309
312 usb_hcd_pxa27x_remove(hcd, pdev); 310 usb_hcd_pxa27x_remove(hcd, pdev);
313 return 0; 311 return 0;
314} 312}
315 313
316static int ohci_hcd_pxa27x_drv_suspend(struct device *dev, pm_message_t state) 314static int ohci_hcd_pxa27x_drv_suspend(struct platform_device *dev, pm_message_t state)
317{ 315{
318// struct platform_device *pdev = to_platform_device(dev); 316// struct usb_hcd *hcd = platform_get_drvdata(dev);
319// struct usb_hcd *hcd = dev_get_drvdata(dev);
320 printk("%s: not implemented yet\n", __FUNCTION__); 317 printk("%s: not implemented yet\n", __FUNCTION__);
321 318
322 return 0; 319 return 0;
323} 320}
324 321
325static int ohci_hcd_pxa27x_drv_resume(struct device *dev) 322static int ohci_hcd_pxa27x_drv_resume(struct platform_device *dev)
326{ 323{
327// struct platform_device *pdev = to_platform_device(dev); 324// struct usb_hcd *hcd = platform_get_drvdata(dev);
328// struct usb_hcd *hcd = dev_get_drvdata(dev);
329 printk("%s: not implemented yet\n", __FUNCTION__); 325 printk("%s: not implemented yet\n", __FUNCTION__);
330 326
331 return 0; 327 return 0;
332} 328}
333 329
334 330
335static struct device_driver ohci_hcd_pxa27x_driver = { 331static struct platform_driver ohci_hcd_pxa27x_driver = {
336 .name = "pxa27x-ohci",
337 .bus = &platform_bus_type,
338 .probe = ohci_hcd_pxa27x_drv_probe, 332 .probe = ohci_hcd_pxa27x_drv_probe,
339 .remove = ohci_hcd_pxa27x_drv_remove, 333 .remove = ohci_hcd_pxa27x_drv_remove,
340 .suspend = ohci_hcd_pxa27x_drv_suspend, 334 .suspend = ohci_hcd_pxa27x_drv_suspend,
341 .resume = ohci_hcd_pxa27x_drv_resume, 335 .resume = ohci_hcd_pxa27x_drv_resume,
336 .driver = {
337 .name = "pxa27x-ohci",
338 },
342}; 339};
343 340
344static int __init ohci_hcd_pxa27x_init (void) 341static int __init ohci_hcd_pxa27x_init (void)
@@ -347,12 +344,12 @@ static int __init ohci_hcd_pxa27x_init (void)
347 pr_debug ("block sizes: ed %d td %d\n", 344 pr_debug ("block sizes: ed %d td %d\n",
348 sizeof (struct ed), sizeof (struct td)); 345 sizeof (struct ed), sizeof (struct td));
349 346
350 return driver_register(&ohci_hcd_pxa27x_driver); 347 return platform_driver_register(&ohci_hcd_pxa27x_driver);
351} 348}
352 349
353static void __exit ohci_hcd_pxa27x_cleanup (void) 350static void __exit ohci_hcd_pxa27x_cleanup (void)
354{ 351{
355 driver_unregister(&ohci_hcd_pxa27x_driver); 352 platform_driver_unregister(&ohci_hcd_pxa27x_driver);
356} 353}
357 354
358module_init (ohci_hcd_pxa27x_init); 355module_init (ohci_hcd_pxa27x_init);
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index ee1fc605b402..35cc9402adc0 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -459,39 +459,38 @@ static const struct hc_driver ohci_s3c2410_hc_driver = {
459 459
460/* device driver */ 460/* device driver */
461 461
462static int ohci_hcd_s3c2410_drv_probe(struct device *dev) 462static int ohci_hcd_s3c2410_drv_probe(struct platform_device *pdev)
463{ 463{
464 struct platform_device *pdev = to_platform_device(dev);
465 return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev); 464 return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev);
466} 465}
467 466
468static int ohci_hcd_s3c2410_drv_remove(struct device *dev) 467static int ohci_hcd_s3c2410_drv_remove(struct platform_device *pdev)
469{ 468{
470 struct platform_device *pdev = to_platform_device(dev); 469 struct usb_hcd *hcd = platform_get_drvdata(pdev);
471 struct usb_hcd *hcd = dev_get_drvdata(dev);
472 470
473 usb_hcd_s3c2410_remove(hcd, pdev); 471 usb_hcd_s3c2410_remove(hcd, pdev);
474 return 0; 472 return 0;
475} 473}
476 474
477static struct device_driver ohci_hcd_s3c2410_driver = { 475static struct platform_driver ohci_hcd_s3c2410_driver = {
478 .name = "s3c2410-ohci",
479 .owner = THIS_MODULE,
480 .bus = &platform_bus_type,
481 .probe = ohci_hcd_s3c2410_drv_probe, 476 .probe = ohci_hcd_s3c2410_drv_probe,
482 .remove = ohci_hcd_s3c2410_drv_remove, 477 .remove = ohci_hcd_s3c2410_drv_remove,
483 /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ 478 /*.suspend = ohci_hcd_s3c2410_drv_suspend, */
484 /*.resume = ohci_hcd_s3c2410_drv_resume, */ 479 /*.resume = ohci_hcd_s3c2410_drv_resume, */
480 .driver = {
481 .owner = THIS_MODULE,
482 .name = "s3c2410-ohci",
483 },
485}; 484};
486 485
487static int __init ohci_hcd_s3c2410_init (void) 486static int __init ohci_hcd_s3c2410_init (void)
488{ 487{
489 return driver_register(&ohci_hcd_s3c2410_driver); 488 return platform_driver_register(&ohci_hcd_s3c2410_driver);
490} 489}
491 490
492static void __exit ohci_hcd_s3c2410_cleanup (void) 491static void __exit ohci_hcd_s3c2410_cleanup (void)
493{ 492{
494 driver_unregister(&ohci_hcd_s3c2410_driver); 493 platform_driver_unregister(&ohci_hcd_s3c2410_driver);
495} 494}
496 495
497module_init (ohci_hcd_s3c2410_init); 496module_init (ohci_hcd_s3c2410_init);
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 5607c0ae6835..a7722a6a5a5b 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1631,24 +1631,21 @@ static struct hc_driver sl811h_hc_driver = {
1631/*-------------------------------------------------------------------------*/ 1631/*-------------------------------------------------------------------------*/
1632 1632
1633static int __devexit 1633static int __devexit
1634sl811h_remove(struct device *dev) 1634sl811h_remove(struct platform_device *dev)
1635{ 1635{
1636 struct usb_hcd *hcd = dev_get_drvdata(dev); 1636 struct usb_hcd *hcd = platform_get_drvdata(dev);
1637 struct sl811 *sl811 = hcd_to_sl811(hcd); 1637 struct sl811 *sl811 = hcd_to_sl811(hcd);
1638 struct platform_device *pdev;
1639 struct resource *res; 1638 struct resource *res;
1640 1639
1641 pdev = container_of(dev, struct platform_device, dev);
1642
1643 remove_debug_file(sl811); 1640 remove_debug_file(sl811);
1644 usb_remove_hcd(hcd); 1641 usb_remove_hcd(hcd);
1645 1642
1646 /* some platforms may use IORESOURCE_IO */ 1643 /* some platforms may use IORESOURCE_IO */
1647 res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 1644 res = platform_get_resource(dev, IORESOURCE_MEM, 1);
1648 if (res) 1645 if (res)
1649 iounmap(sl811->data_reg); 1646 iounmap(sl811->data_reg);
1650 1647
1651 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1648 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
1652 if (res) 1649 if (res)
1653 iounmap(sl811->addr_reg); 1650 iounmap(sl811->addr_reg);
1654 1651
@@ -1657,11 +1654,10 @@ sl811h_remove(struct device *dev)
1657} 1654}
1658 1655
1659static int __devinit 1656static int __devinit
1660sl811h_probe(struct device *dev) 1657sl811h_probe(struct platform_device *dev)
1661{ 1658{
1662 struct usb_hcd *hcd; 1659 struct usb_hcd *hcd;
1663 struct sl811 *sl811; 1660 struct sl811 *sl811;
1664 struct platform_device *pdev;
1665 struct resource *addr, *data; 1661 struct resource *addr, *data;
1666 int irq; 1662 int irq;
1667 void __iomem *addr_reg; 1663 void __iomem *addr_reg;
@@ -1674,24 +1670,23 @@ sl811h_probe(struct device *dev)
1674 * specific platform_data. we don't probe for IRQs, and do only 1670 * specific platform_data. we don't probe for IRQs, and do only
1675 * minimal sanity checking. 1671 * minimal sanity checking.
1676 */ 1672 */
1677 pdev = container_of(dev, struct platform_device, dev); 1673 irq = platform_get_irq(dev, 0);
1678 irq = platform_get_irq(pdev, 0); 1674 if (dev->num_resources < 3 || irq < 0)
1679 if (pdev->num_resources < 3 || irq < 0)
1680 return -ENODEV; 1675 return -ENODEV;
1681 1676
1682 /* refuse to confuse usbcore */ 1677 /* refuse to confuse usbcore */
1683 if (dev->dma_mask) { 1678 if (dev->dev.dma_mask) {
1684 DBG("no we won't dma\n"); 1679 DBG("no we won't dma\n");
1685 return -EINVAL; 1680 return -EINVAL;
1686 } 1681 }
1687 1682
1688 /* the chip may be wired for either kind of addressing */ 1683 /* the chip may be wired for either kind of addressing */
1689 addr = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1684 addr = platform_get_resource(dev, IORESOURCE_MEM, 0);
1690 data = platform_get_resource(pdev, IORESOURCE_MEM, 1); 1685 data = platform_get_resource(dev, IORESOURCE_MEM, 1);
1691 retval = -EBUSY; 1686 retval = -EBUSY;
1692 if (!addr || !data) { 1687 if (!addr || !data) {
1693 addr = platform_get_resource(pdev, IORESOURCE_IO, 0); 1688 addr = platform_get_resource(dev, IORESOURCE_IO, 0);
1694 data = platform_get_resource(pdev, IORESOURCE_IO, 1); 1689 data = platform_get_resource(dev, IORESOURCE_IO, 1);
1695 if (!addr || !data) 1690 if (!addr || !data)
1696 return -ENODEV; 1691 return -ENODEV;
1697 ioaddr = 1; 1692 ioaddr = 1;
@@ -1713,7 +1708,7 @@ sl811h_probe(struct device *dev)
1713 } 1708 }
1714 1709
1715 /* allocate and initialize hcd */ 1710 /* allocate and initialize hcd */
1716 hcd = usb_create_hcd(&sl811h_hc_driver, dev, dev->bus_id); 1711 hcd = usb_create_hcd(&sl811h_hc_driver, &dev->dev, dev->dev.bus_id);
1717 if (!hcd) { 1712 if (!hcd) {
1718 retval = -ENOMEM; 1713 retval = -ENOMEM;
1719 goto err5; 1714 goto err5;
@@ -1723,7 +1718,7 @@ sl811h_probe(struct device *dev)
1723 1718
1724 spin_lock_init(&sl811->lock); 1719 spin_lock_init(&sl811->lock);
1725 INIT_LIST_HEAD(&sl811->async); 1720 INIT_LIST_HEAD(&sl811->async);
1726 sl811->board = dev->platform_data; 1721 sl811->board = dev->dev.platform_data;
1727 init_timer(&sl811->timer); 1722 init_timer(&sl811->timer);
1728 sl811->timer.function = sl811h_timer; 1723 sl811->timer.function = sl811h_timer;
1729 sl811->timer.data = (unsigned long) sl811; 1724 sl811->timer.data = (unsigned long) sl811;
@@ -1785,9 +1780,9 @@ sl811h_probe(struct device *dev)
1785 */ 1780 */
1786 1781
1787static int 1782static int
1788sl811h_suspend(struct device *dev, pm_message_t state) 1783sl811h_suspend(struct platform_device *dev, pm_message_t state)
1789{ 1784{
1790 struct usb_hcd *hcd = dev_get_drvdata(dev); 1785 struct usb_hcd *hcd = platform_get_drvdata(dev);
1791 struct sl811 *sl811 = hcd_to_sl811(hcd); 1786 struct sl811 *sl811 = hcd_to_sl811(hcd);
1792 int retval = 0; 1787 int retval = 0;
1793 1788
@@ -1796,27 +1791,27 @@ sl811h_suspend(struct device *dev, pm_message_t state)
1796 else if (state.event == PM_EVENT_SUSPEND) 1791 else if (state.event == PM_EVENT_SUSPEND)
1797 port_power(sl811, 0); 1792 port_power(sl811, 0);
1798 if (retval == 0) 1793 if (retval == 0)
1799 dev->power.power_state = state; 1794 dev->dev.power.power_state = state;
1800 return retval; 1795 return retval;
1801} 1796}
1802 1797
1803static int 1798static int
1804sl811h_resume(struct device *dev) 1799sl811h_resume(struct platform_device *dev)
1805{ 1800{
1806 struct usb_hcd *hcd = dev_get_drvdata(dev); 1801 struct usb_hcd *hcd = platform_get_drvdata(dev);
1807 struct sl811 *sl811 = hcd_to_sl811(hcd); 1802 struct sl811 *sl811 = hcd_to_sl811(hcd);
1808 1803
1809 /* with no "check to see if VBUS is still powered" board hook, 1804 /* with no "check to see if VBUS is still powered" board hook,
1810 * let's assume it'd only be powered to enable remote wakeup. 1805 * let's assume it'd only be powered to enable remote wakeup.
1811 */ 1806 */
1812 if (dev->power.power_state.event == PM_EVENT_SUSPEND 1807 if (dev->dev.power.power_state.event == PM_EVENT_SUSPEND
1813 || !hcd->can_wakeup) { 1808 || !hcd->can_wakeup) {
1814 sl811->port1 = 0; 1809 sl811->port1 = 0;
1815 port_power(sl811, 1); 1810 port_power(sl811, 1);
1816 return 0; 1811 return 0;
1817 } 1812 }
1818 1813
1819 dev->power.power_state = PMSG_ON; 1814 dev->dev.power.power_state = PMSG_ON;
1820 return sl811h_bus_resume(hcd); 1815 return sl811h_bus_resume(hcd);
1821} 1816}
1822 1817
@@ -1829,16 +1824,16 @@ sl811h_resume(struct device *dev)
1829 1824
1830 1825
1831/* this driver is exported so sl811_cs can depend on it */ 1826/* this driver is exported so sl811_cs can depend on it */
1832struct device_driver sl811h_driver = { 1827struct platform_driver sl811h_driver = {
1833 .name = (char *) hcd_name,
1834 .bus = &platform_bus_type,
1835 .owner = THIS_MODULE,
1836
1837 .probe = sl811h_probe, 1828 .probe = sl811h_probe,
1838 .remove = __devexit_p(sl811h_remove), 1829 .remove = __devexit_p(sl811h_remove),
1839 1830
1840 .suspend = sl811h_suspend, 1831 .suspend = sl811h_suspend,
1841 .resume = sl811h_resume, 1832 .resume = sl811h_resume,
1833 .driver = {
1834 .name = (char *) hcd_name,
1835 .owner = THIS_MODULE,
1836 },
1842}; 1837};
1843EXPORT_SYMBOL(sl811h_driver); 1838EXPORT_SYMBOL(sl811h_driver);
1844 1839
@@ -1850,12 +1845,12 @@ static int __init sl811h_init(void)
1850 return -ENODEV; 1845 return -ENODEV;
1851 1846
1852 INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION); 1847 INFO("driver %s, %s\n", hcd_name, DRIVER_VERSION);
1853 return driver_register(&sl811h_driver); 1848 return platform_driver_register(&sl811h_driver);
1854} 1849}
1855module_init(sl811h_init); 1850module_init(sl811h_init);
1856 1851
1857static void __exit sl811h_cleanup(void) 1852static void __exit sl811h_cleanup(void)
1858{ 1853{
1859 driver_unregister(&sl811h_driver); 1854 platform_driver_unregister(&sl811h_driver);
1860} 1855}
1861module_exit(sl811h_cleanup); 1856module_exit(sl811h_cleanup);