linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Andy Whitcroft <apw@canonical.com>,
	Lance Ortiz <lance.ortiz@hp.com>,
	lance_ortiz@hotmail.com, jiang.liu@huawei.com,
	tony.luck@intel.com, bp@alien8.de, rostedt@goodmis.org,
	mchehab@redhat.com, linux-acpi@vger.kernel.org,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] checkpatch: prefer dev_<level>( to dev_printk(KERN_<LEVEL>
Date: Wed, 2 Jan 2013 18:34:41 -0600	[thread overview]
Message-ID: <CAErSpo51SUYBOj89RM7SSBPEEGW6dddjWUX53u0srZS_eqkbSA@mail.gmail.com> (raw)
In-Reply-To: <1357171594.25181.19.camel@joe-AO722>

On Wed, Jan 2, 2013 at 6:06 PM, Joe Perches <joe@perches.com> wrote:
> Add YA check to printk style.
>
> dev_<level> uses are functions and generate smaller
> object code than dev_printk(KERN_<LEVEL>.
>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
>  scripts/checkpatch.pl | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 4d2c7df..f50b32d 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2430,6 +2430,16 @@ sub process {
>                              "Prefer pr_warn(... to pr_warning(...\n" . $herecurr);
>                 }
>
> +               if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) {
> +                       my $orig = $1;
> +                       my $level = lc($orig);
> +                       $level = "warn" if ($level eq "warning");
> +                       my $level2 = $level;
> +                       $level2 = "dbg" if ($level eq "debug");
> +                       WARN("PREFER_DEV_LEVEL",
> +                            "Prefer dev_$level2(... to dev_printk(KERN_$orig, ...\n" . $herecurr);

This suggests dev_dbg() instead of dev_printk(KERN_DEBUG), doesn't it?
 Those aren't equivalent (dev_printk() always does the printk, but in
many cases dev_dbg() does not, depending on CONFIG_DEBUG,
CONFIG_DYNAMIC_DEBUG, etc.)

> +               }
> +
>  # function brace can't be on same line, except for #defines of do while,
>  # or if closed on same line
>                 if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and
>
>

  reply	other threads:[~2013-01-03  0:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-02 23:27 [PATCH v8 1/3] aerdrv: Trace Event for AER Lance Ortiz
2013-01-02 23:27 ` [PATCH v8 2/3] aerdrv: Enhanced AER logging Lance Ortiz
2013-01-02 23:27 ` [PATCH v8 3/3] aerdrv: Cleanup log output for AER Lance Ortiz
2013-01-02 23:27   ` Joe Perches
2013-01-02 23:41     ` Tony Luck
2013-01-03 15:51       ` Borislav Petkov
2013-01-03  0:06   ` [PATCH] checkpatch: prefer dev_<level>( to dev_printk(KERN_<LEVEL> Joe Perches
2013-01-03  0:34     ` Bjorn Helgaas [this message]
2013-01-03  0:39       ` Joe Perches
2013-01-03 10:08     ` Andy Whitcroft
2013-01-03 16:28       ` Joe Perches
2013-01-03 16:49         ` [PATCH V2] " Joe Perches

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=CAErSpo51SUYBOj89RM7SSBPEEGW6dddjWUX53u0srZS_eqkbSA@mail.gmail.com \
    --to=bhelgaas@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=bp@alien8.de \
    --cc=jiang.liu@huawei.com \
    --cc=joe@perches.com \
    --cc=lance.ortiz@hp.com \
    --cc=lance_ortiz@hotmail.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tony.luck@intel.com \
    /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).