Commit f4f86d8d authored by Oleksij Rempel's avatar Oleksij Rempel Committed by David S. Miller

net: phy: execute genphy_loopback() per default on all PHYs

The generic loopback is really generic and is defined by the 802.3
standard, we should just mandate that drivers implement a custom
loopback if the generic one cannot work.
Suggested-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e9377a91
......@@ -1777,6 +1777,9 @@ int phy_loopback(struct phy_device *phydev, bool enable)
struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver);
int ret = 0;
if (!phydrv)
return -ENODEV;
mutex_lock(&phydev->lock);
if (enable && phydev->loopback_enabled) {
......@@ -1789,10 +1792,10 @@ int phy_loopback(struct phy_device *phydev, bool enable)
goto out;
}
if (phydev->drv && phydrv->set_loopback)
if (phydrv->set_loopback)
ret = phydrv->set_loopback(phydev, enable);
else
ret = -EOPNOTSUPP;
ret = genphy_loopback(phydev, enable);
if (ret)
goto out;
......
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