netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: simplify a check in phy_check_link_status
@ 2024-03-07 21:16 Heiner Kallweit
  2024-03-08  4:50 ` [PATCH] " Ratheesh Kannoth
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Heiner Kallweit @ 2024-03-07 21:16 UTC (permalink / raw)
  To: Russell King - ARM Linux, Andrew Lunn, Paolo Abeni, Eric Dumazet,
	David Miller, Jakub Kicinski
  Cc: netdev@vger.kernel.org

Handling case err == 0 in the other branch allows to simplify the
code. In addition I assume in "err & phydev->eee_cfg.tx_lpi_enabled"
it should have been a logical and operator. It works as expected also
with the bitwise and, but using a bitwise and with a bool value looks
ugly to me.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index c3a0a5ee5..c4236564c 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -985,10 +985,10 @@ static int phy_check_link_status(struct phy_device *phydev)
 		phydev->state = PHY_RUNNING;
 		err = genphy_c45_eee_is_active(phydev,
 					       NULL, NULL, NULL);
-		if (err < 0)
+		if (err <= 0)
 			phydev->enable_tx_lpi = false;
 		else
-			phydev->enable_tx_lpi = (err & phydev->eee_cfg.tx_lpi_enabled);
+			phydev->enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled;
 
 		phy_link_up(phydev);
 	} else if (!phydev->link && phydev->state != PHY_NOLINK) {
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-03-11 21:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-07 21:16 [PATCH net-next] net: phy: simplify a check in phy_check_link_status Heiner Kallweit
2024-03-08  4:50 ` [PATCH] " Ratheesh Kannoth
2024-03-08  7:09   ` Heiner Kallweit
2024-03-08  7:39 ` [EXTERNAL] [PATCH net-next] " Suman Ghosh
2024-03-11 20:44 ` Heiner Kallweit
2024-03-11 21:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).