From 95fb8bb3181bbe1ee87c95e91dff94f74f148c33 Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Wed, 28 Aug 2019 09:34:47 +0800 Subject: 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 Reviewed-by: Heiner Kallweit Signed-off-by: David S. Miller --- drivers/net/phy/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index f3adea9ef400..0acd5b49f450 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -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; } -- cgit v1.2.3-59-g8ed1b