From: Joe Perches Date: Thu, 31 May 2012 23:26:09 +0000 (-0700) Subject: checkpatch: suggest pr_ over printk(KERN_ X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=243f3803cf2a3665092c5fd6f924f453694681a6;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.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 Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2262e1f57fa6..e5bd60ff48e3 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -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"); + 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