Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: rtl8723bs: do some code cleaning in modified function

do some code cleaning after changes of previous commit.
Fixed comments, camel case names, variable naming conventions;
kept function names without chip series numbers (this is
just code for 8723), fixed indentations, blank lines and
other minor stuff.

Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Link: https://lore.kernel.org/r/2bddef34cebdf35666d8abec4462c1a8d30c8c60.1628329348.git.fabioaiuto83@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Fabio Aiuto and committed by
Greg Kroah-Hartman
caa976eb 7942bdd4

+135 -130
+14 -12
drivers/staging/rtl8723bs/hal/odm_CfoTracking.c
··· 188 188 } 189 189 } 190 190 191 - void ODM_ParsingCFO(void *pDM_VOID, void *pPktinfo_VOID, s8 *pcfotail) 191 + void odm_parsing_cfo(void *dm_void, void *pkt_info_void, s8 *cfotail) 192 192 { 193 - struct dm_odm_t *pDM_Odm = (struct dm_odm_t *)pDM_VOID; 194 - struct odm_packet_info *pPktinfo = pPktinfo_VOID; 195 - struct cfo_tracking *pCfoTrack = &pDM_Odm->DM_CfoTrack; 193 + struct dm_odm_t *dm_odm = (struct dm_odm_t *)dm_void; 194 + struct odm_packet_info *pkt_info = pkt_info_void; 195 + struct cfo_tracking *cfo_track = &dm_odm->DM_CfoTrack; 196 196 u8 i; 197 197 198 - if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) 198 + if (!(dm_odm->SupportAbility & ODM_BB_CFO_TRACKING)) 199 199 return; 200 200 201 - if (pPktinfo->station_id != 0) { 202 - /* 3 Update CFO report for path-A & path-B */ 203 - /* Only paht-A and path-B have CFO tail and short CFO */ 201 + if (pkt_info->station_id != 0) { 202 + /* 203 + * 3 Update CFO report for path-A & path-B 204 + * Only paht-A and path-B have CFO tail and short CFO 205 + */ 204 206 for (i = ODM_RF_PATH_A; i <= ODM_RF_PATH_B; i++) 205 - pCfoTrack->CFO_tail[i] = (int)pcfotail[i]; 207 + cfo_track->CFO_tail[i] = (int)cfotail[i]; 206 208 207 209 /* 3 Update packet counter */ 208 - if (pCfoTrack->packetCount == 0xffffffff) 209 - pCfoTrack->packetCount = 0; 210 + if (cfo_track->packetCount == 0xffffffff) 211 + cfo_track->packetCount = 0; 210 212 else 211 - pCfoTrack->packetCount++; 213 + cfo_track->packetCount++; 212 214 } 213 215 }
+1 -1
drivers/staging/rtl8723bs/hal/odm_CfoTracking.h
··· 34 34 35 35 void ODM_CfoTracking(void *pDM_VOID); 36 36 37 - void ODM_ParsingCFO(void *pDM_VOID, void *pPktinfo_VOID, s8 *pcfotail); 37 + void odm_parsing_cfo(void *pDM_VOID, void *pPktinfo_VOID, s8 *pcfotail); 38 38 39 39 #endif
+112 -109
drivers/staging/rtl8723bs/hal/odm_HWConfig.c
··· 10 10 #define READ_AND_CONFIG_MP(ic, txt) (ODM_ReadAndConfig_MP_##ic##txt(pDM_Odm)) 11 11 #define READ_AND_CONFIG READ_AND_CONFIG_MP 12 12 13 - static u8 odm_QueryRxPwrPercentage(s8 AntPower) 13 + static u8 odm_query_rx_pwr_percentage(s8 ant_power) 14 14 { 15 - if ((AntPower <= -100) || (AntPower >= 20)) 15 + if ((ant_power <= -100) || (ant_power >= 20)) 16 16 return 0; 17 - else if (AntPower >= 0) 17 + else if (ant_power >= 0) 18 18 return 100; 19 19 else 20 - return 100 + AntPower; 20 + return 100 + ant_power; 21 21 22 22 } 23 23 24 - s32 odm_SignalScaleMapping(struct dm_odm_t *pDM_Odm, s32 CurrSig) 24 + s32 odm_signal_scale_mapping(struct dm_odm_t *dm_odm, s32 curr_sig) 25 25 { 26 - s32 RetSig = 0; 26 + s32 ret_sig = 0; 27 27 28 - if (pDM_Odm->SupportInterface == ODM_ITRF_SDIO) { 29 - if (CurrSig >= 51 && CurrSig <= 100) 30 - RetSig = 100; 31 - else if (CurrSig >= 41 && CurrSig <= 50) 32 - RetSig = 80 + ((CurrSig - 40)*2); 33 - else if (CurrSig >= 31 && CurrSig <= 40) 34 - RetSig = 66 + (CurrSig - 30); 35 - else if (CurrSig >= 21 && CurrSig <= 30) 36 - RetSig = 54 + (CurrSig - 20); 37 - else if (CurrSig >= 10 && CurrSig <= 20) 38 - RetSig = 42 + (((CurrSig - 10) * 2) / 3); 39 - else if (CurrSig >= 5 && CurrSig <= 9) 40 - RetSig = 22 + (((CurrSig - 5) * 3) / 2); 41 - else if (CurrSig >= 1 && CurrSig <= 4) 42 - RetSig = 6 + (((CurrSig - 1) * 3) / 2); 28 + if (dm_odm->SupportInterface == ODM_ITRF_SDIO) { 29 + if (curr_sig >= 51 && curr_sig <= 100) 30 + ret_sig = 100; 31 + else if (curr_sig >= 41 && curr_sig <= 50) 32 + ret_sig = 80 + ((curr_sig - 40)*2); 33 + else if (curr_sig >= 31 && curr_sig <= 40) 34 + ret_sig = 66 + (curr_sig - 30); 35 + else if (curr_sig >= 21 && curr_sig <= 30) 36 + ret_sig = 54 + (curr_sig - 20); 37 + else if (curr_sig >= 10 && curr_sig <= 20) 38 + ret_sig = 42 + (((curr_sig - 10) * 2) / 3); 39 + else if (curr_sig >= 5 && curr_sig <= 9) 40 + ret_sig = 22 + (((curr_sig - 5) * 3) / 2); 41 + else if (curr_sig >= 1 && curr_sig <= 4) 42 + ret_sig = 6 + (((curr_sig - 1) * 3) / 2); 43 43 else 44 - RetSig = CurrSig; 44 + ret_sig = curr_sig; 45 45 } 46 46 47 - return RetSig; 47 + return ret_sig; 48 48 } 49 49 50 - static u8 odm_EVMdbToPercentage(s8 Value) 50 + static u8 odm_evm_db_to_percentage(s8 value) 51 51 { 52 52 /* */ 53 53 /* -33dB~0dB to 0%~99% */ 54 54 /* */ 55 55 s8 ret_val; 56 56 57 - ret_val = Value; 57 + ret_val = value; 58 58 ret_val /= 2; 59 59 60 60 if (ret_val >= 0) ··· 71 71 return ret_val; 72 72 } 73 73 74 - static void odm_RxPhyStatus92CSeries_Parsing( 75 - struct dm_odm_t *pDM_Odm, 76 - struct odm_phy_info *pPhyInfo, 77 - u8 *pPhyStatus, 78 - struct odm_packet_info *pPktinfo 79 - ) 74 + static void odm_rx_phy_status_parsing(struct dm_odm_t *dm_odm, 75 + struct odm_phy_info *phy_info, 76 + u8 *phy_status, 77 + struct odm_packet_info *pkt_info) 80 78 { 81 79 u8 i; 82 80 s8 rx_pwr[4], rx_pwr_all = 0; 83 - u8 EVM, PWDB_ALL = 0, PWDB_ALL_BT; 84 - u8 RSSI, total_rssi = 0; 85 - bool isCCKrate = false; 81 + u8 evm, pwdb_all = 0, pwdb_all_bt; 82 + u8 rssi, total_rssi = 0; 83 + bool is_cck_rate = false; 86 84 u8 rf_rx_num = 0; 87 - u8 LNA_idx, VGA_idx; 88 - struct phy_status_rpt_8192cd_t *pPhyStaRpt = (struct phy_status_rpt_8192cd_t *)pPhyStatus; 85 + u8 lna_idx, vga_idx; 86 + struct phy_status_rpt_8192cd_t *phy_sta_rpt = (struct phy_status_rpt_8192cd_t *)phy_status; 89 87 90 - isCCKrate = pPktinfo->data_rate <= DESC_RATE11M; 91 - pPhyInfo->rx_mimo_signal_quality[ODM_RF_PATH_A] = -1; 92 - pPhyInfo->rx_mimo_signal_quality[ODM_RF_PATH_B] = -1; 88 + is_cck_rate = pkt_info->data_rate <= DESC_RATE11M; 89 + phy_info->rx_mimo_signal_quality[ODM_RF_PATH_A] = -1; 90 + phy_info->rx_mimo_signal_quality[ODM_RF_PATH_B] = -1; 93 91 94 92 95 - if (isCCKrate) { 93 + if (is_cck_rate) { 96 94 u8 cck_agc_rpt; 97 95 98 - pDM_Odm->PhyDbgInfo.NumQryPhyStatusCCK++; 99 - /* */ 100 - /* (1)Hardware does not provide RSSI for CCK */ 101 - /* (2)PWDB, Average PWDB calculated by hardware (for rate adaptive) */ 102 - /* */ 96 + dm_odm->PhyDbgInfo.NumQryPhyStatusCCK++; 103 97 104 - cck_agc_rpt = pPhyStaRpt->cck_agc_rpt_ofdm_cfosho_a; 98 + /* 99 + * (1)Hardware does not provide RSSI for CCK/ 100 + * (2)PWDB, Average PWDB calculated by 101 + * hardware (for rate adaptive) 102 + */ 105 103 106 - /* 2011.11.28 LukeLee: 88E use different LNA & VGA gain table */ 107 - /* The RSSI formula should be modified according to the gain table */ 108 - LNA_idx = ((cck_agc_rpt & 0xE0)>>5); 109 - VGA_idx = (cck_agc_rpt & 0x1F); 110 - rx_pwr_all = odm_CCKRSSI_8723B(LNA_idx, VGA_idx); 111 - PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); 112 - if (PWDB_ALL > 100) 113 - PWDB_ALL = 100; 104 + cck_agc_rpt = phy_sta_rpt->cck_agc_rpt_ofdm_cfosho_a; 114 105 115 - pPhyInfo->rx_pwd_ba11 = PWDB_ALL; 116 - pPhyInfo->bt_rx_rssi_percentage = PWDB_ALL; 117 - pPhyInfo->recv_signal_power = rx_pwr_all; 118 - /* */ 106 + /* 107 + * 2011.11.28 LukeLee: 88E use different LNA & VGA gain table 108 + * The RSSI formula should be modified according to the gain table 109 + */ 110 + lna_idx = ((cck_agc_rpt & 0xE0)>>5); 111 + vga_idx = (cck_agc_rpt & 0x1F); 112 + rx_pwr_all = odm_cck_rssi(lna_idx, vga_idx); 113 + pwdb_all = odm_query_rx_pwr_percentage(rx_pwr_all); 114 + if (pwdb_all > 100) 115 + pwdb_all = 100; 116 + 117 + phy_info->rx_pwd_ba11 = pwdb_all; 118 + phy_info->bt_rx_rssi_percentage = pwdb_all; 119 + phy_info->recv_signal_power = rx_pwr_all; 120 + 119 121 /* (3) Get Signal Quality (EVM) */ 120 - /* */ 122 + 121 123 /* if (pPktinfo->bPacketMatchBSSID) */ 122 124 { 123 - u8 SQ, SQ_rpt; 125 + u8 sq, sq_rpt; 124 126 125 - if (pPhyInfo->rx_pwd_ba11 > 40 && !pDM_Odm->bInHctTest) 126 - SQ = 100; 127 + if (phy_info->rx_pwd_ba11 > 40 && !dm_odm->bInHctTest) 128 + sq = 100; 127 129 else { 128 - SQ_rpt = pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all; 130 + sq_rpt = phy_sta_rpt->cck_sig_qual_ofdm_pwdb_all; 129 131 130 - if (SQ_rpt > 64) 131 - SQ = 0; 132 - else if (SQ_rpt < 20) 133 - SQ = 100; 132 + if (sq_rpt > 64) 133 + sq = 0; 134 + else if (sq_rpt < 20) 135 + sq = 100; 134 136 else 135 - SQ = ((64-SQ_rpt) * 100) / 44; 137 + sq = ((64-sq_rpt) * 100) / 44; 136 138 137 139 } 138 140 139 - pPhyInfo->signal_quality = SQ; 140 - pPhyInfo->rx_mimo_signal_quality[ODM_RF_PATH_A] = SQ; 141 - pPhyInfo->rx_mimo_signal_quality[ODM_RF_PATH_B] = -1; 141 + phy_info->signal_quality = sq; 142 + phy_info->rx_mimo_signal_quality[ODM_RF_PATH_A] = sq; 143 + phy_info->rx_mimo_signal_quality[ODM_RF_PATH_B] = -1; 142 144 } 143 145 } else { /* is OFDM rate */ 144 - pDM_Odm->PhyDbgInfo.NumQryPhyStatusOFDM++; 146 + dm_odm->PhyDbgInfo.NumQryPhyStatusOFDM++; 145 147 146 - /* */ 147 - /* (1)Get RSSI for HT rate */ 148 - /* */ 148 + /* 149 + * (1)Get RSSI for HT rate 150 + */ 149 151 150 152 for (i = ODM_RF_PATH_A; i < ODM_RF_PATH_MAX; i++) { 151 153 /* 2008/01/30 MH we will judge RF RX path now. */ 152 - if (pDM_Odm->RFPathRxEnable & BIT(i)) 154 + if (dm_odm->RFPathRxEnable & BIT(i)) 153 155 rf_rx_num++; 154 156 /* else */ 155 157 /* continue; */ 156 158 157 - rx_pwr[i] = ((pPhyStaRpt->path_agc[i].gain&0x3F)*2) - 110; 159 + rx_pwr[i] = ((phy_sta_rpt->path_agc[i].gain & 0x3F) * 2) - 110; 158 160 159 - 160 - pPhyInfo->rx_pwr[i] = rx_pwr[i]; 161 + phy_info->rx_pwr[i] = rx_pwr[i]; 161 162 162 163 /* Translate DBM to percentage. */ 163 - RSSI = odm_QueryRxPwrPercentage(rx_pwr[i]); 164 - total_rssi += RSSI; 164 + rssi = odm_query_rx_pwr_percentage(rx_pwr[i]); 165 + total_rssi += rssi; 165 166 166 - pPhyInfo->rx_mimo_signal_strength[i] = (u8) RSSI; 167 + phy_info->rx_mimo_signal_strength[i] = (u8)rssi; 167 168 168 169 /* Get Rx snr value in DB */ 169 - pPhyInfo->rx_snr[i] = pDM_Odm->PhyDbgInfo.RxSNRdB[i] = (s32)(pPhyStaRpt->path_rxsnr[i]/2); 170 + phy_info->rx_snr[i] = dm_odm->PhyDbgInfo.RxSNRdB[i] = (s32)(phy_sta_rpt->path_rxsnr[i]/2); 170 171 } 171 172 173 + /* 174 + * (2)PWDB, Average PWDB calculated by hardware (for rate adaptive) 175 + */ 176 + rx_pwr_all = ((phy_sta_rpt->cck_sig_qual_ofdm_pwdb_all >> 1) & 0x7f) - 110; 172 177 173 - /* */ 174 - /* (2)PWDB, Average PWDB calculated by hardware (for rate adaptive) */ 175 - /* */ 176 - rx_pwr_all = (((pPhyStaRpt->cck_sig_qual_ofdm_pwdb_all) >> 1)&0x7f)-110; 178 + pwdb_all_bt = pwdb_all = odm_query_rx_pwr_percentage(rx_pwr_all); 177 179 178 - PWDB_ALL_BT = PWDB_ALL = odm_QueryRxPwrPercentage(rx_pwr_all); 179 - 180 - pPhyInfo->rx_pwd_ba11 = PWDB_ALL; 181 - pPhyInfo->bt_rx_rssi_percentage = PWDB_ALL_BT; 182 - pPhyInfo->rx_power = rx_pwr_all; 183 - pPhyInfo->recv_signal_power = rx_pwr_all; 180 + phy_info->rx_pwd_ba11 = pwdb_all; 181 + phy_info->bt_rx_rssi_percentage = pwdb_all_bt; 182 + phy_info->rx_power = rx_pwr_all; 183 + phy_info->recv_signal_power = rx_pwr_all; 184 184 185 185 /* 186 186 * (3)EVM of HT rate ··· 195 195 * is supposed to be negative) is not correct 196 196 * anymore. 197 197 */ 198 - EVM = odm_EVMdbToPercentage(pPhyStaRpt->stream_rxevm[0]); /* dbm */ 198 + evm = odm_evm_db_to_percentage(phy_sta_rpt->stream_rxevm[0]); /* dbm */ 199 199 200 200 /* Fill value in RFD, Get the first spatial stream only */ 201 - pPhyInfo->signal_quality = (u8)(EVM & 0xff); 201 + phy_info->signal_quality = (u8)(evm & 0xff); 202 202 203 - pPhyInfo->rx_mimo_signal_quality[ODM_RF_PATH_A] = (u8)(EVM & 0xff); 203 + phy_info->rx_mimo_signal_quality[ODM_RF_PATH_A] = (u8)(evm & 0xff); 204 204 205 - ODM_ParsingCFO(pDM_Odm, pPktinfo, pPhyStaRpt->path_cfotail); 205 + odm_parsing_cfo(dm_odm, pkt_info, phy_sta_rpt->path_cfotail); 206 206 } 207 207 208 - /* UI BSS List signal strength(in percentage), make it good looking, from 0~100. */ 209 - /* It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). */ 210 - if (isCCKrate) { 211 - pPhyInfo->signal_strength = (u8)(odm_SignalScaleMapping(pDM_Odm, PWDB_ALL));/* PWDB_ALL; */ 208 + /* 209 + * UI BSS List signal strength(in percentage), make it good 210 + * looking, from 0~100. 211 + * It is assigned to the BSS List in GetValueFromBeaconOrProbeRsp(). 212 + */ 213 + if (is_cck_rate) { 214 + phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, pwdb_all)); 212 215 } else { 213 216 if (rf_rx_num != 0) { 214 - pPhyInfo->signal_strength = (u8)(odm_SignalScaleMapping(pDM_Odm, total_rssi /= rf_rx_num)); 217 + phy_info->signal_strength = (u8)(odm_signal_scale_mapping(dm_odm, total_rssi /= rf_rx_num)); 215 218 } 216 219 } 217 220 } ··· 367 364 /* Endianness before calling this API */ 368 365 /* */ 369 366 static void ODM_PhyStatusQuery_92CSeries( 370 - struct dm_odm_t *pDM_Odm, 371 - struct odm_phy_info *pPhyInfo, 372 - u8 *pPhyStatus, 373 - struct odm_packet_info *pPktinfo 367 + struct dm_odm_t *dm_odm, 368 + struct odm_phy_info *phy_info, 369 + u8 *phy_status, 370 + struct odm_packet_info *pkt_info 374 371 ) 375 372 { 376 373 377 - odm_RxPhyStatus92CSeries_Parsing(pDM_Odm, pPhyInfo, pPhyStatus, pPktinfo); 374 + odm_rx_phy_status_parsing(dm_odm, phy_info, phy_status, pkt_info); 378 375 379 - if (!pDM_Odm->RSSI_test) 380 - odm_Process_RSSIForDM(pDM_Odm, pPhyInfo, pPktinfo); 376 + if (!dm_odm->RSSI_test) 377 + odm_Process_RSSIForDM(dm_odm, phy_info, pkt_info); 381 378 } 382 379 383 380 void ODM_PhyStatusQuery(
+1 -1
drivers/staging/rtl8723bs/hal/odm_HWConfig.h
··· 102 102 u32 *pSize 103 103 ); 104 104 105 - s32 odm_SignalScaleMapping(struct dm_odm_t *pDM_Odm, s32 CurrSig); 105 + s32 odm_signal_scale_mapping(struct dm_odm_t *pDM_Odm, s32 CurrSig); 106 106 107 107 #endif
+6 -6
drivers/staging/rtl8723bs/hal/odm_RTL8723B.c
··· 7 7 8 8 #include "odm_precomp.h" 9 9 10 - s8 odm_CCKRSSI_8723B(u8 LNA_idx, u8 VGA_idx) 10 + s8 odm_cck_rssi(u8 lna_idx, u8 vga_idx) 11 11 { 12 12 s8 rx_pwr_all = 0x00; 13 13 14 - switch (LNA_idx) { 14 + switch (lna_idx) { 15 15 /* 46 53 73 95 201301231630 */ 16 16 /* 46 53 77 99 201301241630 */ 17 17 18 18 case 6: 19 - rx_pwr_all = -34 - (2 * VGA_idx); 19 + rx_pwr_all = -34 - (2 * vga_idx); 20 20 break; 21 21 case 4: 22 - rx_pwr_all = -14 - (2 * VGA_idx); 22 + rx_pwr_all = -14 - (2 * vga_idx); 23 23 break; 24 24 case 1: 25 - rx_pwr_all = 6 - (2 * VGA_idx); 25 + rx_pwr_all = 6 - (2 * vga_idx); 26 26 break; 27 27 case 0: 28 - rx_pwr_all = 16 - (2 * VGA_idx); 28 + rx_pwr_all = 16 - (2 * vga_idx); 29 29 break; 30 30 default: 31 31 /* rx_pwr_all = -53+(2*(31-VGA_idx)); */
+1 -1
drivers/staging/rtl8723bs/hal/odm_RTL8723B.h
··· 9 9 10 10 #define DM_DIG_MIN_NIC_8723 0x1C 11 11 12 - s8 odm_CCKRSSI_8723B(u8 LNA_idx, u8 VGA_idx); 12 + s8 odm_cck_rssi(u8 LNA_idx, u8 VGA_idx); 13 13 14 14 #endif