Skip to contentSkip to conversation

staging: rtl8723bs: replace msleep with usleep_range

PATCH In review Omer PALA 4 participants 6 messages Sep 17 – Sep 19 Staging

lore
Share & tools
lore

Omer PALA

author
#0 lore raw

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

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.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +1 -1
index 448611ad8..1d3262413 100644
@@ -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);
 	}
 }
 
Signature · 1 line
2.55.0
#1 lore raw
Quoted 15 lines · Omer PALA

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.

---
 drivers/staging/rtl8723bs/core/rtw_pwrctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +0 -0
index 448611ad8..1d3262413 100644

drivers/staging/rtl8723bs/core/rtw_pwrctrl.c void LPS_Leave_check(struct adapter *padapter) · line 564

Quoted 5 lines
drivers/staging/rtl8723bs/core/rtw_pwrctrl.c +1 -1
@@ -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

author
#2 lore raw
Quoted 11 lines · Dan Carpenter

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

#3 lore raw
Quoted 10 lines · Ömer PALA
Quoted 9 lines · Dan Carpenter

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

Quoted 7 lines
Quoted 2 lines

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

#4 lore raw
In reply to Omer PALA
Quoted 4 lines · Omer PALA

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

author
#5 lore raw
Quoted 5 lines · Nam Cao

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