aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2008-10-15 22:02:20 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-16 11:21:35 -0700
commite09dec4831bbb319987215ea0a280b2a620021b7 (patch)
tree61a66f78f37b264a6e039eeef86453c75c4dd1ff /scripts
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')
-rwxr-xr-xscripts/checkpatch.pl13
1 files changed, 9 insertions, 4 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0e5af8ed107..9e7e9d1d595 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1942,12 +1942,17 @@ sub process {
#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\>}) {
- my $checkfile = "include/linux/$1.h";
- if (-f "$root/$checkfile" && $realfile ne $checkfile &&
+ my $file = "$1.h";
+ my $checkfile = "include/linux/$file";
+ if (-f "$root/$checkfile" &&
+ $realfile ne $checkfile &&
$1 ne 'irq')
{
- WARN("Use #include <linux/$1.h> instead of <asm/$1.h>\n" .
- $herecurr);
+ if ($realfile =~ m{^arch/}) {
+ CHK("Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
+ } else {
+ WARN("Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
+ }
}
}