checkpatch: make the IS_ENABLED macro check warning clearer
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
Signed-off-by Jianyun Gao <[email protected]>
--- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
@@ -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