Skip to content

Commit

Permalink
checkpatch: reduce warnings for #include of asm/foo.h to check from a…
Browse files Browse the repository at this point in the history
…rch/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 <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
awhitcroft authored and torvalds committed Oct 16, 2008
1 parent c1ab332 commit e09dec4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit e09dec4

Please sign in to comment.