* [PATCH] checkpatch: add --fix option for INCLUDE_LINUX
@ 2020-11-21 16:17 Dwaipayan Ray
2020-11-21 20:05 ` Joe Perches
0 siblings, 1 reply; 3+ messages in thread
From: Dwaipayan Ray @ 2020-11-21 16:17 UTC (permalink / raw)
To: joe; +Cc: linux-kernel-mentees, dwaipayanray1, linux-kernel, lukas.bulwahn
Provide fix option to INCLUDE_LINUX check to replace asm
includes.
Macros of type:
#include <asm/percpu.h>
are corrected to:
#include <linux/percpu.h>
Signed-off-by: Dwaipayan Ray <dwaipayanray1@gmail.com>
---
scripts/checkpatch.pl | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 0da6422cd0fd..f852f130e065 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5468,8 +5468,11 @@ sub process {
CHK("ARCH_INCLUDE_LINUX",
"Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
} else {
- WARN("INCLUDE_LINUX",
- "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
+ if (WARN("INCLUDE_LINUX",
+ "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr) &&
+ $fix) {
+ $fixed[$fixlinenr] =~ s/\<asm\/$file\>/\<linux\/$file\>/;
+ }
}
}
}
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] checkpatch: add --fix option for INCLUDE_LINUX
2020-11-21 16:17 [PATCH] checkpatch: add --fix option for INCLUDE_LINUX Dwaipayan Ray
@ 2020-11-21 20:05 ` Joe Perches
2020-11-21 20:31 ` Dwaipayan Ray
0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2020-11-21 20:05 UTC (permalink / raw)
To: Dwaipayan Ray; +Cc: linux-kernel-mentees, linux-kernel, lukas.bulwahn
On Sat, 2020-11-21 at 21:47 +0530, Dwaipayan Ray wrote:
> Provide fix option to INCLUDE_LINUX check to replace asm
> includes.
>
> Macros of type:
> #include <asm/percpu.h>
>
> are corrected to:
> #include <linux/percpu.h>
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -5468,8 +5468,11 @@ sub process {
> CHK("ARCH_INCLUDE_LINUX",
> "Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
> } else {
> - WARN("INCLUDE_LINUX",
> - "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
> + if (WARN("INCLUDE_LINUX",
> + "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr) &&
> + $fix) {
> + $fixed[$fixlinenr] =~ s/\<asm\/$file\>/\<linux\/$file\>/;
$file can include a slash.
e.g.: arch/arm/kernel/atags_parse.c:#include <asm/mach/arch.h>
Probably simpler to use /Q /E quoting.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] checkpatch: add --fix option for INCLUDE_LINUX
2020-11-21 20:05 ` Joe Perches
@ 2020-11-21 20:31 ` Dwaipayan Ray
0 siblings, 0 replies; 3+ messages in thread
From: Dwaipayan Ray @ 2020-11-21 20:31 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel-mentees, linux-kernel, Lukas Bulwahn
On Sun, Nov 22, 2020 at 1:35 AM Joe Perches <joe@perches.com> wrote:
>
> On Sat, 2020-11-21 at 21:47 +0530, Dwaipayan Ray wrote:
> > Provide fix option to INCLUDE_LINUX check to replace asm
> > includes.
> >
> > Macros of type:
> > #include <asm/percpu.h>
> >
> > are corrected to:
> > #include <linux/percpu.h>
> []
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -5468,8 +5468,11 @@ sub process {
> > CHK("ARCH_INCLUDE_LINUX",
> > "Consider using #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
> > } else {
> > - WARN("INCLUDE_LINUX",
> > - "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr);
> > + if (WARN("INCLUDE_LINUX",
> > + "Use #include <linux/$file> instead of <asm/$file>\n" . $herecurr) &&
> > + $fix) {
> > + $fixed[$fixlinenr] =~ s/\<asm\/$file\>/\<linux\/$file\>/;
>
> $file can include a slash.
>
> e.g.: arch/arm/kernel/atags_parse.c:#include <asm/mach/arch.h>
>
> Probably simpler to use /Q /E quoting.
>
>
Thanks. I will do that.
Regards,
Dwaipayan.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-21 20:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-21 16:17 [PATCH] checkpatch: add --fix option for INCLUDE_LINUX Dwaipayan Ray
2020-11-21 20:05 ` Joe Perches
2020-11-21 20:31 ` Dwaipayan Ray
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).