diff mbox series

[v3,net-next,1/3] net: phy: stop PHY if needed when entering phy_disconnect

Message ID f0248feb-f58a-b59e-a041-0421ec1f8151@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series net: phy: improve stopping PHY | expand

Commit Message

Heiner Kallweit Jan. 17, 2019, 7:07 p.m. UTC
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>
---
 drivers/net/phy/phy_device.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index b5f5cda4c..9e588f03e 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);