Commit dc139313 authored by Joe Perches's avatar Joe Perches Committed by Linus Torvalds
Browse files

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: default avatarJoe Perches <>
Cc: Andy Whitcroft <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 5dc49c75
......@@ -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");
"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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment