* [PATCH v5 1/3] rtl8723bs: io: Add independent rtw_check_continual_io_error function
[not found] <20260111032136.7078-1-2023060904@ycu.edu.cn>
@ 2026-01-11 3:21 ` 2023060904
2026-01-11 13:04 ` Greg KH
2026-01-12 7:55 ` Dan Carpenter
2026-01-11 3:21 ` [PATCH v5 2/3] rtl8723bs: sdio: Use local error_count instead of global variable 2023060904
2026-01-11 3:21 ` [PATCH v5 3/3] rtl8723bs: io: Remove redundant global continual_io_error variable 2023060904
2 siblings, 2 replies; 5+ messages in thread
From: 2023060904 @ 2026-01-11 3:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, 2023060904, guagua210311
From: Changjun Zheng <2023060904@ycu.edu.cn>
Add a new function to check if the error count exceeds the MAX_CONTINUAL_IO_ERR
threshold. This function follows the single responsibility principle and
prepares for the subsequent removal of the global continual_io_error variable.
Signed-off-by: Changjun Zheng <2023060904@ycu.edu.cn>
---
Changelog from v1 to v2:
Initial draft: Implemented basic local error count logic, fixed compilation errors.
Changelog from v2 to v3:
Merged small patches into one, optimized function logic to remove redundant code.
Changelog from v3 to v4:
Split monolithic patch into single-purpose patches (per Greg's comment), fixed coding style.
Changelog from v4 to v5:
Fixed format errors (spaces around '=', trailing whitespace) per checkpatch.pl;
Standardized author name format (split "changjunzheng" to "Changjun Zheng");
Moved changelog to below the --- separator (kernel format rule).
drivers/staging/rtl8723bs/core/rtw_io.c | 16 ++--------------
drivers/staging/rtl8723bs/include/rtw_io.h | 3 +--
2 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_io.c b/drivers/staging/rtl8723bs/core/rtw_io.c
index 0f52710e6d3a..cd455cfcf046 100644
--- a/drivers/staging/rtl8723bs/core/rtw_io.c
+++ b/drivers/staging/rtl8723bs/core/rtw_io.c
@@ -132,19 +132,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/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_ */
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v5 2/3] rtl8723bs: sdio: Use local error_count instead of global variable
[not found] <20260111032136.7078-1-2023060904@ycu.edu.cn>
2026-01-11 3:21 ` [PATCH v5 1/3] rtl8723bs: io: Add independent rtw_check_continual_io_error function 2023060904
@ 2026-01-11 3:21 ` 2023060904
2026-01-11 3:21 ` [PATCH v5 3/3] rtl8723bs: io: Remove redundant global continual_io_error variable 2023060904
2 siblings, 0 replies; 5+ messages in thread
From: 2023060904 @ 2026-01-11 3:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, 2023060904, guagua210311
From: Changjun Zheng <2023060904@ycu.edu.cn>
Replace the global continual_io_error variable with a local error_count in
sd_read32 and sd_write32 functions. This eliminates cross-function dependency
on the global variable and keeps the error counting logic isolated to each
IO operation.
Signed-off-by: Changjun Zheng <2023060904@ycu.edu.cn>
---
Changelog from v1 to v2:
- Initial draft: Implemented basic local error count logic, fixed compilation errors.
Changelog from v2 to v3:
- Merged small patches into one, optimized function logic to remove redundant code.
Changelog from v3 to v4:
- Split monolithic patch into single-purpose patches (per Greg's comment), fixed coding style.
Changelog from v4 to v5:
- Fixed format errors (spaces around '=', trailing whitespace) per checkpatch.pl;
- Standardized author name format (split "changjunzheng" to "Changjun Zheng");
- Moved changelog to below the --- separator (kernel format rule).
.../staging/rtl8723bs/os_dep/sdio_ops_linux.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v5 3/3] rtl8723bs: io: Remove redundant global continual_io_error variable
[not found] <20260111032136.7078-1-2023060904@ycu.edu.cn>
2026-01-11 3:21 ` [PATCH v5 1/3] rtl8723bs: io: Add independent rtw_check_continual_io_error function 2023060904
2026-01-11 3:21 ` [PATCH v5 2/3] rtl8723bs: sdio: Use local error_count instead of global variable 2023060904
@ 2026-01-11 3:21 ` 2023060904
2 siblings, 0 replies; 5+ messages in thread
From: 2023060904 @ 2026-01-11 3:21 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel, 2023060904, guagua210311
From: Changjun Zheng <2023060904@ycu.edu.cn>
Remove the global continual_io_error member from struct dvobj_priv, as it is
no longer used after the local error_count logic is adopted in sdio functions.
This reduces unnecessary memory usage and simplifies the dvobj_priv structure.
Signed-off-by: Changjun Zheng <2023060904@ycu.edu.cn>
---
Changelog from v1 to v2:
- Initial draft: Implemented basic local error count logic, fixed compilation errors.
Changelog from v2 to v3:
- Merged small patches into one, optimized function logic to remove redundant code.
Changelog from v3 to v4:
- Split monolithic patch into single-purpose patches (per Greg's comment), fixed coding style.
Changelog from v4 to v5:
- Fixed format errors (spaces around '=', trailing whitespace) per checkpatch.pl;
- Standardized author name format (split "changjunzheng" to "Changjun Zheng");
- Moved changelog to below the --- separator (kernel format rule).
drivers/staging/rtl8723bs/include/drv_types.h | 1 -
1 file changed, 1 deletion(-)
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;
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v5 1/3] rtl8723bs: io: Add independent rtw_check_continual_io_error function
2026-01-11 3:21 ` [PATCH v5 1/3] rtl8723bs: io: Add independent rtw_check_continual_io_error function 2023060904
@ 2026-01-11 13:04 ` Greg KH
2026-01-12 7:55 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Greg KH @ 2026-01-11 13:04 UTC (permalink / raw)
To: 2023060904; +Cc: linux-staging, linux-kernel, guagua210311
On Sun, Jan 11, 2026 at 11:21:34AM +0800, 2023060904@ycu.edu.cn wrote:
> From: Changjun Zheng <2023060904@ycu.edu.cn>
>
> Add a new function to check if the error count exceeds the MAX_CONTINUAL_IO_ERR
> threshold. This function follows the single responsibility principle and
> prepares for the subsequent removal of the global continual_io_error variable.
>
> Signed-off-by: Changjun Zheng <2023060904@ycu.edu.cn>
> ---
This patch is corrupted and can not be applied:
checking file drivers/staging/rtl8723bs/core/rtw_io.c
patch: **** malformed patch at line 228: }
So something went wrong.
Also, make sure that each commit builds properly, I think this one will
break the build, right?
And finally, please use git send-email to send all of these out
together, your 0/3 email does not show up as properly threaded here.
See the result on lore.kernel.org as proof of that:
https://lore.kernel.org/all/12B32ED3FD2801A5+20260111032136.7078-1-2023060904@ycu.edu.cn/
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v5 1/3] rtl8723bs: io: Add independent rtw_check_continual_io_error function
2026-01-11 3:21 ` [PATCH v5 1/3] rtl8723bs: io: Add independent rtw_check_continual_io_error function 2023060904
2026-01-11 13:04 ` Greg KH
@ 2026-01-12 7:55 ` Dan Carpenter
1 sibling, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2026-01-12 7:55 UTC (permalink / raw)
To: 2023060904; +Cc: gregkh, linux-staging, linux-kernel, guagua210311
On Sun, Jan 11, 2026 at 11:21:34AM +0800, 2023060904@ycu.edu.cn wrote:
> diff --git a/drivers/staging/rtl8723bs/core/rtw_io.c b/drivers/staging/rtl8723bs/core/rtw_io.c
> index 0f52710e6d3a..cd455cfcf046 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_io.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_io.c
> @@ -132,19 +132,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;
> }
You've broken this patch up in the wrong way. This patch removes
the dvobj->continual_io_error++ and then the later patches remove
the code which uses it. This introduces a bug and then fixes it
later. You can't introduce bugs even when they are fixed later in
the patchset.
Also I don't really know why you are doing this. Have you tested
your code? I don't really know why they wrote it like this
originally, but it wouldn't surpise me if they did it based on
testing.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-01-12 7:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260111032136.7078-1-2023060904@ycu.edu.cn>
2026-01-11 3:21 ` [PATCH v5 1/3] rtl8723bs: io: Add independent rtw_check_continual_io_error function 2023060904
2026-01-11 13:04 ` Greg KH
2026-01-12 7:55 ` Dan Carpenter
2026-01-11 3:21 ` [PATCH v5 2/3] rtl8723bs: sdio: Use local error_count instead of global variable 2023060904
2026-01-11 3:21 ` [PATCH v5 3/3] rtl8723bs: io: Remove redundant global continual_io_error variable 2023060904
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox