diff mbox series

[net-next] net: phy: simplify genphy_c45_ethtool_set_eee

Message ID 442277c7-7431-4542-80b5-1d3d691714d7@gmail.com (mailing list archive)
State Accepted
Commit b38061fe9cfa90a781e9e59fc761191fc8b469a1
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: phy: simplify genphy_c45_ethtool_set_eee | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 940 this patch: 940
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 957 this patch: 957
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 957 this patch: 957
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 32 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-23--03-00 (tests: 1457)

Commit Message

Heiner Kallweit Feb. 20, 2024, 9:55 p.m. UTC
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 <hkallweit1@gmail.com>
---
 drivers/net/phy/phy-c45.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Feb. 27, 2024, 8:20 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

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!
diff mbox series

Patch

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index c69568e76..9566645ea 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -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);