Skip to content

Commit d5c3d84

Browse files
ffainellidavem330
authored andcommitted
net: phy: Avoid polling PHY with PHY_IGNORE_INTERRUPTS
Commit 2c7b492 ("phy: fix the use of PHY_IGNORE_INTERRUPT") changed a hunk in phy_state_machine() in the PHY_RUNNING case which was not needed. The change essentially makes the PHY library treat PHY devices with PHY_IGNORE_INTERRUPT to keep polling for the PHY device, even though the intent is not to do it. Fix this by reverting that specific hunk, which makes the PHY state machine wait for state changes, and stay in the PHY_RUNNING state for as long as needed. Fixes: 2c7b492 ("phy: fix the use of PHY_IGNORE_INTERRUPT") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ceb6560 commit d5c3d84

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/net/phy/phy.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -905,10 +905,10 @@ void phy_state_machine(struct work_struct *work)
905905
phydev->adjust_link(phydev->attached_dev);
906906
break;
907907
case PHY_RUNNING:
908-
/* Only register a CHANGE if we are polling or ignoring
909-
* interrupts and link changed since latest checking.
908+
/* Only register a CHANGE if we are polling and link changed
909+
* since latest checking.
910910
*/
911-
if (!phy_interrupt_is_valid(phydev)) {
911+
if (phydev->irq == PHY_POLL) {
912912
old_link = phydev->link;
913913
err = phy_read_status(phydev);
914914
if (err)
@@ -1000,8 +1000,13 @@ void phy_state_machine(struct work_struct *work)
10001000
phy_state_to_str(old_state),
10011001
phy_state_to_str(phydev->state));
10021002

1003-
queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
1004-
PHY_STATE_TIME * HZ);
1003+
/* Only re-schedule a PHY state machine change if we are polling the
1004+
* PHY, if PHY_IGNORE_INTERRUPT is set, then we will be moving
1005+
* between states from phy_mac_interrupt()
1006+
*/
1007+
if (phydev->irq == PHY_POLL)
1008+
queue_delayed_work(system_power_efficient_wq, &phydev->state_queue,
1009+
PHY_STATE_TIME * HZ);
10051010
}
10061011

10071012
void phy_mac_interrupt(struct phy_device *phydev, int new_link)

0 commit comments

Comments
 (0)