From 4858ea1731d621dfa9615b7ea9102c7924f1fa29 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 28 Jan 2020 12:42:19 +0000 Subject: net: phylink: rejig resolve retriggering Use a boolean flag in phylink_resolve() to indicate whether we should re-run the resolve after the current one has completed. This will allow us to retrigger the resolution for other conditions in future. Signed-off-by: Russell King --- drivers/net/phy/phylink.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 6033d2dfd223..169d05f0fd8e 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -572,6 +572,7 @@ static void phylink_resolve(struct work_struct *w) struct phylink_link_state link_state; struct net_device *ndev = pl->netdev; bool cur_link_state; + bool retrigger = false; mutex_lock(&pl->state_mutex); if (pl->netdev) @@ -583,7 +584,9 @@ static void phylink_resolve(struct work_struct *w) pl->mac_link_dropped = false; link_state.link = false; } else if (pl->mac_link_dropped) { + pl->mac_link_dropped = false; link_state.link = false; + retrigger = true; } else { switch (pl->cur_link_an_mode) { case MLO_AN_PHY: @@ -628,10 +631,8 @@ static void phylink_resolve(struct work_struct *w) else phylink_link_up(pl, link_state); } - if (!link_state.link && pl->mac_link_dropped) { - pl->mac_link_dropped = false; + if (retrigger) queue_work(system_power_efficient_wq, &pl->resolve); - } mutex_unlock(&pl->state_mutex); } -- cgit