OSDN Git Service

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 3860dd8..616a5fe 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);