wireless: Remove casts to same type
Adding casts of objects to the same type is unnecessary and confusing for a human reader. For example, this cast: int y; int *p = (int *)&y; I used the coccinelle script below to find and remove these unnecessary casts. I manually removed the conversions this script produces of casts with __force, __iomem and __user. @@ type T; T *p; @@ - (T *)p + p Neatened the mwifiex_deauthenticate_infra function which was doing odd things with array pointers and not using is_zero_ether_addr. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
6469933605
commit
2c208890c6
@@ -214,13 +214,13 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
|
||||
for (e_aci = 0; e_aci < AC_MAX; e_aci++) {
|
||||
rtlpriv->cfg->ops->set_hw_reg(hw,
|
||||
HW_VAR_AC_PARAM,
|
||||
(u8 *) (&e_aci));
|
||||
&e_aci);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HW_VAR_ACK_PREAMBLE:{
|
||||
u8 reg_tmp;
|
||||
u8 short_preamble = (bool) (*(u8 *) val);
|
||||
u8 short_preamble = (bool)*val;
|
||||
reg_tmp = (mac->cur_40_prime_sc) << 5;
|
||||
if (short_preamble)
|
||||
reg_tmp |= 0x80;
|
||||
@@ -232,7 +232,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
|
||||
u8 min_spacing_to_set;
|
||||
u8 sec_min_space;
|
||||
|
||||
min_spacing_to_set = *((u8 *) val);
|
||||
min_spacing_to_set = *val;
|
||||
if (min_spacing_to_set <= 7) {
|
||||
sec_min_space = 0;
|
||||
|
||||
@@ -257,7 +257,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
|
||||
case HW_VAR_SHORTGI_DENSITY:{
|
||||
u8 density_to_set;
|
||||
|
||||
density_to_set = *((u8 *) val);
|
||||
density_to_set = *val;
|
||||
mac->min_space_cfg |= (density_to_set << 3);
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_MLME, DBG_LOUD,
|
||||
@@ -284,7 +284,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
|
||||
else
|
||||
p_regtoset = regtoset_normal;
|
||||
|
||||
factor_toset = *((u8 *) val);
|
||||
factor_toset = *(val);
|
||||
if (factor_toset <= 3) {
|
||||
factor_toset = (1 << (factor_toset + 2));
|
||||
if (factor_toset > 0xf)
|
||||
@@ -316,17 +316,17 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
|
||||
break;
|
||||
}
|
||||
case HW_VAR_AC_PARAM:{
|
||||
u8 e_aci = *((u8 *) val);
|
||||
u8 e_aci = *(val);
|
||||
rtl92c_dm_init_edca_turbo(hw);
|
||||
|
||||
if (rtlpci->acm_method != eAcmWay2_SW)
|
||||
rtlpriv->cfg->ops->set_hw_reg(hw,
|
||||
HW_VAR_ACM_CTRL,
|
||||
(u8 *) (&e_aci));
|
||||
(&e_aci));
|
||||
break;
|
||||
}
|
||||
case HW_VAR_ACM_CTRL:{
|
||||
u8 e_aci = *((u8 *) val);
|
||||
u8 e_aci = *(val);
|
||||
union aci_aifsn *p_aci_aifsn =
|
||||
(union aci_aifsn *)(&(mac->ac[0].aifs));
|
||||
u8 acm = p_aci_aifsn->f.acm;
|
||||
@@ -382,7 +382,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
|
||||
break;
|
||||
}
|
||||
case HW_VAR_RETRY_LIMIT:{
|
||||
u8 retry_limit = ((u8 *) (val))[0];
|
||||
u8 retry_limit = val[0];
|
||||
|
||||
rtl_write_word(rtlpriv, REG_RL,
|
||||
retry_limit << RETRY_LIMIT_SHORT_SHIFT |
|
||||
@@ -396,13 +396,13 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
|
||||
rtlefuse->efuse_usedbytes = *((u16 *) val);
|
||||
break;
|
||||
case HW_VAR_EFUSE_USAGE:
|
||||
rtlefuse->efuse_usedpercentage = *((u8 *) val);
|
||||
rtlefuse->efuse_usedpercentage = *val;
|
||||
break;
|
||||
case HW_VAR_IO_CMD:
|
||||
rtl92c_phy_set_io_cmd(hw, (*(enum io_type *)val));
|
||||
break;
|
||||
case HW_VAR_WPA_CONFIG:
|
||||
rtl_write_byte(rtlpriv, REG_SECCFG, *((u8 *) val));
|
||||
rtl_write_byte(rtlpriv, REG_SECCFG, *val);
|
||||
break;
|
||||
case HW_VAR_SET_RPWM:{
|
||||
u8 rpwm_val;
|
||||
@@ -411,31 +411,30 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
|
||||
udelay(1);
|
||||
|
||||
if (rpwm_val & BIT(7)) {
|
||||
rtl_write_byte(rtlpriv, REG_PCIE_HRPWM,
|
||||
(*(u8 *) val));
|
||||
rtl_write_byte(rtlpriv, REG_PCIE_HRPWM, *val);
|
||||
} else {
|
||||
rtl_write_byte(rtlpriv, REG_PCIE_HRPWM,
|
||||
((*(u8 *) val) | BIT(7)));
|
||||
*val | BIT(7));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case HW_VAR_H2C_FW_PWRMODE:{
|
||||
u8 psmode = (*(u8 *) val);
|
||||
u8 psmode = *val;
|
||||
|
||||
if ((psmode != FW_PS_ACTIVE_MODE) &&
|
||||
(!IS_92C_SERIAL(rtlhal->version))) {
|
||||
rtl92c_dm_rf_saving(hw, true);
|
||||
}
|
||||
|
||||
rtl92c_set_fw_pwrmode_cmd(hw, (*(u8 *) val));
|
||||
rtl92c_set_fw_pwrmode_cmd(hw, *val);
|
||||
break;
|
||||
}
|
||||
case HW_VAR_FW_PSMODE_STATUS:
|
||||
ppsc->fw_current_inpsmode = *((bool *) val);
|
||||
break;
|
||||
case HW_VAR_H2C_FW_JOINBSSRPT:{
|
||||
u8 mstatus = (*(u8 *) val);
|
||||
u8 mstatus = *val;
|
||||
u8 tmp_regcr, tmp_reg422;
|
||||
bool recover = false;
|
||||
|
||||
@@ -472,7 +471,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
|
||||
rtl_write_byte(rtlpriv, REG_CR + 1,
|
||||
(tmp_regcr & ~(BIT(0))));
|
||||
}
|
||||
rtl92c_set_fw_joinbss_report_cmd(hw, (*(u8 *) val));
|
||||
rtl92c_set_fw_joinbss_report_cmd(hw, *val);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -486,7 +485,7 @@ void rtl92ce_set_hw_reg(struct ieee80211_hw *hw, u8 variable, u8 *val)
|
||||
break;
|
||||
}
|
||||
case HW_VAR_CORRECT_TSF:{
|
||||
u8 btype_ibss = ((u8 *) (val))[0];
|
||||
u8 btype_ibss = val[0];
|
||||
|
||||
if (btype_ibss)
|
||||
_rtl92ce_stop_tx_beacon(hw);
|
||||
@@ -1589,10 +1588,10 @@ static void _rtl92ce_read_adapter_info(struct ieee80211_hw *hw)
|
||||
rtlefuse->autoload_failflag,
|
||||
hwinfo);
|
||||
|
||||
rtlefuse->eeprom_channelplan = *(u8 *)&hwinfo[EEPROM_CHANNELPLAN];
|
||||
rtlefuse->eeprom_channelplan = *&hwinfo[EEPROM_CHANNELPLAN];
|
||||
rtlefuse->eeprom_version = *(u16 *)&hwinfo[EEPROM_VERSION];
|
||||
rtlefuse->txpwr_fromeprom = true;
|
||||
rtlefuse->eeprom_oemid = *(u8 *)&hwinfo[EEPROM_CUSTOMER_ID];
|
||||
rtlefuse->eeprom_oemid = *&hwinfo[EEPROM_CUSTOMER_ID];
|
||||
|
||||
RT_TRACE(rtlpriv, COMP_INIT, DBG_LOUD,
|
||||
"EEPROM Customer ID: 0x%2x\n", rtlefuse->eeprom_oemid);
|
||||
@@ -1939,7 +1938,7 @@ void rtl92ce_update_channel_access_setting(struct ieee80211_hw *hw)
|
||||
u16 sifs_timer;
|
||||
|
||||
rtlpriv->cfg->ops->set_hw_reg(hw, HW_VAR_SLOT_TIME,
|
||||
(u8 *)&mac->slot_time);
|
||||
&mac->slot_time);
|
||||
if (!mac->ht_enable)
|
||||
sifs_timer = 0x0a0a;
|
||||
else
|
||||
|
Reference in New Issue
Block a user