Commit 319bfafe authored by Russell King's avatar Russell King Committed by David S. Miller

net: phylink: rearrange resolve mac_config() call

Use a boolean to indicate whether mac_config() should be called during
a resolution. This allows resolution to have a single location where
mac_config() will be called, which will allow us to make decisions
about how and what we do.
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b06e5cac
...@@ -421,13 +421,6 @@ static void phylink_mac_config(struct phylink *pl, ...@@ -421,13 +421,6 @@ static void phylink_mac_config(struct phylink *pl,
pl->mac_ops->mac_config(pl->config, pl->cur_link_an_mode, state); 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) static void phylink_mac_pcs_an_restart(struct phylink *pl)
{ {
if (pl->link_config.an_enabled && if (pl->link_config.an_enabled &&
...@@ -578,6 +571,7 @@ static void phylink_resolve(struct work_struct *w) ...@@ -578,6 +571,7 @@ static void phylink_resolve(struct work_struct *w)
struct phylink *pl = container_of(w, struct phylink, resolve); struct phylink *pl = container_of(w, struct phylink, resolve);
struct phylink_link_state link_state; struct phylink_link_state link_state;
struct net_device *ndev = pl->netdev; struct net_device *ndev = pl->netdev;
bool mac_config = false;
bool cur_link_state; bool cur_link_state;
mutex_lock(&pl->state_mutex); mutex_lock(&pl->state_mutex);
...@@ -596,12 +590,12 @@ static void phylink_resolve(struct work_struct *w) ...@@ -596,12 +590,12 @@ static void phylink_resolve(struct work_struct *w)
case MLO_AN_PHY: case MLO_AN_PHY:
link_state = pl->phy_state; link_state = pl->phy_state;
phylink_apply_manual_flow(pl, &link_state); phylink_apply_manual_flow(pl, &link_state);
phylink_mac_config_up(pl, &link_state); mac_config = link_state.link;
break; break;
case MLO_AN_FIXED: case MLO_AN_FIXED:
phylink_get_fixed_state(pl, &link_state); phylink_get_fixed_state(pl, &link_state);
phylink_mac_config_up(pl, &link_state); mac_config = link_state.link;
break; break;
case MLO_AN_INBAND: case MLO_AN_INBAND:
...@@ -619,15 +613,16 @@ static void phylink_resolve(struct work_struct *w) ...@@ -619,15 +613,16 @@ static void phylink_resolve(struct work_struct *w)
/* If we have a PHY, we need to update with /* If we have a PHY, we need to update with
* the PHY flow control bits. */ * the PHY flow control bits. */
link_state.pause = pl->phy_state.pause; link_state.pause = pl->phy_state.pause;
phylink_apply_manual_flow(pl, &link_state); mac_config = true;
phylink_mac_config(pl, &link_state);
} else {
phylink_apply_manual_flow(pl, &link_state);
} }
phylink_apply_manual_flow(pl, &link_state);
break; break;
} }
} }
if (mac_config)
phylink_mac_config(pl, &link_state);
if (link_state.link != cur_link_state) { if (link_state.link != cur_link_state) {
pl->old_link_state = link_state.link; pl->old_link_state = link_state.link;
if (!link_state.link) if (!link_state.link)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment