aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
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/host
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/host')
-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
8 files changed, 124 insertions, 144 deletions
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);