aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/fec.c
diff options
context:
space:
mode:
authorShawn Guo <shawn.guo@freescale.com>2011-01-05 16:13:10 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-09 18:42:55 -0500
commit8649a230e33320b00f778a6f7c17a2764e844730 (patch)
tree0384070956fcf781dd83af4543bb607fc1651b8d /drivers/net/fec.c
parent862f0982eadcea0e114576c57ea426d3d51a69a6 (diff)
net/fec: remove the use of "index" which is legacy
The "index" becomes legacy since fep->pdev->id starts working to identify the instance. Moreover, the call of fec_enet_init(ndev, 0) always passes 0 to fep->index. This makes the following code in fec_get_mac buggy. /* Adjust MAC if using default MAC address */ if (iap == fec_mac_default) dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index; It may be the time to remove "index" and use fep->pdev->id instead. Signed-off-by: Shawn Guo <shawn.guo@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/fec.c')
-rw-r--r--drivers/net/fec.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 52e9ca8de4b2..47f6b3b91423 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -186,7 +186,6 @@ struct fec_enet_private {
186 int mii_timeout; 186 int mii_timeout;
187 uint phy_speed; 187 uint phy_speed;
188 phy_interface_t phy_interface; 188 phy_interface_t phy_interface;
189 int index;
190 int link; 189 int link;
191 int full_duplex; 190 int full_duplex;
192 struct completion mdio_done; 191 struct completion mdio_done;
@@ -566,7 +565,7 @@ static void __inline__ fec_get_mac(struct net_device *dev)
566 565
567 /* Adjust MAC if using default MAC address */ 566 /* Adjust MAC if using default MAC address */
568 if (iap == fec_mac_default) 567 if (iap == fec_mac_default)
569 dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index; 568 dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->pdev->id;
570} 569}
571#endif 570#endif
572 571
@@ -1067,9 +1066,8 @@ static const struct net_device_ops fec_netdev_ops = {
1067 /* 1066 /*
1068 * XXX: We need to clean up on failure exits here. 1067 * XXX: We need to clean up on failure exits here.
1069 * 1068 *
1070 * index is only used in legacy code
1071 */ 1069 */
1072static int fec_enet_init(struct net_device *dev, int index) 1070static int fec_enet_init(struct net_device *dev)
1073{ 1071{
1074 struct fec_enet_private *fep = netdev_priv(dev); 1072 struct fec_enet_private *fep = netdev_priv(dev);
1075 struct bufdesc *cbd_base; 1073 struct bufdesc *cbd_base;
@@ -1086,7 +1084,6 @@ static int fec_enet_init(struct net_device *dev, int index)
1086 1084
1087 spin_lock_init(&fep->hw_lock); 1085 spin_lock_init(&fep->hw_lock);
1088 1086
1089 fep->index = index;
1090 fep->hwp = (void __iomem *)dev->base_addr; 1087 fep->hwp = (void __iomem *)dev->base_addr;
1091 fep->netdev = dev; 1088 fep->netdev = dev;
1092 1089
@@ -1316,7 +1313,7 @@ fec_probe(struct platform_device *pdev)
1316 } 1313 }
1317 clk_enable(fep->clk); 1314 clk_enable(fep->clk);
1318 1315
1319 ret = fec_enet_init(ndev, 0); 1316 ret = fec_enet_init(ndev);
1320 if (ret) 1317 if (ret)
1321 goto failed_init; 1318 goto failed_init;
1322 1319