mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] rtl8723bs: Replace atomic_t with int for continual_io_error (no concurrency)
@ 2025-12-18 14:46 cjz
  2025-12-18 14:56 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: cjz @ 2025-12-18 14:46 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, changjunzheng

From: changjunzheng <guagua210311@qq.com>

The 'continual_io_error' variable is defined as atomic_t, but all call sites
of rtw_inc_and_chk_continual_io_error/rtw_reset_continual_io_error are in
process context (sdio_ops_linux.c/sdio_intf.c, SDIO read/write retry logic).
There is no interrupt/thread concurrency modifying this variable, so atomic
operations are unnecessary and introduce slight performance overhead.

This change replaces atomic_t with a normal int, and replaces atomic_inc_return()/atomic_set()
with ordinary increment/assignment, keeping all functional logic unchanged.

---
v2 changes:
1. Remove redundant 'error_count' variable and fix variable declaration position (comply with kernel coding standards).
2. Simplify the function logic of rtw_inc_and_chk_continual_io_error.

Signed-off-by: changjunzheng <guagua210311@qq.com>
---
 drivers/staging/rtl8723bs/core/rtw_io.c       | 10 +++-------
 drivers/staging/rtl8723bs/include/drv_types.h |  2 +-
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_io.c b/drivers/staging/rtl8723bs/core/rtw_io.c
index fe9f94001eed..0f52710e6d3a 100644
--- a/drivers/staging/rtl8723bs/core/rtw_io.c
+++ b/drivers/staging/rtl8723bs/core/rtw_io.c
@@ -139,16 +139,12 @@ int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapt
  */
 int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj)
 {
-	int error_count = atomic_inc_return(&dvobj->continual_io_error);
-
-	if (error_count > MAX_CONTINUAL_IO_ERR)
-		return true;
-
-	return false;
+	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)
 {
-	atomic_set(&dvobj->continual_io_error, 0);
+	dvobj->continual_io_error = 0;
 }
diff --git a/drivers/staging/rtl8723bs/include/drv_types.h b/drivers/staging/rtl8723bs/include/drv_types.h
index f86180dc350c..bd7bb5828d56 100644
--- a/drivers/staging/rtl8723bs/include/drv_types.h
+++ b/drivers/staging/rtl8723bs/include/drv_types.h
@@ -279,7 +279,7 @@ struct dvobj_priv {
 	u8 Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
 
 	u8 irq_alloc;
-	atomic_t continual_io_error;
+	int continual_io_error;
 
 	atomic_t disable_func;
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-18 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-18 14:46 [PATCH v2] rtl8723bs: Replace atomic_t with int for continual_io_error (no concurrency) cjz
2025-12-18 14:56 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®