net: phy: force phy suspend when calling phy_stop

Some ethernet drivers may call phy_start() and phy_stop() from
ndo_open() and ndo_close() respectively.

When network cable is unconnected, and operate like below:
step 1: ifconfig ethX up -> ndo_open -> phy_start ->start
autoneg, and phy is no link.
step 2: ifconfig ethX down -> ndo_close -> phy_stop -> just stop
phy state machine.

This patch forces phy suspend even phydev->link is off.

Signed-off-by: Jian Shen <[email protected]>
Reviewed-by: Heiner Kallweit <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
Jian Shen authored and David S. Miller committed 2019-08-28 16:16:27 -07:00
1 parent 8e4a2adced
commit 95fb8bb318
1 file changed
+1 -1
+1 -1
View File
@@ -911,8 +911,8 @@ void phy_state_machine(struct work_struct *work)
if (phydev->link) {
phydev->link = 0;
phy_link_down(phydev, true);
do_suspend = true;
}
do_suspend = true;
break;
}