aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-10-04 20:13:32 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-05 14:04:59 -0400
commit8f26b8376faad26372a579606ecbd77b20e99dd8 (patch)
tree50fc1463508ac9fd91a0b437284d84a81918f903 /scripts
parentfa64205df9dfd7b7662cc64a7e82115c00e428e5 (diff)
checkpatch: update suggested printk conversions
Direct conversion of printk(KERN_<LEVEL>... to pr_<level> isn't the preferred conversion when a struct net_device or struct device is available. Hint that using netdev_<level> or dev_<level> is preferred to using pr_<level>. Add netdev_dbg and dev_dbg variants too. Miscellaneous whitespace neatening of a misplaced close brace. Signed-off-by: Joe Perches <joe@perches.com> Cc: Andy Whitcroft <apw@canonical.com> Cc: Greg KH <gregkh@linuxfoundation.org> Cc: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 5ae91889bc6b..844af8b4c078 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -421,7 +421,7 @@ sub top_of_kernel_tree {
421 } 421 }
422 } 422 }
423 return 1; 423 return 1;
424 } 424}
425 425
426sub parse_email { 426sub parse_email {
427 my ($formatted_email) = @_; 427 my ($formatted_email) = @_;
@@ -2399,8 +2399,10 @@ sub process {
2399 my $orig = $1; 2399 my $orig = $1;
2400 my $level = lc($orig); 2400 my $level = lc($orig);
2401 $level = "warn" if ($level eq "warning"); 2401 $level = "warn" if ($level eq "warning");
2402 my $level2 = $level;
2403 $level2 = "dbg" if ($level eq "debug");
2402 WARN("PREFER_PR_LEVEL", 2404 WARN("PREFER_PR_LEVEL",
2403 "Prefer pr_$level(... to printk(KERN_$1, ...\n" . $herecurr); 2405 "Prefer netdev_$level2(netdev, ... then dev_$level2(dev, ... then pr_$level(... to printk(KERN_$orig ...\n" . $herecurr);
2404 } 2406 }
2405 2407
2406 if ($line =~ /\bpr_warning\s*\(/) { 2408 if ($line =~ /\bpr_warning\s*\(/) {