Skip to content

Commit 8f26b83

Browse files
JoePerchestorvalds
authored andcommitted
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 <[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]>
1 parent fa64205 commit 8f26b83

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/checkpatch.pl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ sub top_of_kernel_tree {
421421
}
422422
}
423423
return 1;
424-
}
424+
}
425425

426426
sub parse_email {
427427
my ($formatted_email) = @_;
@@ -2399,8 +2399,10 @@ sub process {
23992399
my $orig = $1;
24002400
my $level = lc($orig);
24012401
$level = "warn" if ($level eq "warning");
2402+
my $level2 = $level;
2403+
$level2 = "dbg" if ($level eq "debug");
24022404
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);
24042406
}
24052407

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

0 commit comments

Comments
 (0)