mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
e1000e: cleanup boolean logic
Replace occurrences of 'if (<bool expr> == <1|0>)' with 'if ([!]<bool expr>)' Replace occurrences of '<bool var> = (<non-bool expr>) ? true : false' with '<bool var> = <non-bool expr>'. Replace occurrence of '<bool var> = <non-bool expr>' with '<bool var> = !!<non-bool expr>' While the latter replacement is not really necessary, it is done here for consistency and clarity. No functional changes. Signed-off-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
6ad651456e
commit
04499ec4ee
6 changed files with 31 additions and 35 deletions
|
@ -718,7 +718,7 @@ s32 e1000e_copper_link_setup_m88(struct e1000_hw *hw)
|
|||
* 1 - Enabled
|
||||
*/
|
||||
phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL;
|
||||
if (phy->disable_polarity_correction == 1)
|
||||
if (phy->disable_polarity_correction)
|
||||
phy_data |= M88E1000_PSCR_POLARITY_REVERSAL;
|
||||
|
||||
/* Enable downshift on BM (disabled by default) */
|
||||
|
@ -1090,7 +1090,7 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw)
|
|||
* If autoneg_advertised is zero, we assume it was not defaulted
|
||||
* by the calling code so we set to advertise full capability.
|
||||
*/
|
||||
if (phy->autoneg_advertised == 0)
|
||||
if (!phy->autoneg_advertised)
|
||||
phy->autoneg_advertised = phy->autoneg_mask;
|
||||
|
||||
e_dbg("Reconfiguring auto-neg advertisement params\n");
|
||||
|
@ -1596,7 +1596,7 @@ s32 e1000e_check_downshift(struct e1000_hw *hw)
|
|||
ret_val = e1e_rphy(hw, offset, &phy_data);
|
||||
|
||||
if (!ret_val)
|
||||
phy->speed_downgraded = (phy_data & mask);
|
||||
phy->speed_downgraded = !!(phy_data & mask);
|
||||
|
||||
return ret_val;
|
||||
}
|
||||
|
@ -1925,8 +1925,8 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw)
|
|||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
phy->polarity_correction = (phy_data &
|
||||
M88E1000_PSCR_POLARITY_REVERSAL);
|
||||
phy->polarity_correction = !!(phy_data &
|
||||
M88E1000_PSCR_POLARITY_REVERSAL);
|
||||
|
||||
ret_val = e1000_check_polarity_m88(hw);
|
||||
if (ret_val)
|
||||
|
@ -1936,7 +1936,7 @@ s32 e1000e_get_phy_info_m88(struct e1000_hw *hw)
|
|||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
phy->is_mdix = (phy_data & M88E1000_PSSR_MDIX);
|
||||
phy->is_mdix = !!(phy_data & M88E1000_PSSR_MDIX);
|
||||
|
||||
if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) {
|
||||
ret_val = e1000_get_cable_length(hw);
|
||||
|
@ -1999,7 +1999,7 @@ s32 e1000e_get_phy_info_igp(struct e1000_hw *hw)
|
|||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
phy->is_mdix = (data & IGP01E1000_PSSR_MDIX);
|
||||
phy->is_mdix = !!(data & IGP01E1000_PSSR_MDIX);
|
||||
|
||||
if ((data & IGP01E1000_PSSR_SPEED_MASK) ==
|
||||
IGP01E1000_PSSR_SPEED_1000MBPS) {
|
||||
|
@ -2052,8 +2052,7 @@ s32 e1000_get_phy_info_ife(struct e1000_hw *hw)
|
|||
ret_val = e1e_rphy(hw, IFE_PHY_SPECIAL_CONTROL, &data);
|
||||
if (ret_val)
|
||||
return ret_val;
|
||||
phy->polarity_correction = (data & IFE_PSC_AUTO_POLARITY_DISABLE)
|
||||
? false : true;
|
||||
phy->polarity_correction = !(data & IFE_PSC_AUTO_POLARITY_DISABLE);
|
||||
|
||||
if (phy->polarity_correction) {
|
||||
ret_val = e1000_check_polarity_ife(hw);
|
||||
|
@ -2070,7 +2069,7 @@ s32 e1000_get_phy_info_ife(struct e1000_hw *hw)
|
|||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
phy->is_mdix = (data & IFE_PMC_MDIX_STATUS) ? true : false;
|
||||
phy->is_mdix = !!(data & IFE_PMC_MDIX_STATUS);
|
||||
|
||||
/* The following parameters are undefined for 10/100 operation. */
|
||||
phy->cable_length = E1000_CABLE_LENGTH_UNDEFINED;
|
||||
|
@ -2979,7 +2978,7 @@ static s32 __e1000_write_phy_reg_hv(struct e1000_hw *hw, u32 offset, u16 data,
|
|||
if ((hw->phy.type == e1000_phy_82578) &&
|
||||
(hw->phy.revision >= 1) &&
|
||||
(hw->phy.addr == 2) &&
|
||||
((MAX_PHY_REG_ADDRESS & reg) == 0) && (data & (1 << 11))) {
|
||||
!(MAX_PHY_REG_ADDRESS & reg) && (data & (1 << 11))) {
|
||||
u16 data2 = 0x7EFF;
|
||||
ret_val = e1000_access_phy_debug_regs_hv(hw,
|
||||
(1 << 6) | 0x3,
|
||||
|
@ -3265,7 +3264,7 @@ s32 e1000_get_phy_info_82577(struct e1000_hw *hw)
|
|||
if (ret_val)
|
||||
return ret_val;
|
||||
|
||||
phy->is_mdix = (data & I82577_PHY_STATUS2_MDIX) ? true : false;
|
||||
phy->is_mdix = !!(data & I82577_PHY_STATUS2_MDIX);
|
||||
|
||||
if ((data & I82577_PHY_STATUS2_SPEED_MASK) ==
|
||||
I82577_PHY_STATUS2_SPEED_1000MBPS) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue