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

parent
35d2aeac98
commit
e7f4dc3536
@@ -2859,7 +2859,7 @@ static int sh_mdio_release(struct sh_eth_private *mdp)
|
||||
static int sh_mdio_init(struct sh_eth_private *mdp,
|
||||
struct sh_eth_plat_data *pd)
|
||||
{
|
||||
int ret, i;
|
||||
int ret;
|
||||
struct bb_info *bitbang;
|
||||
struct platform_device *pdev = mdp->pdev;
|
||||
struct device *dev = &mdp->pdev->dev;
|
||||
@@ -2885,20 +2885,10 @@ static int sh_mdio_init(struct sh_eth_private *mdp,
|
||||
snprintf(mdp->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
|
||||
pdev->name, pdev->id);
|
||||
|
||||
/* PHY IRQ */
|
||||
mdp->mii_bus->irq = devm_kmalloc_array(dev, PHY_MAX_ADDR, sizeof(int),
|
||||
GFP_KERNEL);
|
||||
if (!mdp->mii_bus->irq) {
|
||||
ret = -ENOMEM;
|
||||
goto out_free_bus;
|
||||
}
|
||||
|
||||
/* register MDIO bus */
|
||||
if (dev->of_node) {
|
||||
ret = of_mdiobus_register(mdp->mii_bus, dev->of_node);
|
||||
} else {
|
||||
for (i = 0; i < PHY_MAX_ADDR; i++)
|
||||
mdp->mii_bus->irq[i] = PHY_POLL;
|
||||
if (pd->phy_irq > 0)
|
||||
mdp->mii_bus->irq[pd->phy] = pd->phy_irq;
|
||||
|
||||
|
Reference in New Issue
Block a user