[PATCH] staging: rtl8723bs: replace msleep with usleep_range in rtw_dev_unload
From: Gustavo Arantes
Date: Sun Mar 08 2026 - 17:56:44 EST
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@xxxxxxxxx>
---
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