Skip to contentSkip to conversation

staging: rtl8723bs: os_intfs: replace msleep with usleep_range

PATCH In review Connor Sample 2 participants 2 messages Jul 29 – Jul 30 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: os_intfs: replace msleep with usleep_range

checkpatch.pl warns that msleep() of durations <20ms may sleep for up to 20ms. As per Documentation/timers/delay_sleep_functions.rst, usleep_range() should be used whenever the accuracy of msleep() is not sufficient in order to avoid jiffy rounding.

Replaced msleep(10) with usleep_range(10000, 11000) and replaced a 1ms polling loop (msleep(1)) with usleep_range(1000, 2000). This should provide improved scheduling tolerances without changing the minimum delay expectation for the hardware.

---
 drivers/staging/rtl8723bs/os_dep/os_intfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/os_dep/os_intfs.c +2 -2
index f31196f54b3e..ccac4c2c3269 100644
@@ -992,7 +992,7 @@ void rtw_dev_unload(struct adapter *padapter)
 			if (cnt > 5)
 				break;
 			cnt++;
-			msleep(10);
+			usleep_range(10000, 11000);
 		}
 
 		/* check the status of IPS */
@@ -1092,7 +1092,7 @@ void rtw_suspend_common(struct adapter *padapter)
 	pwrpriv->bInSuspend = true;
 
 	while (pwrpriv->bips_processing)
-		msleep(1);
+		usleep_range(1000, 2000);
 
 	if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved))
 		return;
Signature · 1 line
2.55.0
#1 lore raw
Quoted 9 lines · Connor Sample

checkpatch.pl warns that msleep() of durations <20ms may sleep for up to 20ms. As per Documentation/timers/delay_sleep_functions.rst, usleep_range() should be used whenever the accuracy of msleep() is not sufficient in order to avoid jiffy rounding.

Replaced msleep(10) with usleep_range(10000, 11000) and replaced a 1ms polling loop (msleep(1)) with usleep_range(1000, 2000). This should provide improved scheduling tolerances without changing the minimum delay expectation for the hardware.

Please see the many places in the mailing list archives where we have rejected this same patch :)