rtl8723bs: v3 - Remove global continual_io_error, use local count
PATCH v3 1/1 rtl8723bs: v3 - Remove global continual_io_error, use local count
From: changjunzheng <[email protected]>
1. Remove global 'continual_io_error' variable from struct dvobj_priv (eliminate cross-function dependency)
2. Replace global count logic with local 'error_count' in sd_read32/sd_write32
3. Delete redundant rtw_inc_and_chk/rtw_reset_continual_io_error functions
4. Add independent bool rtw_check_continual_io_error() (single responsibility)
5. Comply with kernel coding style (whitespace, indentation, variable declaration)
--- drivers/staging/rtl8723bs/core/rtw_io.c | 17 ++--------------- drivers/staging/rtl8723bs/include/drv_types.h | 1 - drivers/staging/rtl8723bs/include/rtw_io.h | 3 +-- .../staging/rtl8723bs/os_dep/sdio_ops_linux.c | 16 +++++++++------- 4 files changed, 12 insertions(+), 25 deletions(-)
drivers/staging/rtl8723bs/core/rtw_io.c +2 -15
@@ -131,20 +131,7 @@ int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adaptreturn _SUCCESS; } - -/* -* Increase and check if the continual_io_error of this @param dvobjprive is larger than MAX_CONTINUAL_IO_ERR -* @return true: -* @return false: -*/ -int rtw_inc_and_chk_continual_io_error (struct dvobj_priv *dvobj) -{ - dvobj->continual_io_error++; -return (dvobj->continual_io_error >MAX_CONTINUAL_IO_ERR ); -} - -/* Set the continual_io_error of this @param dvobjprive to 0 */ -void rtw_reset_continual_io_error (struct dvobj_priv *dvobj) +bool rtw_check_continual_io_error (int error_count) { - dvobj->continual_io_error =0 ; +return (error_count >MAX_CONTINUAL_IO_ERR ) ? true : false; }
drivers/staging/rtl8723bs/include/drv_types.h +0 -1
@@ -279,7 +279,6 @@ struct dvobj_priv {u8 Queue2Pipe[HW_QUEUE_ENTRY ];/* for out pipe mapping */ u8 irq_alloc; -int continual_io_error;atomic_t disable_func;
drivers/staging/rtl8723bs/include/rtw_io.h +1 -2
@@ -48,8 +48,6 @@ struct intf_hdl {#define SD_IO_TRY_CNT (8)#define MAX_CONTINUAL_IO_ERR SD_IO_TRY_CNT -int rtw_inc_and_chk_continual_io_error (struct dvobj_priv *dvobj); -void rtw_reset_continual_io_error (struct dvobj_priv *dvobj);struct io_priv {
@@ -70,5 +68,6 @@ extern int rtw_write32(struct adapter *adapter, u32 addr, u32 val);extern u32 rtw_write_port (struct adapter *adapter,u32 addr,u32 cnt,u8 *pmem);int rtw_init_io_priv (struct adapter *padapter,void (*set_intf_ops)(struct adapter *padapter,struct _io_ops *pops)); +bool rtw_check_continual_io_error (int error_count);#endif /* _RTL8711_IO_H_ */
drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c +9 -7
@@ -207,7 +207,7 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err)if (err && *err) {int i; - +int error_count =0 ; *err =0 ;for (i =0 ; i <SD_IO_TRY_CNT ; i++) {if (claim_needed)
@@ -217,13 +217,13 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err)sdio_release_host (func);if (*err ==0 ) { -rtw_reset_continual_io_error (psdiodev); + error_count=0 ;break ; }else {if ((-ESHUTDOWN == *err) || (-ENODEV == *err)) padapter->bSurpriseRemoved = true; - -if (rtw_inc_and_chk_continual_io_error (psdiodev) == true) { + error_count++; +if (rtw_check_continual_io_error (error_count) == true) { padapter->bSurpriseRemoved = true;break ; }
@@ -284,7 +284,7 @@ void sd_write32(struct intf_hdl *pintfhdl, u32 addr, u32 v, s32 *err)if (err && *err) {int i; - +int error_count =0 ; *err =0 ;for (i =0 ; i <SD_IO_TRY_CNT ; i++) {if (claim_needed)
@@ -292,14 +292,16 @@ void sd_write32(struct intf_hdl *pintfhdl, u32 addr, u32 v, s32 *err)sdio_writel (func, v, addr, err);if (claim_needed)sdio_release_host (func); +if (*err ==0 ) { -rtw_reset_continual_io_error (psdiodev); + error_count =0 ;break ; }else {if ((-ESHUTDOWN == *err) || (-ENODEV == *err)) padapter->bSurpriseRemoved = true; -if (rtw_inc_and_chk_continual_io_error (psdiodev) == true) { + error_count++; +if (rtw_check_continual_io_error (error_count) == true) { padapter->bSurpriseRemoved = true;break ; }
Signature · 1 line
2.43.0
Greg KH
maintainerQuoted 7 lines · cjz
From: changjunzheng <[email protected]>
1. Remove global '
continual_io_error' variable from structdvobj_priv(eliminate cross-function dependency)
2. Replace global count logic with local 'error_count' in sd_read32/sd_write32
3. Delete redundant rtw_inc_and_chk/rtw_reset_continual_io_error functions
4. Add independent boolrtw_check_continual_io_error()(single responsibility)
5. Comply with kernel coding style (whitespace, indentation, variable declaration)
When you list different things, that's a huge hint that you need to have multiple patches as a series.
Quoted 1 line
Signed-off-by changjunzheng <[email protected]>
Is this how you sign documents? Sorry, I have to ask.
Quoted 1 line
---
What changed from previous versions should be below here, as the documentation requests to have happen.
Quoted 81 lines
drivers/staging/rtl8723bs/core/rtw_io.c | 17 ++--------------- drivers/staging/rtl8723bs/include/drv_types.h | 1 - drivers/staging/rtl8723bs/include/rtw_io.h | 3 +-- .../staging/rtl8723bs/os_dep/sdio_ops_linux.c | 16 +++++++++------- 4 files changed, 12 insertions(+), 25 deletions(-)drivers/staging/rtl8723bs/core/rtw_io.c +2
-15@@ -131,20 +131,7 @@ int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adaptreturn _SUCCESS; } - -/* -* Increase and check if the continual_io_error of this @param dvobjprive is larger than MAX_CONTINUAL_IO_ERR -* @return true: -* @return false: -*/ -int rtw_inc_and_chk_continual_io_error (struct dvobj_priv *dvobj) -{ - dvobj->continual_io_error++; -return (dvobj->continual_io_error >MAX_CONTINUAL_IO_ERR ); -} - -/* Set the continual_io_error of this @param dvobjprive to 0 */ -void rtw_reset_continual_io_error (struct dvobj_priv *dvobj) +bool rtw_check_continual_io_error (int error_count) { - dvobj->continual_io_error =0 ; +return (error_count >MAX_CONTINUAL_IO_ERR ) ? true : false; }drivers/staging/rtl8723bs/include/drv_types.h +0
-1@@ -279,7 +279,6 @@ struct dvobj_priv {u8 Queue2Pipe[HW_QUEUE_ENTRY ];/* for out pipe mapping */ u8 irq_alloc; -int continual_io_error;atomic_t disable_func;drivers/staging/rtl8723bs/include/rtw_io.h +1
-2@@ -48,8 +48,6 @@ struct intf_hdl {#define SD_IO_TRY_CNT (8)#define MAX_CONTINUAL_IO_ERR SD_IO_TRY_CNT -int rtw_inc_and_chk_continual_io_error (struct dvobj_priv *dvobj); -void rtw_reset_continual_io_error (struct dvobj_priv *dvobj);struct io_priv {@@ -70,5 +68,6 @@ extern int rtw_write32(struct adapter *adapter, u32 addr, u32 val);extern u32 rtw_write_port (struct adapter *adapter,u32 addr,u32 cnt,u8 *pmem);int rtw_init_io_priv (struct adapter *padapter,void (*set_intf_ops)(struct adapter *padapter,struct _io_ops *pops)); +bool rtw_check_continual_io_error (int error_count);#endif /* _RTL8711_IO_H_ */ drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c +1
-1@@ -207,7 +207,7 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err)if (err && *err) {int i; - +int error_count =0 ; *err =0 ;for (i =0 ; i <SD_IO_TRY_CNT ; i++) {if (claim_needed)@@ -217,13 +217,13 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err)sdio_release_host (func);
drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err) · line 225
Quoted 10 lines
drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c +2
-3if (*err ==0 ) { -rtw_reset_continual_io_error (psdiodev); + error_count=0 ;break ; }else {if ((-ESHUTDOWN == *err) || (-ENODEV == *err)) padapter->bSurpriseRemoved = true; - -if (rtw_inc_and_chk_continual_io_error (psdiodev) == true) { + error_count++;
This adds a coding style error, please always run your patches through checkpatch before sending them out.
thanks,
greg k-h