* + checkpatch-add-prefer_is_enabled-test.patch added to -mm tree
@ 2016-03-28 21:48 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2016-03-28 21:48 UTC (permalink / raw)
To: joe, mm-commits
The patch titled
Subject: checkpatch: add PREFER_IS_ENABLED test
has been added to the -mm tree. Its filename is
checkpatch-add-prefer_is_enabled-test.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/checkpatch-add-prefer_is_enabled-test.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/checkpatch-add-prefer_is_enabled-test.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: Joe Perches <joe@perches.com>
Subject: checkpatch: add PREFER_IS_ENABLED test
Using #if defined CONFIG_<FOO> || defined CONFIG_<FOO>_MODULE is
more verbose than necessary and IS_ENABLED(CONFIG_<FOO>) is preferred.
So add a test and a message for it.
--fix it to if desired.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
scripts/checkpatch.pl | 10 ++++++++++
1 file changed, 10 insertions(+)
diff -puN scripts/checkpatch.pl~checkpatch-add-prefer_is_enabled-test scripts/checkpatch.pl
--- a/scripts/checkpatch.pl~checkpatch-add-prefer_is_enabled-test
+++ a/scripts/checkpatch.pl
@@ -5637,6 +5637,16 @@ sub process {
}
}
+# 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 case / default statements not preceded by break/fallthrough/switch
if ($line =~ /^.\s*(?:case\s+(?:$Ident|$Constant)\s*|default):/) {
my $has_break = 0;
_
Patches currently in -mm which might be from joe@perches.com are
checkpatch-add-prefer_is_enabled-test.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-28 21:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-28 21:48 + checkpatch-add-prefer_is_enabled-test.patch added to -mm tree akpm
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.