From: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
To: "Andrew F. Davis" <afd@ti.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: dac: mcp4725: Remove unneeded conversions to bool
Date: Fri, 1 Jul 2016 17:03:03 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.02.1607011700150.7271@pmeerw.net> (raw)
In-Reply-To: <20160701143352.17224-1-afd@ti.com>
> Found with scripts/coccinelle/misc/boolconv.cocci.
I'd argue that
pd = (inbuf[0] >> 1) & 0x3;
if (pd) {
data->powerdown = true;
data->powerdown_mode = pd - 1;
} else {
data->powerdown = false;
data->powerdown_mode = 2; /* largest register to gnd */
}
is less compact but probably easier to read/understand;
> Signed-off-by: Andrew F. Davis <afd@ti.com>
but I'm fine with the proposed patch as well to make cocci happy
regards, p.
> ---
> drivers/iio/dac/mcp4725.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c
> index cca935c..c3bb3fd 100644
> --- a/drivers/iio/dac/mcp4725.c
> +++ b/drivers/iio/dac/mcp4725.c
> @@ -361,7 +361,7 @@ static int mcp4725_probe(struct i2c_client *client,
> return err;
> }
> pd = (inbuf[0] >> 1) & 0x3;
> - data->powerdown = pd > 0 ? true : false;
> + data->powerdown = pd > 0;
> data->powerdown_mode = pd ? pd - 1 : 2; /* largest register to gnd */
> data->dac_value = (inbuf[1] << 4) | (inbuf[2] >> 4);
>
>
--
Peter Meerwald-Stadler
+43-664-2444418 (mobile)
next prev parent reply other threads:[~2016-07-01 15:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-01 14:33 Andrew F. Davis
2016-07-01 15:03 ` Peter Meerwald-Stadler [this message]
2016-07-01 15:18 ` Andrew F. Davis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1607011700150.7271@pmeerw.net \
--to=pmeerw@pmeerw.net \
--cc=afd@ti.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®