[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1357173594.25181.27.camel@joe-AO722>
Date: Wed, 02 Jan 2013 16:39:54 -0800
From: Joe Perches <joe@...ches.com>
To: Bjorn Helgaas <bhelgaas@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Andy Whitcroft <apw@...onical.com>,
Lance Ortiz <lance.ortiz@...com>, lance_ortiz@...mail.com,
jiang.liu@...wei.com, tony.luck@...el.com, bp@...en8.de,
rostedt@...dmis.org, mchehab@...hat.com,
linux-acpi@...r.kernel.org, linux-pci@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] checkpatch: prefer dev_<level>( to
dev_printk(KERN_<LEVEL>
On Wed, 2013-01-02 at 18:34 -0600, Bjorn Helgaas wrote:
> On Wed, Jan 2, 2013 at 6:06 PM, Joe Perches <joe@...ches.com> wrote:
> > Add YA check to printk style.
> >
> > dev_<level> uses are functions and generate smaller
> > object code than dev_printk(KERN_<LEVEL>.
[]
> > diff --git 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.)
True, I think the suggested change is appropriate though.
If people really want debug output in a specific file,
then they should #define DEBUG and/or enable dynamic debug.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists