Skip to content

Commit

Permalink
net: phy: core: don't disable device interrupts in phy_change
Browse files Browse the repository at this point in the history
If state is not PHY_HALTED I see no need to temporarily disable
interrupts on the device. As long as the current interrupt isn't acked
on the device no new interrupt can happen anyway.

In addition remove a unneeded enabling of interrupts in the state
machine when handling state PHY_CHANGELINK.

Tested on a Odroid-C2 with RTL8211F phy in interrupt mode.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Heiner Kallweit authored and David S. Miller committed Dec 4, 2017
1 parent a6d1642 commit c34bc2b
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions drivers/net/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,24 +730,21 @@ void phy_change(struct phy_device *phydev)
!phydev->drv->did_interrupt(phydev))
return;

if (phy_disable_interrupts(phydev))
goto phy_err;
if (phydev->state == PHY_HALTED)
if (phy_disable_interrupts(phydev))
goto phy_err;
}

mutex_lock(&phydev->lock);
if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state))
phydev->state = PHY_CHANGELINK;
mutex_unlock(&phydev->lock);

if (phy_interrupt_is_valid(phydev)) {
/* Reenable interrupts */
if (PHY_HALTED != phydev->state &&
phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED))
goto phy_err;
}

/* reschedule state queue work to run as soon as possible */
phy_trigger_machine(phydev, true);

if (phy_interrupt_is_valid(phydev) && phy_clear_interrupt(phydev))
goto phy_err;
return;

phy_err:
Expand Down Expand Up @@ -987,10 +984,6 @@ void phy_state_machine(struct work_struct *work)
phydev->state = PHY_NOLINK;
phy_link_down(phydev, true);
}

if (phy_interrupt_is_valid(phydev))
err = phy_config_interrupt(phydev,
PHY_INTERRUPT_ENABLED);
break;
case PHY_HALTED:
if (phydev->link) {
Expand Down

0 comments on commit c34bc2b

Please sign in to comment.