public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: replace msleep with usleep_range in _rtw_free_evt_priv
@ 2026-04-01  3:42 Marco Lu
  2026-04-01  4:13 ` Ethan Tidmore
  0 siblings, 1 reply; 2+ messages in thread
From: Marco Lu @ 2026-04-01  3:42 UTC (permalink / raw)
  To: gregkh, linux-staging, linux-kernel; +Cc: Marco Lu

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


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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range in _rtw_free_evt_priv
  2026-04-01  3:42 [PATCH] staging: rtl8723bs: replace msleep with usleep_range in _rtw_free_evt_priv Marco Lu
@ 2026-04-01  4:13 ` Ethan Tidmore
  0 siblings, 0 replies; 2+ messages in thread
From: Ethan Tidmore @ 2026-04-01  4:13 UTC (permalink / raw)
  To: Marco Lu, gregkh, linux-staging, linux-kernel; +Cc: Marco Lu

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

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

end of thread, other threads:[~2026-04-01  4:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-01  3:42 [PATCH] staging: rtl8723bs: replace msleep with usleep_range in _rtw_free_evt_priv Marco Lu
2026-04-01  4:13 ` Ethan Tidmore

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