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

staging: rtl8723bs: remove RF_*TX enum

remove RF_*TX enum, its only used value is RF_1TX.
So remove it and remove all indexes and loop over
these enum items.

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

authored by

Fabio Aiuto and committed by
Greg Kroah-Hartman
da4c99c2 1b09e388

+64 -112
+8 -9
drivers/staging/rtl8723bs/hal/HalHWImg8723B_BB.c
··· 543 543 ******************************************************************************/ 544 544 545 545 static u32 Array_MP_8723B_PHY_REG_PG[] = { 546 - 0, 0, 0x00000e08, 0x0000ff00, 0x00003800, 547 - 0, 0, 0x0000086c, 0xffffff00, 0x32343600, 548 - 0, 0, 0x00000e00, 0xffffffff, 0x40424444, 549 - 0, 0, 0x00000e04, 0xffffffff, 0x28323638, 550 - 0, 0, 0x00000e10, 0xffffffff, 0x38404244, 551 - 0, 0, 0x00000e14, 0xffffffff, 0x26303436 546 + 0, 0x00000e08, 0x0000ff00, 0x00003800, 547 + 0, 0x0000086c, 0xffffff00, 0x32343600, 548 + 0, 0x00000e00, 0xffffffff, 0x40424444, 549 + 0, 0x00000e04, 0xffffffff, 0x28323638, 550 + 0, 0x00000e10, 0xffffffff, 0x38404244, 551 + 0, 0x00000e14, 0xffffffff, 0x26303436 552 552 }; 553 553 554 554 void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(struct dm_odm_t *pDM_Odm) ··· 559 559 pDM_Odm->PhyRegPgVersion = 1; 560 560 pDM_Odm->PhyRegPgValueType = PHY_REG_PG_EXACT_VALUE; 561 561 562 - for (i = 0; i < ARRAY_SIZE(Array_MP_8723B_PHY_REG_PG); i += 5) { 562 + for (i = 0; i < ARRAY_SIZE(Array_MP_8723B_PHY_REG_PG); i += 4) { 563 563 u32 v1 = Array[i]; 564 564 u32 v2 = Array[i+1]; 565 565 u32 v3 = Array[i+2]; 566 566 u32 v4 = Array[i+3]; 567 - u32 v5 = Array[i+4]; 568 567 569 - odm_ConfigBB_PHY_REG_PG_8723B(pDM_Odm, v1, v2, v3, v4, v5); 568 + odm_ConfigBB_PHY_REG_PG_8723B(pDM_Odm, v1, v2, v3, v4); 570 569 } 571 570 }
+46 -74
drivers/staging/rtl8723bs/hal/hal_com_phycfg.c
··· 11 11 #include <linux/kernel.h> 12 12 13 13 u8 PHY_GetTxPowerByRateBase(struct adapter *Adapter, u8 RfPath, 14 - u8 TxNum, enum rate_section RateSection) 14 + enum rate_section RateSection) 15 15 { 16 16 struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); 17 17 u8 value = 0; ··· 21 21 22 22 switch (RateSection) { 23 23 case CCK: 24 - value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][0]; 24 + value = pHalData->TxPwrByRateBase2_4G[RfPath][0]; 25 25 break; 26 26 case OFDM: 27 - value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][1]; 27 + value = pHalData->TxPwrByRateBase2_4G[RfPath][1]; 28 28 break; 29 29 case HT_MCS0_MCS7: 30 - value = pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][2]; 30 + value = pHalData->TxPwrByRateBase2_4G[RfPath][2]; 31 31 break; 32 32 default: 33 33 break; ··· 37 37 } 38 38 39 39 static void 40 - phy_SetTxPowerByRateBase( 41 - struct adapter *Adapter, 42 - u8 RfPath, 43 - enum rate_section RateSection, 44 - u8 TxNum, 45 - u8 Value 46 - ) 40 + phy_SetTxPowerByRateBase(struct adapter *Adapter, u8 RfPath, 41 + enum rate_section RateSection, u8 Value) 47 42 { 48 43 struct hal_com_data *pHalData = GET_HAL_DATA(Adapter); 49 44 ··· 47 52 48 53 switch (RateSection) { 49 54 case CCK: 50 - pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][0] = Value; 55 + pHalData->TxPwrByRateBase2_4G[RfPath][0] = Value; 51 56 break; 52 57 case OFDM: 53 - pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][1] = Value; 58 + pHalData->TxPwrByRateBase2_4G[RfPath][1] = Value; 54 59 break; 55 60 case HT_MCS0_MCS7: 56 - pHalData->TxPwrByRateBase2_4G[RfPath][TxNum][2] = Value; 61 + pHalData->TxPwrByRateBase2_4G[RfPath][2] = Value; 57 62 break; 58 63 default: 59 64 break; ··· 68 73 u8 path, base; 69 74 70 75 for (path = RF_PATH_A; path <= RF_PATH_B; ++path) { 71 - base = PHY_GetTxPowerByRate(padapter, path, RF_1TX, MGN_11M); 72 - phy_SetTxPowerByRateBase(padapter, path, CCK, RF_1TX, base); 76 + base = PHY_GetTxPowerByRate(padapter, path, MGN_11M); 77 + phy_SetTxPowerByRateBase(padapter, path, CCK, base); 73 78 74 - base = PHY_GetTxPowerByRate(padapter, path, RF_1TX, MGN_54M); 75 - phy_SetTxPowerByRateBase(padapter, path, OFDM, RF_1TX, base); 79 + base = PHY_GetTxPowerByRate(padapter, path, MGN_54M); 80 + phy_SetTxPowerByRateBase(padapter, path, OFDM, base); 76 81 77 - base = PHY_GetTxPowerByRate(padapter, path, RF_1TX, MGN_MCS7); 78 - phy_SetTxPowerByRateBase(padapter, path, HT_MCS0_MCS7, RF_1TX, base); 82 + base = PHY_GetTxPowerByRate(padapter, path, MGN_MCS7); 83 + phy_SetTxPowerByRateBase(padapter, path, HT_MCS0_MCS7, base); 79 84 } 80 85 } 81 86 ··· 315 320 } 316 321 } 317 322 318 - static void PHY_StoreTxPowerByRateNew( 319 - struct adapter *padapter, 320 - u32 RfPath, 321 - u32 TxNum, 322 - u32 RegAddr, 323 - u32 BitMask, 324 - u32 Data 325 - ) 323 + static void PHY_StoreTxPowerByRateNew(struct adapter *padapter, u32 RfPath, 324 + u32 RegAddr, u32 BitMask, u32 Data) 326 325 { 327 326 struct hal_com_data *pHalData = GET_HAL_DATA(padapter); 328 327 u8 i = 0, rateIndex[4] = {0}, rateNum = 0; ··· 327 338 if (RfPath >= RF_PATH_MAX) 328 339 return; 329 340 330 - if (TxNum > RF_MAX_TX_NUM) 331 - return; 332 - 333 341 for (i = 0; i < rateNum; ++i) { 334 - pHalData->TxPwrByRateOffset[RfPath][TxNum][rateIndex[i]] = PwrByRateVal[i]; 342 + pHalData->TxPwrByRateOffset[RfPath][rateIndex[i]] = PwrByRateVal[i]; 335 343 } 336 344 } 337 345 ··· 345 359 void PHY_InitTxPowerByRate(struct adapter *padapter) 346 360 { 347 361 struct hal_com_data *pHalData = GET_HAL_DATA(padapter); 348 - u8 rfPath, TxNum, rate; 362 + u8 rfPath, rate; 349 363 350 364 for (rfPath = 0; rfPath < TX_PWR_BY_RATE_NUM_RF; ++rfPath) 351 - for (TxNum = 0; TxNum < TX_PWR_BY_RATE_NUM_RF; ++TxNum) 352 - for (rate = 0; rate < TX_PWR_BY_RATE_NUM_RATE; ++rate) 353 - pHalData->TxPwrByRateOffset[rfPath][TxNum][rate] = 0; 365 + for (rate = 0; rate < TX_PWR_BY_RATE_NUM_RATE; ++rate) 366 + pHalData->TxPwrByRateOffset[rfPath][rate] = 0; 354 367 } 355 368 356 369 void PHY_StoreTxPowerByRate( 357 370 struct adapter *padapter, 358 371 u32 RfPath, 359 - u32 TxNum, 360 372 u32 RegAddr, 361 373 u32 BitMask, 362 374 u32 Data ··· 364 380 struct dm_odm_t *pDM_Odm = &pHalData->odmpriv; 365 381 366 382 if (pDM_Odm->PhyRegPgVersion > 0) 367 - PHY_StoreTxPowerByRateNew(padapter, RfPath, TxNum, RegAddr, BitMask, Data); 383 + PHY_StoreTxPowerByRateNew(padapter, RfPath, RegAddr, BitMask, Data); 368 384 else if (pDM_Odm->PhyRegPgVersion == 0) { 369 385 PHY_StoreTxPowerByRateOld(padapter, RegAddr, BitMask, Data); 370 386 } ··· 375 391 struct adapter *padapter 376 392 ) 377 393 { 378 - u8 base = 0, i = 0, value = 0, path = 0, txNum = 0; 394 + u8 base = 0, i = 0, value = 0, path = 0; 379 395 u8 cckRates[4] = { 380 396 MGN_1M, MGN_2M, MGN_5_5M, MGN_11M 381 397 }; ··· 386 402 MGN_MCS0, MGN_MCS1, MGN_MCS2, MGN_MCS3, MGN_MCS4, MGN_MCS5, MGN_MCS6, MGN_MCS7 387 403 }; 388 404 for (path = RF_PATH_A; path < RF_PATH_MAX; ++path) { 389 - for (txNum = RF_1TX; txNum < RF_MAX_TX_NUM; ++txNum) { 390 - /* CCK */ 391 - base = PHY_GetTxPowerByRate(padapter, path, txNum, MGN_11M); 392 - for (i = 0; i < ARRAY_SIZE(cckRates); ++i) { 393 - value = PHY_GetTxPowerByRate(padapter, path, txNum, cckRates[i]); 394 - PHY_SetTxPowerByRate(padapter, path, txNum, cckRates[i], value - base); 395 - } 405 + /* CCK */ 406 + base = PHY_GetTxPowerByRate(padapter, path, MGN_11M); 407 + for (i = 0; i < ARRAY_SIZE(cckRates); ++i) { 408 + value = PHY_GetTxPowerByRate(padapter, path, cckRates[i]); 409 + PHY_SetTxPowerByRate(padapter, path, cckRates[i], value - base); 410 + } 396 411 397 - /* OFDM */ 398 - base = PHY_GetTxPowerByRate(padapter, path, txNum, MGN_54M); 399 - for (i = 0; i < sizeof(ofdmRates); ++i) { 400 - value = PHY_GetTxPowerByRate(padapter, path, txNum, ofdmRates[i]); 401 - PHY_SetTxPowerByRate(padapter, path, txNum, ofdmRates[i], value - base); 402 - } 412 + /* OFDM */ 413 + base = PHY_GetTxPowerByRate(padapter, path, MGN_54M); 414 + for (i = 0; i < sizeof(ofdmRates); ++i) { 415 + value = PHY_GetTxPowerByRate(padapter, path, ofdmRates[i]); 416 + PHY_SetTxPowerByRate(padapter, path, ofdmRates[i], value - base); 417 + } 403 418 404 - /* HT MCS0~7 */ 405 - base = PHY_GetTxPowerByRate(padapter, path, txNum, MGN_MCS7); 406 - for (i = 0; i < sizeof(mcs0_7Rates); ++i) { 407 - value = PHY_GetTxPowerByRate(padapter, path, txNum, mcs0_7Rates[i]); 408 - PHY_SetTxPowerByRate(padapter, path, txNum, mcs0_7Rates[i], value - base); 409 - } 410 - 419 + /* HT MCS0~7 */ 420 + base = PHY_GetTxPowerByRate(padapter, path, MGN_MCS7); 421 + for (i = 0; i < sizeof(mcs0_7Rates); ++i) { 422 + value = PHY_GetTxPowerByRate(padapter, path, mcs0_7Rates[i]); 423 + PHY_SetTxPowerByRate(padapter, path, mcs0_7Rates[i], value - base); 411 424 } 412 425 } 413 426 } ··· 571 590 return index; 572 591 } 573 592 574 - s8 PHY_GetTxPowerByRate( 575 - struct adapter *padapter, u8 RFPath, u8 TxNum, u8 Rate 576 - ) 593 + s8 PHY_GetTxPowerByRate(struct adapter *padapter, u8 RFPath, u8 Rate) 577 594 { 578 595 struct hal_com_data *pHalData = GET_HAL_DATA(padapter); 579 596 s8 value = 0; ··· 584 605 if (RFPath >= RF_PATH_MAX) 585 606 return value; 586 607 587 - if (TxNum >= RF_MAX_TX_NUM) 588 - return value; 589 - 590 608 if (rateIndex >= TX_PWR_BY_RATE_NUM_RATE) 591 609 return value; 592 610 593 - return pHalData->TxPwrByRateOffset[RFPath][TxNum][rateIndex]; 611 + return pHalData->TxPwrByRateOffset[RFPath][rateIndex]; 594 612 595 613 } 596 614 597 615 void PHY_SetTxPowerByRate( 598 616 struct adapter *padapter, 599 617 u8 RFPath, 600 - u8 TxNum, 601 618 u8 Rate, 602 619 s8 Value 603 620 ) ··· 604 629 if (RFPath >= RF_PATH_MAX) 605 630 return; 606 631 607 - if (TxNum >= RF_MAX_TX_NUM) 608 - return; 609 - 610 632 if (rateIndex >= TX_PWR_BY_RATE_NUM_RATE) 611 633 return; 612 634 613 - pHalData->TxPwrByRateOffset[RFPath][TxNum][rateIndex] = Value; 635 + pHalData->TxPwrByRateOffset[RFPath][rateIndex] = Value; 614 636 } 615 637 616 638 void PHY_SetTxPowerLevelByPath(struct adapter *Adapter, u8 channel, u8 path) ··· 769 797 for (rfPath = RF_PATH_A; rfPath < MAX_RF_PATH_NUM; ++rfPath) { 770 798 if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE) { 771 799 if (rateSection == 2) /* HT 1T */ 772 - BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, rfPath, RF_1TX, HT_MCS0_MCS7); 800 + BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, rfPath, HT_MCS0_MCS7); 773 801 else if (rateSection == 1) /* OFDM */ 774 - BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, rfPath, RF_1TX, OFDM); 802 + BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, rfPath, OFDM); 775 803 else if (rateSection == 0) /* CCK */ 776 - BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, rfPath, RF_1TX, CCK); 804 + BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, rfPath, CCK); 777 805 } else 778 806 BW40PwrBasedBm2_4G = Adapter->registrypriv.RegPowerBase * 2; 779 807
+1 -2
drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.c
··· 118 118 void odm_ConfigBB_PHY_REG_PG_8723B( 119 119 struct dm_odm_t *pDM_Odm, 120 120 u32 RfPath, 121 - u32 TxNum, 122 121 u32 Addr, 123 122 u32 Bitmask, 124 123 u32 Data ··· 126 127 if (Addr == 0xfe || Addr == 0xffe) 127 128 msleep(50); 128 129 else { 129 - PHY_StoreTxPowerByRate(pDM_Odm->Adapter, RfPath, TxNum, Addr, Bitmask, Data); 130 + PHY_StoreTxPowerByRate(pDM_Odm->Adapter, RfPath, Addr, Bitmask, Data); 130 131 } 131 132 } 132 133
+2 -7
drivers/staging/rtl8723bs/hal/odm_RegConfig8723B.h
··· 24 24 u32 Data 25 25 ); 26 26 27 - void odm_ConfigBB_PHY_REG_PG_8723B(struct dm_odm_t *pDM_Odm, 28 - u32 RfPath, 29 - u32 TxNum, 30 - u32 Addr, 31 - u32 Bitmask, 32 - u32 Data 33 - ); 27 + void odm_ConfigBB_PHY_REG_PG_8723B(struct dm_odm_t *pDM_Odm, u32 RfPath, u32 Addr, 28 + u32 Bitmask, u32 Data); 34 29 35 30 void odm_ConfigBB_PHY_8723B(struct dm_odm_t *pDM_Odm, 36 31 u32 Addr,
+1 -1
drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
··· 538 538 s8 txPower = 0, powerDiffByRate = 0, limit = 0; 539 539 540 540 txPower = (s8) PHY_GetTxPowerIndexBase(padapter, RFPath, Rate, BandWidth, Channel); 541 - powerDiffByRate = PHY_GetTxPowerByRate(padapter, RF_PATH_A, RF_1TX, Rate); 541 + powerDiffByRate = PHY_GetTxPowerByRate(padapter, RF_PATH_A, Rate); 542 542 543 543 limit = phy_get_tx_pwr_lmt( 544 544 padapter,
+4 -13
drivers/staging/rtl8723bs/include/hal_com_phycfg.h
··· 18 18 HT_MCS0_MCS7, 19 19 }; 20 20 21 - enum { 22 - RF_1TX = 0, 23 - RF_2TX, 24 - RF_3TX, 25 - RF_4TX, 26 - RF_MAX_TX_NUM, 27 - RF_TX_NUM_NONIMPLEMENT, 28 - }; 29 - 30 21 #define MAX_POWER_INDEX 0x3F 31 22 32 23 enum { ··· 54 63 55 64 }; 56 65 57 - u8 PHY_GetTxPowerByRateBase(struct adapter *Adapter, u8 RfPath, u8 TxNum, 66 + u8 PHY_GetTxPowerByRateBase(struct adapter *Adapter, u8 RfPath, 58 67 enum rate_section RateSection); 59 68 60 69 u8 PHY_GetRateSectionIndexOfTxPowerByRate(struct adapter *padapter, u32 RegAddr, ··· 69 78 void PHY_SetTxPowerIndexByRateSection(struct adapter *padapter, u8 RFPath, u8 Channel, 70 79 u8 RateSection); 71 80 72 - s8 PHY_GetTxPowerByRate(struct adapter *padapter, u8 RFPath, u8 TxNum, u8 RateIndex); 81 + s8 PHY_GetTxPowerByRate(struct adapter *padapter, u8 RFPath, u8 RateIndex); 73 82 74 - void PHY_SetTxPowerByRate(struct adapter *padapter, u8 RFPath, u8 TxNum, u8 Rate, 83 + void PHY_SetTxPowerByRate(struct adapter *padapter, u8 RFPath, u8 Rate, 75 84 s8 Value); 76 85 77 86 void PHY_SetTxPowerLevelByPath(struct adapter *Adapter, u8 channel, u8 path); ··· 82 91 83 92 void PHY_InitTxPowerByRate(struct adapter *padapter); 84 93 85 - void PHY_StoreTxPowerByRate(struct adapter *padapter, u32 RfPath, u32 TxNum, 94 + void PHY_StoreTxPowerByRate(struct adapter *padapter, u32 RfPath, 86 95 u32 RegAddr, u32 BitMask, u32 Data); 87 96 88 97 void PHY_TxPowerByRateConfiguration(struct adapter *padapter);
+2 -6
drivers/staging/rtl8723bs/include/hal_data.h
··· 241 241 /* CCK = 0 OFDM = 1/2 HT-MCS 0-15 =3/4/56 VHT =7/8/9/10/11 */ 242 242 u8 TxPwrByRateTable; 243 243 u8 TxPwrByRateBand; 244 - s8 TxPwrByRateOffset[TX_PWR_BY_RATE_NUM_RF] 245 - [TX_PWR_BY_RATE_NUM_RF] 246 - [TX_PWR_BY_RATE_NUM_RATE]; 244 + s8 TxPwrByRateOffset[TX_PWR_BY_RATE_NUM_RF][TX_PWR_BY_RATE_NUM_RATE]; 247 245 /* */ 248 246 249 247 /* 2 Power Limit Table */ ··· 259 261 [MAX_RF_PATH_NUM]; 260 262 261 263 /* Store the original power by rate value of the base of each rate section of rf path A & B */ 262 - u8 TxPwrByRateBase2_4G[TX_PWR_BY_RATE_NUM_RF] 263 - [TX_PWR_BY_RATE_NUM_RF] 264 - [MAX_BASE_NUM_IN_PHY_REG_PG_2_4G]; 264 + u8 TxPwrByRateBase2_4G[TX_PWR_BY_RATE_NUM_RF][MAX_BASE_NUM_IN_PHY_REG_PG_2_4G]; 265 265 266 266 /* For power group */ 267 267 u8 PwrGroupHT20[RF_PATH_MAX_92C_88E][CHANNEL_MAX_NUMBER];