diff options
author | Shaohui Xie <Shaohui.Xie@freescale.com> | 2015-08-14 07:23:40 +0300 |
---|---|---|
committer | Luis Henriques <luis.henriques@canonical.com> | 2016-02-29 14:14:38 +0300 |
commit | db6207deb8d298a36d1d06ea68200ae8f2866dec (patch) | |
tree | f42d335319dc09cde2ae5c3776574f1e4328bd36 /drivers/net/phy/phy.c | |
parent | ced18efa45a7d65f98a1336751322f7e5c2a3deb (diff) | |
download | linux-db6207deb8d298a36d1d06ea68200ae8f2866dec.tar.xz |
net: phy: fix PHY_RUNNING in phy_state_machine
commit 11e122cbe90ea5079622fb57bdf2dffe8cf68e57 upstream.
Currently, if phy state is PHY_RUNNING, we always register a CHANGE
when phy works in polling or interrupt ignored, this will make the
adjust_link being called even the phy link did Not changed.
checking the phy link to make sure the link did changed before we
register a CHANGE, if link did not changed, we do nothing.
Signed-off-by: Shaohui Xie <Shaohui.Xie@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r-- | drivers/net/phy/phy.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index ccfc44cfcee8..8f2e0fd0c9ca 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -740,6 +740,7 @@ void phy_state_machine(struct work_struct *work) container_of(dwork, struct phy_device, state_queue); bool needs_aneg = false, do_suspend = false, do_resume = false; int err = 0; + int old_link; mutex_lock(&phydev->lock); @@ -823,11 +824,18 @@ void phy_state_machine(struct work_struct *work) phydev->adjust_link(phydev->attached_dev); break; case PHY_RUNNING: - /* Only register a CHANGE if we are - * polling or ignoring interrupts + /* Only register a CHANGE if we are polling or ignoring + * interrupts and link changed since latest checking. */ - if (!phy_interrupt_is_valid(phydev)) - phydev->state = PHY_CHANGELINK; + if (!phy_interrupt_is_valid(phydev)) { + old_link = phydev->link; + err = phy_read_status(phydev); + if (err) + break; + + if (old_link != phydev->link) + phydev->state = PHY_CHANGELINK; + } break; case PHY_CHANGELINK: err = phy_read_status(phydev); |