2009-03-03 20:13:21

by Riku Voipio

[permalink] [raw]
Subject: Re: [PATCH v2] leds: Fix &&/|| confusion

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 <[email protected]>
Date: Tue, 3 Mar 2009 22:06:51 +0200
Subject: [PATCH 19/19] [PATCH v2] leds: Fix &&/|| confusion

Thanks to Roel Kluin <[email protected]> for noticing.

Signed-off-by: Riku Voipio <[email protected]>
---
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


Attachments:
(No filename) (1.44 kB)
signature.asc (189.00 B)
Digital signature
Download all attachments