diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2017-11-30 23:46:19 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-01 21:42:21 +0100 |
commit | 00fde79532d66d18cd0b21fdbd515f4b14078ccf (patch) | |
tree | ba2f3b655ba0124d0a873881b9f7e918b6280056 /drivers | |
parent | Merge branch 'ip6_gre-add-erspan-native-tunnel-for-ipv6' (diff) | |
download | linux-00fde79532d66d18cd0b21fdbd515f4b14078ccf.tar.xz linux-00fde79532d66d18cd0b21fdbd515f4b14078ccf.zip |
net: phy: core: use genphy version of callbacks read_status and config_aneg per default
read_status and config_aneg are the only mandatory callbacks and most
of the time the generic implementation is used by drivers.
So make the core fall back to the generic version if a driver doesn't
implement the respective callback.
Also currently the core doesn't seem to verify that drivers implement
the mandatory calls. If a driver doesn't do so we'd just get a NPE.
With this patch this potential issue doesn't exit any longer.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/phy/phy.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 2b1e67bc1e73..a0e7605dc39a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -493,7 +493,10 @@ static int phy_start_aneg_priv(struct phy_device *phydev, bool sync) /* Invalidate LP advertising flags */ phydev->lp_advertising = 0; - err = phydev->drv->config_aneg(phydev); + if (phydev->drv->config_aneg) + err = phydev->drv->config_aneg(phydev); + else + err = genphy_config_aneg(phydev); if (err < 0) goto out_unlock; |