Skip to contentSkip to conversation

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

PATCH Superseded Tom Rini 2 participants 2 messages May 21, 2020 – May 22, 2020 Checkpatch

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

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

All of our cmds have a Kconfig entry. Making enabling a CMD via the config file an error to checkpatch.pl.

---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/checkpatch.pl +6 -0
index c2641bc995e8..5c0317c67fdb 100755
@@ -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/) {
Signature · 1 line
2.17.1
#1 lore raw

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

Quoted 9 lines · Tom Rini

All of our cmds have a Kconfig entry. Making enabling a CMD via the config file an error to checkpatch.pl.

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