[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <A23D22DD90AB07AE+20260110101801.5820-3-2023060904@ycu.edu.cn>
Date: Sat, 10 Jan 2026 18:17:59 +0800
From: 2023060904@....edu.cn
To: gregkh@...uxfoundation.org
Cc: linux-staging@...ts.linux.dev,
linux-kernel@...r.kernel.org,
2023060904@....edu.cn,
guagua210311@...com
Subject: [PATCH 2/3] rtl8723bs: sdio: Use local error_count instead of global variable
From: changjunzheng <guagua210311@...com>
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.
Changelog v3 -> v4:
1. Split the single v3 patch into 4 logical patches (per Greg KH's request)
2. Fix all coding style errors (trailing spaces, missing assignment spaces, indentation)
3. Add clear, purpose-driven commit messages for each patch
4. Add version changelog as required by kernel documentation
Signed-off-by: changjunzheng <guagua210311@...com>
---
.../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
Powered by blists - more mailing lists