Commit e1cc1c57 authored by David S. Miller's avatar David S. Miller
parents 9d34d1a2 7aa6a478
...@@ -714,7 +714,7 @@ static int __init npe_init_module(void) ...@@ -714,7 +714,7 @@ static int __init npe_init_module(void)
} }
if (!found) if (!found)
return -ENOSYS; return -ENODEV;
return 0; return 0;
} }
......
...@@ -338,12 +338,12 @@ static int ixp4xx_mdio_register(void) ...@@ -338,12 +338,12 @@ static int ixp4xx_mdio_register(void)
if (cpu_is_ixp43x()) { if (cpu_is_ixp43x()) {
/* IXP43x lacks NPE-B and uses NPE-C for MII PHY access */ /* IXP43x lacks NPE-B and uses NPE-C for MII PHY access */
if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEC_ETH)) if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEC_ETH))
return -ENOSYS; return -ENODEV;
mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT; mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthC_BASE_VIRT;
} else { } else {
/* All MII PHY accesses use NPE-B Ethernet registers */ /* All MII PHY accesses use NPE-B Ethernet registers */
if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0)) if (!(ixp4xx_read_feature_bits() & IXP4XX_FEATURE_NPEB_ETH0))
return -ENOSYS; return -ENODEV;
mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT; mdio_regs = (struct eth_regs __iomem *)IXP4XX_EthB_BASE_VIRT;
} }
...@@ -1174,7 +1174,7 @@ static int __devinit eth_init_one(struct platform_device *pdev) ...@@ -1174,7 +1174,7 @@ static int __devinit eth_init_one(struct platform_device *pdev)
regs_phys = IXP4XX_EthC_BASE_PHYS; regs_phys = IXP4XX_EthC_BASE_PHYS;
break; break;
default: default:
err = -ENOSYS; err = -ENODEV;
goto err_free; goto err_free;
} }
...@@ -1189,15 +1189,10 @@ static int __devinit eth_init_one(struct platform_device *pdev) ...@@ -1189,15 +1189,10 @@ static int __devinit eth_init_one(struct platform_device *pdev)
goto err_free; goto err_free;
} }
if (register_netdev(dev)) {
err = -EIO;
goto err_npe_rel;
}
port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name); port->mem_res = request_mem_region(regs_phys, REGS_SIZE, dev->name);
if (!port->mem_res) { if (!port->mem_res) {
err = -EBUSY; err = -EBUSY;
goto err_unreg; goto err_npe_rel;
} }
port->plat = plat; port->plat = plat;
...@@ -1215,20 +1210,25 @@ static int __devinit eth_init_one(struct platform_device *pdev) ...@@ -1215,20 +1210,25 @@ static int __devinit eth_init_one(struct platform_device *pdev)
snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, "0", plat->phy); snprintf(phy_id, BUS_ID_SIZE, PHY_ID_FMT, "0", plat->phy);
port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0, port->phydev = phy_connect(dev, phy_id, &ixp4xx_adjust_link, 0,
PHY_INTERFACE_MODE_MII); PHY_INTERFACE_MODE_MII);
if (IS_ERR(port->phydev)) { if ((err = IS_ERR(port->phydev)))
printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name); goto err_free_mem;
return PTR_ERR(port->phydev);
}
port->phydev->irq = PHY_POLL; port->phydev->irq = PHY_POLL;
if ((err = register_netdev(dev)))
goto err_phy_dis;
printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy, printk(KERN_INFO "%s: MII PHY %i on %s\n", dev->name, plat->phy,
npe_name(port->npe)); npe_name(port->npe));
return 0; return 0;
err_unreg: err_phy_dis:
unregister_netdev(dev); phy_disconnect(port->phydev);
err_free_mem:
npe_port_tab[NPE_ID(port->id)] = NULL;
platform_set_drvdata(pdev, NULL);
release_resource(port->mem_res);
err_npe_rel: err_npe_rel:
npe_release(port->npe); npe_release(port->npe);
err_free: err_free:
...@@ -1242,6 +1242,7 @@ static int __devexit eth_remove_one(struct platform_device *pdev) ...@@ -1242,6 +1242,7 @@ static int __devexit eth_remove_one(struct platform_device *pdev)
struct port *port = netdev_priv(dev); struct port *port = netdev_priv(dev);
unregister_netdev(dev); unregister_netdev(dev);
phy_disconnect(port->phydev);
npe_port_tab[NPE_ID(port->id)] = NULL; npe_port_tab[NPE_ID(port->id)] = NULL;
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
npe_release(port->npe); npe_release(port->npe);
......
...@@ -1249,7 +1249,7 @@ static int __devinit hss_init_one(struct platform_device *pdev) ...@@ -1249,7 +1249,7 @@ static int __devinit hss_init_one(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
if ((port->npe = npe_request(0)) == NULL) { if ((port->npe = npe_request(0)) == NULL) {
err = -ENOSYS; err = -ENODEV;
goto err_free; goto err_free;
} }
...@@ -1311,7 +1311,7 @@ static int __init hss_init_module(void) ...@@ -1311,7 +1311,7 @@ static int __init hss_init_module(void)
if ((ixp4xx_read_feature_bits() & if ((ixp4xx_read_feature_bits() &
(IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS)) != (IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS)) !=
(IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS)) (IXP4XX_FEATURE_HDLC | IXP4XX_FEATURE_HSS))
return -ENOSYS; return -ENODEV;
spin_lock_init(&npe_lock); spin_lock_init(&npe_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment