checkpatch: add --fix option for INCLUDE_LINUX
PATCH v2 1/1 checkpatch: add --fix option for INCLUDE_LINUX
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 <[email protected]>
---
Changes in v2:
- Use \Q..\E quoting
- Use @ as regex delimiter
scripts/checkpatch.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +5 -2
@@ -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@\Q<asm/$file>\E@<linux/$file>@; + } } } }
Signature · 6 lines
2.27.0 _______________________________________________ Linux-kernel-mentees mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
Quoted 4 lines · Dwaipayan Ray
Provide fix option to
INCLUDE_LINUXcheck to replace asm includes.
Quoted 9 lines
Macros of type:
#include <asm/percpu.h>are corrected to:
#include <linux/percpu.h>Signed-off-by Dwaipayan Ray <[email protected]>---
Hello Joe,
Could I get some review on this if you are not too busy.
Thank you,
Dwaipayan.
Quoted 28 lines
Changes in v2:
- Use \Q..\E quoting
- Use @ as regex delimiterscripts/checkpatch.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)scripts/checkpatch.pl +5
-3@@ -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@\Q<asm/$file>\E@<linux/$file>@; + } } } } --2.27.0