History

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.

Andy Whitcroft committed 18 years ago

Commit e09dec41 parent c1ab3321 file · +9 −4Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+9−4
@@ -1942,12 +1942,17 @@ sub process { · 1941 unmodified lines
19421942
19431943 #warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line)
19441944 if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
1945− my $checkfile = "include/linux/$1.h";
1946− if (-f "$root/$checkfile" && $realfile ne $checkfile &&
1945+ my $file = "$1.h";
1946+ my $checkfile = "include/linux/$file";
1947+ if (-f "$root/$checkfile" &&
1948+ $realfile ne $checkfile &&
19471949 $1 ne 'irq')
19481950 {
1949− WARN("Use #include <linux/$1.h> instead of <asm/$1.h>\n" .
1950− $herecurr);
1951+ if ($realfile =~ m{^arch/}) {
1952+ CHK("Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
1953+ } else {
1954+ WARN("Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
1955+ }
19511956 }
19521957 }
19531958