public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: replace msleep with usleep_range in rtw_dev_unload
@ 2026-03-08 21:56 Gustavo Arantes
  2026-03-09 13:37 ` Bryant Boatright
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo Arantes @ 2026-03-08 21:56 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Gustavo Arantes

Replace msleep(10) with usleep_range(10000, 20000) in the command thread
shutdown loop in rtw_dev_unload(), since msleep() for values less than
20ms may not in fact sleep for the intended duration and will often
sleep for up to 20ms, as documented in
Documentation/timers/timers-howto.rst.

Also remove the unnecessary else branch after break and the associated
if braces to simplify the loop.

Signed-off-by: Gustavo Arantes <dev.gustavoa@gmail.com>
---
 drivers/staging/rtl8723bs/os_dep/os_intfs.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
index f2d64b05debb..b5fac9ebc3c7 100644
--- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
@@ -986,12 +986,11 @@ void rtw_dev_unload(struct adapter *padapter)
 			rtw_stop_drv_threads(padapter);
 
 		while (atomic_read(&pcmdpriv->cmdthd_running)) {
-			if (cnt > 5) {
+			if (cnt > 5)
 				break;
-			} else {
-				cnt++;
-				msleep(10);
-			}
+
+			cnt++;
+			usleep_range(10000, 20000);
 		}
 
 		/* check the status of IPS */
-- 
2.53.0


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

end of thread, other threads:[~2026-03-09 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-08 21:56 [PATCH] staging: rtl8723bs: replace msleep with usleep_range in rtw_dev_unload Gustavo Arantes
2026-03-09 13:37 ` Bryant Boatright

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