diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/usb/host/isp116x-hcd.c | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (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/isp116x-hcd.c')
-rw-r--r-- | drivers/usb/host/isp116x-hcd.c | 37 |
1 files changed, 17 insertions, 20 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 | ||
1636 | static int __init_or_module isp116x_remove(struct device *dev) | 1636 | static 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 | ||
1663 | static int __init isp116x_probe(struct device *dev) | 1661 | static 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 | */ |
1767 | static int isp116x_suspend(struct device *dev, pm_message_t state) | 1763 | static 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 | */ |
1781 | static int isp116x_resume(struct device *dev) | 1777 | static 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 | ||
1799 | static struct device_driver isp116x_driver = { | 1795 | static 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 | ||
1819 | module_init(isp116x_init); | 1816 | module_init(isp116x_init); |
1820 | 1817 | ||
1821 | static void __exit isp116x_cleanup(void) | 1818 | static void __exit isp116x_cleanup(void) |
1822 | { | 1819 | { |
1823 | driver_unregister(&isp116x_driver); | 1820 | platform_driver_unregister(&isp116x_driver); |
1824 | } | 1821 | } |
1825 | 1822 | ||
1826 | module_exit(isp116x_cleanup); | 1823 | module_exit(isp116x_cleanup); |