Skip to content

Commit 127fae1

Browse files
mistraubegregkh
authored andcommitted
staging: rtl8723bs: remove Hal_EfuseGetCurrentSize
The function Hal_EfuseGetCurrentSize is not used in the driver code, remove it to get rid of dead code. As Hal_EfuseGetCurrentSize is the only caller of hal_EfuseGetCurrentSize_WiFi and hal_EfuseGetCurrentSize_BT we can remove these two functions as well. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20250823124321.485910-11-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 254c268 commit 127fae1

2 files changed

Lines changed: 0 additions & 185 deletions

File tree

drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c

Lines changed: 0 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -867,190 +867,6 @@ void Hal_ReadEFuse(
867867
hal_ReadEFuse_BT(padapter, _offset, _size_byte, pbuf);
868868
}
869869

870-
static u16 hal_EfuseGetCurrentSize_WiFi(
871-
struct adapter *padapter, bool bPseudoTest
872-
)
873-
{
874-
#ifdef HAL_EFUSE_MEMORY
875-
struct hal_com_data *pHalData = GET_HAL_DATA(padapter);
876-
struct efuse_hal *pEfuseHal = &pHalData->EfuseHal;
877-
#endif
878-
u16 efuse_addr = 0;
879-
u16 start_addr = 0; /* for debug */
880-
u8 hworden = 0;
881-
u8 efuse_data, word_cnts = 0;
882-
u32 count = 0; /* for debug */
883-
884-
885-
if (bPseudoTest) {
886-
#ifdef HAL_EFUSE_MEMORY
887-
efuse_addr = (u16)pEfuseHal->fakeEfuseUsedBytes;
888-
#else
889-
efuse_addr = (u16)fakeEfuseUsedBytes;
890-
#endif
891-
} else
892-
rtw_hal_get_hwreg(padapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr);
893-
894-
start_addr = efuse_addr;
895-
896-
/* switch bank back to bank 0 for later BT and wifi use. */
897-
hal_EfuseSwitchToBank(padapter, 0, bPseudoTest);
898-
899-
count = 0;
900-
while (AVAILABLE_EFUSE_ADDR(efuse_addr)) {
901-
if (efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest) == false)
902-
goto error;
903-
904-
if (efuse_data == 0xFF)
905-
break;
906-
907-
if ((start_addr != 0) && (efuse_addr == start_addr)) {
908-
count++;
909-
910-
efuse_data = 0xFF;
911-
if (count < 4) {
912-
/* try again! */
913-
914-
if (count > 2) {
915-
/* try again form address 0 */
916-
efuse_addr = 0;
917-
start_addr = 0;
918-
}
919-
920-
continue;
921-
}
922-
923-
goto error;
924-
}
925-
926-
if (EXT_HEADER(efuse_data)) {
927-
efuse_addr++;
928-
efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest);
929-
if (ALL_WORDS_DISABLED(efuse_data))
930-
continue;
931-
932-
hworden = efuse_data & 0x0F;
933-
} else {
934-
hworden = efuse_data & 0x0F;
935-
}
936-
937-
word_cnts = Efuse_CalculateWordCnts(hworden);
938-
efuse_addr += (word_cnts*2)+1;
939-
}
940-
941-
if (bPseudoTest) {
942-
#ifdef HAL_EFUSE_MEMORY
943-
pEfuseHal->fakeEfuseUsedBytes = efuse_addr;
944-
#else
945-
fakeEfuseUsedBytes = efuse_addr;
946-
#endif
947-
} else
948-
rtw_hal_set_hwreg(padapter, HW_VAR_EFUSE_BYTES, (u8 *)&efuse_addr);
949-
950-
goto exit;
951-
952-
error:
953-
/* report max size to prevent write efuse */
954-
Hal_GetEfuseDefinition(padapter, EFUSE_WIFI, TYPE_AVAILABLE_EFUSE_BYTES_TOTAL, &efuse_addr);
955-
956-
exit:
957-
958-
return efuse_addr;
959-
}
960-
961-
static u16 hal_EfuseGetCurrentSize_BT(struct adapter *padapter, u8 bPseudoTest)
962-
{
963-
#ifdef HAL_EFUSE_MEMORY
964-
struct hal_com_data *pHalData = GET_HAL_DATA(padapter);
965-
struct efuse_hal *pEfuseHal = &pHalData->EfuseHal;
966-
#endif
967-
u16 btusedbytes;
968-
u16 efuse_addr;
969-
u8 bank, startBank;
970-
u8 hworden = 0;
971-
u8 efuse_data, word_cnts = 0;
972-
u16 retU2 = 0;
973-
974-
if (bPseudoTest) {
975-
#ifdef HAL_EFUSE_MEMORY
976-
btusedbytes = pEfuseHal->fakeBTEfuseUsedBytes;
977-
#else
978-
btusedbytes = fakeBTEfuseUsedBytes;
979-
#endif
980-
} else
981-
rtw_hal_get_hwreg(padapter, HW_VAR_EFUSE_BT_BYTES, (u8 *)&btusedbytes);
982-
983-
efuse_addr = (u16)((btusedbytes%EFUSE_BT_REAL_BANK_CONTENT_LEN));
984-
startBank = (u8)(1+(btusedbytes/EFUSE_BT_REAL_BANK_CONTENT_LEN));
985-
986-
Hal_GetEfuseDefinition(padapter, EFUSE_BT, TYPE_AVAILABLE_EFUSE_BYTES_BANK, &retU2);
987-
988-
for (bank = startBank; bank < 3; bank++) {
989-
if (hal_EfuseSwitchToBank(padapter, bank, bPseudoTest) == false)
990-
/* bank = EFUSE_MAX_BANK; */
991-
break;
992-
993-
/* only when bank is switched we have to reset the efuse_addr. */
994-
if (bank != startBank)
995-
efuse_addr = 0;
996-
997-
while (AVAILABLE_EFUSE_ADDR(efuse_addr)) {
998-
if (efuse_OneByteRead(padapter, efuse_addr,
999-
&efuse_data, bPseudoTest) == false)
1000-
/* bank = EFUSE_MAX_BANK; */
1001-
break;
1002-
1003-
if (efuse_data == 0xFF)
1004-
break;
1005-
1006-
if (EXT_HEADER(efuse_data)) {
1007-
efuse_addr++;
1008-
efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest);
1009-
1010-
if (ALL_WORDS_DISABLED(efuse_data)) {
1011-
efuse_addr++;
1012-
continue;
1013-
}
1014-
1015-
hworden = efuse_data & 0x0F;
1016-
} else {
1017-
hworden = efuse_data & 0x0F;
1018-
}
1019-
1020-
word_cnts = Efuse_CalculateWordCnts(hworden);
1021-
/* read next header */
1022-
efuse_addr += (word_cnts*2)+1;
1023-
}
1024-
1025-
/* Check if we need to check next bank efuse */
1026-
if (efuse_addr < retU2)
1027-
break; /* don't need to check next bank. */
1028-
}
1029-
1030-
retU2 = ((bank-1)*EFUSE_BT_REAL_BANK_CONTENT_LEN)+efuse_addr;
1031-
if (bPseudoTest) {
1032-
pEfuseHal->fakeBTEfuseUsedBytes = retU2;
1033-
} else {
1034-
pEfuseHal->BTEfuseUsedBytes = retU2;
1035-
}
1036-
1037-
return retU2;
1038-
}
1039-
1040-
u16 Hal_EfuseGetCurrentSize(
1041-
struct adapter *padapter, u8 efuseType, bool bPseudoTest
1042-
)
1043-
{
1044-
u16 ret = 0;
1045-
1046-
if (efuseType == EFUSE_WIFI)
1047-
ret = hal_EfuseGetCurrentSize_WiFi(padapter, bPseudoTest);
1048-
else
1049-
ret = hal_EfuseGetCurrentSize_BT(padapter, bPseudoTest);
1050-
1051-
return ret;
1052-
}
1053-
1054870
static struct hal_version ReadChipVersion8723B(struct adapter *padapter)
1055871
{
1056872
u32 value32;

drivers/staging/rtl8723bs/include/hal_intf.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,5 @@ void Hal_ReadEFuse(struct adapter *padapter, u8 efuseType, u16 _offset,
270270
u16 _size_byte, u8 *pbuf);
271271
void Hal_GetEfuseDefinition(struct adapter *padapter, u8 efuseType, u8 type,
272272
void *pOut);
273-
u16 Hal_EfuseGetCurrentSize(struct adapter *padapter, u8 efuseType, bool bPseudoTest);
274273
void hal_notch_filter_8723b(struct adapter *adapter, bool enable);
275274
#endif /* __HAL_INTF_H__ */

0 commit comments

Comments
 (0)