staging: r8188eu: remove constant rf variable
authorMartin Kaiser <martin@kaiser.cx>
Sat, 5 Feb 2022 11:37:38 +0000 (12:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Feb 2022 09:17:57 +0000 (10:17 +0100)
The rf variable in odm_TXPowerTrackingCallback_ThermalMeter_8188E
is always 1. The for loops that use rf will be executed only once.

We can remove the variable and the loops.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Link: https://lore.kernel.org/r/20220205113741.379070-6-martin@kaiser.cx
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/r8188eu/hal/HalPhyRf_8188e.c

index c26c87e5cb78678e539b4f23311c805c597ae31f..5df8371a44fb006868f777bc2767608eafd3639e 100644 (file)
@@ -107,7 +107,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
        s8 OFDM_index_old[2] = {0, 0}, CCK_index_old = 0;
        u32 i = 0, j = 0;
 
-       u8 OFDM_min_index = 6, rf; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
+       u8 OFDM_min_index = 6; /* OFDM BB Swing should be less than +3.0dB, which is required by Arthur */
        s8 OFDM_index_mapping[2][index_mapping_NUM_88E] = {
                {0, 0, 2, 3, 4, 4,              /* 2.4G, decrease power */
                5, 6, 7, 7, 8, 9,
@@ -134,8 +134,6 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
 
        ThermalValue = (u8)rtl8188e_PHY_QueryRFReg(Adapter, RF_PATH_A, RF_T_METER_88E, 0xfc00); /* 0x42: RF Reg[15:10] 88E */
 
-       rf = 1;
-
        if (ThermalValue) {
                /* Query OFDM path A default setting */
                ele_D = rtl8188e_PHY_QueryBBReg(Adapter, rOFDM0_XATxIQImbalance, bMaskDWord) & bMaskOFDM_D;
@@ -171,8 +169,7 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
                        dm_odm->RFCalibrateInfo.ThermalValue_LCK = ThermalValue;
                        dm_odm->RFCalibrateInfo.ThermalValue_IQK = ThermalValue;
 
-                       for (i = 0; i < rf; i++)
-                               dm_odm->RFCalibrateInfo.OFDM_index[i] = OFDM_index_old[i];
+                       dm_odm->RFCalibrateInfo.OFDM_index[0] = OFDM_index_old[0];
                        dm_odm->RFCalibrateInfo.CCK_index = CCK_index_old;
                }
 
@@ -237,16 +234,13 @@ odm_TXPowerTrackingCallback_ThermalMeter_8188E(
                        }
                        if (offset >= index_mapping_NUM_88E)
                                offset = index_mapping_NUM_88E - 1;
-                       for (i = 0; i < rf; i++)
-                               OFDM_index[i] = dm_odm->RFCalibrateInfo.OFDM_index[i] + OFDM_index_mapping[j][offset];
+                       OFDM_index[0] = dm_odm->RFCalibrateInfo.OFDM_index[0] + OFDM_index_mapping[j][offset];
                        CCK_index = dm_odm->RFCalibrateInfo.CCK_index + OFDM_index_mapping[j][offset];
 
-                       for (i = 0; i < rf; i++) {
-                               if (OFDM_index[i] > OFDM_TABLE_SIZE_92D - 1)
-                                       OFDM_index[i] = OFDM_TABLE_SIZE_92D - 1;
-                               else if (OFDM_index[i] < OFDM_min_index)
-                                       OFDM_index[i] = OFDM_min_index;
-                       }
+                       if (OFDM_index[0] > OFDM_TABLE_SIZE_92D - 1)
+                               OFDM_index[0] = OFDM_TABLE_SIZE_92D - 1;
+                       else if (OFDM_index[0] < OFDM_min_index)
+                               OFDM_index[0] = OFDM_min_index;
 
                        if (CCK_index > CCK_TABLE_SIZE - 1)
                                CCK_index = CCK_TABLE_SIZE - 1;