[PATCH] staging: rtl8723bs: replace msleep with usleep_range in _rtw_free_evt_priv

Marco Lu posted 1 patch 3 hours ago
drivers/staging/rtl8723bs/core/rtw_cmd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] staging: rtl8723bs: replace msleep with usleep_range in _rtw_free_evt_priv
Posted by Marco Lu 3 hours ago
The msleep(10) call is an imprecise busy-wait function in
core/rtw_cmd.c/_rtw_free_evt_priv due to timer jitter.

Replace it with usleep_range(10000, 11000)
to save CPU cycles to provide more precise timing.

Signed-off-by: Marco Lu <mcl7d9@outlook.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index abb84f8ae..14778c22e 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -214,8 +214,7 @@ void _rtw_free_evt_priv(struct	evt_priv *pevtpriv)
 {
 	_cancel_workitem_sync(&pevtpriv->c2h_wk);
 	while (pevtpriv->c2h_wk_alive)
-		msleep(10);
-
+		usleep_range(10000, 11000);
 	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
 		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
 
-- 
2.53.0
Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range in _rtw_free_evt_priv
Posted by Ethan Tidmore 3 hours ago
On Tue Mar 31, 2026 at 10:42 PM CDT, Marco Lu wrote:
> The msleep(10) call is an imprecise busy-wait function in
> core/rtw_cmd.c/_rtw_free_evt_priv due to timer jitter.
>
> Replace it with usleep_range(10000, 11000)
> to save CPU cycles to provide more precise timing.
>
> Signed-off-by: Marco Lu <mcl7d9@outlook.com>
> ---

This has been NAKed in the past by Greg. Also, fsleep() is the new API.

Thanks,

ET