From 4fff2d33c707938c537b7aeb2c511226f8a20313 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Mon, 5 Mar 2018 22:34:27 +0100 Subject: [PATCH 1/2] net: phy: remove phy_error from phy_disable_interrupts All callers of phy_disable_interrupts() call phy_error() in the error case. Therefore we don't need to do this within the function too. This change also allows us to use phy_disable_interrupts() in code holding phydev->lock (because phy_error() can take this lock). Signed-off-by: Heiner Kallweit Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller --- drivers/net/phy/phy.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index a6f924fee5840..c5aa773eacdcd 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -662,19 +662,10 @@ static int phy_disable_interrupts(struct phy_device *phydev) /* Disable PHY interrupts */ err = phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED); if (err) - goto phy_err; + return err; /* Clear the interrupt */ - err = phy_clear_interrupt(phydev); - if (err) - goto phy_err; - - return 0; - -phy_err: - phy_error(phydev); - - return err; + return phy_clear_interrupt(phydev); } /** From 70a55c32ee6f3781d294d64c75380c94f4b99ae8 Mon Sep 17 00:00:00 2001 From: Heiner Kallweit Date: Mon, 5 Mar 2018 22:34:46 +0100 Subject: [PATCH 2/2] net: phy: use phy_disable_interrupts in phy_stop Now that phy_disable_interrupts() can't take lock phydev->lock any longer, we can use it to simplify phy_stop(). Signed-off-by: Heiner Kallweit Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller --- drivers/net/phy/phy.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index c5aa773eacdcd..c2d9027be863b 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -765,13 +765,8 @@ void phy_stop(struct phy_device *phydev) if (PHY_HALTED == phydev->state) goto out_unlock; - if (phy_interrupt_is_valid(phydev)) { - /* Disable PHY Interrupts */ - phy_config_interrupt(phydev, PHY_INTERRUPT_DISABLED); - - /* Clear any pending interrupts */ - phy_clear_interrupt(phydev); - } + if (phy_interrupt_is_valid(phydev)) + phy_disable_interrupts(phydev); phydev->state = PHY_HALTED;