net: phy: simplify genphy_c45_ethtool_set_eee
Subsystems (3)
Heiner Kallweit
maintainerPATCH 1/1 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 Heiner Kallweit <[email protected]>
--- drivers/net/phy/phy-c45.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/net/phy/phy-c45.c +4 -9
@@ -1560,10 +1560,8 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev,if (!linkmode_empty (adv)) {__ETHTOOL_DECLARE_LINK_MODE_MASK (tmp); -bool unsupp; - unsupp =linkmode_andnot (tmp, adv, phydev->supported_eee); -if (unsupp) { +if (linkmode_andnot (tmp, adv, phydev->supported_eee)) {phydev_warn (phydev,"At least some EEE link modes are not supported.\n" );return -EINVAL ; }
@@ -1572,18 +1570,15 @@ int genphy_c45_ethtool_set_eee(struct phy_device *phydev, }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); -if (ret <0 ) -return ret;if (ret >0 )return phy_restart_aneg (phydev); -return 0 ; +return ret; }EXPORT_SYMBOL (genphy_c45_ethtool_set_eee);
Signature · 1 line
2.43.2
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 8 lines · On Tue, 20 Feb 2024 22:55:38 +0100 you wrote:
Simplify the function, no functional change intended.
- Remove not needed variable unsupp, I think code is even better readable now.
- Move settingphydev->eee_enabledout of the if clause
- Simplify return value handling[...]
Here is the summary with links:
- [net-next] net: phy: simplify genphy_c45_ethtool_set_eee
https://git.kernel.org/netdev/net-next/c/b38061fe9cfa
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html