2022-04-23 14:03:31

by Solomon Tan

[permalink] [raw]
Subject: [PATCH 0/7] staging: rtl8192e: Remove unnecessary u8 and u16 casts

Hi,

This series of patches removes unnecessary explicit u8 and u16 type
casts. They are broken down into 7 patches as follows:

Patch 1 removes u8 casts in assignment statements of u8 variables.
Patch 2 removes u8 casts in u8 arguments to function calls.
Patch 3 removes u8 casts in comparison expressions.
Patch 4 removes u16 casts in assignment statements.
Patch 5 removes the u16 cast in the u16 argument to a function call.
Patch 6 removes the u16 cast because the function parameter is u32.
Patch 7 removes the u16 cast from a function return statement.

Justification is found in the respective changelogs.

Cheers,
Solomon



2022-04-23 14:19:14

by Solomon Tan

[permalink] [raw]
Subject: [PATCH 3/7] staging: rtl8192e: Remove unnecessary u8 cast in comparison

Since the macro VERSION_8190_BD is defined to be 0x3, and the structure
members card_8192_version and IC_Cut are both u8, an explicit u8 cast is
unnecessary.

Signed-off-by: Solomon Tan <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +-
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 4fe806eae5b7..b608540c036c 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -811,7 +811,7 @@ bool rtl92e_start_adapter(struct net_device *dev)

rtl92e_config_mac(dev);

- if (priv->card_8192_version > (u8)VERSION_8190_BD) {
+ if (priv->card_8192_version > VERSION_8190_BD) {
rtl92e_get_tx_power(dev);
rtl92e_set_tx_power(dev, priv->chan);
}
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 1b70c12be365..b7bdbd895e7b 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -919,7 +919,7 @@ static u8 _rtl92e_phy_switch_channel_step(struct net_device *dev, u8 channel,
continue;
switch (CurrentCmd->CmdID) {
case CmdID_SetTxPowerLevel:
- if (priv->IC_Cut > (u8)VERSION_8190_BD)
+ if (priv->IC_Cut > VERSION_8190_BD)
_rtl92e_set_tx_power_level(dev,
channel);
break;
--
2.36.0

2022-04-23 14:20:35

by Solomon Tan

[permalink] [raw]
Subject: [PATCH 4/7] staging: rtl8192e: Remove unnecessary u16 assignment cast

Remove the explicit casts in assignment statements for u16 variables.
Because these variables are declared as u16, there is implicit
conversion to u16 during the assignment, so an explicit cast is
unnecessary.

Signed-off-by: Solomon Tan <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c | 2 +-
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
index c5e44bbe997c..cd8bbc358d01 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c
@@ -58,7 +58,7 @@ bool rtl92e_send_cmd_pkt(struct net_device *dev, u32 type, const void *data,
memset(pTxFwInfo, 0, sizeof(struct tx_fwinfo_8190pci));
memset(pTxFwInfo, 0x12, 8);
} else {
- tcb_desc->txbuf_size = (u16)frag_length;
+ tcb_desc->txbuf_size = frag_length;
}

seg_ptr = skb_put(skb, frag_length);
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index b608540c036c..feddb15bccbe 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -1225,7 +1225,7 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc,
pdesc->LINIP = 0;
pdesc->CmdInit = 1;
pdesc->Offset = sizeof(struct tx_fwinfo_8190pci) + 8;
- pdesc->PktSize = (u16)skb->len-sizeof(struct tx_fwinfo_8190pci);
+ pdesc->PktSize = skb->len - sizeof(struct tx_fwinfo_8190pci);

pdesc->SecCAMID = 0;
pdesc->RATid = cb_desc->RATRIndex;
@@ -1298,8 +1298,7 @@ void rtl92e_fill_tx_cmd_desc(struct net_device *dev, struct tx_desc_cmd *entry,

entry_tmp->CmdInit = DESC_PACKET_TYPE_NORMAL;
entry_tmp->Offset = sizeof(struct tx_fwinfo_8190pci) + 8;
- entry_tmp->PktSize = (u16)(cb_desc->pkt_size +
- entry_tmp->Offset);
+ entry_tmp->PktSize = cb_desc->pkt_size + entry_tmp->Offset;
entry_tmp->QueueSelect = QSLT_CMD;
entry_tmp->TxFWInfoSize = 0x08;
entry_tmp->RATid = DESC_PACKET_TYPE_INIT;
--
2.36.0

2022-04-23 15:43:39

by Solomon Tan

[permalink] [raw]
Subject: [PATCH 1/7] staging: rtl8192e: Remove unnecessary u8 assignment cast

Remove the explicit casts in assignment statements for u8 variables.
Because these variables are declared as u8, there is implicit conversion
to u8 during the assignment, so an explicit cast is unnecessary.

Signed-off-by: Solomon Tan <[email protected]>
---
.../rtl8192e/rtl8192e/r8190P_rtl8256.c | 8 ++---
.../staging/rtl8192e/rtl8192e/r8192E_dev.c | 32 +++++++++----------
.../staging/rtl8192e/rtl8192e/r8192E_phy.c | 16 +++++-----
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 18 +++++------
4 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c
index 52eeb56c5c76..4abec7b42993 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c
@@ -185,10 +185,10 @@ void rtl92e_set_ofdm_tx_power(struct net_device *dev, u8 powerlevel)
for (index = 0; index < 6; index++) {
writeVal = (u32)(priv->MCSTxPowerLevelOriginalOffset[index] +
((index < 2) ? powerBase0 : powerBase1));
- byte0 = (u8)(writeVal & 0x7f);
- byte1 = (u8)((writeVal & 0x7f00)>>8);
- byte2 = (u8)((writeVal & 0x7f0000)>>16);
- byte3 = (u8)((writeVal & 0x7f000000)>>24);
+ byte0 = writeVal & 0x7f;
+ byte1 = (writeVal & 0x7f00) >> 8;
+ byte2 = (writeVal & 0x7f0000) >> 16;
+ byte3 = (writeVal & 0x7f000000) >> 24;
if (byte0 > 0x24)
byte0 = 0x24;
if (byte1 > 0x24)
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index a45ee95a8e6b..4b31fecde4e6 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -321,7 +321,7 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)

usValue = rtl92e_eeprom_read(dev,
(u16)(EEPROM_Customer_ID>>1)) >> 8;
- priv->eeprom_CustomerID = (u8)(usValue & 0xff);
+ priv->eeprom_CustomerID = usValue & 0xff;
usValue = rtl92e_eeprom_read(dev,
EEPROM_ICVersion_ChannelPlan>>1);
priv->eeprom_ChannelPlan = usValue&0xff;
@@ -399,9 +399,9 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)
priv->EEPROMLegacyHTTxPowerDiff);

if (!priv->AutoloadFailFlag)
- priv->EEPROMThermalMeter = (u8)(((rtl92e_eeprom_read(dev,
+ priv->EEPROMThermalMeter = ((rtl92e_eeprom_read(dev,
(EEPROM_ThermalMeter>>1))) &
- 0xff00)>>8);
+ 0xff00) >> 8;
else
priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter;
RT_TRACE(COMP_INIT, "ThermalMeter = %d\n",
@@ -413,8 +413,8 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)
usValue = rtl92e_eeprom_read(dev,
EEPROM_TxPwDiff_CrystalCap >> 1);
priv->EEPROMAntPwDiff = usValue & 0x0fff;
- priv->EEPROMCrystalCap = (u8)((usValue & 0xf000)
- >> 12);
+ priv->EEPROMCrystalCap = (usValue & 0xf000)
+ >> 12;
} else {
priv->EEPROMAntPwDiff =
EEPROM_Default_AntTxPowerDiff;
@@ -894,9 +894,8 @@ bool rtl92e_start_adapter(struct net_device *dev)

for (i = 0; i < TxBBGainTableLength; i++) {
if (tmpRegA == dm_tx_bb_gain[i]) {
- priv->rfa_txpowertrackingindex = (u8)i;
- priv->rfa_txpowertrackingindex_real =
- (u8)i;
+ priv->rfa_txpowertrackingindex = i;
+ priv->rfa_txpowertrackingindex_real = i;
priv->rfa_txpowertracking_default =
priv->rfa_txpowertrackingindex;
break;
@@ -908,7 +907,7 @@ bool rtl92e_start_adapter(struct net_device *dev)

for (i = 0; i < CCKTxBBGainTableLength; i++) {
if (TempCCk == dm_cck_tx_bb_gain[i][0]) {
- priv->CCKPresentAttentuation_20Mdefault = (u8)i;
+ priv->CCKPresentAttentuation_20Mdefault = i;
break;
}
}
@@ -1303,7 +1302,7 @@ void rtl92e_fill_tx_cmd_desc(struct net_device *dev, struct tx_desc_cmd *entry,
entry_tmp->Offset);
entry_tmp->QueueSelect = QSLT_CMD;
entry_tmp->TxFWInfoSize = 0x08;
- entry_tmp->RATid = (u8)DESC_PACKET_TYPE_INIT;
+ entry_tmp->RATid = DESC_PACKET_TYPE_INIT;
}
entry->TxBufferSize = skb->len;
entry->TxBuffAddr = mapping;
@@ -1613,9 +1612,8 @@ static void _rtl92e_query_rxphystatus(
total_rssi += RSSI;

if (bpacket_match_bssid) {
- pstats->RxMIMOSignalStrength[i] = (u8)RSSI;
- precord_stats->RxMIMOSignalStrength[i] =
- (u8)RSSI;
+ pstats->RxMIMOSignalStrength[i] = RSSI;
+ precord_stats->RxMIMOSignalStrength[i] = RSSI;
}
}

@@ -1661,14 +1659,14 @@ static void _rtl92e_query_rxphystatus(

if (is_cck_rate) {
pstats->SignalStrength = precord_stats->SignalStrength =
- (u8)(_rtl92e_signal_scale_mapping(priv,
- (long)pwdb_all));
+ _rtl92e_signal_scale_mapping(priv,
+ (long)pwdb_all);

} else {
if (rf_rx_num != 0)
pstats->SignalStrength = precord_stats->SignalStrength =
- (u8)(_rtl92e_signal_scale_mapping(priv,
- (long)(total_rssi /= rf_rx_num)));
+ _rtl92e_signal_scale_mapping(priv,
+ (long)(total_rssi /= rf_rx_num));
}
}

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index 411138102948..c7071e0997bc 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -1299,17 +1299,17 @@ void rtl92e_init_gain(struct net_device *dev, u8 Operation)
DIG_ALGO_BY_FALSE_ALARM)
rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x8);
priv->initgain_backup.xaagccore1 =
- (u8)rtl92e_get_bb_reg(dev, rOFDM0_XAAGCCore1,
- BitMask);
+ rtl92e_get_bb_reg(dev, rOFDM0_XAAGCCore1,
+ BitMask);
priv->initgain_backup.xbagccore1 =
- (u8)rtl92e_get_bb_reg(dev, rOFDM0_XBAGCCore1,
- BitMask);
+ rtl92e_get_bb_reg(dev, rOFDM0_XBAGCCore1,
+ BitMask);
priv->initgain_backup.xcagccore1 =
- (u8)rtl92e_get_bb_reg(dev, rOFDM0_XCAGCCore1,
- BitMask);
+ rtl92e_get_bb_reg(dev, rOFDM0_XCAGCCore1,
+ BitMask);
priv->initgain_backup.xdagccore1 =
- (u8)rtl92e_get_bb_reg(dev, rOFDM0_XDAGCCore1,
- BitMask);
+ rtl92e_get_bb_reg(dev, rOFDM0_XDAGCCore1,
+ BitMask);
BitMask = bMaskByte2;
priv->initgain_backup.cca = (u8)rtl92e_get_bb_reg(dev,
rCCK0_CCA, BitMask);
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index aa942d915992..c85b23415772 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -633,7 +633,7 @@ static void _rtl92e_dm_tx_power_tracking_callback_tssi(struct net_device *dev)
rtl92e_writeb(dev, FW_Busy_Flag, 0);
priv->rtllib->bdynamic_txpower_enable = false;

- powerlevelOFDM24G = (u8)(priv->Pwr_Track>>24);
+ powerlevelOFDM24G = priv->Pwr_Track >> 24;
RF_Type = priv->rf_type;
Value = (RF_Type<<8) | powerlevelOFDM24G;

@@ -833,7 +833,7 @@ static void _rtl92e_dm_tx_power_tracking_cb_thermal(struct net_device *dev)
bMaskDWord);
for (i = 0; i < OFDM_Table_Length; i++) {
if (tmpRegA == OFDMSwingTable[i]) {
- priv->OFDM_index[0] = (u8)i;
+ priv->OFDM_index[0] = i;
RT_TRACE(COMP_POWER_TRACKING,
"Initial reg0x%x = 0x%x, OFDM_index = 0x%x\n",
rOFDM0_XATxIQImbalance, tmpRegA,
@@ -844,7 +844,7 @@ static void _rtl92e_dm_tx_power_tracking_cb_thermal(struct net_device *dev)
TempCCk = rtl92e_get_bb_reg(dev, rCCK0_TxFilter1, bMaskByte2);
for (i = 0; i < CCK_Table_length; i++) {
if (TempCCk == (u32)CCKSwingTable_Ch1_Ch13[i][0]) {
- priv->CCK_index = (u8)i;
+ priv->CCK_index = i;
RT_TRACE(COMP_POWER_TRACKING,
"Initial reg0x%x = 0x%x, CCK_index = 0x%x\n",
rCCK0_TxFilter1, TempCCk,
@@ -1041,7 +1041,7 @@ static void _rtl92e_dm_cck_tx_power_adjust_tssi(struct net_device *dev,
{
u32 TempVal;
struct r8192_priv *priv = rtllib_priv(dev);
- u8 attenuation = (u8)priv->CCKPresentAttentuation;
+ u8 attenuation = priv->CCKPresentAttentuation;

TempVal = 0;
if (!bInCH14) {
@@ -1245,10 +1245,10 @@ void rtl92e_dm_backup_state(struct net_device *dev)
return;

rtl92e_set_bb_reg(dev, UFWP, bMaskByte1, 0x8);
- priv->initgain_backup.xaagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XAAGCCore1, bit_mask);
- priv->initgain_backup.xbagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XBAGCCore1, bit_mask);
- priv->initgain_backup.xcagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XCAGCCore1, bit_mask);
- priv->initgain_backup.xdagccore1 = (u8)rtl92e_get_bb_reg(dev, rOFDM0_XDAGCCore1, bit_mask);
+ priv->initgain_backup.xaagccore1 = rtl92e_get_bb_reg(dev, rOFDM0_XAAGCCore1, bit_mask);
+ priv->initgain_backup.xbagccore1 = rtl92e_get_bb_reg(dev, rOFDM0_XBAGCCore1, bit_mask);
+ priv->initgain_backup.xcagccore1 = rtl92e_get_bb_reg(dev, rOFDM0_XCAGCCore1, bit_mask);
+ priv->initgain_backup.xdagccore1 = rtl92e_get_bb_reg(dev, rOFDM0_XDAGCCore1, bit_mask);
bit_mask = bMaskByte2;
priv->initgain_backup.cca = (u8)rtl92e_get_bb_reg(dev, rCCK0_CCA, bit_mask);

@@ -1535,7 +1535,7 @@ static void _rtl92e_dm_initial_gain(struct net_device *dev)

if ((dm_digtable.pre_ig_value != dm_digtable.cur_ig_value)
|| !initialized || force_write) {
- initial_gain = (u8)dm_digtable.cur_ig_value;
+ initial_gain = dm_digtable.cur_ig_value;
rtl92e_writeb(dev, rOFDM0_XAAGCCore1, initial_gain);
rtl92e_writeb(dev, rOFDM0_XBAGCCore1, initial_gain);
rtl92e_writeb(dev, rOFDM0_XCAGCCore1, initial_gain);
--
2.36.0

2022-04-23 18:46:39

by Solomon Tan

[permalink] [raw]
Subject: [PATCH 2/7] staging: rtl8192e: Remove unnecessary u8 argument cast

Remove the unnecessary explicit u8 casts for u8 arguments in function
calls. These functions have declared their parameters to be of type u8,
so the arguments given to those parameters will be automatically coerced
to u8. Therefore, an explicit cast is unnecessary.

Signed-off-by: Solomon Tan <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 9 ++++-----
drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c | 3 +--
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +-
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c | 2 +-
4 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index 4b31fecde4e6..4fe806eae5b7 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -1175,7 +1175,7 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc,
pTxFwInfo = (struct tx_fwinfo_8190pci *)skb->data;
memset(pTxFwInfo, 0, sizeof(struct tx_fwinfo_8190pci));
pTxFwInfo->TxHT = (cb_desc->data_rate & 0x80) ? 1 : 0;
- pTxFwInfo->TxRate = _rtl92e_rate_mgn_to_hw((u8)cb_desc->data_rate);
+ pTxFwInfo->TxRate = _rtl92e_rate_mgn_to_hw(cb_desc->data_rate);
pTxFwInfo->EnableCPUDur = cb_desc->bTxEnableFwCalcDur;
pTxFwInfo->Short = _rtl92e_query_is_short(pTxFwInfo->TxHT,
pTxFwInfo->TxRate, cb_desc);
@@ -1194,7 +1194,7 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc,
pTxFwInfo->CtsEnable = (cb_desc->bCTSEnable) ? 1 : 0;
pTxFwInfo->RtsSTBC = (cb_desc->bRTSSTBC) ? 1 : 0;
pTxFwInfo->RtsHT = (cb_desc->rts_rate&0x80) ? 1 : 0;
- pTxFwInfo->RtsRate = _rtl92e_rate_mgn_to_hw((u8)cb_desc->rts_rate);
+ pTxFwInfo->RtsRate = _rtl92e_rate_mgn_to_hw(cb_desc->rts_rate);
pTxFwInfo->RtsBandwidth = 0;
pTxFwInfo->RtsSubcarrier = cb_desc->RTSSC;
pTxFwInfo->RtsShort = (pTxFwInfo->RtsHT == 0) ?
@@ -1707,8 +1707,7 @@ static void _rtl92e_process_phyinfo(struct r8192_priv *priv, u8 *buffer,
slide_rssi_index = 0;

tmp_val = priv->stats.slide_rssi_total/slide_rssi_statistics;
- priv->stats.signal_strength = rtl92e_translate_to_dbm(priv,
- (u8)tmp_val);
+ priv->stats.signal_strength = rtl92e_translate_to_dbm(priv, tmp_val);
curr_st->rssi = priv->stats.signal_strength;
if (!prev_st->bPacketMatchBSSID) {
if (!prev_st->bToSelfBA)
@@ -2034,7 +2033,7 @@ bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats,
pDrvInfo = (struct rx_fwinfo *)(skb->data + stats->RxBufShift);

stats->rate = _rtl92e_rate_hw_to_mgn((bool)pDrvInfo->RxHT,
- (u8)pDrvInfo->RxRate);
+ pDrvInfo->RxRate);
stats->bShortPreamble = pDrvInfo->SPLCP;

_rtl92e_update_received_rate_histogram_stats(dev, stats);
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
index 9b025b9fa7ab..38110fa4f36d 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c
@@ -34,8 +34,7 @@ static bool _rtl92e_fw_boot_cpu(struct net_device *dev)
netdev_dbg(dev, "Download Firmware: Put code ok!\n");

CPU_status = rtl92e_readl(dev, CPU_GEN);
- rtl92e_writeb(dev, CPU_GEN,
- (u8)((CPU_status|CPU_GEN_PWR_STB_CPU)&0xff));
+ rtl92e_writeb(dev, CPU_GEN, (CPU_status | CPU_GEN_PWR_STB_CPU) & 0xff);
mdelay(1);

if (!_rtl92e_wait_for_fw(dev, CPU_GEN_BOOT_RDY, 200)) {
diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index c7071e0997bc..1b70c12be365 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -933,7 +933,7 @@ static u8 _rtl92e_phy_switch_channel_step(struct net_device *dev, u8 channel,
break;
case CmdID_WritePortUchar:
rtl92e_writeb(dev, CurrentCmd->Para1,
- (u8)CurrentCmd->Para2);
+ CurrentCmd->Para2);
break;
case CmdID_RF_WriteReg:
for (eRFPath = 0; eRFPath <
diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
index c85b23415772..d58800d06e8f 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
@@ -2513,5 +2513,5 @@ static void _rtl92e_dm_send_rssi_to_fw(struct net_device *dev)
{
struct r8192_priv *priv = rtllib_priv(dev);

- rtl92e_writeb(dev, DRIVER_RSSI, (u8)priv->undecorated_smoothed_pwdb);
+ rtl92e_writeb(dev, DRIVER_RSSI, priv->undecorated_smoothed_pwdb);
}
--
2.36.0

2022-04-23 21:28:35

by Solomon Tan

[permalink] [raw]
Subject: [PATCH 6/7] staging: rtl8192e: Remove u16 cast for u32 parameter

The explicit u16 cast is not necessary because rtl92e_eeprom_read's
second parameter is defined to be u32.

Signed-off-by: Solomon Tan <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
index feddb15bccbe..4b9249195b5a 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
@@ -320,7 +320,7 @@ static void _rtl92e_read_eeprom_info(struct net_device *dev)
priv->eeprom_did = rtl92e_eeprom_read(dev, EEPROM_DID >> 1);

usValue = rtl92e_eeprom_read(dev,
- (u16)(EEPROM_Customer_ID>>1)) >> 8;
+ (EEPROM_Customer_ID >> 1)) >> 8;
priv->eeprom_CustomerID = usValue & 0xff;
usValue = rtl92e_eeprom_read(dev,
EEPROM_ICVersion_ChannelPlan>>1);
--
2.36.0

2022-04-24 01:03:10

by Solomon Tan

[permalink] [raw]
Subject: [PATCH 5/7] staging: rtl8192e: Remove unnecessary u16 argument cast

Remove the explicit u16 casts for u16 argument in the function call. This
function has declared its parameter to be of type u16, so the argument
given to that parameter will be automatically coerced to u16. Therefore,
an explicit cast is unnecessary.

Signed-off-by: Solomon Tan <[email protected]>
---
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
index b7bdbd895e7b..f92551094738 100644
--- a/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
+++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
@@ -929,7 +929,7 @@ static u8 _rtl92e_phy_switch_channel_step(struct net_device *dev, u8 channel,
break;
case CmdID_WritePortUshort:
rtl92e_writew(dev, CurrentCmd->Para1,
- (u16)CurrentCmd->Para2);
+ CurrentCmd->Para2);
break;
case CmdID_WritePortUchar:
rtl92e_writeb(dev, CurrentCmd->Para1,
--
2.36.0

2022-04-24 19:56:19

by Solomon Tan

[permalink] [raw]
Subject: [PATCH 7/7] staging: rtl8192e: Remove u16 cast for u16 return value

Remove explicit u16 cast of the function Mk16 return value.
The variable hi does not need to be casted explicitly to u16 as it will
already be casted implicitly.

Signed-off-by: Solomon Tan <[email protected]>
---
drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
index a305b79c53e7..8bc95651e384 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
@@ -136,7 +136,7 @@ static inline u16 Hi16(u32 val)

static inline u16 Mk16(u8 hi, u8 lo)
{
- return lo | (((u16)hi) << 8);
+ return lo | (hi << 8);
}


--
2.36.0