[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1218485592-6679-11-git-send-email-apw@shadowen.org>
Date: Mon, 11 Aug 2008 21:13:05 +0100
From: Andy Whitcroft <apw@...dowen.org>
To: Andrew Morton <akpm@...l.org>
Cc: Randy Dunlap <rdunlap@...otime.net>,
Joel Schopp <jschopp@...tin.ibm.com>,
Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
Andy Whitcroft <apw@...dowen.org>
Subject: [PATCH 10/17] 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@...dowen.org>
---
scripts/checkpatch.pl | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0e5af8e..9e7e9d1 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);
+ }
}
}
--
1.6.0.rc1.258.g80295
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists