Skip to content

Commit

Permalink
checkpatch: update suggested printk conversions
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Andy Whitcroft <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Dan Carpenter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoePerches authored and torvalds committed Oct 5, 2012
1 parent fa64205 commit 8f26b83
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ sub top_of_kernel_tree {
}
}
return 1;
}
}

sub parse_email {
my ($formatted_email) = @_;
Expand Down Expand Up @@ -2399,8 +2399,10 @@ sub process {
my $orig = $1;
my $level = lc($orig);
$level = "warn" if ($level eq "warning");
my $level2 = $level;
$level2 = "dbg" if ($level eq "debug");
WARN("PREFER_PR_LEVEL",
"Prefer pr_$level(... to printk(KERN_$1, ...\n" . $herecurr);
"Prefer netdev_$level2(netdev, ... then dev_$level2(dev, ... then pr_$level(... to printk(KERN_$orig ...\n" . $herecurr);
}

if ($line =~ /\bpr_warning\s*\(/) {
Expand Down

0 comments on commit 8f26b83

Please sign in to comment.