public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: replace msleep with usleep_range
@ 2026-01-10 20:44 Işıkhan IŞIK
  2026-01-11 12:49 ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Işıkhan IŞIK @ 2026-01-10 20:44 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Işıkhan IŞIK

The checkpatch script flags a warning that msleep < 20ms can sleep
for longer than expected.

Replace msleep(10) with usleep_range(10000, 11000) to ensure
more precise delay handling.

Signed-off-by: Işıkhan IŞIK <isikhan2005@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 ef2d92b5588a..97c923015279 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -215,7 +215,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);
-- 
2.52.0


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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-01-10 20:44 Işıkhan IŞIK
@ 2026-01-11 12:49 ` Greg KH
  0 siblings, 0 replies; 21+ messages in thread
From: Greg KH @ 2026-01-11 12:49 UTC (permalink / raw)
  To: Işıkhan IŞIK; +Cc: linux-staging, linux-kernel

On Sat, Jan 10, 2026 at 11:44:45PM +0300, Işıkhan IŞIK wrote:
> The checkpatch script flags a warning that msleep < 20ms can sleep
> for longer than expected.
> 
> Replace msleep(10) with usleep_range(10000, 11000) to ensure
> more precise delay handling.
> 
> Signed-off-by: Işıkhan IŞIK <isikhan2005@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 ef2d92b5588a..97c923015279 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> @@ -215,7 +215,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);
> -- 
> 2.52.0
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You sent a patch that has been sent multiple times in the past days,
  and is identical to ones that has been recently rejected.  Please
  always look at the mailing list traffic to determine if you are
  duplicating other people's work.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

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

* [PATCH] staging: rtl8723bs: replace msleep with usleep_range
@ 2026-02-08 12:15 Miguel Angel De la Vega Rodriguez
  2026-02-08 14:35 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 21+ messages in thread
From: Miguel Angel De la Vega Rodriguez @ 2026-02-08 12:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-staging, linux-kernel, Miguel Angel De la Vega Rodriguez

checkpatch.pl warns that msleep < 20ms can sleep for up to 20ms.

This patch replaces msleep(10) with usleep_range(10000, 11000) to
improve timer precision and allow the scheduler to coalesce interrupts.

Signed-off-by: Miguel Angel De la Vega Rodriguez <miguevrgo@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 b2e7f479f72b..3f5b3ca2066d 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, 11000);
 
 	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
 		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
-- 
2.53.0


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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-02-08 12:15 Miguel Angel De la Vega Rodriguez
@ 2026-02-08 14:35 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2026-02-08 14:35 UTC (permalink / raw)
  To: Miguel Angel De la Vega Rodriguez; +Cc: linux-staging, linux-kernel

On Sun, Feb 08, 2026 at 01:15:00PM +0100, Miguel Angel De la Vega Rodriguez wrote:
> checkpatch.pl warns that msleep < 20ms can sleep for up to 20ms.
> 
> This patch replaces msleep(10) with usleep_range(10000, 11000) to
> improve timer precision and allow the scheduler to coalesce interrupts.
> 
> Signed-off-by: Miguel Angel De la Vega Rodriguez <miguevrgo@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 b2e7f479f72b..3f5b3ca2066d 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, 11000);
>  
>  	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
>  		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
> -- 
> 2.53.0
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You sent a patch that has been sent multiple times in the past, and is
  identical to ones that have been rejected.  Please always look at the
  mailing list traffic to determine if you are duplicating other
  people's work.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

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

* [PATCH] staging: rtl8723bs: replace msleep with usleep_range
@ 2026-02-09 12:07 Ethan Lam
  2026-02-09 12:35 ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Ethan Lam @ 2026-02-09 12:07 UTC (permalink / raw)
  To: gregkh
  Cc: linux-staging, linux-kernel, ignacio.pena87, bryant.boatright,
	strnad.jj, mingo, tglx, Ethan Lam

checkpatch.pl says that msleep < 20ms can sleep for longer than expected.
The documentation says we should "Use uslee_range*()
whenever accuracy of *sleep() is not sufficient)

Replaced msleep(10) with usleep_range(10000, 11000) so the delay
is more accurate and percise

Signed-off-by: Ethan Lam <ethanlxkernel@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 ef2d92b5588a..97c923015279 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -215,7 +215,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);
-- 
2.43.0


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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-02-09 12:07 Ethan Lam
@ 2026-02-09 12:35 ` Greg KH
  0 siblings, 0 replies; 21+ messages in thread
From: Greg KH @ 2026-02-09 12:35 UTC (permalink / raw)
  To: Ethan Lam
  Cc: linux-staging, linux-kernel, ignacio.pena87, bryant.boatright,
	strnad.jj, mingo, tglx

On Mon, Feb 09, 2026 at 08:07:09PM +0800, Ethan Lam wrote:
> checkpatch.pl says that msleep < 20ms can sleep for longer than expected.
> The documentation says we should "Use uslee_range*()
> whenever accuracy of *sleep() is not sufficient)
> 
> Replaced msleep(10) with usleep_range(10000, 11000) so the delay
> is more accurate and percise
> 
> Signed-off-by: Ethan Lam <ethanlxkernel@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 ef2d92b5588a..97c923015279 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> @@ -215,7 +215,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);
> -- 
> 2.43.0
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You sent a patch that has been sent multiple times in the past few
  days, and is identical to ones that has been recently rejected.
  Please always look at the mailing list traffic to determine if you are
  duplicating other people's work.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

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

* [PATCH] staging: rtl8723bs: replace msleep with usleep_range
@ 2026-02-10  5:58 Vo Thanh Cong
  2026-02-10  6:37 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 21+ messages in thread
From: Vo Thanh Cong @ 2026-02-10  5:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-staging, linux-kernel, Vo Thanh Cong

Replace msleep(10) with usleep_range() to provide better accuracy
for short delays (< 20ms) and to resolve checkpatch warning:
"msleep < 20ms can sleep for up to 20ms".

Signed-off-by: Vo Thanh Cong <thanhcongvo079@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 b2e7f479f72b..3f5b3ca2066d 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, 11000);
 
 	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
 		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
-- 
2.52.0


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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-02-10  5:58 Vo Thanh Cong
@ 2026-02-10  6:37 ` Greg Kroah-Hartman
  0 siblings, 0 replies; 21+ messages in thread
From: Greg Kroah-Hartman @ 2026-02-10  6:37 UTC (permalink / raw)
  To: Vo Thanh Cong; +Cc: linux-staging, linux-kernel

On Tue, Feb 10, 2026 at 12:58:59PM +0700, Vo Thanh Cong wrote:
> Replace msleep(10) with usleep_range() to provide better accuracy
> for short delays (< 20ms) and to resolve checkpatch warning:
> "msleep < 20ms can sleep for up to 20ms".
> 
> Signed-off-by: Vo Thanh Cong <thanhcongvo079@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 b2e7f479f72b..3f5b3ca2066d 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, 11000);
>  
>  	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
>  		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
> -- 
> 2.52.0
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- You sent a patch that has been sent multiple times in the past few
  days, and is identical to ones that has been recently rejected.
  Please always look at the mailing list traffic to determine if you are
  duplicating other people's work.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

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

* [PATCH] staging: rtl8723bs: replace msleep with usleep_range
@ 2026-02-14 17:31 Ofek Almog
  2026-02-14 18:11 ` Ethan Tidmore
  0 siblings, 1 reply; 21+ messages in thread
From: Ofek Almog @ 2026-02-14 17:31 UTC (permalink / raw)
  To: gregkh
  Cc: linux-staging, linux-kernel, s9430939, architanant5,
	andriy.shevchenko, Ofek Almog

This patch replaces msleep(10) with usleep_range(10000, 11000) to provide
more precise delay handling while allowing the timer subsystem to coalesce
timers efficiently.

Signed-off-by: Ofek Almog <ofekalm100@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 b2e7f479f72b..3f5b3ca2066d 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, 11000);
 
 	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
 		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
-- 
2.43.0


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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-02-14 17:31 Ofek Almog
@ 2026-02-14 18:11 ` Ethan Tidmore
  2026-02-14 18:24   ` Andy Shevchenko
  0 siblings, 1 reply; 21+ messages in thread
From: Ethan Tidmore @ 2026-02-14 18:11 UTC (permalink / raw)
  To: Ofek Almog, gregkh
  Cc: linux-staging, linux-kernel, s9430939, architanant5,
	andriy.shevchenko

On Sat Feb 14, 2026 at 11:31 AM CST, Ofek Almog wrote:
> This patch replaces msleep(10) with usleep_range(10000, 11000) to provide
> more precise delay handling while allowing the timer subsystem to coalesce
> timers efficiently.
>
> Signed-off-by: Ofek Almog <ofekalm100@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 b2e7f479f72b..3f5b3ca2066d 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, 11000);
>  
>  	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
>  		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);

Shouldn't we be using fsleep() now instead of replacing msleep() with
usleep_range() when the time is sub 20ms?

I feel like I read Andy Shevchenko mention this elsewhere.

Thanks,

ET

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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-02-14 18:11 ` Ethan Tidmore
@ 2026-02-14 18:24   ` Andy Shevchenko
  2026-02-14 19:23     ` Ofek Almog
  0 siblings, 1 reply; 21+ messages in thread
From: Andy Shevchenko @ 2026-02-14 18:24 UTC (permalink / raw)
  To: Ethan Tidmore
  Cc: Ofek Almog, gregkh, linux-staging, linux-kernel, s9430939,
	architanant5

On Sat, Feb 14, 2026 at 12:11:16PM -0600, Ethan Tidmore wrote:
> On Sat Feb 14, 2026 at 11:31 AM CST, Ofek Almog wrote:
> > This patch replaces msleep(10) with usleep_range(10000, 11000) to provide
> > more precise delay handling while allowing the timer subsystem to coalesce
> > timers efficiently.

...

> >  	while (pevtpriv->c2h_wk_alive)
> > -		msleep(10);
> > +		usleep_range(10000, 11000);

The whole approach here seems to be fragile. It should rather use completion
mechanism instead of infinite loop.

> >  	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
> >  		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
> 
> Shouldn't we be using fsleep() now instead of replacing msleep() with
> usleep_range() when the time is sub 20ms?
> 
> I feel like I read Andy Shevchenko mention this elsewhere.

Yep.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-02-14 18:24   ` Andy Shevchenko
@ 2026-02-14 19:23     ` Ofek Almog
  2026-02-15  6:52       ` Greg KH
  0 siblings, 1 reply; 21+ messages in thread
From: Ofek Almog @ 2026-02-14 19:23 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Ethan Tidmore, gregkh, linux-staging, linux-kernel, s9430939,
	architanant5

(Resending as plain text, apologies if you received a previous HTML version)

Hi Andy, Ethan,

Thank you both for the review.

Regarding the fsleep() suggestion - understood, that clearly seems
like the right helper to use here.

Regarding the completion mechanism logic - I completely agree that the
current infinite loop polling is fragile. However, as this is my very
first contribution and I do not have the hardware to verify logic
changes, I am hesitant to refactor the synchronization mechanism
blindly.

Would you prefer I send a v2 that strictly switches to fsleep() as an
incremental improvement over msleep(), or should I drop this patch
altogether until someone with the hardware can refactor the logic
properly?

Best regards,
Ofek

‫בתאריך שבת, 14 בפבר׳ 2026 ב-20:24 מאת ‪Andy Shevchenko‬‏
<‪andriy.shevchenko@intel.com‬‏>:‬
>
> On Sat, Feb 14, 2026 at 12:11:16PM -0600, Ethan Tidmore wrote:
> > On Sat Feb 14, 2026 at 11:31 AM CST, Ofek Almog wrote:
> > > This patch replaces msleep(10) with usleep_range(10000, 11000) to provide
> > > more precise delay handling while allowing the timer subsystem to coalesce
> > > timers efficiently.
>
> ...
>
> > >     while (pevtpriv->c2h_wk_alive)
> > > -           msleep(10);
> > > +           usleep_range(10000, 11000);
>
> The whole approach here seems to be fragile. It should rather use completion
> mechanism instead of infinite loop.
>
> > >     while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
> > >             void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
> >
> > Shouldn't we be using fsleep() now instead of replacing msleep() with
> > usleep_range() when the time is sub 20ms?
> >
> > I feel like I read Andy Shevchenko mention this elsewhere.
>
> Yep.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-02-14 19:23     ` Ofek Almog
@ 2026-02-15  6:52       ` Greg KH
  0 siblings, 0 replies; 21+ messages in thread
From: Greg KH @ 2026-02-15  6:52 UTC (permalink / raw)
  To: Ofek Almog
  Cc: Andy Shevchenko, Ethan Tidmore, linux-staging, linux-kernel,
	s9430939, architanant5

On Sat, Feb 14, 2026 at 09:23:45PM +0200, Ofek Almog wrote:
> (Resending as plain text, apologies if you received a previous HTML version)
> 
> Hi Andy, Ethan,
> 
> Thank you both for the review.
> 
> Regarding the fsleep() suggestion - understood, that clearly seems
> like the right helper to use here.
> 
> Regarding the completion mechanism logic - I completely agree that the
> current infinite loop polling is fragile. However, as this is my very
> first contribution and I do not have the hardware to verify logic
> changes, I am hesitant to refactor the synchronization mechanism
> blindly.
> 
> Would you prefer I send a v2 that strictly switches to fsleep() as an
> incremental improvement over msleep(), or should I drop this patch
> altogether until someone with the hardware can refactor the logic
> properly?

Please drop it, see the archives for why (you need someone with the
hardare and specs to figure out what needs to be done.)

thanks,

greg k-h

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

* [PATCH] staging: rtl8723bs: replace msleep with usleep_range
@ 2026-03-09  0:40 sluisr
  2026-03-09 13:33 ` Bryant Boatright
  2026-03-09 16:01 ` Greg KH
  0 siblings, 2 replies; 21+ messages in thread
From: sluisr @ 2026-03-09  0:40 UTC (permalink / raw)
  To: gregkh; +Cc: david.laight.linux, linux-staging, linux-kernel, sluisr

This patch addresses the checkpatch.pl warnings:
WARNING: msleep < 20ms can sleep for up to 20ms; see function description of msleep().

It is recommended to use usleep_range for delays less than 20ms.

Signed-off-by: sluisr <contact@sluisr.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c      | 2 +-
 drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +-
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index abb84f8ae..f6293f049 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, 11000);
 
 	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
 		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index b1f20aa81..7ac013519 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -5833,7 +5833,7 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned char *pbuf)
 		return H2C_SUCCESS;
 
 	if ((pstapriv->tim_bitmap & BIT(0)) && (psta_bmc->sleepq_len > 0)) {
-		msleep(10);/*  10ms, ATIM(HIQ) Windows */
+		usleep_range(10000, 11000);/*  10ms, ATIM(HIQ) Windows */
 
 		/* spin_lock_bh(&psta_bmc->sleep_q.lock); */
 		spin_lock_bh(&pxmitpriv->lock);
diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index 1c9e02732..ad6c375ba 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -420,7 +420,7 @@ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
 			err = -1;
 			break;
 		}
-		msleep(1);
+		usleep_range(1000, 2000);
 	}
 
 	return err;
-- 
2.53.0


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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-03-09  0:40 [PATCH] staging: rtl8723bs: replace msleep with usleep_range sluisr
@ 2026-03-09 13:33 ` Bryant Boatright
  2026-03-09 16:01 ` Greg KH
  1 sibling, 0 replies; 21+ messages in thread
From: Bryant Boatright @ 2026-03-09 13:33 UTC (permalink / raw)
  To: sluisr; +Cc: gregkh, david.laight.linux, linux-staging, linux-kernel, sluisr

On Sun, Mar 08, 2026 at 06:40:50PM -0600, sluisr wrote:

> WARNING: msleep < 20ms can sleep for up to 20ms; see function description of msleep().

This had been addressed in a thread recently and Gred said to drop the patch [1].

Best,

Bryant Boatright

[1] https://lore.kernel.org/linux-staging/20260214173139.49094-1-ofekalm100@gmail.com/



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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-03-09  0:40 [PATCH] staging: rtl8723bs: replace msleep with usleep_range sluisr
  2026-03-09 13:33 ` Bryant Boatright
@ 2026-03-09 16:01 ` Greg KH
  1 sibling, 0 replies; 21+ messages in thread
From: Greg KH @ 2026-03-09 16:01 UTC (permalink / raw)
  To: sluisr; +Cc: david.laight.linux, linux-staging, linux-kernel, sluisr

On Sun, Mar 08, 2026 at 06:40:50PM -0600, sluisr wrote:
> This patch addresses the checkpatch.pl warnings:
> WARNING: msleep < 20ms can sleep for up to 20ms; see function description of msleep().
> 
> It is recommended to use usleep_range for delays less than 20ms.
> 
> Signed-off-by: sluisr <contact@sluisr.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_cmd.c      | 2 +-
>  drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 2 +-
>  drivers/staging/rtl8723bs/core/rtw_pwrctrl.c  | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
> index abb84f8ae..f6293f049 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, 11000);
>  
>  	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
>  		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
> diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> index b1f20aa81..7ac013519 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
> @@ -5833,7 +5833,7 @@ u8 chk_bmc_sleepq_hdl(struct adapter *padapter, unsigned char *pbuf)
>  		return H2C_SUCCESS;
>  
>  	if ((pstapriv->tim_bitmap & BIT(0)) && (psta_bmc->sleepq_len > 0)) {
> -		msleep(10);/*  10ms, ATIM(HIQ) Windows */
> +		usleep_range(10000, 11000);/*  10ms, ATIM(HIQ) Windows */
>  
>  		/* spin_lock_bh(&psta_bmc->sleep_q.lock); */
>  		spin_lock_bh(&pxmitpriv->lock);
> diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> index 1c9e02732..ad6c375ba 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> @@ -420,7 +420,7 @@ s32 LPS_RF_ON_check(struct adapter *padapter, u32 delay_ms)
>  			err = -1;
>  			break;
>  		}
> -		msleep(1);
> +		usleep_range(1000, 2000);
>  	}
>  
>  	return err;
> -- 
> 2.53.0
> 
> 

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- It looks like you did not use your "real" name for the patch on either
  the Signed-off-by: line, or the From: line (both of which have to
  match).  Please read the kernel file,
  Documentation/process/submitting-patches.rst for how to do this
  correctly.

- You sent a patch that has been sent multiple times in the past few
  days, and is identical to ones that has been recently rejected.
  Please always look at the mailing list traffic to determine if you are
  duplicating other people's work.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot

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

* [PATCH] staging: rtl8723bs: replace msleep with usleep_range
@ 2026-03-14  5:11 Marcos Andrade
  2026-03-14 20:56 ` Ethan Tidmore
  0 siblings, 1 reply; 21+ messages in thread
From: Marcos Andrade @ 2026-03-14  5:11 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, marcosandrade95963

The msleep() function is not recommended for delays under 20ms
as it may sleep for longer than desired. Replace msleep(10) with
usleep_range(10000, 11000) to ensure a more precise delay and
better kernel scheduling behavior.
This resolves a checkpatch.pl warning.

Signed-off-by: Marcos Andrade <marcosandrade95963@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index abb84f8ae..261d2e306 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -4,6 +4,7 @@
  * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
  *
  ******************************************************************************/
+#include "linux/delay.h"
 #include <drv_types.h>
 #include <hal_btcoex.h>
 #include <linux/jiffies.h>
@@ -214,7 +215,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);
-- 
2.53.0


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

* Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
  2026-03-14  5:11 [PATCH] staging: rtl8723bs: replace " Marcos Andrade
@ 2026-03-14 20:56 ` Ethan Tidmore
  0 siblings, 0 replies; 21+ messages in thread
From: Ethan Tidmore @ 2026-03-14 20:56 UTC (permalink / raw)
  To: Marcos Andrade, gregkh; +Cc: linux-staging, linux-kernel

On Sat Mar 14, 2026 at 12:11 AM CDT, Marcos Andrade wrote:
> The msleep() function is not recommended for delays under 20ms
> as it may sleep for longer than desired. Replace msleep(10) with
> usleep_range(10000, 11000) to ensure a more precise delay and
> better kernel scheduling behavior.
> This resolves a checkpatch.pl warning.
>
> Signed-off-by: Marcos Andrade <marcosandrade95963@gmail.com>

...


> +#include "linux/delay.h"

This would be <linux/delay.h>.

>  #include <drv_types.h>
>  #include <hal_btcoex.h>
>  #include <linux/jiffies.h>

This has already came up before and Greg decided to drop it. [1]

Thanks,

ET

[1] https://lore.kernel.org/linux-staging/20260214173139.49094-1-ofekalm100@gmail.com/

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

* [PATCH] staging: rtl8723bs: Replace msleep with usleep_range
@ 2026-03-19 19:54 AyushMukkanwar
  2026-03-19 20:23 ` Ethan Tidmore
  2026-03-20  7:42 ` Andy Shevchenko
  0 siblings, 2 replies; 21+ messages in thread
From: AyushMukkanwar @ 2026-03-19 19:54 UTC (permalink / raw)
  To: gregkh
  Cc: s9430939, architanant5, andriy.shevchenko, linux-staging,
	linux-kernel, AyushMukkanwar

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


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

* Re: [PATCH] staging: rtl8723bs: Replace msleep with usleep_range
  2026-03-19 19:54 [PATCH] staging: rtl8723bs: Replace " AyushMukkanwar
@ 2026-03-19 20:23 ` Ethan Tidmore
  2026-03-20  7:42 ` Andy Shevchenko
  1 sibling, 0 replies; 21+ messages in thread
From: Ethan Tidmore @ 2026-03-19 20:23 UTC (permalink / raw)
  To: AyushMukkanwar, gregkh
  Cc: s9430939, architanant5, andriy.shevchenko, linux-staging,
	linux-kernel

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

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

* Re: [PATCH] staging: rtl8723bs: Replace msleep with usleep_range
  2026-03-19 19:54 [PATCH] staging: rtl8723bs: Replace " AyushMukkanwar
  2026-03-19 20:23 ` Ethan Tidmore
@ 2026-03-20  7:42 ` Andy Shevchenko
  1 sibling, 0 replies; 21+ messages in thread
From: Andy Shevchenko @ 2026-03-20  7:42 UTC (permalink / raw)
  To: AyushMukkanwar
  Cc: gregkh, s9430939, architanant5, linux-staging, linux-kernel

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



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

end of thread, other threads:[~2026-03-20  7:42 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09  0:40 [PATCH] staging: rtl8723bs: replace msleep with usleep_range sluisr
2026-03-09 13:33 ` Bryant Boatright
2026-03-09 16:01 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2026-03-19 19:54 [PATCH] staging: rtl8723bs: Replace " AyushMukkanwar
2026-03-19 20:23 ` Ethan Tidmore
2026-03-20  7:42 ` Andy Shevchenko
2026-03-14  5:11 [PATCH] staging: rtl8723bs: replace " Marcos Andrade
2026-03-14 20:56 ` Ethan Tidmore
2026-02-14 17:31 Ofek Almog
2026-02-14 18:11 ` Ethan Tidmore
2026-02-14 18:24   ` Andy Shevchenko
2026-02-14 19:23     ` Ofek Almog
2026-02-15  6:52       ` Greg KH
2026-02-10  5:58 Vo Thanh Cong
2026-02-10  6:37 ` Greg Kroah-Hartman
2026-02-09 12:07 Ethan Lam
2026-02-09 12:35 ` Greg KH
2026-02-08 12:15 Miguel Angel De la Vega Rodriguez
2026-02-08 14:35 ` Greg Kroah-Hartman
2026-01-10 20:44 Işıkhan IŞIK
2026-01-11 12:49 ` Greg KH

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