[PATCH] checkpatch: make the IS_ENABLED macro check warning clearer

Jianyun Gao posted 1 patch 2 weeks ago
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] checkpatch: make the IS_ENABLED macro check warning clearer
Posted by Jianyun Gao 2 weeks ago
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

Signed-off-by: Jianyun Gao <jianyungao89@gmail.com>
---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index c0250244cf7a..e9c45f5d1925 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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)";
 			}
-- 
2.34.1