diff options
author | Joe Perches <joe@perches.com> | 2013-02-21 19:44:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-21 20:22:26 -0500 |
commit | dc1393130b026908c54d4538abbb5c2badbfabbe (patch) | |
tree | 4185d47c7dcf7d2a5c4922fe759e0a203ffb484a /scripts/checkpatch.pl | |
parent | 5dc49c75a26b99e86a18441e0b64c1f7c7c6a500 (diff) |
checkpatch: prefer dev_<level>( to dev_printk(KERN_<LEVEL>
Add YA check to printk style.
dev_<level> uses are functions and generate smaller
object code than dev_printk(KERN_<LEVEL>.
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-x | scripts/checkpatch.pl | 9 |
1 files changed, 9 insertions, 0 deletions
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 { | |||
2430 | "Prefer pr_warn(... to pr_warning(...\n" . $herecurr); | 2430 | "Prefer pr_warn(... to pr_warning(...\n" . $herecurr); |
2431 | } | 2431 | } |
2432 | 2432 | ||
2433 | if ($line =~ /\bdev_printk\s*\(\s*KERN_([A-Z]+)/) { | ||
2434 | my $orig = $1; | ||
2435 | my $level = lc($orig); | ||
2436 | $level = "warn" if ($level eq "warning"); | ||
2437 | $level = "dbg" if ($level eq "debug"); | ||
2438 | WARN("PREFER_DEV_LEVEL", | ||
2439 | "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr); | ||
2440 | } | ||
2441 | |||
2433 | # function brace can't be on same line, except for #defines of do while, | 2442 | # function brace can't be on same line, except for #defines of do while, |
2434 | # or if closed on same line | 2443 | # or if closed on same line |
2435 | if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and | 2444 | if (($line=~/$Type\s*$Ident\(.*\).*\s{/) and |