* [PATCH] drivers: iio: max1027: Fix sparse warning: "dubious: x | !y"
@ 2016-09-23 6:13 Sandhya Bankar
2016-09-23 15:22 ` Lars-Peter Clausen
0 siblings, 1 reply; 3+ messages in thread
From: Sandhya Bankar @ 2016-09-23 6:13 UTC (permalink / raw)
To: jic23, knaack.h, lars, pmeerw, linux-iio
Fixing below warning:
drivers/iio/adc/max1027.c:241:34: warning: dubious: x | !y .
Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
---
drivers/iio/adc/max1027.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index 712fbd2..b1fee47 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -238,7 +238,9 @@ static int max1027_read_single_value(struct iio_dev *indio_dev,
/* Configure conversion register with the requested chan */
st->reg = MAX1027_CONV_REG | MAX1027_CHAN(chan->channel) |
- MAX1027_NOSCAN | !!(chan->type == IIO_TEMP);
+ MAX1027_NOSCAN;
+ if (chan->type == IIO_TEMP)
+ st->reg |= 1;
ret = spi_write(st->spi, &st->reg, 1);
if (ret < 0) {
dev_err(&indio_dev->dev,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers: iio: max1027: Fix sparse warning: "dubious: x | !y"
2016-09-23 6:13 [PATCH] drivers: iio: max1027: Fix sparse warning: "dubious: x | !y" Sandhya Bankar
@ 2016-09-23 15:22 ` Lars-Peter Clausen
2016-09-23 19:48 ` sandhya bankar
0 siblings, 1 reply; 3+ messages in thread
From: Lars-Peter Clausen @ 2016-09-23 15:22 UTC (permalink / raw)
To: Sandhya Bankar, jic23, knaack.h, pmeerw, linux-iio
On 09/23/2016 08:13 AM, Sandhya Bankar wrote:
> Fixing below warning:
> drivers/iio/adc/max1027.c:241:34: warning: dubious: x | !y .
>
> Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Hi,
Thanks for the patch. Looks good in general, just one minor detail
> ---
> drivers/iio/adc/max1027.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> index 712fbd2..b1fee47 100644
> --- a/drivers/iio/adc/max1027.c
> +++ b/drivers/iio/adc/max1027.c
> @@ -238,7 +238,9 @@ static int max1027_read_single_value(struct iio_dev *indio_dev,
>
> /* Configure conversion register with the requested chan */
> st->reg = MAX1027_CONV_REG | MAX1027_CHAN(chan->channel) |
> - MAX1027_NOSCAN | !!(chan->type == IIO_TEMP);
> + MAX1027_NOSCAN;
> + if (chan->type == IIO_TEMP)
> + st->reg |= 1;
The driver has a symbolic constant defined for this 'MAX1027_TEMP'. Using
this instead of the number makes it clear what the semantic meaning of the
value is.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drivers: iio: max1027: Fix sparse warning: "dubious: x | !y"
2016-09-23 15:22 ` Lars-Peter Clausen
@ 2016-09-23 19:48 ` sandhya bankar
0 siblings, 0 replies; 3+ messages in thread
From: sandhya bankar @ 2016-09-23 19:48 UTC (permalink / raw)
To: Lars-Peter Clausen
Cc: jic23, knaack.h, Peter Meerwald-Stadler, linux-iio,
Daniel Baluta, Alison Schofield
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
On Fri, Sep 23, 2016 at 8:52 PM, Lars-Peter Clausen <lars@metafoo.de> wrote:
> On 09/23/2016 08:13 AM, Sandhya Bankar wrote:
> > Fixing below warning:
> > drivers/iio/adc/max1027.c:241:34: warning: dubious: x | !y .
> >
> > Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
>
> Hi,
>
> Thanks for the patch. Looks good in general, just one minor detail
>
>
Thanks for review !
I will incorporate your suggestion and send new patch.
Thanks,
Sandhya
> > ---
> > drivers/iio/adc/max1027.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
> > index 712fbd2..b1fee47 100644
> > --- a/drivers/iio/adc/max1027.c
> > +++ b/drivers/iio/adc/max1027.c
> > @@ -238,7 +238,9 @@ static int max1027_read_single_value(struct iio_dev
> *indio_dev,
> >
> > /* Configure conversion register with the requested chan */
> > st->reg = MAX1027_CONV_REG | MAX1027_CHAN(chan->channel) |
> > - MAX1027_NOSCAN | !!(chan->type == IIO_TEMP);
> > + MAX1027_NOSCAN;
> > + if (chan->type == IIO_TEMP)
> > + st->reg |= 1;
>
> The driver has a symbolic constant defined for this 'MAX1027_TEMP'. Using
> this instead of the number makes it clear what the semantic meaning of the
> value is.
>
>
[-- Attachment #2: Type: text/html, Size: 2153 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-23 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-23 6:13 [PATCH] drivers: iio: max1027: Fix sparse warning: "dubious: x | !y" Sandhya Bankar
2016-09-23 15:22 ` Lars-Peter Clausen
2016-09-23 19:48 ` sandhya bankar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.