From febd058b88c48c0cd9893897b38af86ab2e5f8a3 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 28 Jan 2020 12:43:52 +0000 Subject: net: phylink: rearrange resolve's mac_config call Use a boolean to indicate whether mac_config() should be called during a resolution. This allows us to have a common location during resolution where mac_config() will be called. Signed-off-by: Russell King --- drivers/net/phy/phylink.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 169d05f0fd8e..16cf2dd0ef50 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -415,13 +415,6 @@ static void phylink_mac_config(struct phylink *pl, pl->mac_ops->mac_config(pl->config, pl->cur_link_an_mode, state); } -static void phylink_mac_config_up(struct phylink *pl, - const struct phylink_link_state *state) -{ - if (state->link) - phylink_mac_config(pl, state); -} - static void phylink_mac_pcs_an_restart(struct phylink *pl) { if (pl->link_config.an_enabled && @@ -572,6 +565,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 mac_config = false; bool retrigger = false; mutex_lock(&pl->state_mutex); @@ -592,12 +586,12 @@ static void phylink_resolve(struct work_struct *w) case MLO_AN_PHY: link_state = pl->phy_state; phylink_apply_manual_flow(pl, &link_state); - phylink_mac_config_up(pl, &link_state); + mac_config = link_state.link; break; case MLO_AN_FIXED: phylink_get_fixed_state(pl, &link_state); - phylink_mac_config_up(pl, &link_state); + mac_config = link_state.link; break; case MLO_AN_INBAND: @@ -615,15 +609,16 @@ static void phylink_resolve(struct work_struct *w) /* If we have a PHY, we need to update with * the PHY flow control bits. */ link_state.pause = pl->phy_state.pause; - phylink_apply_manual_flow(pl, &link_state); - phylink_mac_config(pl, &link_state); - } else { - phylink_apply_manual_flow(pl, &link_state); + mac_config = true; } + phylink_apply_manual_flow(pl, &link_state); break; } } + if (mac_config) + phylink_mac_config(pl, &link_state); + if (link_state.link != cur_link_state) { pl->old_link_state = link_state.link; if (!link_state.link) -- cgit