Commit b38061fe authored by Heiner Kallweit's avatar Heiner Kallweit Committed by Paolo Abeni

net: phy: simplify genphy_c45_ethtool_set_eee

Simplify the function, no functional change intended.

- Remove not needed variable unsupp, I think code is even better
  readable now.
- Move setting phydev->eee_enabled out of the if clause
- Simplify return value handling
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/442277c7-7431-4542-80b5-1d3d691714d7@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 55a72460
...@@ -1561,10 +1561,8 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev, ...@@ -1561,10 +1561,8 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev,
if (!linkmode_empty(adv)) { if (!linkmode_empty(adv)) {
__ETHTOOL_DECLARE_LINK_MODE_MASK(tmp); __ETHTOOL_DECLARE_LINK_MODE_MASK(tmp);
bool unsupp;
unsupp = linkmode_andnot(tmp, adv, phydev->supported_eee); if (linkmode_andnot(tmp, adv, phydev->supported_eee)) {
if (unsupp) {
phydev_warn(phydev, "At least some EEE link modes are not supported.\n"); phydev_warn(phydev, "At least some EEE link modes are not supported.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1573,18 +1571,15 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev, ...@@ -1573,18 +1571,15 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev,
} }
linkmode_copy(phydev->advertising_eee, adv); linkmode_copy(phydev->advertising_eee, adv);
phydev->eee_enabled = true;
} else {
phydev->eee_enabled = false;
} }
phydev->eee_enabled = data->eee_enabled;
ret = genphy_c45_an_config_eee_aneg(phydev); ret = genphy_c45_an_config_eee_aneg(phydev);
if (ret < 0)
return ret;
if (ret > 0) if (ret > 0)
return phy_restart_aneg(phydev); return phy_restart_aneg(phydev);
return 0; return ret;
} }
EXPORT_SYMBOL(genphy_c45_ethtool_set_eee); EXPORT_SYMBOL(genphy_c45_ethtool_set_eee);
......
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