public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: replace msleep() with fsleep() in rtw_cmd.c
@ 2026-02-26  1:05 Jose A. Perez de Azpillaga
  2026-02-27  2:03 ` Ethan Tidmore
  2026-02-27  8:46 ` [PATCH v2] " Jose A. Perez de Azpillaga
  0 siblings, 2 replies; 7+ messages in thread
From: Jose A. Perez de Azpillaga @ 2026-02-26  1:05 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Minu Jin, linux-staging, linux-kernel

Replace msleep() with fsleep() in rtw_cmd.c to improve delay
precision and follow modern kernel practices.

Specifically, this fixes a checkpatch warning for the 10ms delay
in _rtw_free_evt_priv() and updates the 100ms polling loop in
rtw_chk_hi_queue_hdl() for consistency.

Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index abb84f8aecbe..e2c5eb2d32ef 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -8,6 +8,7 @@
 #include <hal_btcoex.h>
 #include <linux/jiffies.h>
 #include <linux/align.h>
+#include <linux/delay.h>

 static struct _cmd_callback rtw_cmd_callback[] = {
 	{GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/
@@ -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);
+		fsleep(10 * 1000);

 	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
 		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
@@ -1495,7 +1496,7 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
 	rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty);

 	while (!empty && jiffies_to_msecs(jiffies - start) < g_wait_hiq_empty) {
-		msleep(100);
+		fsleep(100 * 1000);
 		rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty);
 	}

--
2.53.0


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

* Re: [PATCH] staging: rtl8723bs: replace msleep() with fsleep() in rtw_cmd.c
  2026-02-26  1:05 [PATCH] staging: rtl8723bs: replace msleep() with fsleep() in rtw_cmd.c Jose A. Perez de Azpillaga
@ 2026-02-27  2:03 ` Ethan Tidmore
  2026-02-27  8:46 ` [PATCH v2] " Jose A. Perez de Azpillaga
  1 sibling, 0 replies; 7+ messages in thread
From: Ethan Tidmore @ 2026-02-27  2:03 UTC (permalink / raw)
  To: Jose A. Perez de Azpillaga, Greg Kroah-Hartman
  Cc: Minu Jin, linux-staging, linux-kernel

On Wed Feb 25, 2026 at 7:05 PM CST, Jose A. Perez de Azpillaga wrote:
> Replace msleep() with fsleep() in rtw_cmd.c to improve delay
> precision and follow modern kernel practices.
>
> Specifically, this fixes a checkpatch warning for the 10ms delay
> in _rtw_free_evt_priv() and updates the 100ms polling loop in
> rtw_chk_hi_queue_hdl() for consistency.
>
> Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
> ---

...

>  	_cancel_workitem_sync(&pevtpriv->c2h_wk);
>  	while (pevtpriv->c2h_wk_alive)
> -		msleep(10);
> +		fsleep(10 * 1000);

It's better to use USEC_PER_MSEC instead of 1000 to avoid magic numbers.

...

>  	while (!empty && jiffies_to_msecs(jiffies - start) < g_wait_hiq_empty) {
> -		msleep(100);
> +		fsleep(100 * 1000);

Ditto.

Thanks,

ET

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

* [PATCH v2] staging: rtl8723bs: replace msleep() with fsleep() in rtw_cmd.c
  2026-02-26  1:05 [PATCH] staging: rtl8723bs: replace msleep() with fsleep() in rtw_cmd.c Jose A. Perez de Azpillaga
  2026-02-27  2:03 ` Ethan Tidmore
@ 2026-02-27  8:46 ` Jose A. Perez de Azpillaga
  2026-02-27 15:18   ` Ethan Tidmore
  2026-02-28  4:46   ` Ethan Tidmore
  1 sibling, 2 replies; 7+ messages in thread
From: Jose A. Perez de Azpillaga @ 2026-02-27  8:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Ethan Tidmore, Jose A . Perez de Azpillaga, Minu Jin,
	linux-staging, linux-kernel

Replace msleep() with fsleep() in rtw_cmd.c to improve delay
precision and follow modern kernel practices.

Specifically, this fixes a checkpatch warning for the 10ms delay
in _rtw_free_evt_priv() and updates the 100ms polling loops in
rtw_chk_hi_queue_hdl() and rtw_free_cmd_priv() for consistency.

Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
---
v2: changed to USEC_PER_MSEC instead of magic numbers
---
 drivers/staging/rtl8723bs/core/rtw_cmd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index abb84f8aecbe..c689d3744ad4 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -8,6 +8,7 @@
 #include <hal_btcoex.h>
 #include <linux/jiffies.h>
 #include <linux/align.h>
+#include <linux/delay.h>

 static struct _cmd_callback rtw_cmd_callback[] = {
 	{GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/
@@ -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);
+		fsleep(10 * USEC_PER_MSEC);

 	while (!rtw_cbuf_empty(pevtpriv->c2h_queue)) {
 		void *c2h = rtw_cbuf_pop(pevtpriv->c2h_queue);
@@ -1495,7 +1496,7 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
 	rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty);

 	while (!empty && jiffies_to_msecs(jiffies - start) < g_wait_hiq_empty) {
-		msleep(100);
+		fsleep(100 * USEC_PER_MSEC);
 		rtw_hal_get_hwreg(padapter, HW_VAR_CHK_HI_QUEUE_EMPTY, &empty);
 	}

--
2.53.0


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

* Re: [PATCH v2] staging: rtl8723bs: replace msleep() with fsleep() in rtw_cmd.c
  2026-02-27  8:46 ` [PATCH v2] " Jose A. Perez de Azpillaga
@ 2026-02-27 15:18   ` Ethan Tidmore
  2026-02-27 16:39     ` Dan Carpenter
  2026-02-28  4:46   ` Ethan Tidmore
  1 sibling, 1 reply; 7+ messages in thread
From: Ethan Tidmore @ 2026-02-27 15:18 UTC (permalink / raw)
  To: Jose A. Perez de Azpillaga, Greg Kroah-Hartman
  Cc: Ethan Tidmore, Minu Jin, linux-staging, linux-kernel

On Fri Feb 27, 2026 at 2:46 AM CST, Jose A. Perez de Azpillaga wrote:
> Replace msleep() with fsleep() in rtw_cmd.c to improve delay
> precision and follow modern kernel practices.
>
> Specifically, this fixes a checkpatch warning for the 10ms delay
> in _rtw_free_evt_priv() and updates the 100ms polling loops in
> rtw_chk_hi_queue_hdl() and rtw_free_cmd_priv() for consistency.
>
> Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
> ---
> v2: changed to USEC_PER_MSEC instead of magic numbers
> ---
^^^
Remove this.

Here's Dan Carpenters's resource on making a v2:

https://staticthinking.wordpress.com/2022/07/27/how-to-send-a-v2-patch/

Thanks,

ET

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

* Re: [PATCH v2] staging: rtl8723bs: replace msleep() with fsleep() in rtw_cmd.c
  2026-02-27 15:18   ` Ethan Tidmore
@ 2026-02-27 16:39     ` Dan Carpenter
  2026-02-27 17:16       ` Ethan Tidmore
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2026-02-27 16:39 UTC (permalink / raw)
  To: Ethan Tidmore
  Cc: Jose A. Perez de Azpillaga, Greg Kroah-Hartman, Minu Jin,
	linux-staging, linux-kernel

On Fri, Feb 27, 2026 at 09:18:24AM -0600, Ethan Tidmore wrote:
> On Fri Feb 27, 2026 at 2:46 AM CST, Jose A. Perez de Azpillaga wrote:
> > Replace msleep() with fsleep() in rtw_cmd.c to improve delay
> > precision and follow modern kernel practices.
> >
> > Specifically, this fixes a checkpatch warning for the 10ms delay
> > in _rtw_free_evt_priv() and updates the 100ms polling loops in
> > rtw_chk_hi_queue_hdl() and rtw_free_cmd_priv() for consistency.
> >
> > Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
> > ---
> > v2: changed to USEC_PER_MSEC instead of magic numbers
> > ---
> ^^^
> Remove this.
> 

Having an extra --- cut off line doesn't matter.  The other thing that
you sometimes see is an extra blank line before the --- cut off line
and that's fine too.

regards,
dan carpenter


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

* Re: [PATCH v2] staging: rtl8723bs: replace msleep() with fsleep() in rtw_cmd.c
  2026-02-27 16:39     ` Dan Carpenter
@ 2026-02-27 17:16       ` Ethan Tidmore
  0 siblings, 0 replies; 7+ messages in thread
From: Ethan Tidmore @ 2026-02-27 17:16 UTC (permalink / raw)
  To: Dan Carpenter, Ethan Tidmore
  Cc: Jose A. Perez de Azpillaga, Greg Kroah-Hartman, Minu Jin,
	linux-staging, linux-kernel

On Fri Feb 27, 2026 at 10:39 AM CST, Dan Carpenter wrote:
> On Fri, Feb 27, 2026 at 09:18:24AM -0600, Ethan Tidmore wrote:
>> On Fri Feb 27, 2026 at 2:46 AM CST, Jose A. Perez de Azpillaga wrote:
>> > Replace msleep() with fsleep() in rtw_cmd.c to improve delay
>> > precision and follow modern kernel practices.
>> >
>> > Specifically, this fixes a checkpatch warning for the 10ms delay
>> > in _rtw_free_evt_priv() and updates the 100ms polling loops in
>> > rtw_chk_hi_queue_hdl() and rtw_free_cmd_priv() for consistency.
>> >
>> > Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
>> > ---
>> > v2: changed to USEC_PER_MSEC instead of magic numbers
>> > ---
>> ^^^
>> Remove this.
>> 
>
> Having an extra --- cut off line doesn't matter.  The other thing that
> you sometimes see is an extra blank line before the --- cut off line
> and that's fine too.
>
> regards,
> dan carpenter

Oh ok, nice to know. I guess I assumed the last cut of line was the one
that counted.

Thanks,

ET

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

* Re: [PATCH v2] staging: rtl8723bs: replace msleep() with fsleep() in rtw_cmd.c
  2026-02-27  8:46 ` [PATCH v2] " Jose A. Perez de Azpillaga
  2026-02-27 15:18   ` Ethan Tidmore
@ 2026-02-28  4:46   ` Ethan Tidmore
  1 sibling, 0 replies; 7+ messages in thread
From: Ethan Tidmore @ 2026-02-28  4:46 UTC (permalink / raw)
  To: Jose A. Perez de Azpillaga, Greg Kroah-Hartman
  Cc: Ethan Tidmore, Minu Jin, linux-staging, linux-kernel

On Fri Feb 27, 2026 at 2:46 AM CST, Jose A. Perez de Azpillaga wrote:
> Replace msleep() with fsleep() in rtw_cmd.c to improve delay
> precision and follow modern kernel practices.
>
> Specifically, this fixes a checkpatch warning for the 10ms delay
> in _rtw_free_evt_priv() and updates the 100ms polling loops in
> rtw_chk_hi_queue_hdl() and rtw_free_cmd_priv() for consistency.
>
> Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
> ---
> v2: changed to USEC_PER_MSEC instead of magic numbers
> ---
>  drivers/staging/rtl8723bs/core/rtw_cmd.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Sorry about the confusion, LGTM.

Reviewed-by: Ethan Tidmore <ethantidmore06@gmail.com>

Thanks,

ET

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

end of thread, other threads:[~2026-02-28  4:47 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-26  1:05 [PATCH] staging: rtl8723bs: replace msleep() with fsleep() in rtw_cmd.c Jose A. Perez de Azpillaga
2026-02-27  2:03 ` Ethan Tidmore
2026-02-27  8:46 ` [PATCH v2] " Jose A. Perez de Azpillaga
2026-02-27 15:18   ` Ethan Tidmore
2026-02-27 16:39     ` Dan Carpenter
2026-02-27 17:16       ` Ethan Tidmore
2026-02-28  4:46   ` Ethan Tidmore

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