* [PATCH] iio: adc: tsl4030: Use false / true instead of 0 / 1 with booleans
@ 2019-10-13 16:37 jic23
2019-10-20 13:06 ` Sebastian Reichel
0 siblings, 1 reply; 3+ messages in thread
From: jic23 @ 2019-10-13 16:37 UTC (permalink / raw)
To: linux-iio; +Cc: Jonathan Cameron, Sebastian Reichel
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Suggestion from coccinelle / coccicheck
CHECK drivers/iio/adc/twl4030-madc.c
drivers/iio/adc/twl4030-madc.c:524:6-15: WARNING: Comparison of 0/1 to bool variable
drivers/iio/adc/twl4030-madc.c:655:1-43: WARNING: Assignment of 0/1 to bool variable
drivers/iio/adc/twl4030-madc.c:659:2-44: WARNING: Assignment of 0/1 to bool variable
drivers/iio/adc/twl4030-madc.c:664:1-43: WARNING: Assignment of 0/1 to bool variable
drivers/iio/adc/twl4030-madc.c:498:2-34: WARNING: Assignment of 0/1 to bool variable
drivers/iio/adc/twl4030-madc.c:510:2-19: WARNING: Assignment of 0/1 to bool variable
drivers/iio/adc/twl4030-madc.c:511:2-11: WARNING: Assignment of 0/1 to bool variable
drivers/iio/adc/twl4030-madc.c:531:2-19: WARNING: Assignment of 0/1 to bool variable
drivers/iio/adc/twl4030-madc.c:532:2-11: WARNING: Assignment of 0/1 to bool variable
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Sebastian Reichel <sre@kernel.org>
---
drivers/iio/adc/twl4030-madc.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
index 55c5119fe575..472b08f37fea 100644
--- a/drivers/iio/adc/twl4030-madc.c
+++ b/drivers/iio/adc/twl4030-madc.c
@@ -495,7 +495,7 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
ret = twl4030_madc_disable_irq(madc, i);
if (ret < 0)
dev_dbg(madc->dev, "Disable interrupt failed %d\n", i);
- madc->requests[i].result_pending = 1;
+ madc->requests[i].result_pending = true;
}
for (i = 0; i < TWL4030_MADC_NUM_METHODS; i++) {
r = &madc->requests[i];
@@ -507,8 +507,8 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
len = twl4030_madc_read_channels(madc, method->rbase,
r->channels, r->rbuf, r->raw);
/* Free request */
- r->result_pending = 0;
- r->active = 0;
+ r->result_pending = false;
+ r->active = false;
}
mutex_unlock(&madc->lock);
@@ -521,15 +521,15 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
*/
for (i = 0; i < TWL4030_MADC_NUM_METHODS; i++) {
r = &madc->requests[i];
- if (r->active == 0)
+ if (!r->active)
continue;
method = &twl4030_conversion_methods[r->method];
/* Read results */
len = twl4030_madc_read_channels(madc, method->rbase,
r->channels, r->rbuf, r->raw);
/* Free request */
- r->result_pending = 0;
- r->active = 0;
+ r->result_pending = false;
+ r->active = false;
}
mutex_unlock(&madc->lock);
@@ -652,16 +652,16 @@ static int twl4030_madc_conversion(struct twl4030_madc_request *req)
ret = twl4030_madc_start_conversion(twl4030_madc, req->method);
if (ret < 0)
goto out;
- twl4030_madc->requests[req->method].active = 1;
+ twl4030_madc->requests[req->method].active = true;
/* Wait until conversion is ready (ctrl register returns EOC) */
ret = twl4030_madc_wait_conversion_ready(twl4030_madc, 5, method->ctrl);
if (ret) {
- twl4030_madc->requests[req->method].active = 0;
+ twl4030_madc->requests[req->method].active = false;
goto out;
}
ret = twl4030_madc_read_channels(twl4030_madc, method->rbase,
req->channels, req->rbuf, req->raw);
- twl4030_madc->requests[req->method].active = 0;
+ twl4030_madc->requests[req->method].active = false;
out:
mutex_unlock(&twl4030_madc->lock);
--
2.23.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: tsl4030: Use false / true instead of 0 / 1 with booleans
2019-10-13 16:37 [PATCH] iio: adc: tsl4030: Use false / true instead of 0 / 1 with booleans jic23
@ 2019-10-20 13:06 ` Sebastian Reichel
2019-10-22 10:26 ` Jonathan Cameron
0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Reichel @ 2019-10-20 13:06 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, Jonathan Cameron
[-- Attachment #1: Type: text/plain, Size: 3893 bytes --]
Hi,
On Sun, Oct 13, 2019 at 05:37:54PM +0100, jic23@kernel.org wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Suggestion from coccinelle / coccicheck
>
> CHECK drivers/iio/adc/twl4030-madc.c
> drivers/iio/adc/twl4030-madc.c:524:6-15: WARNING: Comparison of 0/1 to bool variable
> drivers/iio/adc/twl4030-madc.c:655:1-43: WARNING: Assignment of 0/1 to bool variable
> drivers/iio/adc/twl4030-madc.c:659:2-44: WARNING: Assignment of 0/1 to bool variable
> drivers/iio/adc/twl4030-madc.c:664:1-43: WARNING: Assignment of 0/1 to bool variable
> drivers/iio/adc/twl4030-madc.c:498:2-34: WARNING: Assignment of 0/1 to bool variable
> drivers/iio/adc/twl4030-madc.c:510:2-19: WARNING: Assignment of 0/1 to bool variable
> drivers/iio/adc/twl4030-madc.c:511:2-11: WARNING: Assignment of 0/1 to bool variable
> drivers/iio/adc/twl4030-madc.c:531:2-19: WARNING: Assignment of 0/1 to bool variable
> drivers/iio/adc/twl4030-madc.c:532:2-11: WARNING: Assignment of 0/1 to bool variable
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Cc: Sebastian Reichel <sre@kernel.org>
> ---
Apart from the typo in the patch subject (tsl4030 vs twl4030):
Reviewed-by: Sebastian Reichel <sre@kernel.org>
-- Sebastian
> drivers/iio/adc/twl4030-madc.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
> index 55c5119fe575..472b08f37fea 100644
> --- a/drivers/iio/adc/twl4030-madc.c
> +++ b/drivers/iio/adc/twl4030-madc.c
> @@ -495,7 +495,7 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
> ret = twl4030_madc_disable_irq(madc, i);
> if (ret < 0)
> dev_dbg(madc->dev, "Disable interrupt failed %d\n", i);
> - madc->requests[i].result_pending = 1;
> + madc->requests[i].result_pending = true;
> }
> for (i = 0; i < TWL4030_MADC_NUM_METHODS; i++) {
> r = &madc->requests[i];
> @@ -507,8 +507,8 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
> len = twl4030_madc_read_channels(madc, method->rbase,
> r->channels, r->rbuf, r->raw);
> /* Free request */
> - r->result_pending = 0;
> - r->active = 0;
> + r->result_pending = false;
> + r->active = false;
> }
> mutex_unlock(&madc->lock);
>
> @@ -521,15 +521,15 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
> */
> for (i = 0; i < TWL4030_MADC_NUM_METHODS; i++) {
> r = &madc->requests[i];
> - if (r->active == 0)
> + if (!r->active)
> continue;
> method = &twl4030_conversion_methods[r->method];
> /* Read results */
> len = twl4030_madc_read_channels(madc, method->rbase,
> r->channels, r->rbuf, r->raw);
> /* Free request */
> - r->result_pending = 0;
> - r->active = 0;
> + r->result_pending = false;
> + r->active = false;
> }
> mutex_unlock(&madc->lock);
>
> @@ -652,16 +652,16 @@ static int twl4030_madc_conversion(struct twl4030_madc_request *req)
> ret = twl4030_madc_start_conversion(twl4030_madc, req->method);
> if (ret < 0)
> goto out;
> - twl4030_madc->requests[req->method].active = 1;
> + twl4030_madc->requests[req->method].active = true;
> /* Wait until conversion is ready (ctrl register returns EOC) */
> ret = twl4030_madc_wait_conversion_ready(twl4030_madc, 5, method->ctrl);
> if (ret) {
> - twl4030_madc->requests[req->method].active = 0;
> + twl4030_madc->requests[req->method].active = false;
> goto out;
> }
> ret = twl4030_madc_read_channels(twl4030_madc, method->rbase,
> req->channels, req->rbuf, req->raw);
> - twl4030_madc->requests[req->method].active = 0;
> + twl4030_madc->requests[req->method].active = false;
>
> out:
> mutex_unlock(&twl4030_madc->lock);
> --
> 2.23.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] iio: adc: tsl4030: Use false / true instead of 0 / 1 with booleans
2019-10-20 13:06 ` Sebastian Reichel
@ 2019-10-22 10:26 ` Jonathan Cameron
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2019-10-22 10:26 UTC (permalink / raw)
To: Sebastian Reichel; +Cc: linux-iio, Jonathan Cameron
On Sun, 20 Oct 2019 15:06:44 +0200
Sebastian Reichel <sre@kernel.org> wrote:
> Hi,
>
> On Sun, Oct 13, 2019 at 05:37:54PM +0100, jic23@kernel.org wrote:
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > Suggestion from coccinelle / coccicheck
> >
> > CHECK drivers/iio/adc/twl4030-madc.c
> > drivers/iio/adc/twl4030-madc.c:524:6-15: WARNING: Comparison of 0/1 to bool variable
> > drivers/iio/adc/twl4030-madc.c:655:1-43: WARNING: Assignment of 0/1 to bool variable
> > drivers/iio/adc/twl4030-madc.c:659:2-44: WARNING: Assignment of 0/1 to bool variable
> > drivers/iio/adc/twl4030-madc.c:664:1-43: WARNING: Assignment of 0/1 to bool variable
> > drivers/iio/adc/twl4030-madc.c:498:2-34: WARNING: Assignment of 0/1 to bool variable
> > drivers/iio/adc/twl4030-madc.c:510:2-19: WARNING: Assignment of 0/1 to bool variable
> > drivers/iio/adc/twl4030-madc.c:511:2-11: WARNING: Assignment of 0/1 to bool variable
> > drivers/iio/adc/twl4030-madc.c:531:2-19: WARNING: Assignment of 0/1 to bool variable
> > drivers/iio/adc/twl4030-madc.c:532:2-11: WARNING: Assignment of 0/1 to bool variable
> >
> > Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> > Cc: Sebastian Reichel <sre@kernel.org>
> > ---
>
> Apart from the typo in the patch subject (tsl4030 vs twl4030):
>
Fixed :)
> Reviewed-by: Sebastian Reichel <sre@kernel.org>
Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to poke at it.
Thanks,
Jonathan
>
> -- Sebastian
>
> > drivers/iio/adc/twl4030-madc.c | 18 +++++++++---------
> > 1 file changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/iio/adc/twl4030-madc.c b/drivers/iio/adc/twl4030-madc.c
> > index 55c5119fe575..472b08f37fea 100644
> > --- a/drivers/iio/adc/twl4030-madc.c
> > +++ b/drivers/iio/adc/twl4030-madc.c
> > @@ -495,7 +495,7 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
> > ret = twl4030_madc_disable_irq(madc, i);
> > if (ret < 0)
> > dev_dbg(madc->dev, "Disable interrupt failed %d\n", i);
> > - madc->requests[i].result_pending = 1;
> > + madc->requests[i].result_pending = true;
> > }
> > for (i = 0; i < TWL4030_MADC_NUM_METHODS; i++) {
> > r = &madc->requests[i];
> > @@ -507,8 +507,8 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
> > len = twl4030_madc_read_channels(madc, method->rbase,
> > r->channels, r->rbuf, r->raw);
> > /* Free request */
> > - r->result_pending = 0;
> > - r->active = 0;
> > + r->result_pending = false;
> > + r->active = false;
> > }
> > mutex_unlock(&madc->lock);
> >
> > @@ -521,15 +521,15 @@ static irqreturn_t twl4030_madc_threaded_irq_handler(int irq, void *_madc)
> > */
> > for (i = 0; i < TWL4030_MADC_NUM_METHODS; i++) {
> > r = &madc->requests[i];
> > - if (r->active == 0)
> > + if (!r->active)
> > continue;
> > method = &twl4030_conversion_methods[r->method];
> > /* Read results */
> > len = twl4030_madc_read_channels(madc, method->rbase,
> > r->channels, r->rbuf, r->raw);
> > /* Free request */
> > - r->result_pending = 0;
> > - r->active = 0;
> > + r->result_pending = false;
> > + r->active = false;
> > }
> > mutex_unlock(&madc->lock);
> >
> > @@ -652,16 +652,16 @@ static int twl4030_madc_conversion(struct twl4030_madc_request *req)
> > ret = twl4030_madc_start_conversion(twl4030_madc, req->method);
> > if (ret < 0)
> > goto out;
> > - twl4030_madc->requests[req->method].active = 1;
> > + twl4030_madc->requests[req->method].active = true;
> > /* Wait until conversion is ready (ctrl register returns EOC) */
> > ret = twl4030_madc_wait_conversion_ready(twl4030_madc, 5, method->ctrl);
> > if (ret) {
> > - twl4030_madc->requests[req->method].active = 0;
> > + twl4030_madc->requests[req->method].active = false;
> > goto out;
> > }
> > ret = twl4030_madc_read_channels(twl4030_madc, method->rbase,
> > req->channels, req->rbuf, req->raw);
> > - twl4030_madc->requests[req->method].active = 0;
> > + twl4030_madc->requests[req->method].active = false;
> >
> > out:
> > mutex_unlock(&twl4030_madc->lock);
> > --
> > 2.23.0
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-22 10:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-13 16:37 [PATCH] iio: adc: tsl4030: Use false / true instead of 0 / 1 with booleans jic23
2019-10-20 13:06 ` Sebastian Reichel
2019-10-22 10:26 ` Jonathan Cameron
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.