From patchwork Tue May 26 18:29:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Rini X-Patchwork-Id: 246617 List-Id: U-Boot discussion From: trini at konsulko.com (Tom Rini) Date: Tue, 26 May 2020 14:29:02 -0400 Subject: [PATCHv2] checkpatch.pl: Add check for defining CONFIG_CMD_xxx via config files In-Reply-To: <20200522223240.187032-1-sjg@chromium.org> References: <20200522223240.187032-1-sjg@chromium.org> Message-ID: <20200526182902.28417-1-trini@konsulko.com> 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 --- Changes in v2: - Rebase on Simon's update that adds a u-boot section - Catch undef as well - Have a more generic message --- scripts/checkpatch.pl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 33ec4e2bfd44..cabb072a0de9 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2265,6 +2265,12 @@ sub u_boot_line { WARN("PREFER_IF", "Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible\n" . $herecurr); } + + # use defconfig to manage CONFIG_CMD options + if ($line =~ /\+\s*#\s*(define|undef)\s+(CONFIG_CMD\w*)\b/) { + ERROR("DEFINE_CONFIG_CMD", + "All commands are managed by Kconfig\n" . $herecurr); + } } sub process {