Skip to contentSkip to conversation

checkpatch: make the IS_ENABLED macro check warning clearer

PATCH New Jianyun Gao 1 participant 1 message Jan 23 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpatch: make the IS_ENABLED macro check warning clearer

When I used checkpatch.pl to check my patch, I received the following warning:

  WARNING: Prefer IS_ENABLED(<FOO>) to CONFIG_<FOO> || CONFIG_<FOO>_MODULE

It identified issues with my patch, but the suggested way to fix them still left me a bit confused. I think the following suggestion would be clearer:

  WARNING: Prefer IS_ENABLED(CONFIG_<FOO>) to CONFIG_<FOO> || CONFIG_<FOO>_MODULE
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index c0250244cf7a..e9c45f5d1925 100755
@@ -7334,7 +7334,7 @@ sub process {
 		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) &&
+				 "Prefer IS_ENABLED(${CONFIG_}<FOO>) to ${CONFIG_}<FOO> || ${CONFIG_}<FOO>_MODULE\n" . $herecurr) &&
 			    $fix) {
 				$fixed[$fixlinenr] = "\+#if IS_ENABLED($config)";
 			}
Signature · 1 line
2.34.1