diff options
| author | Jingoo Han <jg1.han@samsung.com> | 2013-05-22 20:52:31 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-05-26 00:27:58 -0400 |
| commit | 8513fbd880093f00a47e85a552f14ca2de8d84d6 (patch) | |
| tree | 6f061e2e9b87983cd91688bff5238c730db79137 | |
| parent | 6d0bfe22611602f36617bc7aa2ffa1bbb2f54c67 (diff) | |
net: ethernet: use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using
platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev,
so we can directly pass a struct platform_device.
Also, unnecessary dev_set_drvdata() is removed, because the driver core
clears the driver data to NULL after device_release or on probe failure.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
23 files changed, 66 insertions, 95 deletions
diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c index 269295403fc4..7ff4b30d55ea 100644 --- a/drivers/net/ethernet/aeroflex/greth.c +++ b/drivers/net/ethernet/aeroflex/greth.c | |||
| @@ -1565,7 +1565,7 @@ error1: | |||
| 1565 | 1565 | ||
| 1566 | static int greth_of_remove(struct platform_device *of_dev) | 1566 | static int greth_of_remove(struct platform_device *of_dev) |
| 1567 | { | 1567 | { |
| 1568 | struct net_device *ndev = dev_get_drvdata(&of_dev->dev); | 1568 | struct net_device *ndev = platform_get_drvdata(of_dev); |
| 1569 | struct greth_private *greth = netdev_priv(ndev); | 1569 | struct greth_private *greth = netdev_priv(ndev); |
| 1570 | 1570 | ||
| 1571 | /* Free descriptor areas */ | 1571 | /* Free descriptor areas */ |
| @@ -1573,8 +1573,6 @@ static int greth_of_remove(struct platform_device *of_dev) | |||
| 1573 | 1573 | ||
| 1574 | dma_free_coherent(&of_dev->dev, 1024, greth->tx_bd_base, greth->tx_bd_base_phys); | 1574 | dma_free_coherent(&of_dev->dev, 1024, greth->tx_bd_base, greth->tx_bd_base_phys); |
| 1575 | 1575 | ||
| 1576 | dev_set_drvdata(&of_dev->dev, NULL); | ||
| 1577 | |||
| 1578 | if (greth->phy) | 1576 | if (greth->phy) |
| 1579 | phy_stop(greth->phy); | 1577 | phy_stop(greth->phy); |
| 1580 | mdiobus_unregister(greth->mdio); | 1578 | mdiobus_unregister(greth->mdio); |
diff --git a/drivers/net/ethernet/amd/sunlance.c b/drivers/net/ethernet/amd/sunlance.c index f47b780892e9..ece56831a647 100644 --- a/drivers/net/ethernet/amd/sunlance.c +++ b/drivers/net/ethernet/amd/sunlance.c | |||
| @@ -1470,7 +1470,7 @@ no_link_test: | |||
| 1470 | goto fail; | 1470 | goto fail; |
| 1471 | } | 1471 | } |
| 1472 | 1472 | ||
| 1473 | dev_set_drvdata(&op->dev, lp); | 1473 | platform_set_drvdata(op, lp); |
| 1474 | 1474 | ||
| 1475 | printk(KERN_INFO "%s: LANCE %pM\n", | 1475 | printk(KERN_INFO "%s: LANCE %pM\n", |
| 1476 | dev->name, dev->dev_addr); | 1476 | dev->name, dev->dev_addr); |
| @@ -1501,7 +1501,7 @@ static int sunlance_sbus_probe(struct platform_device *op) | |||
| 1501 | 1501 | ||
| 1502 | static int sunlance_sbus_remove(struct platform_device *op) | 1502 | static int sunlance_sbus_remove(struct platform_device *op) |
| 1503 | { | 1503 | { |
| 1504 | struct lance_private *lp = dev_get_drvdata(&op->dev); | 1504 | struct lance_private *lp = platform_get_drvdata(op); |
| 1505 | struct net_device *net_dev = lp->dev; | 1505 | struct net_device *net_dev = lp->dev; |
| 1506 | 1506 | ||
| 1507 | unregister_netdev(net_dev); | 1507 | unregister_netdev(net_dev); |
| @@ -1510,8 +1510,6 @@ static int sunlance_sbus_remove(struct platform_device *op) | |||
| 1510 | 1510 | ||
| 1511 | free_netdev(net_dev); | 1511 | free_netdev(net_dev); |
| 1512 | 1512 | ||
| 1513 | dev_set_drvdata(&op->dev, NULL); | ||
| 1514 | |||
| 1515 | return 0; | 1513 | return 0; |
| 1516 | } | 1514 | } |
| 1517 | 1515 | ||
diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c index e80bfb60c3ef..c2777712da99 100644 --- a/drivers/net/ethernet/broadcom/sb1250-mac.c +++ b/drivers/net/ethernet/broadcom/sb1250-mac.c | |||
| @@ -2197,7 +2197,7 @@ static const struct net_device_ops sbmac_netdev_ops = { | |||
| 2197 | 2197 | ||
| 2198 | static int sbmac_init(struct platform_device *pldev, long long base) | 2198 | static int sbmac_init(struct platform_device *pldev, long long base) |
| 2199 | { | 2199 | { |
| 2200 | struct net_device *dev = dev_get_drvdata(&pldev->dev); | 2200 | struct net_device *dev = platform_get_drvdata(pldev); |
| 2201 | int idx = pldev->id; | 2201 | int idx = pldev->id; |
| 2202 | struct sbmac_softc *sc = netdev_priv(dev); | 2202 | struct sbmac_softc *sc = netdev_priv(dev); |
| 2203 | unsigned char *eaddr; | 2203 | unsigned char *eaddr; |
| @@ -2275,7 +2275,7 @@ static int sbmac_init(struct platform_device *pldev, long long base) | |||
| 2275 | dev->name); | 2275 | dev->name); |
| 2276 | goto free_mdio; | 2276 | goto free_mdio; |
| 2277 | } | 2277 | } |
| 2278 | dev_set_drvdata(&pldev->dev, sc->mii_bus); | 2278 | platform_set_drvdata(pldev, sc->mii_bus); |
| 2279 | 2279 | ||
| 2280 | err = register_netdev(dev); | 2280 | err = register_netdev(dev); |
| 2281 | if (err) { | 2281 | if (err) { |
| @@ -2300,7 +2300,6 @@ static int sbmac_init(struct platform_device *pldev, long long base) | |||
| 2300 | return 0; | 2300 | return 0; |
| 2301 | unreg_mdio: | 2301 | unreg_mdio: |
| 2302 | mdiobus_unregister(sc->mii_bus); | 2302 | mdiobus_unregister(sc->mii_bus); |
| 2303 | dev_set_drvdata(&pldev->dev, NULL); | ||
| 2304 | free_mdio: | 2303 | free_mdio: |
| 2305 | mdiobus_free(sc->mii_bus); | 2304 | mdiobus_free(sc->mii_bus); |
| 2306 | uninit_ctx: | 2305 | uninit_ctx: |
| @@ -2624,7 +2623,7 @@ static int sbmac_probe(struct platform_device *pldev) | |||
| 2624 | goto out_unmap; | 2623 | goto out_unmap; |
| 2625 | } | 2624 | } |
| 2626 | 2625 | ||
| 2627 | dev_set_drvdata(&pldev->dev, dev); | 2626 | platform_set_drvdata(pldev, dev); |
| 2628 | SET_NETDEV_DEV(dev, &pldev->dev); | 2627 | SET_NETDEV_DEV(dev, &pldev->dev); |
| 2629 | 2628 | ||
| 2630 | sc = netdev_priv(dev); | 2629 | sc = netdev_priv(dev); |
| @@ -2649,7 +2648,7 @@ out_out: | |||
| 2649 | 2648 | ||
| 2650 | static int __exit sbmac_remove(struct platform_device *pldev) | 2649 | static int __exit sbmac_remove(struct platform_device *pldev) |
| 2651 | { | 2650 | { |
| 2652 | struct net_device *dev = dev_get_drvdata(&pldev->dev); | 2651 | struct net_device *dev = platform_get_drvdata(pldev); |
| 2653 | struct sbmac_softc *sc = netdev_priv(dev); | 2652 | struct sbmac_softc *sc = netdev_priv(dev); |
| 2654 | 2653 | ||
| 2655 | unregister_netdev(dev); | 2654 | unregister_netdev(dev); |
diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c index 9bc15e2365bb..9947765e90c5 100644 --- a/drivers/net/ethernet/freescale/fec_mpc52xx.c +++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c | |||
| @@ -981,7 +981,7 @@ static int mpc52xx_fec_probe(struct platform_device *op) | |||
| 981 | goto err_node; | 981 | goto err_node; |
| 982 | 982 | ||
| 983 | /* We're done ! */ | 983 | /* We're done ! */ |
| 984 | dev_set_drvdata(&op->dev, ndev); | 984 | platform_set_drvdata(op, ndev); |
| 985 | netdev_info(ndev, "%s MAC %pM\n", | 985 | netdev_info(ndev, "%s MAC %pM\n", |
| 986 | op->dev.of_node->full_name, ndev->dev_addr); | 986 | op->dev.of_node->full_name, ndev->dev_addr); |
| 987 | 987 | ||
| @@ -1010,7 +1010,7 @@ mpc52xx_fec_remove(struct platform_device *op) | |||
| 1010 | struct net_device *ndev; | 1010 | struct net_device *ndev; |
| 1011 | struct mpc52xx_fec_priv *priv; | 1011 | struct mpc52xx_fec_priv *priv; |
| 1012 | 1012 | ||
| 1013 | ndev = dev_get_drvdata(&op->dev); | 1013 | ndev = platform_get_drvdata(op); |
| 1014 | priv = netdev_priv(ndev); | 1014 | priv = netdev_priv(ndev); |
| 1015 | 1015 | ||
| 1016 | unregister_netdev(ndev); | 1016 | unregister_netdev(ndev); |
| @@ -1030,14 +1030,13 @@ mpc52xx_fec_remove(struct platform_device *op) | |||
| 1030 | 1030 | ||
| 1031 | free_netdev(ndev); | 1031 | free_netdev(ndev); |
| 1032 | 1032 | ||
| 1033 | dev_set_drvdata(&op->dev, NULL); | ||
| 1034 | return 0; | 1033 | return 0; |
| 1035 | } | 1034 | } |
| 1036 | 1035 | ||
| 1037 | #ifdef CONFIG_PM | 1036 | #ifdef CONFIG_PM |
| 1038 | static int mpc52xx_fec_of_suspend(struct platform_device *op, pm_message_t state) | 1037 | static int mpc52xx_fec_of_suspend(struct platform_device *op, pm_message_t state) |
| 1039 | { | 1038 | { |
| 1040 | struct net_device *dev = dev_get_drvdata(&op->dev); | 1039 | struct net_device *dev = platform_get_drvdata(op); |
| 1041 | 1040 | ||
| 1042 | if (netif_running(dev)) | 1041 | if (netif_running(dev)) |
| 1043 | mpc52xx_fec_close(dev); | 1042 | mpc52xx_fec_close(dev); |
| @@ -1047,7 +1046,7 @@ static int mpc52xx_fec_of_suspend(struct platform_device *op, pm_message_t state | |||
| 1047 | 1046 | ||
| 1048 | static int mpc52xx_fec_of_resume(struct platform_device *op) | 1047 | static int mpc52xx_fec_of_resume(struct platform_device *op) |
| 1049 | { | 1048 | { |
| 1050 | struct net_device *dev = dev_get_drvdata(&op->dev); | 1049 | struct net_device *dev = platform_get_drvdata(op); |
| 1051 | 1050 | ||
| 1052 | mpc52xx_fec_hw_init(dev); | 1051 | mpc52xx_fec_hw_init(dev); |
| 1053 | mpc52xx_fec_reset_stats(dev); | 1052 | mpc52xx_fec_reset_stats(dev); |
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index edc120094c34..8de53a14a6f4 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | |||
| @@ -1048,7 +1048,7 @@ static int fs_enet_probe(struct platform_device *ofdev) | |||
| 1048 | } | 1048 | } |
| 1049 | 1049 | ||
| 1050 | SET_NETDEV_DEV(ndev, &ofdev->dev); | 1050 | SET_NETDEV_DEV(ndev, &ofdev->dev); |
| 1051 | dev_set_drvdata(&ofdev->dev, ndev); | 1051 | platform_set_drvdata(ofdev, ndev); |
| 1052 | 1052 | ||
| 1053 | fep = netdev_priv(ndev); | 1053 | fep = netdev_priv(ndev); |
| 1054 | fep->dev = &ofdev->dev; | 1054 | fep->dev = &ofdev->dev; |
| @@ -1106,7 +1106,6 @@ out_cleanup_data: | |||
| 1106 | fep->ops->cleanup_data(ndev); | 1106 | fep->ops->cleanup_data(ndev); |
| 1107 | out_free_dev: | 1107 | out_free_dev: |
| 1108 | free_netdev(ndev); | 1108 | free_netdev(ndev); |
| 1109 | dev_set_drvdata(&ofdev->dev, NULL); | ||
| 1110 | out_put: | 1109 | out_put: |
| 1111 | of_node_put(fpi->phy_node); | 1110 | of_node_put(fpi->phy_node); |
| 1112 | out_free_fpi: | 1111 | out_free_fpi: |
| @@ -1116,7 +1115,7 @@ out_free_fpi: | |||
| 1116 | 1115 | ||
| 1117 | static int fs_enet_remove(struct platform_device *ofdev) | 1116 | static int fs_enet_remove(struct platform_device *ofdev) |
| 1118 | { | 1117 | { |
| 1119 | struct net_device *ndev = dev_get_drvdata(&ofdev->dev); | 1118 | struct net_device *ndev = platform_get_drvdata(ofdev); |
| 1120 | struct fs_enet_private *fep = netdev_priv(ndev); | 1119 | struct fs_enet_private *fep = netdev_priv(ndev); |
| 1121 | 1120 | ||
| 1122 | unregister_netdev(ndev); | 1121 | unregister_netdev(ndev); |
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c index 2bafbd37c247..844ecfa84d17 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c +++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | |||
| @@ -179,7 +179,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) | |||
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | new_bus->parent = &ofdev->dev; | 181 | new_bus->parent = &ofdev->dev; |
| 182 | dev_set_drvdata(&ofdev->dev, new_bus); | 182 | platform_set_drvdata(ofdev, new_bus); |
| 183 | 183 | ||
| 184 | ret = of_mdiobus_register(new_bus, ofdev->dev.of_node); | 184 | ret = of_mdiobus_register(new_bus, ofdev->dev.of_node); |
| 185 | if (ret) | 185 | if (ret) |
| @@ -188,7 +188,6 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) | |||
| 188 | return 0; | 188 | return 0; |
| 189 | 189 | ||
| 190 | out_free_irqs: | 190 | out_free_irqs: |
| 191 | dev_set_drvdata(&ofdev->dev, NULL); | ||
| 192 | kfree(new_bus->irq); | 191 | kfree(new_bus->irq); |
| 193 | out_unmap_regs: | 192 | out_unmap_regs: |
| 194 | iounmap(bitbang->dir); | 193 | iounmap(bitbang->dir); |
| @@ -202,11 +201,10 @@ out: | |||
| 202 | 201 | ||
| 203 | static int fs_enet_mdio_remove(struct platform_device *ofdev) | 202 | static int fs_enet_mdio_remove(struct platform_device *ofdev) |
| 204 | { | 203 | { |
| 205 | struct mii_bus *bus = dev_get_drvdata(&ofdev->dev); | 204 | struct mii_bus *bus = platform_get_drvdata(ofdev); |
| 206 | struct bb_info *bitbang = bus->priv; | 205 | struct bb_info *bitbang = bus->priv; |
| 207 | 206 | ||
| 208 | mdiobus_unregister(bus); | 207 | mdiobus_unregister(bus); |
| 209 | dev_set_drvdata(&ofdev->dev, NULL); | ||
| 210 | kfree(bus->irq); | 208 | kfree(bus->irq); |
| 211 | free_mdio_bitbang(bus); | 209 | free_mdio_bitbang(bus); |
| 212 | iounmap(bitbang->dir); | 210 | iounmap(bitbang->dir); |
diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c index 18e8ef203736..2f1c46a12f05 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c | |||
| @@ -180,7 +180,7 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) | |||
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | new_bus->parent = &ofdev->dev; | 182 | new_bus->parent = &ofdev->dev; |
| 183 | dev_set_drvdata(&ofdev->dev, new_bus); | 183 | platform_set_drvdata(ofdev, new_bus); |
| 184 | 184 | ||
| 185 | ret = of_mdiobus_register(new_bus, ofdev->dev.of_node); | 185 | ret = of_mdiobus_register(new_bus, ofdev->dev.of_node); |
| 186 | if (ret) | 186 | if (ret) |
| @@ -189,7 +189,6 @@ static int fs_enet_mdio_probe(struct platform_device *ofdev) | |||
| 189 | return 0; | 189 | return 0; |
| 190 | 190 | ||
| 191 | out_free_irqs: | 191 | out_free_irqs: |
| 192 | dev_set_drvdata(&ofdev->dev, NULL); | ||
| 193 | kfree(new_bus->irq); | 192 | kfree(new_bus->irq); |
| 194 | out_unmap_regs: | 193 | out_unmap_regs: |
| 195 | iounmap(fec->fecp); | 194 | iounmap(fec->fecp); |
| @@ -204,11 +203,10 @@ out: | |||
| 204 | 203 | ||
| 205 | static int fs_enet_mdio_remove(struct platform_device *ofdev) | 204 | static int fs_enet_mdio_remove(struct platform_device *ofdev) |
| 206 | { | 205 | { |
| 207 | struct mii_bus *bus = dev_get_drvdata(&ofdev->dev); | 206 | struct mii_bus *bus = platform_get_drvdata(ofdev); |
| 208 | struct fec_info *fec = bus->priv; | 207 | struct fec_info *fec = bus->priv; |
| 209 | 208 | ||
| 210 | mdiobus_unregister(bus); | 209 | mdiobus_unregister(bus); |
| 211 | dev_set_drvdata(&ofdev->dev, NULL); | ||
| 212 | kfree(bus->irq); | 210 | kfree(bus->irq); |
| 213 | iounmap(fec->fecp); | 211 | iounmap(fec->fecp); |
| 214 | kfree(fec); | 212 | kfree(fec); |
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c index 2375a01715a0..14f06947e70d 100644 --- a/drivers/net/ethernet/freescale/gianfar.c +++ b/drivers/net/ethernet/freescale/gianfar.c | |||
| @@ -1000,7 +1000,7 @@ static int gfar_probe(struct platform_device *ofdev) | |||
| 1000 | spin_lock_init(&priv->bflock); | 1000 | spin_lock_init(&priv->bflock); |
| 1001 | INIT_WORK(&priv->reset_task, gfar_reset_task); | 1001 | INIT_WORK(&priv->reset_task, gfar_reset_task); |
| 1002 | 1002 | ||
| 1003 | dev_set_drvdata(&ofdev->dev, priv); | 1003 | platform_set_drvdata(ofdev, priv); |
| 1004 | regs = priv->gfargrp[0].regs; | 1004 | regs = priv->gfargrp[0].regs; |
| 1005 | 1005 | ||
| 1006 | gfar_detect_errata(priv); | 1006 | gfar_detect_errata(priv); |
| @@ -1240,15 +1240,13 @@ register_fail: | |||
| 1240 | 1240 | ||
| 1241 | static int gfar_remove(struct platform_device *ofdev) | 1241 | static int gfar_remove(struct platform_device *ofdev) |
| 1242 | { | 1242 | { |
| 1243 | struct gfar_private *priv = dev_get_drvdata(&ofdev->dev); | 1243 | struct gfar_private *priv = platform_get_drvdata(ofdev); |
| 1244 | 1244 | ||
| 1245 | if (priv->phy_node) | 1245 | if (priv->phy_node) |
| 1246 | of_node_put(priv->phy_node); | 1246 | of_node_put(priv->phy_node); |
| 1247 | if (priv->tbi_node) | 1247 | if (priv->tbi_node) |
| 1248 | of_node_put(priv->tbi_node); | 1248 | of_node_put(priv->tbi_node); |
| 1249 | 1249 | ||
| 1250 | dev_set_drvdata(&ofdev->dev, NULL); | ||
| 1251 | |||
| 1252 | unregister_netdev(priv->ndev); | 1250 | unregister_netdev(priv->ndev); |
| 1253 | unmap_group_regs(priv); | 1251 | unmap_group_regs(priv); |
| 1254 | free_gfar_dev(priv); | 1252 | free_gfar_dev(priv); |
diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c index 083ea2b4d20a..098f133908ae 100644 --- a/drivers/net/ethernet/freescale/gianfar_ptp.c +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c | |||
| @@ -519,7 +519,7 @@ static int gianfar_ptp_probe(struct platform_device *dev) | |||
| 519 | } | 519 | } |
| 520 | gfar_phc_index = ptp_clock_index(etsects->clock); | 520 | gfar_phc_index = ptp_clock_index(etsects->clock); |
| 521 | 521 | ||
| 522 | dev_set_drvdata(&dev->dev, etsects); | 522 | platform_set_drvdata(dev, etsects); |
| 523 | 523 | ||
| 524 | return 0; | 524 | return 0; |
| 525 | 525 | ||
| @@ -537,7 +537,7 @@ no_memory: | |||
| 537 | 537 | ||
| 538 | static int gianfar_ptp_remove(struct platform_device *dev) | 538 | static int gianfar_ptp_remove(struct platform_device *dev) |
| 539 | { | 539 | { |
| 540 | struct etsects *etsects = dev_get_drvdata(&dev->dev); | 540 | struct etsects *etsects = platform_get_drvdata(dev); |
| 541 | 541 | ||
| 542 | gfar_write(&etsects->regs->tmr_temask, 0); | 542 | gfar_write(&etsects->regs->tmr_temask, 0); |
| 543 | gfar_write(&etsects->regs->tmr_ctrl, 0); | 543 | gfar_write(&etsects->regs->tmr_ctrl, 0); |
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index e04c59818f60..3c43dac894ec 100644 --- a/drivers/net/ethernet/freescale/ucc_geth.c +++ b/drivers/net/ethernet/freescale/ucc_geth.c | |||
| @@ -3564,7 +3564,7 @@ static void ucc_geth_timeout(struct net_device *dev) | |||
| 3564 | 3564 | ||
| 3565 | static int ucc_geth_suspend(struct platform_device *ofdev, pm_message_t state) | 3565 | static int ucc_geth_suspend(struct platform_device *ofdev, pm_message_t state) |
| 3566 | { | 3566 | { |
| 3567 | struct net_device *ndev = dev_get_drvdata(&ofdev->dev); | 3567 | struct net_device *ndev = platform_get_drvdata(ofdev); |
| 3568 | struct ucc_geth_private *ugeth = netdev_priv(ndev); | 3568 | struct ucc_geth_private *ugeth = netdev_priv(ndev); |
| 3569 | 3569 | ||
| 3570 | if (!netif_running(ndev)) | 3570 | if (!netif_running(ndev)) |
| @@ -3592,7 +3592,7 @@ static int ucc_geth_suspend(struct platform_device *ofdev, pm_message_t state) | |||
| 3592 | 3592 | ||
| 3593 | static int ucc_geth_resume(struct platform_device *ofdev) | 3593 | static int ucc_geth_resume(struct platform_device *ofdev) |
| 3594 | { | 3594 | { |
| 3595 | struct net_device *ndev = dev_get_drvdata(&ofdev->dev); | 3595 | struct net_device *ndev = platform_get_drvdata(ofdev); |
| 3596 | struct ucc_geth_private *ugeth = netdev_priv(ndev); | 3596 | struct ucc_geth_private *ugeth = netdev_priv(ndev); |
| 3597 | int err; | 3597 | int err; |
| 3598 | 3598 | ||
diff --git a/drivers/net/ethernet/freescale/xgmac_mdio.c b/drivers/net/ethernet/freescale/xgmac_mdio.c index 418068b941b1..c1b6e7e31aac 100644 --- a/drivers/net/ethernet/freescale/xgmac_mdio.c +++ b/drivers/net/ethernet/freescale/xgmac_mdio.c | |||
| @@ -227,7 +227,7 @@ static int xgmac_mdio_probe(struct platform_device *pdev) | |||
| 227 | goto err_registration; | 227 | goto err_registration; |
| 228 | } | 228 | } |
| 229 | 229 | ||
| 230 | dev_set_drvdata(&pdev->dev, bus); | 230 | platform_set_drvdata(pdev, bus); |
| 231 | 231 | ||
| 232 | return 0; | 232 | return 0; |
| 233 | 233 | ||
| @@ -242,7 +242,7 @@ err_ioremap: | |||
| 242 | 242 | ||
| 243 | static int xgmac_mdio_remove(struct platform_device *pdev) | 243 | static int xgmac_mdio_remove(struct platform_device *pdev) |
| 244 | { | 244 | { |
| 245 | struct mii_bus *bus = dev_get_drvdata(&pdev->dev); | 245 | struct mii_bus *bus = platform_get_drvdata(pdev); |
| 246 | 246 | ||
| 247 | mdiobus_unregister(bus); | 247 | mdiobus_unregister(bus); |
| 248 | iounmap(bus->priv); | 248 | iounmap(bus->priv); |
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c index 90ea0b1673ca..0605e76c7edd 100644 --- a/drivers/net/ethernet/ibm/ehea/ehea_main.c +++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c | |||
| @@ -3289,7 +3289,7 @@ static int ehea_probe_adapter(struct platform_device *dev, | |||
| 3289 | 3289 | ||
| 3290 | adapter->pd = EHEA_PD_ID; | 3290 | adapter->pd = EHEA_PD_ID; |
| 3291 | 3291 | ||
| 3292 | dev_set_drvdata(&dev->dev, adapter); | 3292 | platform_set_drvdata(dev, adapter); |
| 3293 | 3293 | ||
| 3294 | 3294 | ||
| 3295 | /* initialize adapter and ports */ | 3295 | /* initialize adapter and ports */ |
| @@ -3360,7 +3360,7 @@ out: | |||
| 3360 | 3360 | ||
| 3361 | static int ehea_remove(struct platform_device *dev) | 3361 | static int ehea_remove(struct platform_device *dev) |
| 3362 | { | 3362 | { |
| 3363 | struct ehea_adapter *adapter = dev_get_drvdata(&dev->dev); | 3363 | struct ehea_adapter *adapter = platform_get_drvdata(dev); |
| 3364 | int i; | 3364 | int i; |
| 3365 | 3365 | ||
| 3366 | for (i = 0; i < EHEA_MAX_PORTS; i++) | 3366 | for (i = 0; i < EHEA_MAX_PORTS; i++) |
diff --git a/drivers/net/ethernet/ibm/emac/mal.c b/drivers/net/ethernet/ibm/emac/mal.c index 610ed223d1db..856ea66c9223 100644 --- a/drivers/net/ethernet/ibm/emac/mal.c +++ b/drivers/net/ethernet/ibm/emac/mal.c | |||
| @@ -696,7 +696,7 @@ static int mal_probe(struct platform_device *ofdev) | |||
| 696 | 696 | ||
| 697 | /* Advertise this instance to the rest of the world */ | 697 | /* Advertise this instance to the rest of the world */ |
| 698 | wmb(); | 698 | wmb(); |
| 699 | dev_set_drvdata(&ofdev->dev, mal); | 699 | platform_set_drvdata(ofdev, mal); |
| 700 | 700 | ||
| 701 | mal_dbg_register(mal); | 701 | mal_dbg_register(mal); |
| 702 | 702 | ||
| @@ -722,7 +722,7 @@ static int mal_probe(struct platform_device *ofdev) | |||
| 722 | 722 | ||
| 723 | static int mal_remove(struct platform_device *ofdev) | 723 | static int mal_remove(struct platform_device *ofdev) |
| 724 | { | 724 | { |
| 725 | struct mal_instance *mal = dev_get_drvdata(&ofdev->dev); | 725 | struct mal_instance *mal = platform_get_drvdata(ofdev); |
| 726 | 726 | ||
| 727 | MAL_DBG(mal, "remove" NL); | 727 | MAL_DBG(mal, "remove" NL); |
| 728 | 728 | ||
| @@ -735,8 +735,6 @@ static int mal_remove(struct platform_device *ofdev) | |||
| 735 | "mal%d: commac list is not empty on remove!\n", | 735 | "mal%d: commac list is not empty on remove!\n", |
| 736 | mal->index); | 736 | mal->index); |
| 737 | 737 | ||
| 738 | dev_set_drvdata(&ofdev->dev, NULL); | ||
| 739 | |||
| 740 | free_irq(mal->serr_irq, mal); | 738 | free_irq(mal->serr_irq, mal); |
| 741 | free_irq(mal->txde_irq, mal); | 739 | free_irq(mal->txde_irq, mal); |
| 742 | free_irq(mal->txeob_irq, mal); | 740 | free_irq(mal->txeob_irq, mal); |
diff --git a/drivers/net/ethernet/ibm/emac/rgmii.c b/drivers/net/ethernet/ibm/emac/rgmii.c index 39251765b55d..c47e23d6eeaa 100644 --- a/drivers/net/ethernet/ibm/emac/rgmii.c +++ b/drivers/net/ethernet/ibm/emac/rgmii.c | |||
| @@ -95,7 +95,7 @@ static inline u32 rgmii_mode_mask(int mode, int input) | |||
| 95 | 95 | ||
| 96 | int rgmii_attach(struct platform_device *ofdev, int input, int mode) | 96 | int rgmii_attach(struct platform_device *ofdev, int input, int mode) |
| 97 | { | 97 | { |
| 98 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 98 | struct rgmii_instance *dev = platform_get_drvdata(ofdev); |
| 99 | struct rgmii_regs __iomem *p = dev->base; | 99 | struct rgmii_regs __iomem *p = dev->base; |
| 100 | 100 | ||
| 101 | RGMII_DBG(dev, "attach(%d)" NL, input); | 101 | RGMII_DBG(dev, "attach(%d)" NL, input); |
| @@ -124,7 +124,7 @@ int rgmii_attach(struct platform_device *ofdev, int input, int mode) | |||
| 124 | 124 | ||
| 125 | void rgmii_set_speed(struct platform_device *ofdev, int input, int speed) | 125 | void rgmii_set_speed(struct platform_device *ofdev, int input, int speed) |
| 126 | { | 126 | { |
| 127 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 127 | struct rgmii_instance *dev = platform_get_drvdata(ofdev); |
| 128 | struct rgmii_regs __iomem *p = dev->base; | 128 | struct rgmii_regs __iomem *p = dev->base; |
| 129 | u32 ssr; | 129 | u32 ssr; |
| 130 | 130 | ||
| @@ -146,7 +146,7 @@ void rgmii_set_speed(struct platform_device *ofdev, int input, int speed) | |||
| 146 | 146 | ||
| 147 | void rgmii_get_mdio(struct platform_device *ofdev, int input) | 147 | void rgmii_get_mdio(struct platform_device *ofdev, int input) |
| 148 | { | 148 | { |
| 149 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 149 | struct rgmii_instance *dev = platform_get_drvdata(ofdev); |
| 150 | struct rgmii_regs __iomem *p = dev->base; | 150 | struct rgmii_regs __iomem *p = dev->base; |
| 151 | u32 fer; | 151 | u32 fer; |
| 152 | 152 | ||
| @@ -167,7 +167,7 @@ void rgmii_get_mdio(struct platform_device *ofdev, int input) | |||
| 167 | 167 | ||
| 168 | void rgmii_put_mdio(struct platform_device *ofdev, int input) | 168 | void rgmii_put_mdio(struct platform_device *ofdev, int input) |
| 169 | { | 169 | { |
| 170 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 170 | struct rgmii_instance *dev = platform_get_drvdata(ofdev); |
| 171 | struct rgmii_regs __iomem *p = dev->base; | 171 | struct rgmii_regs __iomem *p = dev->base; |
| 172 | u32 fer; | 172 | u32 fer; |
| 173 | 173 | ||
| @@ -188,7 +188,7 @@ void rgmii_put_mdio(struct platform_device *ofdev, int input) | |||
| 188 | 188 | ||
| 189 | void rgmii_detach(struct platform_device *ofdev, int input) | 189 | void rgmii_detach(struct platform_device *ofdev, int input) |
| 190 | { | 190 | { |
| 191 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 191 | struct rgmii_instance *dev = platform_get_drvdata(ofdev); |
| 192 | struct rgmii_regs __iomem *p; | 192 | struct rgmii_regs __iomem *p; |
| 193 | 193 | ||
| 194 | BUG_ON(!dev || dev->users == 0); | 194 | BUG_ON(!dev || dev->users == 0); |
| @@ -214,7 +214,7 @@ int rgmii_get_regs_len(struct platform_device *ofdev) | |||
| 214 | 214 | ||
| 215 | void *rgmii_dump_regs(struct platform_device *ofdev, void *buf) | 215 | void *rgmii_dump_regs(struct platform_device *ofdev, void *buf) |
| 216 | { | 216 | { |
| 217 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 217 | struct rgmii_instance *dev = platform_get_drvdata(ofdev); |
| 218 | struct emac_ethtool_regs_subhdr *hdr = buf; | 218 | struct emac_ethtool_regs_subhdr *hdr = buf; |
| 219 | struct rgmii_regs *regs = (struct rgmii_regs *)(hdr + 1); | 219 | struct rgmii_regs *regs = (struct rgmii_regs *)(hdr + 1); |
| 220 | 220 | ||
| @@ -279,7 +279,7 @@ static int rgmii_probe(struct platform_device *ofdev) | |||
| 279 | (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out"); | 279 | (dev->flags & EMAC_RGMII_FLAG_HAS_MDIO) ? "" : "out"); |
| 280 | 280 | ||
| 281 | wmb(); | 281 | wmb(); |
| 282 | dev_set_drvdata(&ofdev->dev, dev); | 282 | platform_set_drvdata(ofdev, dev); |
| 283 | 283 | ||
| 284 | return 0; | 284 | return 0; |
| 285 | 285 | ||
| @@ -291,9 +291,7 @@ static int rgmii_probe(struct platform_device *ofdev) | |||
| 291 | 291 | ||
| 292 | static int rgmii_remove(struct platform_device *ofdev) | 292 | static int rgmii_remove(struct platform_device *ofdev) |
| 293 | { | 293 | { |
| 294 | struct rgmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 294 | struct rgmii_instance *dev = platform_get_drvdata(ofdev); |
| 295 | |||
| 296 | dev_set_drvdata(&ofdev->dev, NULL); | ||
| 297 | 295 | ||
| 298 | WARN_ON(dev->users != 0); | 296 | WARN_ON(dev->users != 0); |
| 299 | 297 | ||
diff --git a/drivers/net/ethernet/ibm/emac/tah.c b/drivers/net/ethernet/ibm/emac/tah.c index 795f1393e2b6..c231a4a32c4d 100644 --- a/drivers/net/ethernet/ibm/emac/tah.c +++ b/drivers/net/ethernet/ibm/emac/tah.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | int tah_attach(struct platform_device *ofdev, int channel) | 26 | int tah_attach(struct platform_device *ofdev, int channel) |
| 27 | { | 27 | { |
| 28 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); | 28 | struct tah_instance *dev = platform_get_drvdata(ofdev); |
| 29 | 29 | ||
| 30 | mutex_lock(&dev->lock); | 30 | mutex_lock(&dev->lock); |
| 31 | /* Reset has been done at probe() time... nothing else to do for now */ | 31 | /* Reset has been done at probe() time... nothing else to do for now */ |
| @@ -37,7 +37,7 @@ int tah_attach(struct platform_device *ofdev, int channel) | |||
| 37 | 37 | ||
| 38 | void tah_detach(struct platform_device *ofdev, int channel) | 38 | void tah_detach(struct platform_device *ofdev, int channel) |
| 39 | { | 39 | { |
| 40 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); | 40 | struct tah_instance *dev = platform_get_drvdata(ofdev); |
| 41 | 41 | ||
| 42 | mutex_lock(&dev->lock); | 42 | mutex_lock(&dev->lock); |
| 43 | --dev->users; | 43 | --dev->users; |
| @@ -46,7 +46,7 @@ void tah_detach(struct platform_device *ofdev, int channel) | |||
| 46 | 46 | ||
| 47 | void tah_reset(struct platform_device *ofdev) | 47 | void tah_reset(struct platform_device *ofdev) |
| 48 | { | 48 | { |
| 49 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); | 49 | struct tah_instance *dev = platform_get_drvdata(ofdev); |
| 50 | struct tah_regs __iomem *p = dev->base; | 50 | struct tah_regs __iomem *p = dev->base; |
| 51 | int n; | 51 | int n; |
| 52 | 52 | ||
| @@ -74,7 +74,7 @@ int tah_get_regs_len(struct platform_device *ofdev) | |||
| 74 | 74 | ||
| 75 | void *tah_dump_regs(struct platform_device *ofdev, void *buf) | 75 | void *tah_dump_regs(struct platform_device *ofdev, void *buf) |
| 76 | { | 76 | { |
| 77 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); | 77 | struct tah_instance *dev = platform_get_drvdata(ofdev); |
| 78 | struct emac_ethtool_regs_subhdr *hdr = buf; | 78 | struct emac_ethtool_regs_subhdr *hdr = buf; |
| 79 | struct tah_regs *regs = (struct tah_regs *)(hdr + 1); | 79 | struct tah_regs *regs = (struct tah_regs *)(hdr + 1); |
| 80 | 80 | ||
| @@ -118,7 +118,7 @@ static int tah_probe(struct platform_device *ofdev) | |||
| 118 | goto err_free; | 118 | goto err_free; |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | dev_set_drvdata(&ofdev->dev, dev); | 121 | platform_set_drvdata(ofdev, dev); |
| 122 | 122 | ||
| 123 | /* Initialize TAH and enable IPv4 checksum verification, no TSO yet */ | 123 | /* Initialize TAH and enable IPv4 checksum verification, no TSO yet */ |
| 124 | tah_reset(ofdev); | 124 | tah_reset(ofdev); |
| @@ -137,9 +137,7 @@ static int tah_probe(struct platform_device *ofdev) | |||
| 137 | 137 | ||
| 138 | static int tah_remove(struct platform_device *ofdev) | 138 | static int tah_remove(struct platform_device *ofdev) |
| 139 | { | 139 | { |
| 140 | struct tah_instance *dev = dev_get_drvdata(&ofdev->dev); | 140 | struct tah_instance *dev = platform_get_drvdata(ofdev); |
| 141 | |||
| 142 | dev_set_drvdata(&ofdev->dev, NULL); | ||
| 143 | 141 | ||
| 144 | WARN_ON(dev->users != 0); | 142 | WARN_ON(dev->users != 0); |
| 145 | 143 | ||
diff --git a/drivers/net/ethernet/ibm/emac/zmii.c b/drivers/net/ethernet/ibm/emac/zmii.c index f91202f42125..4cdf286f7ee3 100644 --- a/drivers/net/ethernet/ibm/emac/zmii.c +++ b/drivers/net/ethernet/ibm/emac/zmii.c | |||
| @@ -84,7 +84,7 @@ static inline u32 zmii_mode_mask(int mode, int input) | |||
| 84 | 84 | ||
| 85 | int zmii_attach(struct platform_device *ofdev, int input, int *mode) | 85 | int zmii_attach(struct platform_device *ofdev, int input, int *mode) |
| 86 | { | 86 | { |
| 87 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 87 | struct zmii_instance *dev = platform_get_drvdata(ofdev); |
| 88 | struct zmii_regs __iomem *p = dev->base; | 88 | struct zmii_regs __iomem *p = dev->base; |
| 89 | 89 | ||
| 90 | ZMII_DBG(dev, "init(%d, %d)" NL, input, *mode); | 90 | ZMII_DBG(dev, "init(%d, %d)" NL, input, *mode); |
| @@ -150,7 +150,7 @@ int zmii_attach(struct platform_device *ofdev, int input, int *mode) | |||
| 150 | 150 | ||
| 151 | void zmii_get_mdio(struct platform_device *ofdev, int input) | 151 | void zmii_get_mdio(struct platform_device *ofdev, int input) |
| 152 | { | 152 | { |
| 153 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 153 | struct zmii_instance *dev = platform_get_drvdata(ofdev); |
| 154 | u32 fer; | 154 | u32 fer; |
| 155 | 155 | ||
| 156 | ZMII_DBG2(dev, "get_mdio(%d)" NL, input); | 156 | ZMII_DBG2(dev, "get_mdio(%d)" NL, input); |
| @@ -163,7 +163,7 @@ void zmii_get_mdio(struct platform_device *ofdev, int input) | |||
| 163 | 163 | ||
| 164 | void zmii_put_mdio(struct platform_device *ofdev, int input) | 164 | void zmii_put_mdio(struct platform_device *ofdev, int input) |
| 165 | { | 165 | { |
| 166 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 166 | struct zmii_instance *dev = platform_get_drvdata(ofdev); |
| 167 | 167 | ||
| 168 | ZMII_DBG2(dev, "put_mdio(%d)" NL, input); | 168 | ZMII_DBG2(dev, "put_mdio(%d)" NL, input); |
| 169 | mutex_unlock(&dev->lock); | 169 | mutex_unlock(&dev->lock); |
| @@ -172,7 +172,7 @@ void zmii_put_mdio(struct platform_device *ofdev, int input) | |||
| 172 | 172 | ||
| 173 | void zmii_set_speed(struct platform_device *ofdev, int input, int speed) | 173 | void zmii_set_speed(struct platform_device *ofdev, int input, int speed) |
| 174 | { | 174 | { |
| 175 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 175 | struct zmii_instance *dev = platform_get_drvdata(ofdev); |
| 176 | u32 ssr; | 176 | u32 ssr; |
| 177 | 177 | ||
| 178 | mutex_lock(&dev->lock); | 178 | mutex_lock(&dev->lock); |
| @@ -193,7 +193,7 @@ void zmii_set_speed(struct platform_device *ofdev, int input, int speed) | |||
| 193 | 193 | ||
| 194 | void zmii_detach(struct platform_device *ofdev, int input) | 194 | void zmii_detach(struct platform_device *ofdev, int input) |
| 195 | { | 195 | { |
| 196 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 196 | struct zmii_instance *dev = platform_get_drvdata(ofdev); |
| 197 | 197 | ||
| 198 | BUG_ON(!dev || dev->users == 0); | 198 | BUG_ON(!dev || dev->users == 0); |
| 199 | 199 | ||
| @@ -218,7 +218,7 @@ int zmii_get_regs_len(struct platform_device *ofdev) | |||
| 218 | 218 | ||
| 219 | void *zmii_dump_regs(struct platform_device *ofdev, void *buf) | 219 | void *zmii_dump_regs(struct platform_device *ofdev, void *buf) |
| 220 | { | 220 | { |
| 221 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 221 | struct zmii_instance *dev = platform_get_drvdata(ofdev); |
| 222 | struct emac_ethtool_regs_subhdr *hdr = buf; | 222 | struct emac_ethtool_regs_subhdr *hdr = buf; |
| 223 | struct zmii_regs *regs = (struct zmii_regs *)(hdr + 1); | 223 | struct zmii_regs *regs = (struct zmii_regs *)(hdr + 1); |
| 224 | 224 | ||
| @@ -272,7 +272,7 @@ static int zmii_probe(struct platform_device *ofdev) | |||
| 272 | printk(KERN_INFO | 272 | printk(KERN_INFO |
| 273 | "ZMII %s initialized\n", ofdev->dev.of_node->full_name); | 273 | "ZMII %s initialized\n", ofdev->dev.of_node->full_name); |
| 274 | wmb(); | 274 | wmb(); |
| 275 | dev_set_drvdata(&ofdev->dev, dev); | 275 | platform_set_drvdata(ofdev, dev); |
| 276 | 276 | ||
| 277 | return 0; | 277 | return 0; |
| 278 | 278 | ||
| @@ -284,9 +284,7 @@ static int zmii_probe(struct platform_device *ofdev) | |||
| 284 | 284 | ||
| 285 | static int zmii_remove(struct platform_device *ofdev) | 285 | static int zmii_remove(struct platform_device *ofdev) |
| 286 | { | 286 | { |
| 287 | struct zmii_instance *dev = dev_get_drvdata(&ofdev->dev); | 287 | struct zmii_instance *dev = platform_get_drvdata(ofdev); |
| 288 | |||
| 289 | dev_set_drvdata(&ofdev->dev, NULL); | ||
| 290 | 288 | ||
| 291 | WARN_ON(dev->users != 0); | 289 | WARN_ON(dev->users != 0); |
| 292 | 290 | ||
diff --git a/drivers/net/ethernet/netx-eth.c b/drivers/net/ethernet/netx-eth.c index cb9e63831500..5da3ffb61062 100644 --- a/drivers/net/ethernet/netx-eth.c +++ b/drivers/net/ethernet/netx-eth.c | |||
| @@ -430,11 +430,9 @@ exit: | |||
| 430 | 430 | ||
| 431 | static int netx_eth_drv_remove(struct platform_device *pdev) | 431 | static int netx_eth_drv_remove(struct platform_device *pdev) |
| 432 | { | 432 | { |
| 433 | struct net_device *ndev = dev_get_drvdata(&pdev->dev); | 433 | struct net_device *ndev = platform_get_drvdata(pdev); |
| 434 | struct netx_eth_priv *priv = netdev_priv(ndev); | 434 | struct netx_eth_priv *priv = netdev_priv(ndev); |
| 435 | 435 | ||
| 436 | platform_set_drvdata(pdev, NULL); | ||
| 437 | |||
| 438 | unregister_netdev(ndev); | 436 | unregister_netdev(ndev); |
| 439 | xc_stop(priv->xc); | 437 | xc_stop(priv->xc); |
| 440 | free_xc(priv->xc); | 438 | free_xc(priv->xc); |
diff --git a/drivers/net/ethernet/octeon/octeon_mgmt.c b/drivers/net/ethernet/octeon/octeon_mgmt.c index 921729f9c85c..e6e029237a63 100644 --- a/drivers/net/ethernet/octeon/octeon_mgmt.c +++ b/drivers/net/ethernet/octeon/octeon_mgmt.c | |||
| @@ -1437,7 +1437,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev) | |||
| 1437 | 1437 | ||
| 1438 | SET_NETDEV_DEV(netdev, &pdev->dev); | 1438 | SET_NETDEV_DEV(netdev, &pdev->dev); |
| 1439 | 1439 | ||
| 1440 | dev_set_drvdata(&pdev->dev, netdev); | 1440 | platform_set_drvdata(pdev, netdev); |
| 1441 | p = netdev_priv(netdev); | 1441 | p = netdev_priv(netdev); |
| 1442 | netif_napi_add(netdev, &p->napi, octeon_mgmt_napi_poll, | 1442 | netif_napi_add(netdev, &p->napi, octeon_mgmt_napi_poll, |
| 1443 | OCTEON_MGMT_NAPI_WEIGHT); | 1443 | OCTEON_MGMT_NAPI_WEIGHT); |
| @@ -1559,7 +1559,7 @@ err: | |||
| 1559 | 1559 | ||
| 1560 | static int octeon_mgmt_remove(struct platform_device *pdev) | 1560 | static int octeon_mgmt_remove(struct platform_device *pdev) |
| 1561 | { | 1561 | { |
| 1562 | struct net_device *netdev = dev_get_drvdata(&pdev->dev); | 1562 | struct net_device *netdev = platform_get_drvdata(pdev); |
| 1563 | 1563 | ||
| 1564 | unregister_netdev(netdev); | 1564 | unregister_netdev(netdev); |
| 1565 | free_netdev(netdev); | 1565 | free_netdev(netdev); |
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 95cff98d8a34..fa322409bff3 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c | |||
| @@ -10108,7 +10108,7 @@ static int niu_of_probe(struct platform_device *op) | |||
| 10108 | goto err_out_iounmap; | 10108 | goto err_out_iounmap; |
| 10109 | } | 10109 | } |
| 10110 | 10110 | ||
| 10111 | dev_set_drvdata(&op->dev, dev); | 10111 | platform_set_drvdata(op, dev); |
| 10112 | 10112 | ||
| 10113 | niu_device_announce(np); | 10113 | niu_device_announce(np); |
| 10114 | 10114 | ||
| @@ -10145,7 +10145,7 @@ err_out: | |||
| 10145 | 10145 | ||
| 10146 | static int niu_of_remove(struct platform_device *op) | 10146 | static int niu_of_remove(struct platform_device *op) |
| 10147 | { | 10147 | { |
| 10148 | struct net_device *dev = dev_get_drvdata(&op->dev); | 10148 | struct net_device *dev = platform_get_drvdata(op); |
| 10149 | 10149 | ||
| 10150 | if (dev) { | 10150 | if (dev) { |
| 10151 | struct niu *np = netdev_priv(dev); | 10151 | struct niu *np = netdev_priv(dev); |
| @@ -10175,7 +10175,6 @@ static int niu_of_remove(struct platform_device *op) | |||
| 10175 | niu_put_parent(np); | 10175 | niu_put_parent(np); |
| 10176 | 10176 | ||
| 10177 | free_netdev(dev); | 10177 | free_netdev(dev); |
| 10178 | dev_set_drvdata(&op->dev, NULL); | ||
| 10179 | } | 10178 | } |
| 10180 | return 0; | 10179 | return 0; |
| 10181 | } | 10180 | } |
diff --git a/drivers/net/ethernet/sun/sunhme.c b/drivers/net/ethernet/sun/sunhme.c index 436fa9d5a071..171f5b0809c4 100644 --- a/drivers/net/ethernet/sun/sunhme.c +++ b/drivers/net/ethernet/sun/sunhme.c | |||
| @@ -2506,7 +2506,7 @@ static struct quattro *quattro_sbus_find(struct platform_device *child) | |||
| 2506 | struct quattro *qp; | 2506 | struct quattro *qp; |
| 2507 | 2507 | ||
| 2508 | op = to_platform_device(parent); | 2508 | op = to_platform_device(parent); |
| 2509 | qp = dev_get_drvdata(&op->dev); | 2509 | qp = platform_get_drvdata(op); |
| 2510 | if (qp) | 2510 | if (qp) |
| 2511 | return qp; | 2511 | return qp; |
| 2512 | 2512 | ||
| @@ -2521,7 +2521,7 @@ static struct quattro *quattro_sbus_find(struct platform_device *child) | |||
| 2521 | qp->next = qfe_sbus_list; | 2521 | qp->next = qfe_sbus_list; |
| 2522 | qfe_sbus_list = qp; | 2522 | qfe_sbus_list = qp; |
| 2523 | 2523 | ||
| 2524 | dev_set_drvdata(&op->dev, qp); | 2524 | platform_set_drvdata(op, qp); |
| 2525 | } | 2525 | } |
| 2526 | return qp; | 2526 | return qp; |
| 2527 | } | 2527 | } |
diff --git a/drivers/net/ethernet/sun/sunqe.c b/drivers/net/ethernet/sun/sunqe.c index 8182591bc187..b072f4dba033 100644 --- a/drivers/net/ethernet/sun/sunqe.c +++ b/drivers/net/ethernet/sun/sunqe.c | |||
| @@ -767,7 +767,7 @@ static struct sunqec *get_qec(struct platform_device *child) | |||
| 767 | struct platform_device *op = to_platform_device(child->dev.parent); | 767 | struct platform_device *op = to_platform_device(child->dev.parent); |
| 768 | struct sunqec *qecp; | 768 | struct sunqec *qecp; |
| 769 | 769 | ||
| 770 | qecp = dev_get_drvdata(&op->dev); | 770 | qecp = platform_get_drvdata(op); |
| 771 | if (!qecp) { | 771 | if (!qecp) { |
| 772 | qecp = kzalloc(sizeof(struct sunqec), GFP_KERNEL); | 772 | qecp = kzalloc(sizeof(struct sunqec), GFP_KERNEL); |
| 773 | if (qecp) { | 773 | if (qecp) { |
| @@ -801,7 +801,7 @@ static struct sunqec *get_qec(struct platform_device *child) | |||
| 801 | goto fail; | 801 | goto fail; |
| 802 | } | 802 | } |
| 803 | 803 | ||
| 804 | dev_set_drvdata(&op->dev, qecp); | 804 | platform_set_drvdata(op, qecp); |
| 805 | 805 | ||
| 806 | qecp->next_module = root_qec_dev; | 806 | qecp->next_module = root_qec_dev; |
| 807 | root_qec_dev = qecp; | 807 | root_qec_dev = qecp; |
| @@ -902,7 +902,7 @@ static int qec_ether_init(struct platform_device *op) | |||
| 902 | if (res) | 902 | if (res) |
| 903 | goto fail; | 903 | goto fail; |
| 904 | 904 | ||
| 905 | dev_set_drvdata(&op->dev, qe); | 905 | platform_set_drvdata(op, qe); |
| 906 | 906 | ||
| 907 | printk(KERN_INFO "%s: qe channel[%d] %pM\n", dev->name, qe->channel, | 907 | printk(KERN_INFO "%s: qe channel[%d] %pM\n", dev->name, qe->channel, |
| 908 | dev->dev_addr); | 908 | dev->dev_addr); |
| @@ -934,7 +934,7 @@ static int qec_sbus_probe(struct platform_device *op) | |||
| 934 | 934 | ||
| 935 | static int qec_sbus_remove(struct platform_device *op) | 935 | static int qec_sbus_remove(struct platform_device *op) |
| 936 | { | 936 | { |
| 937 | struct sunqe *qp = dev_get_drvdata(&op->dev); | 937 | struct sunqe *qp = platform_get_drvdata(op); |
| 938 | struct net_device *net_dev = qp->dev; | 938 | struct net_device *net_dev = qp->dev; |
| 939 | 939 | ||
| 940 | unregister_netdev(net_dev); | 940 | unregister_netdev(net_dev); |
| @@ -948,8 +948,6 @@ static int qec_sbus_remove(struct platform_device *op) | |||
| 948 | 948 | ||
| 949 | free_netdev(net_dev); | 949 | free_netdev(net_dev); |
| 950 | 950 | ||
| 951 | dev_set_drvdata(&op->dev, NULL); | ||
| 952 | |||
| 953 | return 0; | 951 | return 0; |
| 954 | } | 952 | } |
| 955 | 953 | ||
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c index 57c2e5ef2804..58eb4488beff 100644 --- a/drivers/net/ethernet/xilinx/ll_temac_main.c +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c | |||
| @@ -1007,7 +1007,7 @@ static int temac_of_probe(struct platform_device *op) | |||
| 1007 | return -ENOMEM; | 1007 | return -ENOMEM; |
| 1008 | 1008 | ||
| 1009 | ether_setup(ndev); | 1009 | ether_setup(ndev); |
| 1010 | dev_set_drvdata(&op->dev, ndev); | 1010 | platform_set_drvdata(op, ndev); |
| 1011 | SET_NETDEV_DEV(ndev, &op->dev); | 1011 | SET_NETDEV_DEV(ndev, &op->dev); |
| 1012 | ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ | 1012 | ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ |
| 1013 | ndev->features = NETIF_F_SG | NETIF_F_FRAGLIST; | 1013 | ndev->features = NETIF_F_SG | NETIF_F_FRAGLIST; |
| @@ -1136,7 +1136,7 @@ static int temac_of_probe(struct platform_device *op) | |||
| 1136 | 1136 | ||
| 1137 | static int temac_of_remove(struct platform_device *op) | 1137 | static int temac_of_remove(struct platform_device *op) |
| 1138 | { | 1138 | { |
| 1139 | struct net_device *ndev = dev_get_drvdata(&op->dev); | 1139 | struct net_device *ndev = platform_get_drvdata(op); |
| 1140 | struct temac_local *lp = netdev_priv(ndev); | 1140 | struct temac_local *lp = netdev_priv(ndev); |
| 1141 | 1141 | ||
| 1142 | temac_mdio_teardown(lp); | 1142 | temac_mdio_teardown(lp); |
| @@ -1145,7 +1145,6 @@ static int temac_of_remove(struct platform_device *op) | |||
| 1145 | if (lp->phy_node) | 1145 | if (lp->phy_node) |
| 1146 | of_node_put(lp->phy_node); | 1146 | of_node_put(lp->phy_node); |
| 1147 | lp->phy_node = NULL; | 1147 | lp->phy_node = NULL; |
| 1148 | dev_set_drvdata(&op->dev, NULL); | ||
| 1149 | iounmap(lp->regs); | 1148 | iounmap(lp->regs); |
| 1150 | if (lp->sdma_regs) | 1149 | if (lp->sdma_regs) |
| 1151 | iounmap(lp->sdma_regs); | 1150 | iounmap(lp->sdma_regs); |
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index 24748e8367a1..fb7d1c28a2ea 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c | |||
| @@ -1484,7 +1484,7 @@ static int axienet_of_probe(struct platform_device *op) | |||
| 1484 | return -ENOMEM; | 1484 | return -ENOMEM; |
| 1485 | 1485 | ||
| 1486 | ether_setup(ndev); | 1486 | ether_setup(ndev); |
| 1487 | dev_set_drvdata(&op->dev, ndev); | 1487 | platform_set_drvdata(op, ndev); |
| 1488 | 1488 | ||
| 1489 | SET_NETDEV_DEV(ndev, &op->dev); | 1489 | SET_NETDEV_DEV(ndev, &op->dev); |
| 1490 | ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ | 1490 | ndev->flags &= ~IFF_MULTICAST; /* clear multicast */ |
| @@ -1622,7 +1622,7 @@ nodev: | |||
| 1622 | 1622 | ||
| 1623 | static int axienet_of_remove(struct platform_device *op) | 1623 | static int axienet_of_remove(struct platform_device *op) |
| 1624 | { | 1624 | { |
| 1625 | struct net_device *ndev = dev_get_drvdata(&op->dev); | 1625 | struct net_device *ndev = platform_get_drvdata(op); |
| 1626 | struct axienet_local *lp = netdev_priv(ndev); | 1626 | struct axienet_local *lp = netdev_priv(ndev); |
| 1627 | 1627 | ||
| 1628 | axienet_mdio_teardown(lp); | 1628 | axienet_mdio_teardown(lp); |
| @@ -1632,8 +1632,6 @@ static int axienet_of_remove(struct platform_device *op) | |||
| 1632 | of_node_put(lp->phy_node); | 1632 | of_node_put(lp->phy_node); |
| 1633 | lp->phy_node = NULL; | 1633 | lp->phy_node = NULL; |
| 1634 | 1634 | ||
| 1635 | dev_set_drvdata(&op->dev, NULL); | ||
| 1636 | |||
| 1637 | iounmap(lp->regs); | 1635 | iounmap(lp->regs); |
| 1638 | if (lp->dma_regs) | 1636 | if (lp->dma_regs) |
| 1639 | iounmap(lp->dma_regs); | 1637 | iounmap(lp->dma_regs); |
