net: stmmac: use xpcs_create_mdiodev()
Use the new xpcs_create_mdiodev() creator, which simplifies the creation and destruction of the mdio device associated with xpcs. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
9a5d500cff
commit
727e373f89
@ -491,7 +491,6 @@ int stmmac_mdio_reset(struct mii_bus *bus)
|
||||
int stmmac_xpcs_setup(struct mii_bus *bus)
|
||||
{
|
||||
struct net_device *ndev = bus->priv;
|
||||
struct mdio_device *mdiodev;
|
||||
struct stmmac_priv *priv;
|
||||
struct dw_xpcs *xpcs;
|
||||
int mode, addr;
|
||||
@ -501,16 +500,10 @@ int stmmac_xpcs_setup(struct mii_bus *bus)
|
||||
|
||||
/* Try to probe the XPCS by scanning all addresses. */
|
||||
for (addr = 0; addr < PHY_MAX_ADDR; addr++) {
|
||||
mdiodev = mdio_device_create(bus, addr);
|
||||
if (IS_ERR(mdiodev))
|
||||
xpcs = xpcs_create_mdiodev(bus, addr, mode);
|
||||
if (IS_ERR(xpcs))
|
||||
continue;
|
||||
|
||||
xpcs = xpcs_create(mdiodev, mode);
|
||||
if (IS_ERR_OR_NULL(xpcs)) {
|
||||
mdio_device_free(mdiodev);
|
||||
continue;
|
||||
}
|
||||
|
||||
priv->hw->xpcs = xpcs;
|
||||
break;
|
||||
}
|
||||
@ -669,10 +662,8 @@ int stmmac_mdio_unregister(struct net_device *ndev)
|
||||
if (!priv->mii)
|
||||
return 0;
|
||||
|
||||
if (priv->hw->xpcs) {
|
||||
mdio_device_free(priv->hw->xpcs->mdiodev);
|
||||
if (priv->hw->xpcs)
|
||||
xpcs_destroy(priv->hw->xpcs);
|
||||
}
|
||||
|
||||
mdiobus_unregister(priv->mii);
|
||||
priv->mii->priv = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user