Staging: rtl8188eu: Cleanup code to increase compactness
cover Staging: rtl8188eu: Cleanup code to increase compactness
Remove unnecessary code to increase readability and compactness.
Vatika Harlalka (4):
Staging: rtl8188eu: Remove redundant if condition clause
Staging: rtl8188eu: Remove unnecessary if condition
Staging: rtl8188eu: Remove dead code.
Staging: rtl8188eu: Change return type of function to void.
drivers/staging/rtl8188eu/hal/bb_cfg.c | 3 +- drivers/staging/rtl8188eu/hal/phy.c | 53 ++++++++++------------------------ 2 files changed, 16 insertions(+), 40 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/4 Staging: rtl8188eu: Remove redundant if condition clause
Clause removed as !sim_bitmap is always true.
--- drivers/staging/rtl8188eu/hal/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8188eu/hal/phy.c +1 -1
@@ -1025,7 +1025,7 @@ static bool simularity_compare(struct adapter *adapt, s32 resulta[][8], diff = (tmp1 > tmp2) ? (tmp1 - tmp2) : (tmp2 - tmp1);if (diff >MAX_TOLERANCE ) { -if ((i ==2 || i ==6 ) && !sim_bitmap) { +if (i ==2 || i ==6 ) {if (resulta[c1][i] + resulta[c1][i+1 ] ==0 ) final_candidate[(i/4 )] = c2;else if (resulta[c2][i] + resulta[c2][i+1 ] ==0 )
Signature · 1 line
1.9.1
Jes Sorensen
NAKRe: [Outreachy kernel] [PATCH 1/4] Staging: rtl8188eu: Remove redundant if condition clause
Quoted 13 lines · Vatika Harlalka
Clause removed as !sim_bitmap is always true.
Signed-off-by Vatika Harlalka <[email protected]>--- drivers/staging/rtl8188eu/hal/phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/rtl8188eu/hal/phy.c +0
-0
drivers/staging/rtl8188eu/hal/phy.c static bool simularity_compare(struct adapter *adapt, s32 resulta[][8], · line 1031
Quoted 8 lines
drivers/staging/rtl8188eu/hal/phy.c +1
-1@@ -1025,7 +1025,7 @@ static bool simularity_compare(struct adapter *adapt, s32 resulta[][8], diff = (tmp1 > tmp2) ? (tmp1 - tmp2) : (tmp2 - tmp1);if (diff >MAX_TOLERANCE ) { -if ((i ==2 || i ==6 ) && !sim_bitmap) { +if (i ==2 || i ==6 ) {if (resulta[c1][i] + resulta[c1][i+1 ] ==0 ) final_candidate[(i/4 )] = c2;else if (resulta[c2][i] + resulta[c2][i+1 ] ==0 )
How do you come to the conclusion that !sim_bitmap is always true here? This is inside a for() loop, and once i > 0, sim_bitmap could be != 0.
NACK
Cheers,
Jes
PATCH 2/4 Staging: rtl8188eu: Remove unnecessary if condition
In reply to Vatika HarlalkaThe variable final will never retain its original value of 0xff so the else branch can be eliminated.
The loop is eliminated as the reg values are reassigned.
--- drivers/staging/rtl8188eu/hal/phy.c | 47 +++++++++++-------------------------- 1 file changed, 14 insertions(+), 33 deletions(-)
drivers/staging/rtl8188eu/hal/phy.c +14 -33
@@ -1393,40 +1393,21 @@ void rtl88eu_phy_iq_calibrate(struct adapter *adapt, bool recovery) } } -for (i =0 ; i <4 ; i++) { - reg_e94 = result[i][0 ]; - reg_e9c = result[i][1 ]; - reg_ea4 = result[i][2 ]; - reg_eac = result[i][3 ]; - reg_eb4 = result[i][4 ]; - reg_ebc = result[i][5 ]; - reg_ec4 = result[i][6 ]; - reg_ecc = result[i][7 ]; - } + reg_e94 = result[final][0 ]; + reg_e9c = result[final][1 ]; + reg_ea4 = result[final][2 ]; + reg_eac = result[final][3 ]; + reg_eb4 = result[final][4 ]; + reg_ebc = result[final][5 ]; + reg_ec4 = result[final][6 ]; + reg_ecc = result[final][7 ]; + pathaok = true; + pathbok = true; + dm_odm->RFCalibrateInfo.RegE94 = reg_e94; + dm_odm->RFCalibrateInfo.RegE9C = reg_e9c; + dm_odm->RFCalibrateInfo.RegEB4 = reg_eb4; + dm_odm->RFCalibrateInfo.RegEBC = reg_ebc; -if (final !=0xff ) { - reg_e94 = result[final][0 ]; - reg_e9c = result[final][1 ]; - reg_ea4 = result[final][2 ]; - reg_eac = result[final][3 ]; - reg_eb4 = result[final][4 ]; - reg_ebc = result[final][5 ]; - dm_odm->RFCalibrateInfo.RegE94 = reg_e94; - dm_odm->RFCalibrateInfo.RegE9C = reg_e9c; - dm_odm->RFCalibrateInfo.RegEB4 = reg_eb4; - dm_odm->RFCalibrateInfo.RegEBC = reg_ebc; - reg_ec4 = result[final][6 ]; - reg_ecc = result[final][7 ]; - pathaok = true; - pathbok = true; - }else { -ODM_RT_TRACE (dm_odm,ODM_COMP_CALIBRATION ,ODM_DBG_LOUD , - ("IQK: FAIL use default value\n" )); - dm_odm->RFCalibrateInfo.RegE94 =0x100 ; - dm_odm->RFCalibrateInfo.RegEB4 =0x100 ; - dm_odm->RFCalibrateInfo.RegE9C =0x0 ; - dm_odm->RFCalibrateInfo.RegEBC =0x0 ; - }if (reg_e94 !=0 )patha_fill_iqk (adapt, pathaok, result, final, (reg_ea4 ==0 ));
Signature · 1 line
1.9.1
PATCH 3/4 Staging: rtl8188eu: Remove dead code.
In reply to Vatika HarlalkaThe if condition is always false and the variables are unused elsewhere in the code.
--- drivers/staging/rtl8188eu/hal/phy.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/staging/rtl8188eu/hal/phy.c +0 -4
@@ -1327,7 +1327,6 @@ void rtl88eu_phy_iq_calibrate(struct adapter *adapt, bool recovery)s32 reg_e94, reg_e9c, reg_ea4, reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc;bool is12simular, is13simular, is23simular; -bool singletone = false, carrier_sup = false;u32 iqk_bb_reg_92c[IQK_BB_REG_NUM ] = { rOFDM0_XARxIQImbalance, rOFDM0_XBRxIQImbalance, rOFDM0_ECCAThreshold, rOFDM0_AGCRSSITable,
@@ -1341,9 +1340,6 @@ void rtl88eu_phy_iq_calibrate(struct adapter *adapt, bool recovery)if (!(dm_odm->SupportAbility &ODM_RF_CALIBRATION ))return ; -if (singletone || carrier_sup) -return ; -if (recovery) {ODM_RT_TRACE (dm_odm,ODM_COMP_INIT ,ODM_DBG_LOUD , ("phy_iq_calibrate: Return due to recovery!\n" ));
Signature · 1 line
1.9.1
PATCH 4/4 Staging: rtl8188eu: Change return type of function to void.
In reply to Vatika HarlalkaReturn is made void as the function return value is not used when it is called.
--- drivers/staging/rtl8188eu/hal/bb_cfg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8188eu/hal/bb_cfg.c +1 -2
@@ -398,7 +398,7 @@ static void rtl_bb_delay(struct adapter *adapt, u32 addr, u32 data) } } -static bool set_baseband_phy_config (struct adapter *adapt) +static void set_baseband_phy_config (struct adapter *adapt) {u32 i;u32 arraylen =sizeof (array_phy_reg_1t_8188e)/sizeof (u32);
@@ -411,7 +411,6 @@ static bool set_baseband_phy_config(struct adapter *adapt)if (v1 <0xCDCDCDCD )rtl_bb_delay (adapt, v1, v2); } -return true; }/* PHY_REG_PG.TXT */
Signature · 1 line
1.9.1