Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-11 Thread Joe Perches
On Thu, 2013-04-11 at 13:56 +0200, Bjørn Mork wrote: > I felt I had to share this little gem > which showed up in drivers/gpu/drm/exynos/exynos_drm_vidi.c: > > static int vidi_power_on(struct vidi_context *ctx, bool enable) > { > struct exynos_drm_subdrv *subdrv = >subdrv; >

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-11 Thread Bjørn Mork
Dave Jones writes: > On Wed, Apr 10, 2013 at 03:57:51PM -0700, Andrew Morton wrote: > > On Tue, 09 Apr 2013 20:17:14 -0700 Joe Perches wrote: > > > > > Comparisons of A to true and false are better written > > > as A and !A. > > > > > > Bleat a message on use. > > > > hm. I'm

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-11 Thread Joe Perches
On Thu, 2013-04-11 at 11:19 +0300, Dan Carpenter wrote: > On Wed, Apr 10, 2013 at 10:14:15PM -0400, Dave Jones wrote: > > It would be interesting to see how many people have historically screwed > > up and used (!a) when they mean (a) and vice versa, versus spelling > > it out longform. I'd be

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-11 Thread Dan Carpenter
On Wed, Apr 10, 2013 at 10:14:15PM -0400, Dave Jones wrote: > On Wed, Apr 10, 2013 at 03:57:51PM -0700, Andrew Morton wrote: > > On Tue, 09 Apr 2013 20:17:14 -0700 Joe Perches wrote: > > > > > Comparisons of A to true and false are better written > > > as A and !A. > > > > > > Bleat a

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-11 Thread Dan Carpenter
On Wed, Apr 10, 2013 at 10:14:15PM -0400, Dave Jones wrote: On Wed, Apr 10, 2013 at 03:57:51PM -0700, Andrew Morton wrote: On Tue, 09 Apr 2013 20:17:14 -0700 Joe Perches j...@perches.com wrote: Comparisons of A to true and false are better written as A and !A. Bleat a

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-11 Thread Joe Perches
On Thu, 2013-04-11 at 11:19 +0300, Dan Carpenter wrote: On Wed, Apr 10, 2013 at 10:14:15PM -0400, Dave Jones wrote: It would be interesting to see how many people have historically screwed up and used (!a) when they mean (a) and vice versa, versus spelling it out longform. I'd be

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-11 Thread Bjørn Mork
Dave Jones da...@redhat.com writes: On Wed, Apr 10, 2013 at 03:57:51PM -0700, Andrew Morton wrote: On Tue, 09 Apr 2013 20:17:14 -0700 Joe Perches j...@perches.com wrote: Comparisons of A to true and false are better written as A and !A. Bleat a message on use. hm.

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-11 Thread Joe Perches
On Thu, 2013-04-11 at 13:56 +0200, Bjørn Mork wrote: I felt I had to share this little gem which showed up in drivers/gpu/drm/exynos/exynos_drm_vidi.c: static int vidi_power_on(struct vidi_context *ctx, bool enable) { struct exynos_drm_subdrv *subdrv = ctx-subdrv; struct

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Joe Perches
On Wed, 2013-04-10 at 22:14 -0400, Dave Jones wrote: > It would be interesting to see how many people have historically screwed > up and used (!a) when they mean (a) and vice versa, versus spelling > it out longform. I'd be surprised if the results weren't skewed > in favour of the more verbose

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Dave Jones
On Wed, Apr 10, 2013 at 03:57:51PM -0700, Andrew Morton wrote: > On Tue, 09 Apr 2013 20:17:14 -0700 Joe Perches wrote: > > > Comparisons of A to true and false are better written > > as A and !A. > > > > Bleat a message on use. > > hm. I'm counting around 1,100 instances of "== true"

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Joe Perches
On Wed, 2013-04-10 at 15:57 -0700, Andrew Morton wrote: > On Tue, 09 Apr 2013 20:17:14 -0700 Joe Perches wrote: > > Comparisons of A to true and false are better written > > as A and !A. > > Bleat a message on use. > hm. I'm counting around 1,100 instances of "== true" and "== false". And about

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Andrew Morton
On Tue, 09 Apr 2013 20:17:14 -0700 Joe Perches wrote: > Comparisons of A to true and false are better written > as A and !A. > > Bleat a message on use. hm. I'm counting around 1,100 instances of "== true" and "== false". That's a lot of people to shout at. Is it really worthwhile?

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Andy Whitcroft
On Wed, Apr 10, 2013 at 04:27:51AM -0700, Joe Perches wrote: > like > 0 == foo > instead of > foo == 0 > > there were _way_ too many false positives of > the $Expression sort that I didn't add that test. Makes sense then as it is. Thanks. -apw -- To unsubscribe from this list:

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Joe Perches
On Wed, 2013-04-10 at 10:33 +0100, Andy Whitcroft wrote: > On Tue, Apr 09, 2013 at 08:17:14PM -0700, Joe Perches wrote: > > Comparisons of A to true and false are better written > > as A and !A. [] > In a complex case such as a + b == false will this do the right thing? Very sensible question.

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Andy Whitcroft
On Tue, Apr 09, 2013 at 08:17:14PM -0700, Joe Perches wrote: > Comparisons of A to true and false are better written > as A and !A. > > Bleat a message on use. > > Signed-off-by: Joe Perches > --- > scripts/checkpatch.pl | 17 + > 1 file changed, 17 insertions(+) > > diff

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Andy Whitcroft
On Tue, Apr 09, 2013 at 08:17:14PM -0700, Joe Perches wrote: Comparisons of A to true and false are better written as A and !A. Bleat a message on use. Signed-off-by: Joe Perches j...@perches.com --- scripts/checkpatch.pl | 17 + 1 file changed, 17 insertions(+) diff

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Joe Perches
On Wed, 2013-04-10 at 10:33 +0100, Andy Whitcroft wrote: On Tue, Apr 09, 2013 at 08:17:14PM -0700, Joe Perches wrote: Comparisons of A to true and false are better written as A and !A. [] In a complex case such as a + b == false will this do the right thing? Very sensible question. No it

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Andy Whitcroft
On Wed, Apr 10, 2013 at 04:27:51AM -0700, Joe Perches wrote: like 0 == foo instead of foo == 0 there were _way_ too many false positives of the $Expression sort that I didn't add that test. Makes sense then as it is. Thanks. -apw -- To unsubscribe from this list: send the

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Andrew Morton
On Tue, 09 Apr 2013 20:17:14 -0700 Joe Perches j...@perches.com wrote: Comparisons of A to true and false are better written as A and !A. Bleat a message on use. hm. I'm counting around 1,100 instances of == true and == false. That's a lot of people to shout at. Is it really worthwhile?

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Joe Perches
On Wed, 2013-04-10 at 15:57 -0700, Andrew Morton wrote: On Tue, 09 Apr 2013 20:17:14 -0700 Joe Perches j...@perches.com wrote: Comparisons of A to true and false are better written as A and !A. Bleat a message on use. hm. I'm counting around 1,100 instances of == true and == false. And

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Dave Jones
On Wed, Apr 10, 2013 at 03:57:51PM -0700, Andrew Morton wrote: On Tue, 09 Apr 2013 20:17:14 -0700 Joe Perches j...@perches.com wrote: Comparisons of A to true and false are better written as A and !A. Bleat a message on use. hm. I'm counting around 1,100 instances of ==

Re: [PATCH] checkpatch: Warn on comparisons to true and false

2013-04-10 Thread Joe Perches
On Wed, 2013-04-10 at 22:14 -0400, Dave Jones wrote: It would be interesting to see how many people have historically screwed up and used (!a) when they mean (a) and vice versa, versus spelling it out longform. I'd be surprised if the results weren't skewed in favour of the more verbose

[PATCH] checkpatch: Warn on comparisons to true and false

2013-04-09 Thread Joe Perches
Comparisons of A to true and false are better written as A and !A. Bleat a message on use. Signed-off-by: Joe Perches --- scripts/checkpatch.pl | 17 + 1 file changed, 17 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 3fb6d86..080e7f6 100755 ---

[PATCH] checkpatch: Warn on comparisons to true and false

2013-04-09 Thread Joe Perches
Comparisons of A to true and false are better written as A and !A. Bleat a message on use. Signed-off-by: Joe Perches j...@perches.com --- scripts/checkpatch.pl | 17 + 1 file changed, 17 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index