staging: rtl8723bs: remove struct hal_version
cover staging: rtl8723bs: remove struct hal_version
This series completely removes the hal_version structure, since its contents are almost never (with the exception of ChipType) used in driver code.
Nikolay Kulikov (10):
staging: rtl8723bs: rename ChipType of struct hal_version to
snake_case
staging: rtl8723bs: replace type and rename the chip_type field
staging: rtl8723bs: remove unused macros from include/HalVerDef.h
staging: rtl8723bs: remove unused ICType from struct hal_version
staging: rtl8723bs: remove unused VendorType from struct hal_version
staging: rtl8723bs: remove unused CUTVersion from struct hal_version
staging: rtl8723bs: remove unused ROMVer from struct hal_version
staging: rtl8723bs: move normal_chip field to struct hal_com_data
staging: rtl8723bs: remove struct hal_version from include/HalVerDef.h
staging: rtl8723bs: remove include/HalVerDef.h file
.../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 17 +--- drivers/staging/rtl8723bs/include/HalVerDef.h | 85 ------------------- drivers/staging/rtl8723bs/include/hal_com.h | 1 - drivers/staging/rtl8723bs/include/hal_data.h | 4 +- .../staging/rtl8723bs/include/rtl8723b_hal.h | 1 - 5 files changed, 6 insertions(+), 102 deletions(-) delete mode 100644 drivers/staging/rtl8723bs/include/HalVerDef.h
Signature · 1 line
2.54.0
PATCH 1/10 staging: rtl8723bs: rename ChipType of struct hal_version to snake_case
Rename 'ChipType' field to 'chip_type' to comply with Linux kernel coding style and fix checkpatch.pl warning.
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 2 +- drivers/staging/rtl8723bs/include/HalVerDef.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +1 -1
@@ -836,7 +836,7 @@ static struct hal_version ReadChipVersion8723B(struct adapter *padapter) value32 =rtw_read32 (padapter,REG_SYS_CFG ); ChipVersion.ICType =CHIP_8723B ; - ChipVersion.ChipType = ((value32 &RTL_ID ) ?TEST_CHIP :NORMAL_CHIP ); + ChipVersion.chip_type = ((value32 &RTL_ID ) ?TEST_CHIP :NORMAL_CHIP ); ChipVersion.VendorType = ((value32 &VENDOR_ID ) ?CHIP_VENDOR_UMC :CHIP_VENDOR_TSMC ); ChipVersion.CUTVersion = (value32 &CHIP_VER_RTL_MASK )>>CHIP_VER_RTL_SHIFT ;/* IC version (CUT) */
drivers/staging/rtl8723bs/include/HalVerDef.h +2 -2
@@ -43,7 +43,7 @@ enum hal_vendor_e { /* tag_HAL_Manufacturer_Version_Definition */struct hal_version {/* tag_HAL_VERSION */ enum hal_ic_type_e ICType; -enum hal_chip_type_e ChipType; +enum hal_chip_type_e chip_type;enum hal_cut_version_e CUTVersion;enum hal_vendor_e VendorType;u8 ROMVer;
@@ -53,7 +53,7 @@ struct hal_version { /* tag_HAL_VERSION *//* Get element */ #define GET_CVID_IC_TYPE (version) ((enum hal_ic_type_e)((version).ICType)) -#define GET_CVID_CHIP_TYPE (version) ((enum hal_chip_type_e)((version).ChipType)) +#define GET_CVID_CHIP_TYPE (version) ((enum hal_chip_type_e)((version).chip_type))#define GET_CVID_MANUFACTUER (version) ((enum hal_vendor_e)((version).VendorType))#define GET_CVID_CUT_VERSION (version) ((enum hal_cut_version_e)((version).CUTVersion))#define GET_CVID_ROM_VERSION (version) (((version).ROMVer) & ROM_VERSION_MASK)
Signature · 1 line
2.54.0
PATCH 2/10 staging: rtl8723bs: replace type and rename the chip_type field
In reply to Nikolay KulikovThe 'chip_type' field always accepts one value from the hal_chip_type_e enumeration: TEST_CHIP or NORMAL_CHIP (FPGA is never used).
Changing this field's type to bool will allow it to be used directly in conditions without the need for wrapped macros.
The new type requires a corresponding variable name, so rename it to 'chip_normal' to improve code readability.
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ++-- drivers/staging/rtl8723bs/include/HalVerDef.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +2 -2
@@ -836,7 +836,7 @@ static struct hal_version ReadChipVersion8723B(struct adapter *padapter) value32 =rtw_read32 (padapter,REG_SYS_CFG ); ChipVersion.ICType =CHIP_8723B ; - ChipVersion.chip_type = ((value32 &RTL_ID ) ?TEST_CHIP :NORMAL_CHIP ); + ChipVersion.chip_normal = ((value32 &RTL_ID ) ? false : true); ChipVersion.VendorType = ((value32 &VENDOR_ID ) ?CHIP_VENDOR_UMC :CHIP_VENDOR_TSMC ); ChipVersion.CUTVersion = (value32 &CHIP_VER_RTL_MASK )>>CHIP_VER_RTL_SHIFT ;/* IC version (CUT) */
@@ -912,7 +912,7 @@ void _InitBurstPktLen_8723BS(struct adapter *Adapter)/* ARFB table 9 for 11ac 5G 2SS */ rtw_write32 (Adapter,REG_ARFR0_8723B ,0x00000010 ); -if (IS_NORMAL_CHIP (pHalData->VersionID)) +if (pHalData->VersionID.chip_normal)rtw_write32 (Adapter,REG_ARFR0_8723B +4 ,0xfffff000 );else rtw_write32 (Adapter,REG_ARFR0_8723B +4 ,0x3e0ff000 );
drivers/staging/rtl8723bs/include/HalVerDef.h +1 -1
@@ -43,7 +43,7 @@ enum hal_vendor_e { /* tag_HAL_Manufacturer_Version_Definition */struct hal_version {/* tag_HAL_VERSION */ enum hal_ic_type_e ICType; -enum hal_chip_type_e chip_type; +bool chip_normal;/* true - normal chip, false - test chip */ enum hal_cut_version_e CUTVersion;enum hal_vendor_e VendorType;u8 ROMVer;
Signature · 1 line
2.54.0
PATCH 3/10 staging: rtl8723bs: remove unused macros from include/HalVerDef.h
In reply to Nikolay KulikovRemove macros that are wrappers over the fields of 'struct hal_version' and are never used in driver code.
--- drivers/staging/rtl8723bs/include/HalVerDef.h | 30 ------------------- 1 file changed, 30 deletions(-)
drivers/staging/rtl8723bs/include/HalVerDef.h +0 -30
@@ -51,35 +51,5 @@ struct hal_version { /* tag_HAL_VERSION *//* hal_version VersionID; */ -/* Get element */ -#define GET_CVID_IC_TYPE (version) ((enum hal_ic_type_e)((version).ICType)) -#define GET_CVID_CHIP_TYPE (version) ((enum hal_chip_type_e)((version).chip_type)) -#define GET_CVID_MANUFACTUER (version) ((enum hal_vendor_e)((version).VendorType)) -#define GET_CVID_CUT_VERSION (version) ((enum hal_cut_version_e)((version).CUTVersion)) -#define GET_CVID_ROM_VERSION (version) (((version).ROMVer) & ROM_VERSION_MASK) - -/* */ -/* Common Macro. -- */ -/* */ -/* hal_version VersionID */ - -/* hal_chip_type_e */ -#define IS_TEST_CHIP (version) ((GET_CVID_CHIP_TYPE(version) == TEST_CHIP) ? true : false) -#define IS_NORMAL_CHIP (version) ((GET_CVID_CHIP_TYPE(version) == NORMAL_CHIP) ? true : false) - -/* hal_cut_version_e */ -#define IS_A_CUT (version) ((GET_CVID_CUT_VERSION(version) == A_CUT_VERSION) ? true : false) -#define IS_B_CUT (version) ((GET_CVID_CUT_VERSION(version) == B_CUT_VERSION) ? true : false) -#define IS_C_CUT (version) ((GET_CVID_CUT_VERSION(version) == C_CUT_VERSION) ? true : false) -#define IS_D_CUT (version) ((GET_CVID_CUT_VERSION(version) == D_CUT_VERSION) ? true : false) -#define IS_E_CUT (version) ((GET_CVID_CUT_VERSION(version) == E_CUT_VERSION) ? true : false) -#define IS_I_CUT (version) ((GET_CVID_CUT_VERSION(version) == I_CUT_VERSION) ? true : false) -#define IS_J_CUT (version) ((GET_CVID_CUT_VERSION(version) == J_CUT_VERSION) ? true : false) -#define IS_K_CUT (version) ((GET_CVID_CUT_VERSION(version) == K_CUT_VERSION) ? true : false) - -/* hal_vendor_e */ -#define IS_CHIP_VENDOR_TSMC (version) ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_TSMC) ? true : false) -#define IS_CHIP_VENDOR_UMC (version) ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_UMC) ? true : false) -#define IS_CHIP_VENDOR_SMIC (version) ((GET_CVID_MANUFACTUER(version) == CHIP_VENDOR_SMIC) ? true : false)#endif
Signature · 1 line
2.54.0
PATCH 4/10 staging: rtl8723bs: remove unused ICType from struct hal_version
In reply to Nikolay KulikovRemove the unused 'ICType' field from the 'struct hal_version', as it always takes a single value (CHIP_8723B) upon initialization and is never used in driver.
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 1 - drivers/staging/rtl8723bs/include/HalVerDef.h | 1 - 2 files changed, 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +0 -1
@@ -835,7 +835,6 @@ static struct hal_version ReadChipVersion8723B(struct adapter *padapter) pHalData =GET_HAL_DATA (padapter); value32 =rtw_read32 (padapter,REG_SYS_CFG ); - ChipVersion.ICType =CHIP_8723B ; ChipVersion.chip_normal = ((value32 &RTL_ID ) ? false : true); ChipVersion.VendorType = ((value32 &VENDOR_ID ) ?CHIP_VENDOR_UMC :CHIP_VENDOR_TSMC ); ChipVersion.CUTVersion = (value32 &CHIP_VER_RTL_MASK )>>CHIP_VER_RTL_SHIFT ;/* IC version (CUT) */
drivers/staging/rtl8723bs/include/HalVerDef.h +0 -1
@@ -42,7 +42,6 @@ enum hal_vendor_e { /* tag_HAL_Manufacturer_Version_Definition */ };struct hal_version {/* tag_HAL_VERSION */ -enum hal_ic_type_e ICType;bool chip_normal;/* true - normal chip, false - test chip */ enum hal_cut_version_e CUTVersion;enum hal_vendor_e VendorType;
Signature · 1 line
2.54.0
PATCH 5/10 staging: rtl8723bs: remove unused VendorType from struct hal_version
In reply to Nikolay KulikovThe 'VendorType' field of the 'struct hal_version' is set once when the chip is initialized, but no one ever reads this data, so remove it to eliminate unused code.
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 1 - drivers/staging/rtl8723bs/include/HalVerDef.h | 1 - 2 files changed, 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +0 -1
@@ -836,7 +836,6 @@ static struct hal_version ReadChipVersion8723B(struct adapter *padapter) value32 =rtw_read32 (padapter,REG_SYS_CFG ); ChipVersion.chip_normal = ((value32 &RTL_ID ) ? false : true); - ChipVersion.VendorType = ((value32 &VENDOR_ID ) ?CHIP_VENDOR_UMC :CHIP_VENDOR_TSMC ); ChipVersion.CUTVersion = (value32 &CHIP_VER_RTL_MASK )>>CHIP_VER_RTL_SHIFT ;/* IC version (CUT) */ /* For regulator mode. by tynli. 2011.01.14 */
drivers/staging/rtl8723bs/include/HalVerDef.h +0 -1
@@ -44,7 +44,6 @@ enum hal_vendor_e { /* tag_HAL_Manufacturer_Version_Definition */struct hal_version {/* tag_HAL_VERSION */ bool chip_normal;/* true - normal chip, false - test chip */ enum hal_cut_version_e CUTVersion; -enum hal_vendor_e VendorType;u8 ROMVer; };
Signature · 1 line
2.54.0
PATCH 6/10 staging: rtl8723bs: remove unused CUTVersion from struct hal_version
In reply to Nikolay KulikovRemove the 'CUTVersion' field from 'struct hal_version', which is read during initialization but is never used anywhere in the driver.
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 1 - drivers/staging/rtl8723bs/include/HalVerDef.h | 1 - 2 files changed, 2 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +0 -1
@@ -836,7 +836,6 @@ static struct hal_version ReadChipVersion8723B(struct adapter *padapter) value32 =rtw_read32 (padapter,REG_SYS_CFG ); ChipVersion.chip_normal = ((value32 &RTL_ID ) ? false : true); - ChipVersion.CUTVersion = (value32 &CHIP_VER_RTL_MASK )>>CHIP_VER_RTL_SHIFT ;/* IC version (CUT) */ /* For regulator mode. by tynli. 2011.01.14 */ pHalData->RegulatorMode = ((value32 &SPS_SEL ) ?RT_LDO_REGULATOR :RT_SWITCHING_REGULATOR );
drivers/staging/rtl8723bs/include/HalVerDef.h +0 -1
@@ -43,7 +43,6 @@ enum hal_vendor_e { /* tag_HAL_Manufacturer_Version_Definition */struct hal_version {/* tag_HAL_VERSION */ bool chip_normal;/* true - normal chip, false - test chip */ -enum hal_cut_version_e CUTVersion;u8 ROMVer; };
Signature · 1 line
2.54.0
PATCH 7/10 staging: rtl8723bs: remove unused ROMVer from struct hal_version
In reply to Nikolay Kulikov'ROMVer' field of 'sturct hal_version' never used anywhere in the driver, so remove it to eliminate unused code.
Remove the related call to rtw_read32(), the result of which is only used for 'ROMVer' and is no longer needed.
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 3 --- drivers/staging/rtl8723bs/include/HalVerDef.h | 1 - 2 files changed, 4 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +0 -3
@@ -840,9 +840,6 @@ static struct hal_version ReadChipVersion8723B(struct adapter *padapter)/* For regulator mode. by tynli. 2011.01.14 */ pHalData->RegulatorMode = ((value32 &SPS_SEL ) ?RT_LDO_REGULATOR :RT_SWITCHING_REGULATOR ); - value32 =rtw_read32 (padapter,REG_GPIO_OUTSTS ); - ChipVersion.ROMVer = ((value32 &RF_RL_ID ) >>20 );/* ROM code version. */ -/* For multi-function consideration. Added by Roger, 2010.10.06. */ pHalData->MultiFunc =RT_MULTI_FUNC_NONE ; value32 =rtw_read32 (padapter,REG_MULTI_FUNC_CTRL );
drivers/staging/rtl8723bs/include/HalVerDef.h +0 -1
@@ -43,7 +43,6 @@ enum hal_vendor_e { /* tag_HAL_Manufacturer_Version_Definition */struct hal_version {/* tag_HAL_VERSION */ bool chip_normal;/* true - normal chip, false - test chip */ -u8 ROMVer; };/* hal_version VersionID; */
Signature · 1 line
2.54.0
PATCH 8/10 staging: rtl8723bs: move normal_chip field to struct hal_com_data
In reply to Nikolay KulikovThe 'chip_normal' field is the only remaining member of the 'struct hal_version' that is used.
Move this field to the hal_com_data struct, where other chip information is already stored. The order of assignments and reads to this variable remains unchanged. This is purely a data relocation patch.
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 4 ++-- drivers/staging/rtl8723bs/include/HalVerDef.h | 1 - drivers/staging/rtl8723bs/include/hal_data.h | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +2 -2
@@ -835,7 +835,7 @@ static struct hal_version ReadChipVersion8723B(struct adapter *padapter) pHalData =GET_HAL_DATA (padapter); value32 =rtw_read32 (padapter,REG_SYS_CFG ); - ChipVersion.chip_normal = ((value32 &RTL_ID ) ? false : true); + pHalData->chip_normal = ((value32 &RTL_ID ) ? false : true);/* For regulator mode. by tynli. 2011.01.14 */ pHalData->RegulatorMode = ((value32 &SPS_SEL ) ?RT_LDO_REGULATOR :RT_SWITCHING_REGULATOR );
@@ -906,7 +906,7 @@ void _InitBurstPktLen_8723BS(struct adapter *Adapter)/* ARFB table 9 for 11ac 5G 2SS */ rtw_write32 (Adapter,REG_ARFR0_8723B ,0x00000010 ); -if (pHalData->VersionID.chip_normal) +if (pHalData->chip_normal)rtw_write32 (Adapter,REG_ARFR0_8723B +4 ,0xfffff000 );else rtw_write32 (Adapter,REG_ARFR0_8723B +4 ,0x3e0ff000 );
drivers/staging/rtl8723bs/include/HalVerDef.h +0 -1
@@ -42,7 +42,6 @@ enum hal_vendor_e { /* tag_HAL_Manufacturer_Version_Definition */ };struct hal_version {/* tag_HAL_VERSION */ -bool chip_normal;/* true - normal chip, false - test chip */ };/* hal_version VersionID; */
drivers/staging/rtl8723bs/include/hal_data.h +3 -0
@@ -391,6 +391,9 @@ struct hal_com_data {/* Interrupt related register information. */ u32 SysIntrStatus;u32 SysIntrMask; + +/* Chip version information */ +bool chip_normal;/* true - normal chip, false - test chip */ };#define GET_HAL_DATA (__padapter) ((struct hal_com_data *)((__padapter)->HalData))
Signature · 1 line
2.54.0
PATCH 9/10 staging: rtl8723bs: remove struct hal_version from include/HalVerDef.h
In reply to Nikolay KulikovRemove the empty 'struct hal_version' as all its fields were removed earlier and it is no longer needed.
--- drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 7 +------ drivers/staging/rtl8723bs/include/HalVerDef.h | 5 ----- drivers/staging/rtl8723bs/include/hal_data.h | 1 - 3 files changed, 1 insertion(+), 12 deletions(-)
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c +1 -6
@@ -825,10 +825,9 @@ void Hal_ReadEFuse(hal_ReadEFuse_BT (padapter, _offset, _size_byte, pbuf); } -static struct hal_version ReadChipVersion8723B (struct adapter *padapter) +static void ReadChipVersion8723B (struct adapter *padapter) {u32 value32; -struct hal_version ChipVersion;struct hal_com_data *pHalData;/* YJ, TODO, move read chip type here */
@@ -847,10 +846,6 @@ static struct hal_version ReadChipVersion8723B(struct adapter *padapter) pHalData->MultiFunc |= ((value32 &BT_FUNC_EN ) ?RT_MULTI_FUNC_BT :0 ); pHalData->MultiFunc |= ((value32 &GPS_FUNC_EN ) ?RT_MULTI_FUNC_GPS :0 ); pHalData->PolarityCtl = ((value32 &WL_HWPDN_SL ) ?RT_POLARITY_HIGH_ACT :RT_POLARITY_LOW_ACT ); - - pHalData->VersionID = ChipVersion; - -return ChipVersion; }void rtl8723b_read_chip_version (struct adapter *padapter)
drivers/staging/rtl8723bs/include/HalVerDef.h +0 -5
@@ -41,10 +41,5 @@ enum hal_vendor_e { /* tag_HAL_Manufacturer_Version_Definition */ CHIP_VENDOR_SMIC = 2, }; -struct hal_version {/* tag_HAL_VERSION */ -}; - -/* hal_version VersionID; */ -#endif
drivers/staging/rtl8723bs/include/hal_data.h +0 -1
@@ -162,7 +162,6 @@ struct dm_priv {struct hal_com_data { -struct hal_version VersionID;enum rt_multi_func MultiFunc;/* For multi-function consideration. */ enum rt_polarity_ctl PolarityCtl;/* For Wifi PDn Polarity control. */ enum rt_regulator_mode RegulatorMode;/* switching regulator or LDO */
Signature · 1 line
2.54.0
PATCH 10/10 staging: rtl8723bs: remove include/HalVerDef.h file
In reply to Nikolay KulikovRemove this file and several enumerations from it, as they are not used anywhere in the driver code.
--- drivers/staging/rtl8723bs/include/HalVerDef.h | 45 ------------------- drivers/staging/rtl8723bs/include/hal_com.h | 1 - .../staging/rtl8723bs/include/rtl8723b_hal.h | 1 - 3 files changed, 47 deletions(-) delete mode 100644 drivers/staging/rtl8723bs/include/HalVerDef.h
drivers/staging/rtl8723bs/include/HalVerDef.h deleted +0 -45
@@ -1,45 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/****************************************************************************** -* -* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved. -* -******************************************************************************/ -#ifndef __HAL_VERSION_DEF_H__ -#define __HAL_VERSION_DEF_H__ - -/* hal_ic_type_e */ -enum hal_ic_type_e {/* tag_HAL_IC_Type_Definition */ -CHIP_8723B =8 , -}; - -/* hal_chip_type_e */ -enum hal_chip_type_e {/* tag_HAL_CHIP_Type_Definition */ -TEST_CHIP =0 , -NORMAL_CHIP =1 , -FPGA =2 , -}; - -/* hal_cut_version_e */ -enum hal_cut_version_e {/* tag_HAL_Cut_Version_Definition */ -A_CUT_VERSION =0 , -B_CUT_VERSION =1 , -C_CUT_VERSION =2 , -D_CUT_VERSION =3 , -E_CUT_VERSION =4 , -F_CUT_VERSION =5 , -G_CUT_VERSION =6 , -H_CUT_VERSION =7 , -I_CUT_VERSION =8 , -J_CUT_VERSION =9 , -K_CUT_VERSION =10 , -}; - -/* HAL_Manufacturer */ -enum hal_vendor_e {/* tag_HAL_Manufacturer_Version_Definition */ -CHIP_VENDOR_TSMC =0 , -CHIP_VENDOR_UMC =1 , -CHIP_VENDOR_SMIC =2 , -}; - - -#endif
drivers/staging/rtl8723bs/include/hal_com.h +0 -1
@@ -7,7 +7,6 @@#ifndef __HAL_COMMON_H__#define __HAL_COMMON_H__ -#include "HalVerDef.h" #include "hal_pg.h" #include "hal_phy.h" #include "hal_phy_reg.h"
drivers/staging/rtl8723bs/include/rtl8723b_hal.h +0 -1
@@ -118,7 +118,6 @@ struct rt_firmware_hdr {#define WMM_NORMAL_PAGE_NUM_LPQ_8723B 0x20#define WMM_NORMAL_PAGE_NUM_NPQ_8723B 0x20 -#include "HalVerDef.h" #include "hal_com.h" #define EFUSE_OOB_PROTECT_BYTES 15
Signature · 1 line
2.54.0