Skip to contentSkip to conversation

net: phy: remove phy_error from phy_disable_interrupts

PATCH In review Heiner Kallweit 3 participants 6 messages Mar 5, 2018 – Mar 7, 2018

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

v2 cover 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() takes this lock). Make use of this in phy_stop().

v2:
- splitted into two separate patches

Heiner Kallweit (2):
net: phy: remove phy_error from phy_disable_interrupts
net: phy: use phy_disable_interrupts in phy_stop

 drivers/net/phy/phy.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)
Signature · 1 line
2.16.2
author maintainer
#1 lore raw

PATCH v2 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).

---
 drivers/net/phy/phy.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/phy/phy.c +2 -11
index a6f924fee..c5aa773ea 100644
@@ -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);
 }
 
 /**
Signature · 1 line
2.16.2
maintainer Reviewed-by on v2 1/2
#2 lore raw
Quoted 6 lines · Heiner Kallweit

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).

Andrew

author maintainer
#3 lore raw

PATCH v2 2/2 net: phy: use phy_disable_interrupts in phy_stop

In reply to Heiner Kallweit

Now that phy_disable_interrupts() can't take lock phydev->lock any longer, we can use it to simplify phy_stop().

---
 drivers/net/phy/phy.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/net/phy/phy.c +2 -7
index c5aa773ea..c2d9027be 100644
@@ -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;
 
Signature · 1 line
2.16.2
maintainer
#5 lore raw
In reply to Heiner Kallweit

From: Heiner Kallweit <[email protected]>
Date: Mon, 5 Mar 2018 22:29:43 +0100

Quoted 8 lines

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() takes this lock). Make use of this in phy_stop().

v2:
- splitted into two separate patches

Series applied, thanks.