diff options
author | Gerhard Engleder <gerhard@engleder-embedded.com> | 2021-08-19 15:11:52 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-08-20 14:31:46 +0100 |
commit | 4ed311b08a91fe0a214714605d8159fc51166982 (patch) | |
tree | bade64e600508fe4922894bbb8af5a11413f901d /drivers | |
parent | 600003a364a8030b79f57ba54a3852abf95aafb0 (diff) | |
download | linux-stable-4ed311b08a91fe0a214714605d8159fc51166982.tar.gz linux-stable-4ed311b08a91fe0a214714605d8159fc51166982.tar.bz2 linux-stable-4ed311b08a91fe0a214714605d8159fc51166982.zip |
net: phy: Support set_loopback override
phy_read_status and various other PHY functions support PHY specific
overriding of driver functions by using a PHY specific pointer to the
PHY driver. Add support of PHY specific override to phy_loopback too.
Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/phy/phy_device.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 107aa6d7bc6b..ba5ad86ec826 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -1821,11 +1821,10 @@ EXPORT_SYMBOL(phy_resume); 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; + if (!phydev->drv) + return -EIO; mutex_lock(&phydev->lock); @@ -1839,8 +1838,8 @@ int phy_loopback(struct phy_device *phydev, bool enable) goto out; } - if (phydrv->set_loopback) - ret = phydrv->set_loopback(phydev, enable); + if (phydev->drv->set_loopback) + ret = phydev->drv->set_loopback(phydev, enable); else ret = genphy_loopback(phydev, enable); |