From: Joe Perches Date: Fri, 22 Feb 2013 00:44:13 +0000 (-0800) Subject: checkpatch: prefer dev_( to dev_printk(KERN_ X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=dc1393130b026908c54d4538abbb5c2badbfabbe;p=openwrt%2Fstaging%2Fblogic.git checkpatch: prefer dev_( to dev_printk(KERN_ Add YA check to printk style. dev_ uses are functions and generate smaller object code than dev_printk(KERN_. Signed-off-by: Joe Perches Cc: Andy Whitcroft Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2bb08a962ce3..f9afd075e109 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2430,6 +2430,15 @@ sub process { "Prefer pr_warn(... to pr_warning(...\n" . $herecurr); } + if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) { + my $orig = $1; + my $level = lc($orig); + $level = "warn" if ($level eq "warning"); + $level = "dbg" if ($level eq "debug"); + WARN("PREFER_DEV_LEVEL", + "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\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