Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-04 Thread Joe Perches
On Mon, 2017-12-04 at 11:06 -0800, Paul E. McKenney wrote:
> On Fri, Dec 01, 2017 at 08:45:13PM -0800, Joe Perches wrote:
> > On Fri, 2017-12-01 at 13:44 -0800, Paul E. McKenney wrote:
> 
> > If you really wanted to optimize, you could make the first (smp_|)
> > become (?:smp_|) to avoid the unused capture group.
> > Or perhaps this could emit the actual type in the message like:
> > 
> > if (!$file && $line =~ /\b((?:smp_|)read_barrier_depends)\s*\(/ 
> > {
> > WARN("READ_BARRIER_DEPENDS",
> >  "$1 should only be used in READ_ONCE or DEC Alpha 
> > code\n" . $herecurr);
> 
> How about like this?  (s/$1/$1read_barrier_depends/).

Works for me.

Acked-by: Joe Perches 

Are you going to merge this?
Normally akpm does checkpatch merging but whatever
works for you is OK by me.

cheers, Joe

> commit e4f1d781e33c150547c68e55099794b98ee14d5e
> Author: Paul E. McKenney 
> Date:   Mon Nov 27 09:37:35 2017 -0800
> {smp_,}read_barrier_depends()
> 
> Now that both smp_read_barrier_depends() and read_barrier_depends()
> are being de-emphasized, warn if any are added.
> 
> Signed-off-by: Paul E. McKenney 
> Cc: Andy Whitcroft 
> Cc: Joe Perches 
> [ paulmck: Skipped checking files and handled whitespace per Joe Perches.
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 95cda3ecc66b..9a384bfe2bd5 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5586,6 +5586,12 @@ sub process {
>   }
>   }
>  
> +# check for smp_read_barrier_depends and read_barrier_depends
> + if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> + WARN("READ_BARRIER_DEPENDS",
> +  "$1read_barrier_depends should only be used in 
> READ_ONCE or DEC Alpha code\n" . $herecurr);
> + }
> +
>  # check of hardware specific defines
>   if ($line =~ 
> m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile 
> !~ m@include/asm-@) {
>   CHK("ARCH_DEFINES",
> 


Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-04 Thread Joe Perches
On Mon, 2017-12-04 at 11:06 -0800, Paul E. McKenney wrote:
> On Fri, Dec 01, 2017 at 08:45:13PM -0800, Joe Perches wrote:
> > On Fri, 2017-12-01 at 13:44 -0800, Paul E. McKenney wrote:
> 
> > If you really wanted to optimize, you could make the first (smp_|)
> > become (?:smp_|) to avoid the unused capture group.
> > Or perhaps this could emit the actual type in the message like:
> > 
> > if (!$file && $line =~ /\b((?:smp_|)read_barrier_depends)\s*\(/ 
> > {
> > WARN("READ_BARRIER_DEPENDS",
> >  "$1 should only be used in READ_ONCE or DEC Alpha 
> > code\n" . $herecurr);
> 
> How about like this?  (s/$1/$1read_barrier_depends/).

Works for me.

Acked-by: Joe Perches 

Are you going to merge this?
Normally akpm does checkpatch merging but whatever
works for you is OK by me.

cheers, Joe

> commit e4f1d781e33c150547c68e55099794b98ee14d5e
> Author: Paul E. McKenney 
> Date:   Mon Nov 27 09:37:35 2017 -0800
> {smp_,}read_barrier_depends()
> 
> Now that both smp_read_barrier_depends() and read_barrier_depends()
> are being de-emphasized, warn if any are added.
> 
> Signed-off-by: Paul E. McKenney 
> Cc: Andy Whitcroft 
> Cc: Joe Perches 
> [ paulmck: Skipped checking files and handled whitespace per Joe Perches.
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 95cda3ecc66b..9a384bfe2bd5 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5586,6 +5586,12 @@ sub process {
>   }
>   }
>  
> +# check for smp_read_barrier_depends and read_barrier_depends
> + if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> + WARN("READ_BARRIER_DEPENDS",
> +  "$1read_barrier_depends should only be used in 
> READ_ONCE or DEC Alpha code\n" . $herecurr);
> + }
> +
>  # check of hardware specific defines
>   if ($line =~ 
> m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile 
> !~ m@include/asm-@) {
>   CHK("ARCH_DEFINES",
> 


Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-04 Thread Paul E. McKenney
On Fri, Dec 01, 2017 at 08:45:13PM -0800, Joe Perches wrote:
> On Fri, 2017-12-01 at 13:44 -0800, Paul E. McKenney wrote:

[ . . . ]

> > Good points!  Like this?
> []
> > commit ff155ce179aab891dbe2ca80f82a453383fd165a
> > Author: Paul E. McKenney 
> > Date:   Mon Nov 27 09:37:35 2017 -0800
> > 
> > checkpatch: Add warnings for {smp_,}read_barrier_depends()
> > 
> > Now that both smp_read_barrier_depends() and read_barrier_depends()
> > are being de-emphasized, warn if any are added.
> > 
> > Signed-off-by: Paul E. McKenney 
> > Cc: Andy Whitcroft 
> > Cc: Joe Perches 
> > [ paulmck: Skipped checking files and handled whitespace per Joe 
> > Perches. ]
> > 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -5586,6 +5586,12 @@ sub process {
> > }
> > }
> >  
> > +# check for smp_read_barrier_depends and read_barrier_depends
> > +   if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> > +   WARN("READ_BARRIER_DEPENDS",
> > +"Dependency barriers should only be used in 
> > READ_ONCE or DEC Alpha code" . $herecurr);
> 
> Almost right.  Missing a '\n' after "DEC Alpha code".
> Without the '\n', running checkpatch with --terse outputs badly.
> 
> If you really wanted to optimize, you could make the first (smp_|)
> become (?:smp_|) to avoid the unused capture group.
> Or perhaps this could emit the actual type in the message like:
> 
>   if (!$file && $line =~ /\b((?:smp_|)read_barrier_depends)\s*\(/ 
> {
>   WARN("READ_BARRIER_DEPENDS",
>"$1 should only be used in READ_ONCE or DEC Alpha 
> code\n" . $herecurr);

How about like this?  (s/$1/$1read_barrier_depends/).

Thanx, Paul



commit e4f1d781e33c150547c68e55099794b98ee14d5e
Author: Paul E. McKenney 
Date:   Mon Nov 27 09:37:35 2017 -0800

checkpatch: Add warnings for {smp_,}read_barrier_depends()

Now that both smp_read_barrier_depends() and read_barrier_depends()
are being de-emphasized, warn if any are added.

Signed-off-by: Paul E. McKenney 
Cc: Andy Whitcroft 
Cc: Joe Perches 
[ paulmck: Skipped checking files and handled whitespace per Joe Perches. ]

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 95cda3ecc66b..9a384bfe2bd5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5586,6 +5586,12 @@ sub process {
}
}
 
+# check for smp_read_barrier_depends and read_barrier_depends
+   if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
+   WARN("READ_BARRIER_DEPENDS",
+"$1read_barrier_depends should only be used in 
READ_ONCE or DEC Alpha code\n" . $herecurr);
+   }
+
 # check of hardware specific defines
if ($line =~ 
m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ 
m@include/asm-@) {
CHK("ARCH_DEFINES",



Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-04 Thread Paul E. McKenney
On Fri, Dec 01, 2017 at 08:45:13PM -0800, Joe Perches wrote:
> On Fri, 2017-12-01 at 13:44 -0800, Paul E. McKenney wrote:

[ . . . ]

> > Good points!  Like this?
> []
> > commit ff155ce179aab891dbe2ca80f82a453383fd165a
> > Author: Paul E. McKenney 
> > Date:   Mon Nov 27 09:37:35 2017 -0800
> > 
> > checkpatch: Add warnings for {smp_,}read_barrier_depends()
> > 
> > Now that both smp_read_barrier_depends() and read_barrier_depends()
> > are being de-emphasized, warn if any are added.
> > 
> > Signed-off-by: Paul E. McKenney 
> > Cc: Andy Whitcroft 
> > Cc: Joe Perches 
> > [ paulmck: Skipped checking files and handled whitespace per Joe 
> > Perches. ]
> > 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -5586,6 +5586,12 @@ sub process {
> > }
> > }
> >  
> > +# check for smp_read_barrier_depends and read_barrier_depends
> > +   if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> > +   WARN("READ_BARRIER_DEPENDS",
> > +"Dependency barriers should only be used in 
> > READ_ONCE or DEC Alpha code" . $herecurr);
> 
> Almost right.  Missing a '\n' after "DEC Alpha code".
> Without the '\n', running checkpatch with --terse outputs badly.
> 
> If you really wanted to optimize, you could make the first (smp_|)
> become (?:smp_|) to avoid the unused capture group.
> Or perhaps this could emit the actual type in the message like:
> 
>   if (!$file && $line =~ /\b((?:smp_|)read_barrier_depends)\s*\(/ 
> {
>   WARN("READ_BARRIER_DEPENDS",
>"$1 should only be used in READ_ONCE or DEC Alpha 
> code\n" . $herecurr);

How about like this?  (s/$1/$1read_barrier_depends/).

Thanx, Paul



commit e4f1d781e33c150547c68e55099794b98ee14d5e
Author: Paul E. McKenney 
Date:   Mon Nov 27 09:37:35 2017 -0800

checkpatch: Add warnings for {smp_,}read_barrier_depends()

Now that both smp_read_barrier_depends() and read_barrier_depends()
are being de-emphasized, warn if any are added.

Signed-off-by: Paul E. McKenney 
Cc: Andy Whitcroft 
Cc: Joe Perches 
[ paulmck: Skipped checking files and handled whitespace per Joe Perches. ]

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 95cda3ecc66b..9a384bfe2bd5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5586,6 +5586,12 @@ sub process {
}
}
 
+# check for smp_read_barrier_depends and read_barrier_depends
+   if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
+   WARN("READ_BARRIER_DEPENDS",
+"$1read_barrier_depends should only be used in 
READ_ONCE or DEC Alpha code\n" . $herecurr);
+   }
+
 # check of hardware specific defines
if ($line =~ 
m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ 
m@include/asm-@) {
CHK("ARCH_DEFINES",



Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-01 Thread Joe Perches
On Fri, 2017-12-01 at 13:44 -0800, Paul E. McKenney wrote:
> On Fri, Dec 01, 2017 at 12:14:17PM -0800, Joe Perches wrote:
> > On Fri, 2017-12-01 at 11:51 -0800, Paul E. McKenney wrote:
> > > Now that both smp_read_barrier_depends() and read_barrier_depends()
> > > are being de-emphasized, warn if any are added.
> > 
> > This would also warn on existing files when run
> > with ./scripts/checkpatch.pl -f 
> > 
> > Do you want it to check new patches only?
> > 
> > If so the test could become "if (!$file && etc...)
> > 
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> > > @@ -5586,6 +5586,12 @@ sub process {
> > >   }
> > >   }
> > >  
> > > +# check for smp_read_barrier_depends and read_barrier_depends
> > > + if ($line =~ /\b(smp_|)read_barrier_depends\(/) {
> > 
> > Must become
> > 
> > +   if ($line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> > 
> > similar to the lines above this as there are sometimes
> > spaces between function name and argument parentheses.
> 
> Good points!  Like this?
[]
> commit ff155ce179aab891dbe2ca80f82a453383fd165a
> Author: Paul E. McKenney 
> Date:   Mon Nov 27 09:37:35 2017 -0800
> 
> checkpatch: Add warnings for {smp_,}read_barrier_depends()
> 
> Now that both smp_read_barrier_depends() and read_barrier_depends()
> are being de-emphasized, warn if any are added.
> 
> Signed-off-by: Paul E. McKenney 
> Cc: Andy Whitcroft 
> Cc: Joe Perches 
> [ paulmck: Skipped checking files and handled whitespace per Joe Perches. 
> ]
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -5586,6 +5586,12 @@ sub process {
>   }
>   }
>  
> +# check for smp_read_barrier_depends and read_barrier_depends
> + if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> + WARN("READ_BARRIER_DEPENDS",
> +  "Dependency barriers should only be used in 
> READ_ONCE or DEC Alpha code" . $herecurr);

Almost right.  Missing a '\n' after "DEC Alpha code".
Without the '\n', running checkpatch with --terse outputs badly.

If you really wanted to optimize, you could make the first (smp_|)
become (?:smp_|) to avoid the unused capture group.
Or perhaps this could emit the actual type in the message like:

if (!$file && $line =~ /\b((?:smp_|)read_barrier_depends)\s*\(/ 
{
WARN("READ_BARRIER_DEPENDS",
 "$1 should only be used in READ_ONCE or DEC Alpha 
code\n" . $herecurr);




Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-01 Thread Joe Perches
On Fri, 2017-12-01 at 13:44 -0800, Paul E. McKenney wrote:
> On Fri, Dec 01, 2017 at 12:14:17PM -0800, Joe Perches wrote:
> > On Fri, 2017-12-01 at 11:51 -0800, Paul E. McKenney wrote:
> > > Now that both smp_read_barrier_depends() and read_barrier_depends()
> > > are being de-emphasized, warn if any are added.
> > 
> > This would also warn on existing files when run
> > with ./scripts/checkpatch.pl -f 
> > 
> > Do you want it to check new patches only?
> > 
> > If so the test could become "if (!$file && etc...)
> > 
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> > > @@ -5586,6 +5586,12 @@ sub process {
> > >   }
> > >   }
> > >  
> > > +# check for smp_read_barrier_depends and read_barrier_depends
> > > + if ($line =~ /\b(smp_|)read_barrier_depends\(/) {
> > 
> > Must become
> > 
> > +   if ($line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> > 
> > similar to the lines above this as there are sometimes
> > spaces between function name and argument parentheses.
> 
> Good points!  Like this?
[]
> commit ff155ce179aab891dbe2ca80f82a453383fd165a
> Author: Paul E. McKenney 
> Date:   Mon Nov 27 09:37:35 2017 -0800
> 
> checkpatch: Add warnings for {smp_,}read_barrier_depends()
> 
> Now that both smp_read_barrier_depends() and read_barrier_depends()
> are being de-emphasized, warn if any are added.
> 
> Signed-off-by: Paul E. McKenney 
> Cc: Andy Whitcroft 
> Cc: Joe Perches 
> [ paulmck: Skipped checking files and handled whitespace per Joe Perches. 
> ]
> 
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -5586,6 +5586,12 @@ sub process {
>   }
>   }
>  
> +# check for smp_read_barrier_depends and read_barrier_depends
> + if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> + WARN("READ_BARRIER_DEPENDS",
> +  "Dependency barriers should only be used in 
> READ_ONCE or DEC Alpha code" . $herecurr);

Almost right.  Missing a '\n' after "DEC Alpha code".
Without the '\n', running checkpatch with --terse outputs badly.

If you really wanted to optimize, you could make the first (smp_|)
become (?:smp_|) to avoid the unused capture group.
Or perhaps this could emit the actual type in the message like:

if (!$file && $line =~ /\b((?:smp_|)read_barrier_depends)\s*\(/ 
{
WARN("READ_BARRIER_DEPENDS",
 "$1 should only be used in READ_ONCE or DEC Alpha 
code\n" . $herecurr);




Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-01 Thread Paul E. McKenney
On Fri, Dec 01, 2017 at 12:14:17PM -0800, Joe Perches wrote:
> On Fri, 2017-12-01 at 11:51 -0800, Paul E. McKenney wrote:
> > Now that both smp_read_barrier_depends() and read_barrier_depends()
> > are being de-emphasized, warn if any are added.
> 
> This would also warn on existing files when run
> with ./scripts/checkpatch.pl -f 
> 
> Do you want it to check new patches only?
> 
> If so the test could become "if (!$file && etc...)
> 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 95cda3ecc66b..25f7098e2ad3 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -5586,6 +5586,12 @@ sub process {
> > }
> > }
> >  
> > +# check for smp_read_barrier_depends and read_barrier_depends
> > +   if ($line =~ /\b(smp_|)read_barrier_depends\(/) {
> 
> Must become
> 
> + if ($line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> 
> similar to the lines above this as there are sometimes
> spaces between function name and argument parentheses.

Good points!  Like this?

Thanx, Paul



commit ff155ce179aab891dbe2ca80f82a453383fd165a
Author: Paul E. McKenney 
Date:   Mon Nov 27 09:37:35 2017 -0800

checkpatch: Add warnings for {smp_,}read_barrier_depends()

Now that both smp_read_barrier_depends() and read_barrier_depends()
are being de-emphasized, warn if any are added.

Signed-off-by: Paul E. McKenney 
Cc: Andy Whitcroft 
Cc: Joe Perches 
[ paulmck: Skipped checking files and handled whitespace per Joe Perches. ]

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 95cda3ecc66b..0d90518d4147 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5586,6 +5586,12 @@ sub process {
}
}
 
+# check for smp_read_barrier_depends and read_barrier_depends
+   if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
+   WARN("READ_BARRIER_DEPENDS",
+"Dependency barriers should only be used in 
READ_ONCE or DEC Alpha code" . $herecurr);
+   }
+
 # check of hardware specific defines
if ($line =~ 
m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ 
m@include/asm-@) {
CHK("ARCH_DEFINES",



Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-01 Thread Paul E. McKenney
On Fri, Dec 01, 2017 at 12:14:17PM -0800, Joe Perches wrote:
> On Fri, 2017-12-01 at 11:51 -0800, Paul E. McKenney wrote:
> > Now that both smp_read_barrier_depends() and read_barrier_depends()
> > are being de-emphasized, warn if any are added.
> 
> This would also warn on existing files when run
> with ./scripts/checkpatch.pl -f 
> 
> Do you want it to check new patches only?
> 
> If so the test could become "if (!$file && etc...)
> 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index 95cda3ecc66b..25f7098e2ad3 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -5586,6 +5586,12 @@ sub process {
> > }
> > }
> >  
> > +# check for smp_read_barrier_depends and read_barrier_depends
> > +   if ($line =~ /\b(smp_|)read_barrier_depends\(/) {
> 
> Must become
> 
> + if ($line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> 
> similar to the lines above this as there are sometimes
> spaces between function name and argument parentheses.

Good points!  Like this?

Thanx, Paul



commit ff155ce179aab891dbe2ca80f82a453383fd165a
Author: Paul E. McKenney 
Date:   Mon Nov 27 09:37:35 2017 -0800

checkpatch: Add warnings for {smp_,}read_barrier_depends()

Now that both smp_read_barrier_depends() and read_barrier_depends()
are being de-emphasized, warn if any are added.

Signed-off-by: Paul E. McKenney 
Cc: Andy Whitcroft 
Cc: Joe Perches 
[ paulmck: Skipped checking files and handled whitespace per Joe Perches. ]

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 95cda3ecc66b..0d90518d4147 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5586,6 +5586,12 @@ sub process {
}
}
 
+# check for smp_read_barrier_depends and read_barrier_depends
+   if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
+   WARN("READ_BARRIER_DEPENDS",
+"Dependency barriers should only be used in 
READ_ONCE or DEC Alpha code" . $herecurr);
+   }
+
 # check of hardware specific defines
if ($line =~ 
m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ 
m@include/asm-@) {
CHK("ARCH_DEFINES",



Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-01 Thread Joe Perches
On Fri, 2017-12-01 at 11:51 -0800, Paul E. McKenney wrote:
> Now that both smp_read_barrier_depends() and read_barrier_depends()
> are being de-emphasized, warn if any are added.

This would also warn on existing files when run
with ./scripts/checkpatch.pl -f 

Do you want it to check new patches only?

If so the test could become "if (!$file && etc...)

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 95cda3ecc66b..25f7098e2ad3 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5586,6 +5586,12 @@ sub process {
>   }
>   }
>  
> +# check for smp_read_barrier_depends and read_barrier_depends
> + if ($line =~ /\b(smp_|)read_barrier_depends\(/) {

Must become

+   if ($line =~ /\b(smp_|)read_barrier_depends\s*\(/) {

similar to the lines above this as there are sometimes
spaces between function name and argument parentheses.


Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-01 Thread Joe Perches
On Fri, 2017-12-01 at 11:51 -0800, Paul E. McKenney wrote:
> Now that both smp_read_barrier_depends() and read_barrier_depends()
> are being de-emphasized, warn if any are added.

This would also warn on existing files when run
with ./scripts/checkpatch.pl -f 

Do you want it to check new patches only?

If so the test could become "if (!$file && etc...)

> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 95cda3ecc66b..25f7098e2ad3 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -5586,6 +5586,12 @@ sub process {
>   }
>   }
>  
> +# check for smp_read_barrier_depends and read_barrier_depends
> + if ($line =~ /\b(smp_|)read_barrier_depends\(/) {

Must become

+   if ($line =~ /\b(smp_|)read_barrier_depends\s*\(/) {

similar to the lines above this as there are sometimes
spaces between function name and argument parentheses.


[PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-01 Thread Paul E. McKenney
Now that both smp_read_barrier_depends() and read_barrier_depends()
are being de-emphasized, warn if any are added.

Signed-off-by: Paul E. McKenney 
Cc: Andy Whitcroft 
Cc: Joe Perches 
---
 scripts/checkpatch.pl | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 95cda3ecc66b..25f7098e2ad3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5586,6 +5586,12 @@ sub process {
}
}
 
+# check for smp_read_barrier_depends and read_barrier_depends
+   if ($line =~ /\b(smp_|)read_barrier_depends\(/) {
+   WARN("READ_BARRIER_DEPENDS",
+"Dependency barriers should only be used in 
READ_ONCE or DEC Alpha code" . $herecurr);
+   }
+
 # check of hardware specific defines
if ($line =~ 
m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ 
m@include/asm-@) {
CHK("ARCH_DEFINES",
-- 
2.5.2



[PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()

2017-12-01 Thread Paul E. McKenney
Now that both smp_read_barrier_depends() and read_barrier_depends()
are being de-emphasized, warn if any are added.

Signed-off-by: Paul E. McKenney 
Cc: Andy Whitcroft 
Cc: Joe Perches 
---
 scripts/checkpatch.pl | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 95cda3ecc66b..25f7098e2ad3 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5586,6 +5586,12 @@ sub process {
}
}
 
+# check for smp_read_barrier_depends and read_barrier_depends
+   if ($line =~ /\b(smp_|)read_barrier_depends\(/) {
+   WARN("READ_BARRIER_DEPENDS",
+"Dependency barriers should only be used in 
READ_ONCE or DEC Alpha code" . $herecurr);
+   }
+
 # check of hardware specific defines
if ($line =~ 
m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ 
m@include/asm-@) {
CHK("ARCH_DEFINES",
-- 
2.5.2