All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] checkpatch: mention fsleep() in MSLEEP and USLEEP_RANGE warnings
       [not found] <20260220230555.70073-1-neelb2403@gmail.com>
@ 2026-02-25 15:21 ` Neel Bullywon
  2026-02-25 15:52   ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Neel Bullywon @ 2026-02-25 15:21 UTC (permalink / raw)
  To: apw, joe, dwaipayanray1, lukas.bulwahn; +Cc: andy, linux-kernel, Neel Bullywon

Expand the USLEEP_RANGE check to recommend fsleep() as the preferred
option over both usleep_range() and udelay(), and expand the MSLEEP
warning to suggest considering fsleep() for short msleep calls.
fsleep() autoselects the best sleep mechanism based on duration,
making it the preferred choice for sleep operations.

Signed-off-by: Neel Bullywon <neelb2403@gmail.com>
---
v3:
  - USLEEP_RANGE: reword to recommend fsleep() as preferred over others
    (Andy Shevchenko)
  - MSLEEP: add "consider using fsleep()" (Andy Shevchenko)
v2:
  - Reworded to keep usleep_range as primary suggestion and add fsleep()
    as additional reference (Joe Perches)

 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c0250244cf7a..fc08c780610a 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);
+				    "fsleep() is preferred over others; usleep_range() is preferred over udelay(); see function descriptions 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; consider using fsleep(); see function description of msleep() and fsleep().\n" . $herecurr);
 			}
 		}
 
-- 
2.44.0


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

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

On Wed, Feb 25, 2026 at 10:21:35AM -0500, Neel Bullywon wrote:
> Expand the USLEEP_RANGE check to recommend fsleep() as the preferred
> option over both usleep_range() and udelay(), and expand the MSLEEP
> warning to suggest considering fsleep() for short msleep calls.
> fsleep() autoselects the best sleep mechanism based on duration,
> making it the preferred choice for sleep operations.

Good enough to me.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

...

> -				    "usleep_range is preferred over udelay; see function description of usleep_range() and udelay().\n" . $herecurr);
> +				    "fsleep() is preferred over others; usleep_range() is preferred over udelay(); see function descriptions of usleep_range(), udelay(), and fsleep().\n" . $herecurr);

^^^ just for the context for the below.

...

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

I think 'descriptions' should be plural here as well.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2026-02-25 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260220230555.70073-1-neelb2403@gmail.com>
2026-02-25 15:21 ` [PATCH v3] checkpatch: mention fsleep() in MSLEEP and USLEEP_RANGE warnings Neel Bullywon
2026-02-25 15:52   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.