Commit e09dec48 authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Linus Torvalds

checkpatch: reduce warnings for #include of asm/foo.h to check from arch/bar.c

It is much more likely that an architecture file will want to directly
include asm header files.  Reduce this WARNING to a CHECK when the
referencing file is in the arch directory.
Signed-off-by: default avatarAndy Whitcroft <apw@shadowen.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c1ab3326
...@@ -1942,12 +1942,17 @@ sub process { ...@@ -1942,12 +1942,17 @@ sub process {
#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line) #warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line)
if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) { if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
my $checkfile = "include/linux/$1.h"; my $file = "$1.h";
if (-f "$root/$checkfile" && $realfile ne $checkfile && my $checkfile = "include/linux/$file";
if (-f "$root/$checkfile" &&
$realfile ne $checkfile &&
$1 ne 'irq') $1 ne 'irq')
{ {
WARN("Use #include <linux/$1.h> instead of <asm/$1.h>\n" . if ($realfile =~ m{^arch/}) {
$herecurr); CHK("Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
} else {
WARN("Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
}
} }
} }
......
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