net: phy: stop PHY if needed when entering phy_disconnect
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 17 Jan 2019 19:07:54 +0000 (20:07 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Jan 2019 22:12:25 +0000 (14:12 -0800)
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>
drivers/net/phy/phy_device.c

index 3860dd85d0976c46f594ff2daa9c4ee1a228c4ae..616a5fe47f56933e83911c0f12cf39e5945beaaf 100644 (file)
@@ -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);