[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <442277c7-7431-4542-80b5-1d3d691714d7@gmail.com>
Date: Tue, 20 Feb 2024 22:55:38 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Andrew Lunn <andrew@...n.ch>,
Russell King - ARM Linux <linux@...linux.org.uk>,
Paolo Abeni <pabeni@...hat.com>, Jakub Kicinski <kuba@...nel.org>,
David Miller <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>
Cc: "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: [PATCH net-next] 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 <hkallweit1@...il.com>
---
drivers/net/phy/phy-c45.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
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);
--
2.43.2
Powered by blists - more mailing lists