[PATCH v3 94/95] checkpatch: Remove unwanted CONFIG_IS_ENABLED rules

Simon Glass sjg at chromium.org
Mon Feb 13 00:16:37 CET 2023


These are not relevant anymore so drop them.

Signed-off-by: Simon Glass <sjg at chromium.org>
Suggested-by: Tom Rini <trini at konsulko.com>
---

(no changes since v1)

 scripts/checkpatch.pl           | 16 ----------------
 tools/patman/test_checkpatch.py |  6 ------
 2 files changed, 22 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index ccfcbb3e125..f6fdfcf58de 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2654,12 +2654,6 @@ sub u_boot_line {
 		     "Avoid setting skip_board_fixup env variable\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);
-	}
-
 	# Use _priv as a suffix for the device-private data struct
 	if ($line =~ /^\+\s*\.priv_auto\s*=\s*sizeof\(struct\((\w+)\).*/) {
 		my $struct_name = $1;
@@ -7197,16 +7191,6 @@ sub process {
 			     "IS_ENABLED($1) is normally used as IS_ENABLED(${CONFIG_}$1)\n" . $herecurr);
 		}
 
-# check for #if defined CONFIG_<FOO> || defined CONFIG_<FOO>_MODULE
-		if ($line =~ /^\+\s*#\s*if\s+defined(?:\s*\(?\s*|\s+)(${CONFIG_}[A-Z_]+)\s*\)?\s*\|\|\s*defined(?:\s*\(?\s*|\s+)\1_MODULE\s*\)?\s*$/) {
-			my $config = $1;
-			if (WARN("PREFER_IS_ENABLED",
-				 "Prefer IS_ENABLED(<FOO>) to ${CONFIG_}<FOO> || ${CONFIG_}<FOO>_MODULE\n" . $herecurr) &&
-			    $fix) {
-				$fixed[$fixlinenr] = "\+#if IS_ENABLED($config)";
-			}
-		}
-
 # check for /* fallthrough */ like comment, prefer fallthrough;
 		my @fallthroughs = (
 			'fallthrough',
diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py
index 4c2ab6e590e..6eb73433a4f 100644
--- a/tools/patman/test_checkpatch.py
+++ b/tools/patman/test_checkpatch.py
@@ -405,12 +405,6 @@ index 0000000..2234c87
         pm.add_line('include/myfile.h', '#include <dm.h>')
         self.check_single_message(pm, 'BARRED_INCLUDE_IN_HDR', 'error')
 
-    def test_config_is_enabled_config(self):
-        """Test for accidental CONFIG_IS_ENABLED(CONFIG_*) calls"""
-        pm = PatchMaker()
-        pm.add_line('common/main.c', 'if (CONFIG_IS_ENABLED(CONFIG_CLK))')
-        self.check_single_message(pm, 'CONFIG_IS_ENABLED_CONFIG', 'error')
-
     def check_struct(self, auto, suffix, warning):
         """Check one of the warnings for struct naming
 
-- 
2.39.1.581.gbfd45094c4-goog



More information about the U-Boot mailing list