mdio: Move allocation of interrupts into core
Have mdio_alloc() create the array of interrupt numbers, and initialize it to POLLING. This is what most MDIO drivers want, so allowing code to be removed from the drivers. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

orang tua
35d2aeac98
melakukan
e7f4dc3536
@@ -682,18 +682,9 @@ static int tc_mii_init(struct net_device *dev)
|
||||
(lp->pci_dev->bus->number << 8) | lp->pci_dev->devfn);
|
||||
lp->mii_bus->priv = dev;
|
||||
lp->mii_bus->parent = &lp->pci_dev->dev;
|
||||
lp->mii_bus->irq = kmalloc(sizeof(int) * PHY_MAX_ADDR, GFP_KERNEL);
|
||||
if (!lp->mii_bus->irq) {
|
||||
err = -ENOMEM;
|
||||
goto err_out_free_mii_bus;
|
||||
}
|
||||
|
||||
for (i = 0; i < PHY_MAX_ADDR; i++)
|
||||
lp->mii_bus->irq[i] = PHY_POLL;
|
||||
|
||||
err = mdiobus_register(lp->mii_bus);
|
||||
if (err)
|
||||
goto err_out_free_mdio_irq;
|
||||
goto err_out_free_mii_bus;
|
||||
err = tc_mii_probe(dev);
|
||||
if (err)
|
||||
goto err_out_unregister_bus;
|
||||
@@ -701,8 +692,6 @@ static int tc_mii_init(struct net_device *dev)
|
||||
|
||||
err_out_unregister_bus:
|
||||
mdiobus_unregister(lp->mii_bus);
|
||||
err_out_free_mdio_irq:
|
||||
kfree(lp->mii_bus->irq);
|
||||
err_out_free_mii_bus:
|
||||
mdiobus_free(lp->mii_bus);
|
||||
err_out:
|
||||
@@ -880,7 +869,6 @@ static void tc35815_remove_one(struct pci_dev *pdev)
|
||||
|
||||
phy_disconnect(lp->phy_dev);
|
||||
mdiobus_unregister(lp->mii_bus);
|
||||
kfree(lp->mii_bus->irq);
|
||||
mdiobus_free(lp->mii_bus);
|
||||
unregister_netdev(dev);
|
||||
free_netdev(dev);
|
||||
|
Reference in New Issue
Block a user