Skip to contentSkip to conversation

staging: rtl8723bs: replace msleep with usleep_range in _rtw_free_evt_priv

PATCH In review Marco Lu 2 participants 2 messages Apr 1 Staging

lore
Share & tools
lore

Marco Lu

author
#0 lore raw

PATCH 1/1 staging: rtl8723bs: replace msleep with usleep_range in _rtw_free_evt_priv

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.

---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_cmd.c +1 -2
index abb84f8ae..14778c22e 100644
@@ -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);
 
Signature · 1 line
2.53.0
#1 lore raw
Quoted 8 lines · 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.

---

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

Thanks,

ET