Skip to content

Commit

Permalink
net: phy: Support set_loopback override
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gerhard Engleder authored and David S. Miller committed Aug 20, 2021
1 parent 600003a commit 4ed311b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);

Expand Down

0 comments on commit 4ed311b

Please sign in to comment.