Skip to content

Commit c786459

Browse files
hkallweitkuba-moo
authored andcommitted
net: phy: simplify a check in phy_check_link_status
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 22ca20f commit c786459

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/phy/phy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,10 +985,10 @@ static int phy_check_link_status(struct phy_device *phydev)
985985
phydev->state = PHY_RUNNING;
986986
err = genphy_c45_eee_is_active(phydev,
987987
NULL, NULL, NULL);
988-
if (err < 0)
988+
if (err <= 0)
989989
phydev->enable_tx_lpi = false;
990990
else
991-
phydev->enable_tx_lpi = (err & phydev->eee_cfg.tx_lpi_enabled);
991+
phydev->enable_tx_lpi = phydev->eee_cfg.tx_lpi_enabled;
992992

993993
phy_link_up(phydev);
994994
} else if (!phydev->link && phydev->state != PHY_NOLINK) {

0 commit comments

Comments
 (0)