diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2020-01-28 12:19:25 +0000 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2020-04-16 23:03:55 +0100 |
commit | 8d55917dbd758d16470816a1fc187b4aefa87d32 (patch) | |
tree | 3df0353154d7b21a7cab08e70db7799a0d77a203 | |
parent | 5d8183ab9655514acc7710c2324031b4669b0417 (diff) |
net: phylink: rejig link state tracking
Rejig the link state tracking, so that we can use the current state
in a future patch.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | drivers/net/phy/phylink.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index ee9eb0f5b8e2..6033d2dfd223 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -571,9 +571,14 @@ static void phylink_resolve(struct work_struct *w) struct phylink *pl = container_of(w, struct phylink, resolve); struct phylink_link_state link_state; struct net_device *ndev = pl->netdev; - int link_changed; + bool cur_link_state; mutex_lock(&pl->state_mutex); + if (pl->netdev) + cur_link_state = netif_carrier_ok(ndev); + else + cur_link_state = pl->old_link_state; + if (pl->phylink_disable_state) { pl->mac_link_dropped = false; link_state.link = false; @@ -616,12 +621,7 @@ static void phylink_resolve(struct work_struct *w) } } - if (pl->netdev) - link_changed = (link_state.link != netif_carrier_ok(ndev)); - else - link_changed = (link_state.link != pl->old_link_state); - - if (link_changed) { + if (link_state.link != cur_link_state) { pl->old_link_state = link_state.link; if (!link_state.link) phylink_link_down(pl); |