Re: [RFC 1/1 linux-next] checkpatch: don't ask for asm/file.h to linux/file.h unconditionally

From: Fabian Frederick
Date: Tue Mar 31 2015 - 15:09:45 EST




> On 30 March 2015 at 22:49 Joe Perches <joe@xxxxxxxxxxx> wrote:
>
>
> On Mon, 2015-03-30 at 22:36 +0200, Fabian Frederick wrote:
> > Currently checkpatch warns when asm/file.h is included and linux/file.h
> > exists. That conversion can be made when linux/file.h includes asm/file.h
> > which is not always the case.(See signal.h)
> []
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > -#warn if <asm/foo.h> is #included and <linux/foo.h> is available (uses RAW
> > line)
> > +# warn if <asm/foo.h> is #included and <linux/foo.h> is available and
> > includes
> > +# itself <asm/foo.h> (uses RAW line)
> >Â Â Â Â Â Â Âif ($tree && $rawline =~
> >m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
> >Â Â Â Â Â Â Â Â Â Â Âmy $file = "$1.h";
> >Â Â Â Â Â Â Â Â Â Â Âmy $checkfile = "include/linux/$file";
> > +Â Â Â Â Â Â Â Â Â Âmy $asminclude = `grep -ci "#include <asm/$file.h>"
> > $checkfile`;
>
> This won't work with #include forms like:
>   Â#include    <asm/foo.h>
> or when checkpatch is run from somewhere other
> than the top of tree.
>
> why the -i?

Hi Joe,

This was just an RFC. I guess you're ok with the idea so I added your
suggestions in V2.

Regards,
Fabian

>
> >Â Â Â Â Â Â Â Â Â Â Âif (-f "$root/$checkfile" &&
> >Â Â Â Â Â Â Â Â Â Â Â Â Â$realfile ne $checkfile &&
> > -Â Â Â Â Â Â Â Â Â Â Â Â$1 !~ /$allowed_asm_includes/)
> > +Â Â Â Â Â Â Â Â Â Â Â Â$1 !~ /$allowed_asm_includes/ &&
> > +Â Â Â Â Â Â Â Â Â Â Â Â$asminclude > 0 )
> >Â Â Â Â Â Â Â Â Â Â Â{
> >Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âif ($realfile =~ m{^arch/}) {
> >Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂCHK("ARCH_INCLUDE_LINUX",
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/