diff options
Diffstat (limited to 'drivers/usb/host/sl811-hcd.c')
-rw-r--r-- | drivers/usb/host/sl811-hcd.c | 61 |
1 files changed, 28 insertions, 33 deletions
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 | ||
1633 | static int __devexit | 1633 | static int __devexit |
1634 | sl811h_remove(struct device *dev) | 1634 | sl811h_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 | ||
1659 | static int __devinit | 1656 | static int __devinit |
1660 | sl811h_probe(struct device *dev) | 1657 | sl811h_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 | ||
1787 | static int | 1782 | static int |
1788 | sl811h_suspend(struct device *dev, pm_message_t state) | 1783 | sl811h_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 | ||
1803 | static int | 1798 | static int |
1804 | sl811h_resume(struct device *dev) | 1799 | sl811h_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 */ |
1832 | struct device_driver sl811h_driver = { | 1827 | struct 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 | }; |
1843 | EXPORT_SYMBOL(sl811h_driver); | 1838 | EXPORT_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 | } |
1855 | module_init(sl811h_init); | 1850 | module_init(sl811h_init); |
1856 | 1851 | ||
1857 | static void __exit sl811h_cleanup(void) | 1852 | static void __exit sl811h_cleanup(void) |
1858 | { | 1853 | { |
1859 | driver_unregister(&sl811h_driver); | 1854 | platform_driver_unregister(&sl811h_driver); |
1860 | } | 1855 | } |
1861 | module_exit(sl811h_cleanup); | 1856 | module_exit(sl811h_cleanup); |