phy: Add API for {un}registering an mdio device to a bus.

Rather than have drivers directly manipulate the mii_bus structure,
provide and API for registering and unregistering devices on an MDIO
bus, and performing lookups.

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:
Andrew Lunn
2016-01-06 20:11:18 +01:00
committed by David S. Miller
parent 801a8ef54e
commit 7f854420fb
17 changed files with 98 additions and 49 deletions

View File

@@ -1158,7 +1158,8 @@ static int smsc9420_mii_probe(struct net_device *dev)
BUG_ON(pd->phy_dev);
/* Device only supports internal PHY at address 1 */
if (!pd->mii_bus->phy_map[1]) {
phydev = mdiobus_get_phy(pd->mii_bus, 1);
if (!phydev) {
netdev_err(dev, "no PHY found at address 1\n");
return -ENODEV;
}