[PATCH] staging: rtl8723bs: Replace msleep with usleep_range

AyushMukkanwar posted 1 patch 2 weeks, 1 day ago
drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] staging: rtl8723bs: Replace msleep with usleep_range
Posted by AyushMukkanwar 2 weeks, 1 day ago
The checkpatch.pl script flagged a warning regarding the use of
msleep() for less than 20ms. msleep() relies on jiffies and can
be inaccurate for short durations, leading to inefficient delays.

Replace msleep(10) with usleep_range(10000, 12000) to allow for
timer coalescing. This gives the kernel scheduler a 2ms window
to group wakeups, improving overall system power efficiency
while maintaining the required 10ms minimum delay.

Signed-off-by: AyushMukkanwar <ayushmukkanwar@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index abb84f8aecbe..bab48392f296 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -214,7 +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, 12000);
 
 	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
 		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
-- 
2.53.0
Re: [PATCH] staging: rtl8723bs: Replace msleep with usleep_range
Posted by Andy Shevchenko 2 weeks, 1 day ago
On Fri, Mar 20, 2026 at 01:24:37AM +0530, AyushMukkanwar wrote:
> The checkpatch.pl script flagged a warning regarding the use of
> msleep() for less than 20ms. msleep() relies on jiffies and can
> be inaccurate for short durations, leading to inefficient delays.
> 
> Replace msleep(10) with usleep_range(10000, 12000) to allow for
> timer coalescing. This gives the kernel scheduler a 2ms window
> to group wakeups, improving overall system power efficiency
> while maintaining the required 10ms minimum delay.

The new API is fsleep().

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH] staging: rtl8723bs: Replace msleep with usleep_range
Posted by Ethan Tidmore 2 weeks, 1 day ago
On Thu Mar 19, 2026 at 2:54 PM CDT, AyushMukkanwar wrote:
> The checkpatch.pl script flagged a warning regarding the use of
> msleep() for less than 20ms. msleep() relies on jiffies and can
> be inaccurate for short durations, leading to inefficient delays.
>
> Replace msleep(10) with usleep_range(10000, 12000) to allow for
> timer coalescing. This gives the kernel scheduler a 2ms window
> to group wakeups, improving overall system power efficiency
> while maintaining the required 10ms minimum delay.
>
> Signed-off-by: AyushMukkanwar <ayushmukkanwar@gmail.com>
> ---

Greg has already NAKed this change.

Thanks,

ET