diff mbox series

[2/2] checkpatch.pl: Make CONFIG_IS_ENABLED(CONFIG_*) an error

Message ID 20200930114612.22319-2-alpernebiyasak@gmail.com
State Superseded
Delegated to: Tom Rini
Headers show
Series [1/2] treewide: Fix wrong CONFIG_IS_ENABLED() handling | expand

Commit Message

Alper Nebi Yasak Sept. 30, 2020, 11:46 a.m. UTC
CONFIG_IS_ENABLED() takes the kconfig name without the CONFIG_ prefix,
e.g. CONFIG_IS_ENABLED(CLK) for CONFIG_CLK. Make including the prefix
an error in checkpatch.pl so calls in the wrong format aren't
accidentally reintroduced.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
---

 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Simon Glass Oct. 5, 2020, 1:52 a.m. UTC | #1
Hi Alper,

On Wed, 30 Sep 2020 at 05:46, Alper Nebi Yasak <alpernebiyasak@gmail.com> wrote:
>
> CONFIG_IS_ENABLED() takes the kconfig name without the CONFIG_ prefix,
> e.g. CONFIG_IS_ENABLED(CLK) for CONFIG_CLK. Make including the prefix
> an error in checkpatch.pl so calls in the wrong format aren't
> accidentally reintroduced.
>
> Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
> ---
>
>  scripts/checkpatch.pl | 6 ++++++
>  1 file changed, 6 insertions(+)
>

This looks good but please add a test to patman too.

Regards,
Simon
diff mbox series

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 4bed2b0cdc..4ed7e124c9 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2365,6 +2365,12 @@  sub u_boot_line {
 		ERROR("DISABLE_FDT_OR_INITRD_RELOC",
 		     "fdt or initrd relocation disabled at boot time\n" . $herecurr);
 	}
+
+	# Do not use CONFIG_ prefix in CONFIG_IS_ENABLED() calls
+	if ($line =~ /^\+.*CONFIG_IS_ENABLED\(CONFIG_\w*\).*/) {
+		ERROR("CONFIG_IS_ENABLED_CONFIG",
+		      "CONFIG_IS_ENABLED() takes values without the CONFIG_ prefix\n" . $herecurr);
+	}
 }
 
 sub process {