diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2018-10-11 22:37:38 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-10-15 22:06:38 -0700 |
commit | eb4c470a154d2d3176d08155c3136973661f69ad (patch) | |
tree | a11a0826ea0eea4cd06521d2056fec2b07349822 /drivers | |
parent | 74fb5e25a3e925286e80eb2e0253f88f2b44ec96 (diff) | |
download | linux-eb4c470a154d2d3176d08155c3136973661f69ad.tar.bz2 |
net: phy: simplify handling of PHY_RESUMING in state machine
Simplify code for handling state PHY_RESUMING, no functional change
intended.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/phy/phy.c | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 696955d38dd6..d03bdbbd1eaf 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1059,41 +1059,26 @@ void phy_state_machine(struct work_struct *work) case PHY_RESUMING: if (AUTONEG_ENABLE == phydev->autoneg) { err = phy_aneg_done(phydev); - if (err < 0) + if (err < 0) { break; - - /* err > 0 if AN is done. - * Otherwise, it's 0, and we're still waiting for AN - */ - if (err > 0) { - err = phy_read_status(phydev); - if (err) - break; - - if (phydev->link) { - phydev->state = PHY_RUNNING; - phy_link_up(phydev); - } else { - phydev->state = PHY_NOLINK; - phy_link_down(phydev, false); - } - } else { + } else if (!err) { phydev->state = PHY_AN; phydev->link_timeout = PHY_AN_TIMEOUT; - } - } else { - err = phy_read_status(phydev); - if (err) break; - - if (phydev->link) { - phydev->state = PHY_RUNNING; - phy_link_up(phydev); - } else { - phydev->state = PHY_NOLINK; - phy_link_down(phydev, false); } } + + err = phy_read_status(phydev); + if (err) + break; + + if (phydev->link) { + phydev->state = PHY_RUNNING; + phy_link_up(phydev); + } else { + phydev->state = PHY_NOLINK; + phy_link_down(phydev, false); + } break; } |