public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: replace msleep(1) with fsleep()
@ 2026-03-19 19:13 Zile Xiong
  2026-03-31  8:35 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Zile Xiong @ 2026-03-19 19:13 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Zile Xiong

msleep(1) is not suitable for short delays due to scheduler
granularity.

Use fsleep(USEC_PER_MSEC) instead, which provides a more
appropriate delay for 1 ms sleeps.

Signed-off-by: Zile Xiong <xiongzile99@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c      | 5 +++--
 drivers/staging/rtl8723bs/hal/hal_btcoex.c        | 3 ++-
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 5 +++--
 drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c   | 3 ++-
 drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c    | 5 +++--
 drivers/staging/rtl8723bs/os_dep/os_intfs.c       | 3 ++-
 6 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index f074ea6e0f38..5751584b0f18 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -4,6 +4,7 @@
  * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
  *
  ******************************************************************************/
+#include <linux/delay.h>
 #include <drv_types.h>
 #include <hal_data.h>
 #include <linux/jiffies.h>
@@ -414,7 +415,7 @@ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
 			err = -1;
 			break;
 		}
-		msleep(1);
+		fsleep(USEC_PER_MSEC);
 	}
 
 	return err;
@@ -567,7 +568,7 @@ void LPS_Leave_check(struct adapter *padapter)
 		if (jiffies_to_msecs(jiffies - start_time) > 100)
 			break;
 
-		msleep(1);
+		fsleep(USEC_PER_MSEC);
 	}
 }
 
diff --git a/drivers/staging/rtl8723bs/hal/hal_btcoex.c b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
index 2a2dd60be8bb..596a775329d9 100644
--- a/drivers/staging/rtl8723bs/hal/hal_btcoex.c
+++ b/drivers/staging/rtl8723bs/hal/hal_btcoex.c
@@ -5,6 +5,7 @@
  *
  ******************************************************************************/
 
+#include <linux/delay.h>
 #include <hal_data.h>
 #include <hal_btcoex.h>
 #include <Mp_Precomp.h>
@@ -98,7 +99,7 @@ static void halbtcoutsrc_LeaveLowPower(struct btc_coexist *pBtCoexist)
 		if (utime > timeout)
 			break;
 
-		msleep(1);
+		fsleep(USEC_PER_MSEC);
 	} while (1);
 }
 
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index e794fe3caf9d..8159ad278a6b 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -5,6 +5,7 @@
  *
  ******************************************************************************/
 
+#include <linux/delay.h>
 #include <linux/firmware.h>
 #include <linux/slab.h>
 #include <drv_types.h>
@@ -28,7 +29,7 @@ static void _FWDownloadEnable(struct adapter *padapter, bool enable)
 			if (tmp & 0x01)
 				break;
 			rtw_write8(padapter, REG_MCUFWDL, tmp|0x01);
-			msleep(1);
+			fsleep(USEC_PER_MSEC);
 		} while (count++ < 100);
 
 		/*  8051 reset */
@@ -1157,7 +1158,7 @@ s32 rtl8723b_InitLLTTable(struct adapter *padapter)
 		if (passing_time > 1000)
 			break;
 
-		msleep(1);
+		fsleep(USEC_PER_MSEC);
 	} while (1);
 
 	return ret;
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
index 7fac1c2ba8e0..14a14eeaf9d2 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c
@@ -5,6 +5,7 @@
  *
  ******************************************************************************/
 
+#include <linux/delay.h>
 #include <drv_types.h>
 #include <rtl8723b_hal.h>
 
@@ -391,7 +392,7 @@ int PHY_BBConfig8723B(struct adapter *Adapter)
 
 	rtw_write8(Adapter, REG_RF_CTRL, RF_EN|RF_RSTB|RF_SDMRSTB);
 
-	msleep(1);
+	fsleep(USEC_PER_MSEC);
 
 	PHY_SetRFReg(Adapter, RF_PATH_A, 0x1, 0xfffff, 0x780);
 
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
index f50726d2ed0c..bb6d6d7544b7 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c
@@ -5,6 +5,7 @@
  *
  ******************************************************************************/
 
+#include <linux/delay.h>
 #include <drv_types.h>
 #include <rtl8723b_hal.h>
 
@@ -23,7 +24,7 @@ static u8 rtw_sdio_wait_enough_TxOQT_space(struct adapter *padapter, u8 agg_num)
 		HalQueryTxOQTBufferStatus8723BSdio(padapter);
 
 		if ((++n % 60) == 0) {
-			msleep(1);
+			fsleep(USEC_PER_MSEC);
 			/* yield(); */
 		}
 	}
@@ -386,7 +387,7 @@ static s32 rtl8723bs_xmit_handler(struct adapter *padapter)
 		/* here sleep 1ms will cause big TP loss of TX */
 		/* from 50+ to 40+ */
 		if (padapter->registrypriv.wifi_spec)
-			msleep(1);
+			fsleep(USEC_PER_MSEC);
 		else
 			yield();
 		goto next;
diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index 7ba689f2dfc8..895c47e987c4 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -4,6 +4,7 @@
  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
  *
  ******************************************************************************/
+#include <linux/delay.h>
 #include <drv_types.h>
 #include <hal_data.h>
 #include <rtl8723b_xmit.h>
@@ -1091,7 +1092,7 @@ void rtw_suspend_common(struct adapter *padapter)
 	pwrpriv->bInSuspend = true;
 
 	while (pwrpriv->bips_processing)
-		msleep(1);
+		fsleep(USEC_PER_MSEC);
 
 	if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved))
 		return;
-- 
2.39.5


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

end of thread, other threads:[~2026-03-31  8:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-19 19:13 [PATCH] staging: rtl8723bs: replace msleep(1) with fsleep() Zile Xiong
2026-03-31  8:35 ` Greg KH

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