LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] checkpatch: add check for the buggy while_each_thread()
@ 2015-01-21 17:01 Sergey Dyasly
  0 siblings, 0 replies; only message in thread
From: Sergey Dyasly @ 2015-01-21 17:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: Sergey Dyasly, Oleg Nesterov, Andy Whitcroft, Joe Perches

Now it's preferable to use for_each_thread() instead of while_each_thread().
Add a check to checkpatch.pl in order to prevent any new usages of the buggy
while_each_thread() when possible.

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Sergey Dyasly <dserrg@gmail.com>
---
Changes since v1:
- Added "\s*" to the regular expression
- Limited commit id to 12 digits
- "Prefer to use" --> "Consider using"
- Moved check to the end of the file

 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f0bb6d6..d48f7b2 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5259,6 +5259,12 @@ sub process {
 				}
 			}
 		}
+
+# Check for the buggy while_each_thread()
+		if ($line =~ /\bwhile_each_thread\s*\(/) {
+			WARN("WHILE_EACH_THREAD",
+			     "Consider using for_each_thread() instead of the buggy while_each_thread(). See commit 0c740d0afc3b for details.\n" . $herecurr);
+		}
 	}
 
 	# If we have no input at all, then there is nothing to report on
-- 
2.2.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-01-21 17:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-21 17:01 [PATCH v2] checkpatch: add check for the buggy while_each_thread() Sergey Dyasly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).