mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] checkpatch: mention fsleep() in MSLEEP and USLEEP_RANGE warnings
@ 2026-02-20 23:05 Neel Bullywon
  2026-02-22 11:11 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Neel Bullywon @ 2026-02-20 23:05 UTC (permalink / raw)
  To: apw, joe
  Cc: dwaipayanray1, lukas.bulwahn, andriy.shevchenko, linux-kernel,
	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.

Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Neel Bullywon <neelb2403@gmail.com>
---
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(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c0250244cf7a..03c070bfa0a4 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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
-- 
2.44.0


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

* Re: [PATCH v2] checkpatch: mention fsleep() in MSLEEP and USLEEP_RANGE warnings
  2026-02-20 23:05 [PATCH v2] checkpatch: mention fsleep() in MSLEEP and USLEEP_RANGE warnings Neel Bullywon
@ 2026-02-22 11:11 ` Andy Shevchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2026-02-22 11:11 UTC (permalink / raw)
  To: Neel Bullywon; +Cc: apw, joe, dwaipayanray1, lukas.bulwahn, linux-kernel

On Fri, Feb 20, 2026 at 06:05:55PM -0500, Neel Bullywon wrote:
> 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.

...

> -				    "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"

...

> -				     "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"

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2026-02-22 11:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-20 23:05 [PATCH v2] checkpatch: mention fsleep() in MSLEEP and USLEEP_RANGE warnings Neel Bullywon
2026-02-22 11:11 ` Andy Shevchenko

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

all inboxes | Powered by JetHome®