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(-)
From: changjunzheng <guagua210311@qq.com>
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)
Signed-off-by: changjunzheng <guagua210311@qq.com>
---
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(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_io.c b/drivers/staging/rtl8723bs/core/rtw_io.c
index 0f52710e6d3a..33023ae45196 100644
--- a/drivers/staging/rtl8723bs/core/rtw_io.c
+++ b/drivers/staging/rtl8723bs/core/rtw_io.c
@@ -131,20 +131,7 @@ int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapt
return _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;
}
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
index bd7bb5828d56..de4bec961671 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -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;
diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h
index adf1de4d7924..8ae8849f5fd9 100644
--- a/drivers/staging/rtl8723bs/include/rtw_io.h
+++ b/drivers/staging/rtl8723bs/include/rtw_io.h
@@ -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_ */
diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
index 5dc00e9117ae..571a2c6fc37a 100644
--- a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
+++ b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
@@ -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;
}
--
2.43.0
On Fri, Dec 19, 2025 at 05:39:47PM +0800, cjz wrote:
> From: changjunzheng <guagua210311@qq.com>
>
> 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)
When you list different things, that's a huge hint that you need to have
multiple patches as a series.
> Signed-off-by: changjunzheng <guagua210311@qq.com>
Is this how you sign documents? Sorry, I have to ask.
> ---
What changed from previous versions should be below here, as the
documentation requests to have happen.
> 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(-)
>
> diff --git a/drivers/staging/rtl8723bs/core/rtw_io.c b/drivers/staging/rtl8723bs/core/rtw_io.c
> index 0f52710e6d3a..33023ae45196 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_io.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_io.c
> @@ -131,20 +131,7 @@ int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapt
>
> return _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;
> }
> diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
> index bd7bb5828d56..de4bec961671 100644
> --- a/drivers/staging/rtl8723bs/include/drv_types.h
> +++ b/drivers/staging/rtl8723bs/include/drv_types.h
> @@ -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;
>
> diff --git a/drivers/staging/rtl8723bs/include/rtw_io.h b/drivers/staging/rtl8723bs/include/rtw_io.h
> index adf1de4d7924..8ae8849f5fd9 100644
> --- a/drivers/staging/rtl8723bs/include/rtw_io.h
> +++ b/drivers/staging/rtl8723bs/include/rtw_io.h
> @@ -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_ */
> diff --git a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
> index 5dc00e9117ae..571a2c6fc37a 100644
> --- a/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
> +++ b/drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c
> @@ -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++;
This adds a coding style error, please always run your patches through
checkpatch before sending them out.
thanks,
greg k-h
© 2016 - 2026 Red Hat, Inc.