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
1942 1942
1943#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line)1943#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW line)
1944 if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {1944 if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
1945 my $checkfile = "include/linux/$1.h";1945 my $file = "$1.h";
1946 if (-f "$root/$checkfile" && $realfile ne $checkfile &&1946 my $checkfile = "include/linux/$file";
1947 if (-f "$root/$checkfile" &&
1948 $realfile ne $checkfile &&
1947 $1 ne 'irq')1949 $1 ne 'irq')
1948 {1950 {
1949 WARN("Use #include <linux/$1.h> instead of <asm/$1.h>\n" .1951 if ($realfile =~ m{^arch/}) {
1950 $herecurr);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 }
1951 }1956 }
1952 }1957 }
1953 1958