staging: rtl8188eu: simplify loop in rtl88eu_phy_iq_calibrate()
PATCH 1/2 staging: rtl8188eu: simplify loop in rtl88eu_phy_iq_calibrate()
Zeroing the array result[m][n] and setting only the values at even 'n's simplifies the code and slightly reduces object file size.
Signed-off-by Michael Straube <[email protected]>
--- drivers/staging/rtl8188eu/hal/phy.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/staging/rtl8188eu/hal/phy.c +4 -9
@@ -1225,15 +1225,10 @@ void rtl88eu_phy_iq_calibrate(struct adapter *adapt, bool recovery)return ; } -for (i =0 ; i <8 ; i++) { - result[0 ][i] =0 ; - result[1 ][i] =0 ; - result[2 ][i] =0 ; -if ((i ==0 ) || (i ==2 ) || (i ==4 ) || (i ==6 )) - result[3 ][i] =0x100 ; -else - result[3 ][i] =0 ; - } +memset (result,0 ,sizeof (result)); +for (i =0 ; i <8 ; i +=2 ) + result[3 ][i] =0x100 ; + final =0xff ; pathaok = false; pathbok = false;
Signature · 1 line
2.19.2
PATCH 2/2 staging: rtl8188eu: reuse Hal_GetChnlGroup88E()
Use Hal_GetChnlGroup88E() instead of duplicating it's code in get_rx_power_val_by_reg().
Signed-off-by Michael Straube <[email protected]>
--- drivers/staging/rtl8188eu/hal/rf.c | 17 +++-------------- .../staging/rtl8188eu/hal/rtl8188e_hal_init.c | 2 +- .../staging/rtl8188eu/include/rtl8188e_hal.h | 2 ++ 3 files changed, 6 insertions(+), 15 deletions(-)
drivers/staging/rtl8188eu/hal/rf.c +3 -14
@@ -164,20 +164,9 @@ static void get_rx_power_val_by_reg(struct adapter *adapt, u8 channel,/* increase power diff defined by Realtek for regulatory */ if (hal_data->pwrGroupCnt ==1 ) chnlGroup =0 ; -if (hal_data->pwrGroupCnt >= hal_data->PGMaxGroup) { -if (channel <3 ) - chnlGroup =0 ; -else if (channel <6 ) - chnlGroup =1 ; -else if (channel <9 ) - chnlGroup =2 ; -else if (channel <12 ) - chnlGroup =3 ; -else if (channel <14 ) - chnlGroup =4 ; -else if (channel ==14 ) - chnlGroup =5 ; - } +if (hal_data->pwrGroupCnt >= hal_data->PGMaxGroup) +Hal_GetChnlGroup88E (channel, &chnlGroup); + write_val = hal_data->MCSTxPowerLevelOriginalOffset[chnlGroup][index+(rf ?8 :0 )] + ((index <2 ) ? powerbase0[rf] : powerbase1[rf]);break ;
drivers/staging/rtl8188eu/hal/rtl8188e_hal_init.c +1 -1
@@ -373,7 +373,7 @@ static void Hal_ReadPowerValueFromPROM_8188E(struct txpowerinfo24g *pwrInfo24G, } } -static void Hal_GetChnlGroup88E (u8 chnl,u8 *group) +void Hal_GetChnlGroup88E (u8 chnl,u8 *group) {if (chnl <3 )/* Channel 1-2 */ *group =0 ;
drivers/staging/rtl8188eu/include/rtl8188e_hal.h +2 -0
@@ -329,6 +329,8 @@ struct hal_data_8188e {u8 UsbRxAggPageTimeout; }; +void Hal_GetChnlGroup88E (u8 chnl,u8 *group); +/* rtl8188e_hal_init.c */ void _8051Reset88E (struct adapter *padapter);void rtl8188e_InitializeFirmwareVars (struct adapter *padapter);
Signature · 1 line
2.19.2