Skip to contentSkip to conversation

net: phy: fix phy_start to consider PHY_IGNORE_INTERRUPT

PATCH Superseded Heiner Kallweit 2 participants 3 messages Feb 7, 2018 – Feb 8, 2018

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH v2 1/1 net: phy: fix phy_start to consider PHY_IGNORE_INTERRUPT

This condition wasn't adjusted when PHY_IGNORE_INTERRUPT (-2) was added long ago. In case of PHY_IGNORE_INTERRUPT the MAC interrupt indicates also PHY state changes and we should do what the symbol says.

---
v2:
- use phy_interrupt_is_valid() instead of checking for irq > 0

---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
index f3313a129..50ed35a45 100644
@@ -822,7 +822,7 @@ void phy_start(struct phy_device *phydev)
 		phy_resume(phydev);
 
 		/* make sure interrupts are re-enabled for the PHY */
-		if (phydev->irq != PHY_POLL) {
+		if (phy_interrupt_is_valid(phydev)) {
 			err = phy_enable_interrupts(phydev);
 			if (err < 0)
 				break;
Signature · 1 line
2.16.1
#1 lore raw
Quoted 8 lines · Heiner Kallweit

This condition wasn't adjusted when PHY_IGNORE_INTERRUPT (-2) was added long ago. In case of PHY_IGNORE_INTERRUPT the MAC interrupt indicates also PHY state changes and we should do what the symbol says.

---
v2:
- use phy_interrupt_is_valid() instead of checking for irq > 0

Thanks, could you identify which Fixes: tag we should be using for that? It would be great to see this backported to -stable

Quoted 18 lines
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
index f3313a129..50ed35a45 100644
@@ -822,7 +822,7 @@ void phy_start(struct phy_device *phydev)
 		phy_resume(phydev);
 
 		/* make sure interrupts are re-enabled for the PHY */
-		if (phydev->irq != PHY_POLL) {
+		if (phy_interrupt_is_valid(phydev)) {
 			err = phy_enable_interrupts(phydev);
 			if (err < 0)
 				break;
Signature · 1 line
Florian
author maintainer
#2 lore raw

Am 08.02.2018 um 00:00 schrieb Florian Fainelli:

Quoted 5 lines · Heiner Kallweit
Quoted 4 lines

This condition wasn't adjusted when PHY_IGNORE_INTERRUPT (-2) was added long ago. In case of PHY_IGNORE_INTERRUPT the MAC interrupt indicates also PHY state changes and we should do what the symbol says.

Quoted 8 lines
Quoted 4 lines

---
v2:
- use phy_interrupt_is_valid() instead of checking for irq > 0

Thanks, could you identify which Fixes: tag we should be using for that? It would be great to see this backported to -stable

Before submitting the change I had a look at the phylib history for when the wrong behavior was introduced. However it has been there since introduction of phylib in 2005. Different patches fixed this in few, but not all places.
Latest one was 84a527a41f38 "net: phylib: fix interrupts re-enablement in phy_start" which just partially fixed the issue. So we could declare the change now to fix this fix.

Quoted 20 lines
Quoted 18 lines
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy.c +1 -1
index f3313a129..50ed35a45 100644
@@ -822,7 +822,7 @@ void phy_start(struct phy_device *phydev)
 		phy_resume(phydev);
 
 		/* make sure interrupts are re-enabled for the PHY */
-		if (phydev->irq != PHY_POLL) {
+		if (phy_interrupt_is_valid(phydev)) {
 			err = phy_enable_interrupts(phydev);
 			if (err < 0)
 				break;