Skip to contentSkip to conversation

checkpatch: add check for the buggy while_each_thread()

PATCH New Sergey Dyasly 1 participant 1 message Jan 21, 2015 Checkpatch

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 checkpatch: add check for the buggy while_each_thread()

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 <[email protected]>
Cc Andy Whitcroft <[email protected]>
Cc Joe Perches <[email protected]>

---
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(+)
scripts/checkpatch.pl +6 -0
index f0bb6d6..d48f7b2 100755
@@ -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
Signature · 1 line
2.2.2