public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: add check for the buggy while_each_thread()
@ 2015-01-18 14:24 Sergey Dyasly
  2015-01-19  1:27 ` Joe Perches
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Dyasly @ 2015-01-18 14:24 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>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index f0bb6d6..0c5cc0b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -3255,6 +3255,12 @@ sub process {
 			     "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr);
 		}
 
+# Check for the buggy while_each_thread()
+		if ($line =~ /\bwhile_each_thread\(/) {
+			WARN("WHILE_EACH_THREAD",
+			     "Prefer to use for_each_thread() instead of the buggy while_each_thread(). See commit 0c740d0afc3bff0a097ad03a1c8df92757516f5c for details.\n" . $herecurr);
+		}
+
 # function brace can't be on same line, except for #defines of do while,
 # or if closed on same line
 		if (($line=~/$Type\s*$Ident\(.*\).*\s*{/) and
-- 
2.2.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch: add check for the buggy while_each_thread()
  2015-01-18 14:24 [PATCH] checkpatch: add check for the buggy while_each_thread() Sergey Dyasly
@ 2015-01-19  1:27 ` Joe Perches
  2015-01-21 16:35   ` Sergey Dyasly
  0 siblings, 1 reply; 3+ messages in thread
From: Joe Perches @ 2015-01-19  1:27 UTC (permalink / raw)
  To: Sergey Dyasly; +Cc: linux-kernel, Oleg Nesterov, Andy Whitcroft

On Sun, 2015-01-18 at 17:24 +0300, Sergey Dyasly wrote:
> 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.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -3255,6 +3255,12 @@ sub process {
>  			     "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr);
>  		}
>  
> +# Check for the buggy while_each_thread()
> +		if ($line =~ /\bwhile_each_thread\(/) {

	\bwhile_each_thread\s*\(
or maybe
	\bwhile_each_thread\b

> +			WARN("WHILE_EACH_THREAD",
> +			     "Prefer to use for_each_thread() instead of the buggy while_each_thread(). See commit 0c740d0afc3bff0a097ad03a1c8df92757516f5c for details.\n" . $herecurr);

Pretty long commit id, 12 is probably enough.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] checkpatch: add check for the buggy while_each_thread()
  2015-01-19  1:27 ` Joe Perches
@ 2015-01-21 16:35   ` Sergey Dyasly
  0 siblings, 0 replies; 3+ messages in thread
From: Sergey Dyasly @ 2015-01-21 16:35 UTC (permalink / raw)
  To: Joe Perches; +Cc: linux-kernel, Oleg Nesterov, Andy Whitcroft

On Sun, 18 Jan 2015 17:27:33 -0800
Joe Perches <joe@perches.com> wrote:

> On Sun, 2015-01-18 at 17:24 +0300, Sergey Dyasly wrote:
> > 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.
> []
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -3255,6 +3255,12 @@ sub process {
> >  			     "Prefer dev_$level(... to dev_printk(KERN_$orig, ...\n" . $herecurr);
> >  		}
> >  
> > +# Check for the buggy while_each_thread()
> > +		if ($line =~ /\bwhile_each_thread\(/) {
> 
> 	\bwhile_each_thread\s*\(
> or maybe
> 	\bwhile_each_thread\b
> 
> > +			WARN("WHILE_EACH_THREAD",
> > +			     "Prefer to use for_each_thread() instead of the buggy while_each_thread(). See commit 0c740d0afc3bff0a097ad03a1c8df92757516f5c for details.\n" . $herecurr);
> 
> Pretty long commit id, 12 is probably enough.

"\bwhile_each_thread\s*\(" and 12-digit commit id sound reasonable, thanks.
I'll update the patch.

-- 
Sergey Dyasly <dserrg@gmail.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-01-21 16:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-18 14:24 [PATCH] checkpatch: add check for the buggy while_each_thread() Sergey Dyasly
2015-01-19  1:27 ` Joe Perches
2015-01-21 16:35   ` Sergey Dyasly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox