linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] leds: always true: (x != 1 || x != 2)
@ 2009-02-03 15:34 Roel Kluin
  2009-02-06 18:05 ` Roland Dreier
  0 siblings, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2009-02-03 15:34 UTC (permalink / raw)
  To: riku.voipio, rpurdie, lkml

see vi include/linux/input.h +710:

#define SND_BELL                0x01
#define SND_TONE                0x02

so (code != SND_BELL || code != SND_TONE) is always true 

I think this was intended?
--------------------->8------------------8<-----------------------
(code != SND_BELL || code != SND_TONE) is always true 

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index 76ec749..6a481cf 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -169,7 +169,7 @@ static int pca9532_event(struct input_dev *dev, unsigned int type,
 {
 	struct pca9532_data *data = input_get_drvdata(dev);
 
-	if (type != EV_SND && (code != SND_BELL || code != SND_TONE))
+	if (type != EV_SND && (code != SND_BELL && code != SND_TONE))
 		return -1;
 
 	/* XXX: allow different kind of beeps with psc/pwm modifications */

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

* Re: [PATCH] leds: always true: (x != 1 || x != 2)
  2009-02-03 15:34 [PATCH] leds: always true: (x != 1 || x != 2) Roel Kluin
@ 2009-02-06 18:05 ` Roland Dreier
  2009-02-06 18:51   ` [PATCH v2] leds: Fix &&/|| confusion Roel Kluin
  0 siblings, 1 reply; 4+ messages in thread
From: Roland Dreier @ 2009-02-06 18:05 UTC (permalink / raw)
  To: Roel Kluin; +Cc: riku.voipio, rpurdie, lkml

 > -	if (type != EV_SND && (code != SND_BELL || code != SND_TONE))
 > +	if (type != EV_SND && (code != SND_BELL && code != SND_TONE))

Actually more likely seems to be

	if (type != EV_SND || (code != SND_BELL && code != SND_TONE))

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

* [PATCH v2] leds: Fix &&/|| confusion
  2009-02-06 18:05 ` Roland Dreier
@ 2009-02-06 18:51   ` Roel Kluin
  2009-03-03 20:13     ` Riku Voipio
  0 siblings, 1 reply; 4+ messages in thread
From: Roel Kluin @ 2009-02-06 18:51 UTC (permalink / raw)
  To: Roland Dreier; +Cc: riku.voipio, rpurdie, lkml

Roland Dreier wrote:
>  > -	if (type != EV_SND && (code != SND_BELL || code != SND_TONE))
>  > +	if (type != EV_SND && (code != SND_BELL && code != SND_TONE))
> 
> Actually more likely seems to be
> 
> 	if (type != EV_SND || (code != SND_BELL && code != SND_TONE))

Thanks for your review,

----------------------->8--------------8<-------------------------------
Fix &&/|| confusion

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index 76ec749..11d3f1e 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -169,7 +169,7 @@ static int pca9532_event(struct input_dev *dev, unsigned int type,
 {
 	struct pca9532_data *data = input_get_drvdata(dev);
 
-	if (type != EV_SND && (code != SND_BELL || code != SND_TONE))
+	if (type != EV_SND || (code != SND_BELL && code != SND_TONE))
 		return -1;
 
 	/* XXX: allow different kind of beeps with psc/pwm modifications */

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

* Re: [PATCH v2] leds: Fix &&/|| confusion
  2009-02-06 18:51   ` [PATCH v2] leds: Fix &&/|| confusion Roel Kluin
@ 2009-03-03 20:13     ` Riku Voipio
  0 siblings, 0 replies; 4+ messages in thread
From: Riku Voipio @ 2009-03-03 20:13 UTC (permalink / raw)
  To: Roel Kluin; +Cc: Roland Dreier, rpurdie, lkml

[-- Attachment #1: Type: text/plain, Size: 1516 bytes --]

On Fri, Feb 06, 2009 at 07:51:13PM +0100, Roel Kluin wrote:
> Roland Dreier wrote:
> >  > -	if (type != EV_SND && (code != SND_BELL || code != SND_TONE))
> >  > +	if (type != EV_SND && (code != SND_BELL && code != SND_TONE))
> > 
> > Actually more likely seems to be
> > 
> > 	if (type != EV_SND || (code != SND_BELL && code != SND_TONE))
> 
> Thanks for your review,

I think what I want is:

	if (!(type==EV_SND && (code == SND_BELL || code == SND_TONE)))

Not that I think anyone would send SND_* without EV_SND.

From 725c752a53a83319042dcdaccf072908b29d1c40 Mon Sep 17 00:00:00 2001
From: Riku Voipio <riku.voipio@iki.fi>
Date: Tue, 3 Mar 2009 22:06:51 +0200
Subject: [PATCH 19/19] [PATCH v2] leds: Fix &&/|| confusion

Thanks to Roel Kluin <roel.kluin@gmail.com> for noticing.

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
---
 drivers/leds/leds-pca9532.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index a46d208..dba8921 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -169,7 +169,7 @@ static int pca9532_event(struct input_dev *dev, unsigned int type,
 {
 	struct pca9532_data *data = input_get_drvdata(dev);
 
-	if (type != EV_SND && (code != SND_BELL || code != SND_TONE))
+	if (!(type == EV_SND && (code == SND_BELL || code == SND_TONE)))
 		return -1;
 
 	/* XXX: allow different kind of beeps with psc/pwm modifications */
-- 
1.6.1.3


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

end of thread, other threads:[~2009-03-03 20:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-03 15:34 [PATCH] leds: always true: (x != 1 || x != 2) Roel Kluin
2009-02-06 18:05 ` Roland Dreier
2009-02-06 18:51   ` [PATCH v2] leds: Fix &&/|| confusion Roel Kluin
2009-03-03 20:13     ` Riku Voipio

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).