From: Joe Perches Date: Tue, 20 Mar 2012 23:57:20 +0000 (+1100) Subject: checkpatch: suggest pr_ over printk(KERN_ X-Git-Tag: next-20120403~1^2~19 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d6a1396f06e33b06d19df55a8ad1092072068aa1;p=karo-tx-linux.git checkpatch: suggest pr_ over printk(KERN_ Suggest the shorter pr_ instead of printk(KERN_. Prefer to use pr_ over bare printks. Prefer to use pr_warn over pr_warning. Signed-off-by: Joe Perches Cc: Andy Whitcroft Cc: Theodore Ts'o Signed-off-by: Andrew Morton --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index de639eeeed50..512766594ddf 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2388,6 +2388,19 @@ sub process { } } + if ($line =~ /\bprintk\s*\(\s*KERN_([A-Z]+)/) { + my $orig = $1; + my $level = lc($orig); + $level = "warn" if ($level eq "warning"); + WARN("PREFER_PR_LEVEL", + "Prefer pr_$level(... to printk(KERN_$1, ...\n" . $herecurr); + } + + if ($line =~ /\bpr_warning\s*\(/) { + WARN("PREFER_PR_LEVEL", + "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