summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShaohui Xie <Shaohui.Xie@freescale.com>2015-08-14 12:23:40 +0800
committerDavid S. Miller <davem@davemloft.net>2015-08-17 12:18:09 -0700
commit11e122cbe90ea5079622fb57bdf2dffe8cf68e57 (patch)
tree3080f5a6d8efb6859d8256bced3ea08eb75bfe62
parent5d37852bf7d48e5afb5238a658cc167e7b78b381 (diff)
downloadop-kernel-dev-11e122cbe90ea5079622fb57bdf2dffe8cf68e57.zip
op-kernel-dev-11e122cbe90ea5079622fb57bdf2dffe8cf68e57.tar.gz
net: phy: fix PHY_RUNNING in phy_state_machine
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>
-rw-r--r--drivers/net/phy/phy.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index b2197b5..1e1fbb0 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -811,6 +811,7 @@ void phy_state_machine(struct work_struct *work)
bool needs_aneg = false, do_suspend = false;
enum phy_state old_state;
int err = 0;
+ int old_link;
mutex_lock(&phydev->lock);
@@ -896,11 +897,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);
OpenPOWER on IntegriCloud