Commit 243f3803 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

checkpatch: suggest pr_<level> over printk(KERN_<LEVEL>

Suggest the shorter pr_<level> instead of printk(KERN_<LEVEL>.

Prefer to use pr_<level> over bare printks.
Prefer to use pr_warn over pr_warning.
Signed-off-by: default avatarJoe Perches <>
Cc: Andy Whitcroft <>
Cc: Theodore Ts'o <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 9a4cad4e
......@@ -2382,6 +2382,19 @@ sub process {
if ($line =~ /\bprintk\s*\(\s*KERN_([A-Z]+)/) {
my $orig = $1;
my $level = lc($orig);
$level = "warn" if ($level eq "warning");
"Prefer pr_$level(... to printk(KERN_$1, ...\n" . $herecurr);
if ($line =~ /\bpr_warning\s*\(/) {
"Prefer pr_warn(... to pr_warning(...\n" . $herecurr);
# 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment