Skip to content

Commit

Permalink
net: phy: improve phy_init_hw
Browse files Browse the repository at this point in the history
Currently the soft reset (if defined) is done only if the driver also
implements the config_init callback. I think this dependency is a
mistake, so let's remove it.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Heiner Kallweit authored and David S. Miller committed Jan 22, 2019
1 parent 21e1944 commit a599698
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/phy/phy_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ int phy_init_hw(struct phy_device *phydev)
/* Deassert the reset signal */
phy_device_reset(phydev, 0);

if (!phydev->drv || !phydev->drv->config_init)
if (!phydev->drv)
return 0;

if (phydev->drv->soft_reset)
Expand All @@ -1085,7 +1085,10 @@ int phy_init_hw(struct phy_device *phydev)
if (ret < 0)
return ret;

return phydev->drv->config_init(phydev);
if (phydev->drv->config_init)
ret = phydev->drv->config_init(phydev);

return ret;
}
EXPORT_SYMBOL(phy_init_hw);

Expand Down

0 comments on commit a599698

Please sign in to comment.