mirror of https://gitee.com/openkylin/linux.git
phylink: remove 'mode' variable from phylink_sfp_module_insert()
'mode' is actually constant through phylink_sfp_module_insert(), so remove it and replace it with the enumerated constant. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
f10fcbcf91
commit
444d3502ed
|
@ -1578,7 +1578,7 @@ static int phylink_sfp_module_insert(void *upstream,
|
||||||
__ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, };
|
__ETHTOOL_DECLARE_LINK_MODE_MASK(support) = { 0, };
|
||||||
struct phylink_link_state config;
|
struct phylink_link_state config;
|
||||||
phy_interface_t iface;
|
phy_interface_t iface;
|
||||||
int mode, ret = 0;
|
int ret = 0;
|
||||||
bool changed;
|
bool changed;
|
||||||
u8 port;
|
u8 port;
|
||||||
|
|
||||||
|
@ -1593,7 +1593,6 @@ static int phylink_sfp_module_insert(void *upstream,
|
||||||
case PHY_INTERFACE_MODE_1000BASEX:
|
case PHY_INTERFACE_MODE_1000BASEX:
|
||||||
case PHY_INTERFACE_MODE_2500BASEX:
|
case PHY_INTERFACE_MODE_2500BASEX:
|
||||||
case PHY_INTERFACE_MODE_10GKR:
|
case PHY_INTERFACE_MODE_10GKR:
|
||||||
mode = MLO_AN_INBAND;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -1611,13 +1610,15 @@ static int phylink_sfp_module_insert(void *upstream,
|
||||||
ret = phylink_validate(pl, support, &config);
|
ret = phylink_validate(pl, support, &config);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
netdev_err(pl->netdev, "validation of %s/%s with support %*pb failed: %d\n",
|
netdev_err(pl->netdev, "validation of %s/%s with support %*pb failed: %d\n",
|
||||||
phylink_an_mode_str(mode), phy_modes(config.interface),
|
phylink_an_mode_str(MLO_AN_INBAND),
|
||||||
|
phy_modes(config.interface),
|
||||||
__ETHTOOL_LINK_MODE_MASK_NBITS, support, ret);
|
__ETHTOOL_LINK_MODE_MASK_NBITS, support, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
netdev_dbg(pl->netdev, "requesting link mode %s/%s with support %*pb\n",
|
netdev_dbg(pl->netdev, "requesting link mode %s/%s with support %*pb\n",
|
||||||
phylink_an_mode_str(mode), phy_modes(config.interface),
|
phylink_an_mode_str(MLO_AN_INBAND),
|
||||||
|
phy_modes(config.interface),
|
||||||
__ETHTOOL_LINK_MODE_MASK_NBITS, support);
|
__ETHTOOL_LINK_MODE_MASK_NBITS, support);
|
||||||
|
|
||||||
if (phy_interface_mode_is_8023z(iface) && pl->phydev)
|
if (phy_interface_mode_is_8023z(iface) && pl->phydev)
|
||||||
|
@ -1630,15 +1631,15 @@ static int phylink_sfp_module_insert(void *upstream,
|
||||||
linkmode_copy(pl->link_config.advertising, config.advertising);
|
linkmode_copy(pl->link_config.advertising, config.advertising);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pl->link_an_mode != mode ||
|
if (pl->link_an_mode != MLO_AN_INBAND ||
|
||||||
pl->link_config.interface != config.interface) {
|
pl->link_config.interface != config.interface) {
|
||||||
pl->link_config.interface = config.interface;
|
pl->link_config.interface = config.interface;
|
||||||
pl->link_an_mode = mode;
|
pl->link_an_mode = MLO_AN_INBAND;
|
||||||
|
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
netdev_info(pl->netdev, "switched to %s/%s link mode\n",
|
netdev_info(pl->netdev, "switched to %s/%s link mode\n",
|
||||||
phylink_an_mode_str(mode),
|
phylink_an_mode_str(MLO_AN_INBAND),
|
||||||
phy_modes(config.interface));
|
phy_modes(config.interface));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue