aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2008-10-16 01:02:20 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 14:21:35 -0400
commite09dec4831bbb319987215ea0a280b2a620021b7 (patch)
tree61a66f78f37b264a6e039eeef86453c75c4dd1ff /scripts/checkpatch.pl
parentc1ab33269a84d6056d2ffc728d8bbaa26377d3e3 (diff)
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: Andy Whitcroft <apw@shadowen.org> 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-xscripts/checkpatch.pl13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0e5af8ed107e..9e7e9d1d5958 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1942,12 +1942,17 @@ sub process {
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