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/net/mv643xx_eth.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/net/mv643xx_eth.c')
-rw-r--r-- | drivers/net/mv643xx_eth.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 71f2c6705bc3..3cb9b3fe0cf1 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -1387,9 +1387,8 @@ static void mv643xx_netpoll(struct net_device *netdev) | |||
1387 | * Input : struct device * | 1387 | * Input : struct device * |
1388 | * Output : -ENOMEM if failed , 0 if success | 1388 | * Output : -ENOMEM if failed , 0 if success |
1389 | */ | 1389 | */ |
1390 | static int mv643xx_eth_probe(struct device *ddev) | 1390 | static int mv643xx_eth_probe(struct platform_device *pdev) |
1391 | { | 1391 | { |
1392 | struct platform_device *pdev = to_platform_device(ddev); | ||
1393 | struct mv643xx_eth_platform_data *pd; | 1392 | struct mv643xx_eth_platform_data *pd; |
1394 | int port_num = pdev->id; | 1393 | int port_num = pdev->id; |
1395 | struct mv643xx_private *mp; | 1394 | struct mv643xx_private *mp; |
@@ -1402,7 +1401,7 @@ static int mv643xx_eth_probe(struct device *ddev) | |||
1402 | if (!dev) | 1401 | if (!dev) |
1403 | return -ENOMEM; | 1402 | return -ENOMEM; |
1404 | 1403 | ||
1405 | dev_set_drvdata(ddev, dev); | 1404 | platform_set_drvdata(pdev, dev); |
1406 | 1405 | ||
1407 | mp = netdev_priv(dev); | 1406 | mp = netdev_priv(dev); |
1408 | 1407 | ||
@@ -1546,21 +1545,20 @@ out: | |||
1546 | return err; | 1545 | return err; |
1547 | } | 1546 | } |
1548 | 1547 | ||
1549 | static int mv643xx_eth_remove(struct device *ddev) | 1548 | static int mv643xx_eth_remove(struct platform_device *pdev) |
1550 | { | 1549 | { |
1551 | struct net_device *dev = dev_get_drvdata(ddev); | 1550 | struct net_device *dev = platform_get_drvdata(pdev); |
1552 | 1551 | ||
1553 | unregister_netdev(dev); | 1552 | unregister_netdev(dev); |
1554 | flush_scheduled_work(); | 1553 | flush_scheduled_work(); |
1555 | 1554 | ||
1556 | free_netdev(dev); | 1555 | free_netdev(dev); |
1557 | dev_set_drvdata(ddev, NULL); | 1556 | platform_set_drvdata(pdev, NULL); |
1558 | return 0; | 1557 | return 0; |
1559 | } | 1558 | } |
1560 | 1559 | ||
1561 | static int mv643xx_eth_shared_probe(struct device *ddev) | 1560 | static int mv643xx_eth_shared_probe(struct platform_device *pdev) |
1562 | { | 1561 | { |
1563 | struct platform_device *pdev = to_platform_device(ddev); | ||
1564 | struct resource *res; | 1562 | struct resource *res; |
1565 | 1563 | ||
1566 | printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); | 1564 | printk(KERN_NOTICE "MV-643xx 10/100/1000 Ethernet Driver\n"); |
@@ -1578,7 +1576,7 @@ static int mv643xx_eth_shared_probe(struct device *ddev) | |||
1578 | 1576 | ||
1579 | } | 1577 | } |
1580 | 1578 | ||
1581 | static int mv643xx_eth_shared_remove(struct device *ddev) | 1579 | static int mv643xx_eth_shared_remove(struct platform_device *pdev) |
1582 | { | 1580 | { |
1583 | iounmap(mv643xx_eth_shared_base); | 1581 | iounmap(mv643xx_eth_shared_base); |
1584 | mv643xx_eth_shared_base = NULL; | 1582 | mv643xx_eth_shared_base = NULL; |
@@ -1586,18 +1584,20 @@ static int mv643xx_eth_shared_remove(struct device *ddev) | |||
1586 | return 0; | 1584 | return 0; |
1587 | } | 1585 | } |
1588 | 1586 | ||
1589 | static struct device_driver mv643xx_eth_driver = { | 1587 | static struct platform_driver mv643xx_eth_driver = { |
1590 | .name = MV643XX_ETH_NAME, | ||
1591 | .bus = &platform_bus_type, | ||
1592 | .probe = mv643xx_eth_probe, | 1588 | .probe = mv643xx_eth_probe, |
1593 | .remove = mv643xx_eth_remove, | 1589 | .remove = mv643xx_eth_remove, |
1590 | .driver = { | ||
1591 | .name = MV643XX_ETH_NAME, | ||
1592 | }, | ||
1594 | }; | 1593 | }; |
1595 | 1594 | ||
1596 | static struct device_driver mv643xx_eth_shared_driver = { | 1595 | static struct platform_driver mv643xx_eth_shared_driver = { |
1597 | .name = MV643XX_ETH_SHARED_NAME, | ||
1598 | .bus = &platform_bus_type, | ||
1599 | .probe = mv643xx_eth_shared_probe, | 1596 | .probe = mv643xx_eth_shared_probe, |
1600 | .remove = mv643xx_eth_shared_remove, | 1597 | .remove = mv643xx_eth_shared_remove, |
1598 | .driver = { | ||
1599 | .name = MV643XX_ETH_SHARED_NAME, | ||
1600 | }, | ||
1601 | }; | 1601 | }; |
1602 | 1602 | ||
1603 | /* | 1603 | /* |
@@ -1613,11 +1613,11 @@ static int __init mv643xx_init_module(void) | |||
1613 | { | 1613 | { |
1614 | int rc; | 1614 | int rc; |
1615 | 1615 | ||
1616 | rc = driver_register(&mv643xx_eth_shared_driver); | 1616 | rc = platform_driver_register(&mv643xx_eth_shared_driver); |
1617 | if (!rc) { | 1617 | if (!rc) { |
1618 | rc = driver_register(&mv643xx_eth_driver); | 1618 | rc = platform_driver_register(&mv643xx_eth_driver); |
1619 | if (rc) | 1619 | if (rc) |
1620 | driver_unregister(&mv643xx_eth_shared_driver); | 1620 | platform_driver_unregister(&mv643xx_eth_shared_driver); |
1621 | } | 1621 | } |
1622 | return rc; | 1622 | return rc; |
1623 | } | 1623 | } |
@@ -1633,8 +1633,8 @@ static int __init mv643xx_init_module(void) | |||
1633 | */ | 1633 | */ |
1634 | static void __exit mv643xx_cleanup_module(void) | 1634 | static void __exit mv643xx_cleanup_module(void) |
1635 | { | 1635 | { |
1636 | driver_unregister(&mv643xx_eth_driver); | 1636 | platform_driver_unregister(&mv643xx_eth_driver); |
1637 | driver_unregister(&mv643xx_eth_shared_driver); | 1637 | platform_driver_unregister(&mv643xx_eth_shared_driver); |
1638 | } | 1638 | } |
1639 | 1639 | ||
1640 | module_init(mv643xx_init_module); | 1640 | module_init(mv643xx_init_module); |