aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorKrzysztof Hałasa <khc@pm.waw.pl>2009-05-04 15:31:52 -0400
committerKrzysztof Hałasa <khc@pm.waw.pl>2009-05-09 08:57:57 -0400
commit7aa6a4786e70fe826b998d1f95ba911a28546844 (patch)
tree60efdc48928a292deb96ea5252521fcfbfc458ff /drivers/net
parent3ba8c7920552865a338e00512715786b54db4da0 (diff)
IXP4xx: complete Ethernet netdev setup before calling register_netdev().
Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/arm/ixp4xx_eth.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/arm/ixp4xx_eth.c b/drivers/net/arm/ixp4xx_eth.c
index 721b5421bf1a..a740053d3af3 100644
--- a/drivers/net/arm/ixp4xx_eth.c
+++ b/drivers/net/arm/ixp4xx_eth.c
@@ -1189,15 +1189,10 @@ static int __devinit eth_init_one(struct platform_device *pdev)
1189 goto err_free; 1189 goto err_free;
1190 } 1190 }
1191 1191
1192 if (register_netdev(dev)) {
1193 err = -EIO;
1194 goto err_npe_rel;
1195 }
1196
1197 port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name); 1192 port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name);
1198 if (!port->mem_res) { 1193 if (!port->mem_res) {
1199 err = -EBUSY; 1194 err = -EBUSY;
1200 goto err_unreg; 1195 goto err_npe_rel;
1201 } 1196 }
1202 1197
1203 port->plat = plat; 1198 port->plat = plat;
@@ -1215,20 +1210,25 @@ static int __devinit eth_init_one(struct platform_device *pdev)
1215 snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, "0", plat->phy); 1210 snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, "0", plat->phy);
1216 port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, 1211 port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
1217 PHY_INTERFACE_MODE_MII); 1212 PHY_INTERFACE_MODE_MII);
1218 if (IS_ERR(port->phydev)) { 1213 if ((err = IS_ERR(port->phydev)))
1219 printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); 1214 goto err_free_mem;
1220 return PTR_ERR(port->phydev);
1221 }
1222 1215
1223 port->phydev->irq = PHY_POLL; 1216 port->phydev->irq = PHY_POLL;
1224 1217
1218 if ((err = register_netdev(dev)))
1219 goto err_phy_dis;
1220
1225 printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, 1221 printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy,
1226 npe_name(port->npe)); 1222 npe_name(port->npe));
1227 1223
1228 return 0; 1224 return 0;
1229 1225
1230err_unreg: 1226err_phy_dis:
1231 unregister_netdev(dev); 1227 phy_disconnect(port->phydev);
1228err_free_mem:
1229 npe_port_tab[NPE_ID(port->id)] = NULL;
1230 platform_set_drvdata(pdev, NULL);
1231 release_resource(port->mem_res);
1232err_npe_rel: 1232err_npe_rel:
1233 npe_release(port->npe); 1233 npe_release(port->npe);
1234err_free: 1234err_free:
@@ -1242,6 +1242,7 @@ static int __devexit eth_remove_one(struct platform_device *pdev)
1242 struct port *port = netdev_priv(dev); 1242 struct port *port = netdev_priv(dev);
1243 1243
1244 unregister_netdev(dev); 1244 unregister_netdev(dev);
1245 phy_disconnect(port->phydev);
1245 npe_port_tab[NPE_ID(port->id)] = NULL; 1246 npe_port_tab[NPE_ID(port->id)] = NULL;
1246 platform_set_drvdata(pdev, NULL); 1247 platform_set_drvdata(pdev, NULL);
1247 npe_release(port->npe); 1248 npe_release(port->npe);