From: Andy Whitcroft Date: Thu, 16 Oct 2008 05:02:20 +0000 (-0700) Subject: checkpatch: reduce warnings for #include of asm/foo.h to check from arch/bar.c X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=e09dec4831bbb319987215ea0a280b2a620021b7;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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 { #warn if is #included and is available (uses RAW line) if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\}) { - 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 instead of \n" . - $herecurr); + if ($realfile =~ m{^arch/}) { + CHK("Consider using #include instead of \n" . $herecurr); + } else { + WARN("Use #include instead of \n" . $herecurr); + } } }