From dd30e02141ac5989bdd8e57d2d7d44854d6ce350 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Wed, 20 Feb 2013 13:15:34 +1100 Subject: [PATCH] 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 --- scripts/checkpatch.pl | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- 2.39.5