mirror of https://gitee.com/openkylin/linux.git
ice: Use local variable instead of pointer derefs
Replace multiple instances of vsi->back and pi->phy with equivalent local variables Signed-off-by: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com> Tested-by: Tony Brelinski <tonyx.brelinski@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
parent
dc6aaa139f
commit
efc1eddb28
|
@ -1857,27 +1857,24 @@ static int ice_init_phy_user_cfg(struct ice_port_info *pi)
|
|||
static int ice_configure_phy(struct ice_vsi *vsi)
|
||||
{
|
||||
struct device *dev = ice_pf_to_dev(vsi->back);
|
||||
struct ice_port_info *pi = vsi->port_info;
|
||||
struct ice_aqc_get_phy_caps_data *pcaps;
|
||||
struct ice_aqc_set_phy_cfg_data *cfg;
|
||||
struct ice_port_info *pi;
|
||||
struct ice_phy_info *phy = &pi->phy;
|
||||
struct ice_pf *pf = vsi->back;
|
||||
enum ice_status status;
|
||||
int err = 0;
|
||||
|
||||
pi = vsi->port_info;
|
||||
if (!pi)
|
||||
return -EINVAL;
|
||||
|
||||
/* Ensure we have media as we cannot configure a medialess port */
|
||||
if (!(pi->phy.link_info.link_info & ICE_AQ_MEDIA_AVAILABLE))
|
||||
if (!(phy->link_info.link_info & ICE_AQ_MEDIA_AVAILABLE))
|
||||
return -EPERM;
|
||||
|
||||
ice_print_topo_conflict(vsi);
|
||||
|
||||
if (vsi->port_info->phy.link_info.topo_media_conflict ==
|
||||
ICE_AQ_LINK_TOPO_UNSUPP_MEDIA)
|
||||
if (phy->link_info.topo_media_conflict == ICE_AQ_LINK_TOPO_UNSUPP_MEDIA)
|
||||
return -EPERM;
|
||||
|
||||
if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, vsi->back->flags))
|
||||
if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, pf->flags))
|
||||
return ice_force_phys_link_state(vsi, true);
|
||||
|
||||
pcaps = kzalloc(sizeof(*pcaps), GFP_KERNEL);
|
||||
|
@ -1898,7 +1895,7 @@ static int ice_configure_phy(struct ice_vsi *vsi)
|
|||
* there's nothing to do
|
||||
*/
|
||||
if (pcaps->caps & ICE_AQC_PHY_EN_LINK &&
|
||||
ice_phy_caps_equals_cfg(pcaps, &pi->phy.curr_user_phy_cfg))
|
||||
ice_phy_caps_equals_cfg(pcaps, &phy->curr_user_phy_cfg))
|
||||
goto done;
|
||||
|
||||
/* Use PHY topology as baseline for configuration */
|
||||
|
@ -1929,8 +1926,8 @@ static int ice_configure_phy(struct ice_vsi *vsi)
|
|||
*/
|
||||
if (test_and_clear_bit(__ICE_LINK_DEFAULT_OVERRIDE_PENDING,
|
||||
vsi->back->state)) {
|
||||
cfg->phy_type_low = pi->phy.curr_user_phy_cfg.phy_type_low;
|
||||
cfg->phy_type_high = pi->phy.curr_user_phy_cfg.phy_type_high;
|
||||
cfg->phy_type_low = phy->curr_user_phy_cfg.phy_type_low;
|
||||
cfg->phy_type_high = phy->curr_user_phy_cfg.phy_type_high;
|
||||
} else {
|
||||
u64 phy_low = 0, phy_high = 0;
|
||||
|
||||
|
@ -1948,7 +1945,7 @@ static int ice_configure_phy(struct ice_vsi *vsi)
|
|||
}
|
||||
|
||||
/* FEC */
|
||||
ice_cfg_phy_fec(pi, cfg, pi->phy.curr_user_fec_req);
|
||||
ice_cfg_phy_fec(pi, cfg, phy->curr_user_fec_req);
|
||||
|
||||
/* Can't provide what was requested; use PHY capabilities */
|
||||
if (cfg->link_fec_opt !=
|
||||
|
@ -1960,12 +1957,12 @@ static int ice_configure_phy(struct ice_vsi *vsi)
|
|||
/* Flow Control - always supported; no need to check against
|
||||
* capabilities
|
||||
*/
|
||||
ice_cfg_phy_fc(pi, cfg, pi->phy.curr_user_fc_req);
|
||||
ice_cfg_phy_fc(pi, cfg, phy->curr_user_fc_req);
|
||||
|
||||
/* Enable link and link update */
|
||||
cfg->caps |= ICE_AQ_PHY_ENA_AUTO_LINK_UPDT | ICE_AQ_PHY_ENA_LINK;
|
||||
|
||||
status = ice_aq_set_phy_cfg(&vsi->back->hw, pi, cfg, NULL);
|
||||
status = ice_aq_set_phy_cfg(&pf->hw, pi, cfg, NULL);
|
||||
if (status) {
|
||||
dev_err(dev, "Failed to set phy config, VSI %d error %s\n",
|
||||
vsi->vsi_num, ice_stat_str(status));
|
||||
|
|
Loading…
Reference in New Issue