Skip to content

Commit 42caa07

Browse files
Wade Farnsworthdavem330
authored andcommitted
phylib: fixes for PHY_RESUMING state changes
The PHY_HALTED state disables phydev->link, but the link will not be updated upon entering PHY_RESUMING. Add a call to phy_read_status() to update the link before entering PHY_RUNNING. If the link is not up at this point, enter the PHY_NOLINK state instead. Also, when transitioning from PHY_RESUMING to PHY_RUNNING, calls to netif_carrier_on() and phydev->adjust_link() are missing. Add the calls similar to the other transitions to PHY_RUNNING. Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com> Acked-by: Andy Fleming <afleming@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 67c38fc commit 42caa07

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

‎drivers/net/phy/phy.c‎

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -928,13 +928,32 @@ static void phy_state_machine(struct work_struct *work)
928928
* Otherwise, it's 0, and we're
929929
* still waiting for AN */
930930
if (err > 0) {
931-
phydev->state = PHY_RUNNING;
931+
err = phy_read_status(phydev);
932+
if (err)
933+
break;
934+
935+
if (phydev->link) {
936+
phydev->state = PHY_RUNNING;
937+
netif_carrier_on(phydev->attached_dev);
938+
} else
939+
phydev->state = PHY_NOLINK;
940+
phydev->adjust_link(phydev->attached_dev);
932941
} else {
933942
phydev->state = PHY_AN;
934943
phydev->link_timeout = PHY_AN_TIMEOUT;
935944
}
936-
} else
937-
phydev->state = PHY_RUNNING;
945+
} else {
946+
err = phy_read_status(phydev);
947+
if (err)
948+
break;
949+
950+
if (phydev->link) {
951+
phydev->state = PHY_RUNNING;
952+
netif_carrier_on(phydev->attached_dev);
953+
} else
954+
phydev->state = PHY_NOLINK;
955+
phydev->adjust_link(phydev->attached_dev);
956+
}
938957
break;
939958
}
940959

0 commit comments

Comments
 (0)