summary refs log tree commit diff
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2019-01-17 20:07:54 +0100
committerDavid S. Miller <davem@davemloft.net>2019-01-18 14:12:25 -0800
commit472115d9834cd3a194a14269f28d8b146ad26c11 (patch)
tree0f333172a53af89933dd2e2210d36f3b922a352f
parent340a6f3d2d52a1b72f3454818e53293807f8f127 (diff)
downloadlinux-472115d9834cd3a194a14269f28d8b146ad26c11.tar.gz
net: phy: stop PHY if needed when entering phy_disconnect
Stop PHY if needed when entering phy_disconnect. This allows drivers
that don't need a separate call to phy_stop() to omit this call.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/phy_device.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 3860dd85d097..616a5fe47f56 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -999,6 +999,9 @@ EXPORT_SYMBOL(phy_connect);
  */
 void phy_disconnect(struct phy_device *phydev)
 {
+	if (phy_is_started(phydev))
+		phy_stop(phydev);
+
 	if (phydev->irq > 0)
 		phy_stop_interrupts(phydev);