[PATCH] staging: rtl8723bs: replace msleep with usleep_range

Omer PALA posted 1 patch 1 week ago
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] staging: rtl8723bs: replace msleep with usleep_range
Posted by Omer PALA 1 week ago
Replace msleep(1) with usleep_range(1000, 1500) because msleep with small
values (<20ms) can sleep for up to 20ms due to timer tick resolution.
Using usleep_range provides a more precise and consistent delay for
hardware power control operations.

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

diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
index 448611ad8..1d3262413 100644
--- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
@@ -561,7 +561,7 @@ void LPS_Leave_check(struct adapter *padapter)
 		if (jiffies_to_msecs(jiffies - start_time) > 100)
 			break;
 
-		msleep(1);
+		usleep_range(1000, 1500);
 	}
 }
 
-- 
2.55.0
Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
Posted by Nam Cao 1 week ago
Omer PALA <palaomer100@gmail.com> writes:
> Replace msleep(1) with usleep_range(1000, 1500) because msleep with small
> values (<20ms) can sleep for up to 20ms due to timer tick resolution.
> Using usleep_range provides a more precise and consistent delay for
> hardware power control operations.

Why is precise delay important for power control?

Precise delay comes with a cost, so we don't do that unless necessary.

Nam
Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
Posted by Ömer PALA 1 week ago
Nam Cao <namcao@linutronix.de> wrote:
> Why is precise delay important for power control?
>
> Precise delay comes with a cost, so we don't do that unless necessary.
>
> Nam

Thanks for feedback.
I am sorry for wasting your time.
I thought waiting up to 20ms was too much for power control, so I
submitted this patch.
So i wrote this patch.

I understand this isn't necessary.
You can drop my patch.

Best regards,
Omer PALA
Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
Posted by Dan Carpenter 1 week ago
On Thu, Sep 17, 2026 at 10:19:31AM +0300, Omer PALA wrote:
> Replace msleep(1) with usleep_range(1000, 1500) because msleep with small
> values (<20ms) can sleep for up to 20ms due to timer tick resolution.
> Using usleep_range provides a more precise and consistent delay for
> hardware power control operations.
> 
> Signed-off-by: Omer PALA <palaomer100@gmail.com>
> ---
>  drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> index 448611ad8..1d3262413 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_pwrctrl.c
> @@ -561,7 +561,7 @@ void LPS_Leave_check(struct adapter *padapter)
>  		if (jiffies_to_msecs(jiffies - start_time) > 100)
>  			break;
>  
> -		msleep(1);
> +		usleep_range(1000, 1500);

These kinds of changes need to be tested.

I don't love this checkpatch warning because it we reject almost all
these patches.  If it were new code, presumably the person sending the
patch would be able to test it...  But I guess it serves as a kind of
lesson to not listen to checkpatch and also to search lore before
sending stuff.
https://lore.kernel.org/all/?q=LPS_Leave_check%20msleep

regards,
dan carpenter
Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
Posted by Ömer PALA 1 week ago
Dan Carpenter <error27@gmail.com> wrote:
> These kinds of changes need to be tested.
>
> I don't love this checkpatch warning because it we reject almost all
> these patches.  If it were new code, presumably the person sending the
> patch would be able to test it...  But I guess it serves as a kind of
> lesson to not listen to checkpatch and also to search lore before
> sending stuff.
> https://lore.kernel.org/all/?q=LPS_Leave_check%20msleep
>
> regards,
> dan carpenter

Sorry for wasting your time.

I thought it was an issue.

You can drop my patch.

Best regards,
Omer PALA
Re: [PATCH] staging: rtl8723bs: replace msleep with usleep_range
Posted by Krzysztof Kozlowski 5 days, 18 hours ago
On 17/09/2026 10:14, Ömer PALA wrote:
> Dan Carpenter <error27@gmail.com> wrote:
>> These kinds of changes need to be tested.
>>
>> I don't love this checkpatch warning because it we reject almost all
>> these patches.  If it were new code, presumably the person sending the
>> patch would be able to test it...  But I guess it serves as a kind of
>> lesson to not listen to checkpatch and also to search lore before
>> sending stuff.
>> https://lore.kernel.org/all/?q=LPS_Leave_check%20msleep
>>
>> regards,
>> dan carpenter
> 
> Sorry for wasting your time.
> 
> I thought it was an issue.
> 

I kind of told you to look up archives in other thread. Nam Cao told you
this in other thread. Dan told you this in this thread.

Yet, day later on 18th, you decided to send "dt-bindings: iio: adc: Add
dt binding to xlnx,xadc" without checking in archives.

And that one was even pure AI slop.

Mistakes are fine, we all learn from them, but it seems that you are
not. You are just acknowledging the comment and not taking it as anyhow
learning thing, to change something.

I find it not acceptable, because it means we need to repeat you THE
SAME feedback all over again, because you will be always repeating the
same mistake.

Best regards,
Krzysztof