staging: rtl8723bs: remove unused sys interrupt
cover staging: rtl8723bs: remove unused sys interrupt
This series removes fields 'SysIntrStatus' and 'SysIntrMask' from struct hal_com_data.
'SysIntrStatus' is actually unused. 'SysIntrMask' is initialized to zero and never changes.
Nikolay Kulikov (4):
staging: rtl8723bs: remove unused SysIntrMask from struct hal_com_data
staging: rtl8723bs: remove empty InitSysInterrupt8723BSdio()
staging: rtl8723bs: remove overwriting of current IMR settings
staging: rtl8723bs: remove unused SysIntrStatus from struct
hal_com_data
drivers/staging/rtl8723bs/hal/sdio_halinit.c | 5 ----- drivers/staging/rtl8723bs/hal/sdio_ops.c | 20 -------------------- drivers/staging/rtl8723bs/include/hal_data.h | 4 ---- drivers/staging/rtl8723bs/include/sdio_ops.h | 1 - 4 files changed, 30 deletions(-)
base-commit: ea09c82fbc53aad867541cd2f0bde96c6b228ba0
Signature · 1 line
2.54.0
PATCH 1/4 staging: rtl8723bs: remove unused SysIntrMask from struct hal_com_data
This field is set to 0 once, and its use becomes optional. Remove it to clean up dead code.
--- drivers/staging/rtl8723bs/hal/sdio_ops.c | 4 +--- drivers/staging/rtl8723bs/include/hal_data.h | 1 - 2 files changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtl8723bs/hal/sdio_ops.c +1 -3
@@ -592,8 +592,6 @@ void InitSysInterrupt8723BSdio(struct adapter *adapter)struct hal_com_data *haldata; haldata =GET_HAL_DATA (adapter); - - haldata->SysIntrMask = (0 ); }/*
@@ -616,7 +614,7 @@ void rtw_sdio_enable_interrupt(struct adapter *adapter)/* Update current system IMR settings */ tmp =rtw_read32 (adapter,REG_HSIMR ); -rtw_write32 (adapter,REG_HSIMR , tmp | haldata->SysIntrMask); +rtw_write32 (adapter,REG_HSIMR , tmp);/* */ /* <Roger_Notes> There are some C2H CMDs have been sent before system interrupt is enabled, e.g., C2H, CPWM. */
drivers/staging/rtl8723bs/include/hal_data.h +0 -1
@@ -389,7 +389,6 @@ struct hal_com_data {/* Interrupt related register information. */ u32 SysIntrStatus; -u32 SysIntrMask;/* Chip version information */ bool chip_normal;/* true - normal chip, false - test chip */
Signature · 1 line
2.54.0
PATCH 2/4 staging: rtl8723bs: remove empty InitSysInterrupt8723BSdio()
In reply to Nikolay KulikovThis function does not do any useful work to initialize interrupt, so remove it co clean up dead code.
--- drivers/staging/rtl8723bs/hal/sdio_halinit.c | 5 ----- drivers/staging/rtl8723bs/hal/sdio_ops.c | 13 ------------- drivers/staging/rtl8723bs/include/sdio_ops.h | 1 - 3 files changed, 19 deletions(-)
drivers/staging/rtl8723bs/hal/sdio_halinit.c +0 -5
@@ -532,11 +532,6 @@ static void _InitInterrupt(struct adapter *padapter)/* Initialize and enable SDIO Host Interrupt. */ /* */ InitInterrupt8723BSdio (padapter); - -/* */ -/* Initialize system Host Interrupt. */ -/* */ -InitSysInterrupt8723BSdio (padapter); }static void _InitRFType (struct adapter *padapter)
drivers/staging/rtl8723bs/hal/sdio_ops.c +0 -13
@@ -581,19 +581,6 @@ void InitInterrupt8723BSdio(struct adapter *adapter) 0); } -/* */ -/* Description: */ -/* Initialize System Host Interrupt Mask configuration variables for future use. */ -/* */ -/* Created by Roger, 2011.08.03. */ -/* */ -void InitSysInterrupt8723BSdio (struct adapter *adapter) -{ -struct hal_com_data *haldata; - - haldata =GET_HAL_DATA (adapter); -} -/* * Enable SDIO Host Interrupt Mask configuration on SDIO local domain. *
drivers/staging/rtl8723bs/include/sdio_ops.h +0 -1
@@ -26,7 +26,6 @@ extern void sd_int_hdl(struct adapter *padapter);extern u8 CheckIPSStatus (struct adapter *padapter);extern void InitInterrupt8723BSdio (struct adapter *padapter); -extern void InitSysInterrupt8723BSdio (struct adapter *padapter);void rtw_sdio_enable_interrupt (struct adapter *padapter);void rtw_sdio_disable_interrupt (struct adapter *padapter);extern u8 HalQueryTxBufferStatus8723BSdio (struct adapter *padapter);
Signature · 1 line
2.54.0
PATCH 3/4 staging: rtl8723bs: remove overwriting of current IMR settings
In reply to Nikolay KulikovThe code reads a 32-bit value from REG_HSIMR and writes the result back to the same address. This operation does not change the register's value.
This code does nothing and simply performs unnecessary SDIO operations. Furthermore, if rtw_read32() returns an error or returns an uninitialized value, writing it back will have unknown consequences.
--- drivers/staging/rtl8723bs/hal/sdio_ops.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/staging/rtl8723bs/hal/sdio_ops.c +0 -5
@@ -592,17 +592,12 @@ void rtw_sdio_enable_interrupt(struct adapter *adapter) {struct hal_com_data *haldata;__le32 himr; -u32 tmp; haldata =GET_HAL_DATA (adapter); himr =cpu_to_le32 (haldata->sdio_himr);sdio_local_write (adapter,SDIO_REG_HIMR ,4 , (u8 *)&himr); -/* Update current system IMR settings */ - tmp =rtw_read32 (adapter,REG_HSIMR ); -rtw_write32 (adapter,REG_HSIMR , tmp); -/* */ /* <Roger_Notes> There are some C2H CMDs have been sent before system interrupt is enabled, e.g., C2H, CPWM. */ /* So we need to clear all C2H events that FW has notified, otherwise FW won't schedule any commands anymore. */
Signature · 1 line
2.54.0
Re: [PATCH 3/4] staging: rtl8723bs: remove overwriting of current IMR settings
Quoted 8 lines · Nikolay Kulikov
The code reads a 32-bit value from
REG_HSIMRand writes the result back to the same address. This operation does not change the register's value.This code does nothing and simply performs unnecessary SDIO operations. Furthermore, if
rtw_read32()returns an error or returns an uninitialized value, writing it back will have unknown consequences.
This commit message isn't very useful.
There can be times where reading from a register and then writing the exact same thing back to it is how the hardware is designed. So it's not obvious at all that making this change is safe.
What you should say is that:
Originally, this code use to Step 1: read from the register, Step 2: add some bits to the value and then Step 3: write the result back to the register.
However the problem was that the bits in step 2 were always zero so I have removed that code. Now this function just reads a value and writes the exact same thing back. It is unnecessary and can be removed.
It's not 100% safe to make this change without testing, but it probably is safe enough once we see the explanation *why* the code *used* to exist.
regards,
dan carpenter
Re: [PATCH 3/4] staging: rtl8723bs: remove overwriting of current IMR settings
Quoted 22 lines · Dan Carpenter
Quoted 8 lines · Nikolay Kulikov
The code reads a 32-bit value from
REG_HSIMRand writes the result back to the same address. This operation does not change the register's value.This code does nothing and simply performs unnecessary SDIO operations. Furthermore, if
rtw_read32()returns an error or returns an uninitialized value, writing it back will have unknown consequences.This commit message isn't very useful.
There can be times where reading from a register and then writing the exact same thing back to it is how the hardware is designed. So it's not obvious at all that making this change is safe.
What you should say is that:
Originally, this code use to Step 1: read from the register, Step 2: add some bits to the value and then Step 3: write the result back to the register.
Quoted 8 lines
However the problem was that the bits in step 2 were always zero so I have removed that code. Now this function just reads a value and writes the exact same thing back. It is unnecessary and can be removed.
It's not 100% safe to make this change without testing, but it probably is safe enough once we see the explanation *why* the code *used* to exist.
Indeed, it's much clearer this way, I'll fix it in v2.
Thanks,
Nikolay
PATCH 4/4 staging: rtl8723bs: remove unused SysIntrStatus from struct hal_com_data
In reply to Nikolay KulikovThis field has not been used anywhere since the driver was added, so remove it to eliminate dead code.
--- drivers/staging/rtl8723bs/include/hal_data.h | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/rtl8723bs/include/hal_data.h +0 -3
@@ -387,9 +387,6 @@ struct hal_com_data {/* For bluetooth co-existence */ struct bt_coexist bt_coexist; -/* Interrupt related register information. */ -u32 SysIntrStatus; -/* Chip version information */ bool chip_normal;/* true - normal chip, false - test chip */ };
Signature · 1 line
2.54.0