Skip to contentSkip to conversation

net: phy: simplify genphy_c45_ethtool_set_eee

PATCH Applied Heiner Kallweit 2 participants 2 messages Feb 20, 2024 – Feb 27, 2024

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH 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

---
 drivers/net/phy/phy-c45.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/net/phy/phy-c45.c +4 -9
index c69568e76..9566645ea 100644
@@ -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
#1 lore raw
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 setting phydev->eee_enabled out 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