diff mbox series

checkpatch.pl: Add check for defining CONFIG_CMD_xxx via config files

Message ID 20200521203220.17428-1-trini@konsulko.com
State New
Headers show
Series checkpatch.pl: Add check for defining CONFIG_CMD_xxx via config files | expand

Commit Message

Tom Rini May 21, 2020, 8:32 p.m. UTC
All of our cmds have a Kconfig entry.  Making enabling a CMD via the
config file an error to checkpatch.pl.

Signed-off-by: Tom Rini <trini at konsulko.com>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Simon Glass May 22, 2020, 11:13 p.m. UTC | #1
On Thu, 21 May 2020 at 14:32, Tom Rini <trini at konsulko.com> wrote:
>
> All of our cmds have a Kconfig entry.  Making enabling a CMD via the
> config file an error to checkpatch.pl.
>
> Signed-off-by: Tom Rini <trini at konsulko.com>
> ---
>  scripts/checkpatch.pl | 6 ++++++
>  1 file changed, 6 insertions(+)
>

Reviewed-by: Simon Glass <sjg at chromium.org>
diff mbox series

Patch

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c2641bc995e8..5c0317c67fdb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6502,6 +6502,12 @@  sub process {
 			      "#define of '$1' is wrong - use Kconfig variables or standard guards instead\n" . $herecurr);
 		}
 
+# Defining new CONFIG_CMD is wrong.
+		if ($line =~ /\+\s*#\s*define\s+(CONFIG_CMD\w*)\b/) {
+			ERROR("DEFINE_CONFIG_CMD",
+			      "#define of '$1' is wrong - use Kconfig entries instead\n" . $herecurr);
+		}
+
 # likely/unlikely comparisons similar to "(likely(foo) > 0)"
 		if ($perl_version_ok &&
 		    $line =~ /\b((?:un)?likely)\s*\(\s*$FuncArg\s*\)\s*$Compare/) {