linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Prakruthi Deepak Heragu <pheragu@codeaurora.org>,
	apw@canonical.com, Julia Lawall <julia.lawall@lip6.fr>,
	Dan Carpenter <error27@gmail.com>
Cc: linux-kernel@vger.kernel.org, ckadabi@codeaurora.org,
	tsoni@codeaurora.org, bryanh@codeaurora.org,
	Israel Schlesinger <israels@codeaurora.org>,
	Stepan Moskovchenko <stepanm@codeaurora.org>
Subject: Re: [PATCH] checkpatch: Add warnings for use of mdelay()
Date: Wed, 04 Jul 2018 11:30:53 -0700	[thread overview]
Message-ID: <173cc189627e0d6618b535fcd1ce6a4c90ce2ad0.camel@perches.com> (raw)
In-Reply-To: <1530728333-31590-1-git-send-email-pheragu@codeaurora.org>

On Wed, 2018-07-04 at 11:18 -0700, Prakruthi Deepak Heragu wrote:
> mdelay() is not a preferred API to be used to insert delay in the kernel
> code unless the context is atomic. Instead, msleep() API can be used.
> This patch introduces this warning.

[]

> Signed-off-by: Israel Schlesinger <israels@codeaurora.org>
> Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
> Signed-off-by: Prakruthi Deepak Heragu <pheragu@codeaurora.org>

Really? 3 sign-offs for one trivial patch while
getting simple whitespace issues wrong?

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -5572,6 +5572,12 @@ sub process {
>  			     "Comparing get_jiffies_64() is almost always wrong; prefer time_after64, time_before64 and friends\n" . $herecurr);
>  		}
>  
> +# check the patch for use of mdelay
> +		if ($line =~ /\bmdelay\s*\(/) {
> +			WARN("MDELAY",
> +			     "use of mdelay() found: msleep() is the preferred API.\n" . $herecurr );

No space after $herecurr

> +		}
> +

NACK - I think this is unreasonable.

checkpatch is stupid and can only remain that way.

It cannot check for any particular use in atomic
that is appropriate and should not warn with a
false positive when the use is appropriate.

$ git grep -w mdelay | wc -l
2700

How many of those are correct?

If you want a check like this to be useful, write
something for coccinelle or smatch.


  reply	other threads:[~2018-07-04 18:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-04 18:18 [PATCH] checkpatch: Add warnings for use of mdelay() Prakruthi Deepak Heragu
2018-07-04 18:30 ` Joe Perches [this message]
2018-07-05  8:19   ` Dan Carpenter
2018-07-06  5:49     ` Julia Lawall
2018-07-07 12:09       ` Jia-Ju Bai
  -- strict thread matches above, loose matches on Subject: below --
2010-07-27 17:11 Israel Schlesinger
2010-07-27 17:22 ` Joe Perches
2010-07-27 17:31 ` Jonathan Corbet
2010-07-27 17:32   ` Patrick Pannuto
2010-07-27 19:16     ` Andrew Morton
2010-07-28  9:44       ` Andy Whitcroft

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=173cc189627e0d6618b535fcd1ce6a4c90ce2ad0.camel@perches.com \
    --to=joe@perches.com \
    --cc=apw@canonical.com \
    --cc=bryanh@codeaurora.org \
    --cc=ckadabi@codeaurora.org \
    --cc=error27@gmail.com \
    --cc=israels@codeaurora.org \
    --cc=julia.lawall@lip6.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pheragu@codeaurora.org \
    --cc=stepanm@codeaurora.org \
    --cc=tsoni@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).