aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2017-11-30 17:57:00 -0500
committerDavid S. Miller <davem@davemloft.net>2017-12-04 10:23:42 -0500
commitc34bc2b5059c515aebc3dde4c34baba6db3fd43f (patch)
tree6b257a9110766e92b0aaff09b0f973970c40fa8a /drivers/net/phy/phy.c
parenta6d1642dab0c49829cda61508cbdc97172815ff7 (diff)
net: phy: core: don't disable device interrupts in phy_change
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>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index b410e0c17147..944143b521d7 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -730,8 +730,9 @@ void phy_change(struct phy_device *phydev)
730 !phydev->drv->did_interrupt(phydev)) 730 !phydev->drv->did_interrupt(phydev))
731 return; 731 return;
732 732
733 if (phy_disable_interrupts(phydev)) 733 if (phydev->state == PHY_HALTED)
734 goto phy_err; 734 if (phy_disable_interrupts(phydev))
735 goto phy_err;
735 } 736 }
736 737
737 mutex_lock(&phydev->lock); 738 mutex_lock(&phydev->lock);
@@ -739,15 +740,11 @@ void phy_change(struct phy_device *phydev)
739 phydev->state = PHY_CHANGELINK; 740 phydev->state = PHY_CHANGELINK;
740 mutex_unlock(&phydev->lock); 741 mutex_unlock(&phydev->lock);
741 742
742 if (phy_interrupt_is_valid(phydev)) {
743 /* Reenable interrupts */
744 if (PHY_HALTED != phydev->state &&
745 phy_config_interrupt(phydev, PHY_INTERRUPT_ENABLED))
746 goto phy_err;
747 }
748
749 /* reschedule state queue work to run as soon as possible */ 743 /* reschedule state queue work to run as soon as possible */
750 phy_trigger_machine(phydev, true); 744 phy_trigger_machine(phydev, true);
745
746 if (phy_interrupt_is_valid(phydev) && phy_clear_interrupt(phydev))
747 goto phy_err;
751 return; 748 return;
752 749
753phy_err: 750phy_err:
@@ -987,10 +984,6 @@ void phy_state_machine(struct work_struct *work)
987 phydev->state = PHY_NOLINK; 984 phydev->state = PHY_NOLINK;
988 phy_link_down(phydev, true); 985 phy_link_down(phydev, true);
989 } 986 }
990
991 if (phy_interrupt_is_valid(phydev))
992 err = phy_config_interrupt(phydev,
993 PHY_INTERRUPT_ENABLED);
994 break; 987 break;
995 case PHY_HALTED: 988 case PHY_HALTED:
996 if (phydev->link) { 989 if (phydev->link) {