Skip to contentSkip to conversation

checkpatch: mention fsleep() in MSLEEP and USLEEP_RANGE warnings

PATCH Superseded Neel Bullywon 2 participants 2 messages Feb 20 – Feb 22 Checkpatch

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 checkpatch: mention fsleep() in MSLEEP and USLEEP_RANGE warnings

Expand the MSLEEP warning to also reference fsleep() alongside msleep(), and expand the USLEEP_RANGE check to reference fsleep() alongside usleep_range() and udelay(). fsleep() autoselects the best sleep mechanism based on duration, making it a useful alternative for developers to consider.

---
Changes in v2:
- Keep existing warning text and expand to mention fsleep() instead of replacing the msleep() reference (Andy).
- Also update the USLEEP_RANGE check to mention fsleep() (Andy).

 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +2 -2
index c0250244cf7a..03c070bfa0a4 100755
@@ -6624,7 +6624,7 @@ sub process {
 			# ignore udelay's < 10, however
 			if (! ($delay < 10) ) {
 				CHK("USLEEP_RANGE",
-				    "usleep_range is preferred over udelay; see function description of usleep_range() and udelay().\n" . $herecurr);
+				    "usleep_range is preferred over udelay; see function description of usleep_range(), udelay(), and fsleep().\n" . $herecurr);
 			}
 			if ($delay > 2000) {
 				WARN("LONG_UDELAY",
@@ -6636,7 +6636,7 @@ sub process {
 		if ($line =~ /\bmsleep\s*\((\d+)\);/) {
 			if ($1 < 20) {
 				WARN("MSLEEP",
-				     "msleep < 20ms can sleep for up to 20ms; see function description of msleep().\n" . $herecurr);
+				     "msleep < 20ms can sleep for up to 20ms; see function description of msleep() and fsleep().\n" . $herecurr);
 			}
 		}
 

base-commit: e7aa57247700733e52a8e2e4dee6a52c2a76de02

Signature · 1 line
2.44.0
#1 lore raw
Quoted 5 lines · Neel Bullywon

Expand the MSLEEP warning to also reference fsleep() alongside msleep(), and expand the USLEEP_RANGE check to reference fsleep() alongside usleep_range() and udelay(). fsleep() autoselects the best sleep mechanism based on duration, making it a useful alternative for developers to consider.

...

scripts/checkpatch.pl sub process { · line 6627

Quoted 2 lines
scripts/checkpatch.pl +1 -1
-				    "usleep_range is preferred over udelay; see function description of usleep_range() and udelay().\n" . $herecurr);
+				    "usleep_range is preferred over udelay; see function description of usleep_range(), udelay(), and fsleep().\n" . $herecurr);

"fsleep() is preferred over others; usleep_range() is preferred over udelay(); see function descriptions of usleep_range(), udelay(), and fsleep().\n"

...

scripts/checkpatch.pl sub process { · line 6639

Quoted 2 lines
scripts/checkpatch.pl +1 -1
-				     "msleep < 20ms can sleep for up to 20ms; see function description of msleep().\n" . $herecurr);
+				     "msleep < 20ms can sleep for up to 20ms; see function description of msleep() and fsleep().\n" . $herecurr);

"msleep < 20ms can sleep for up to 20ms; consider using fsleep(); see function description of msleep() and fsleep().\n"

Signature · 2 lines
With Best Regards,
Andy Shevchenko