From: Dan Carpenter <dan.carpenter@oracle.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Stefan Popa <stefan.popa@analog.com>,
jic23@kernel.org, devel@driverdev.osuosl.org,
Michael.Hennerich@analog.com, linux-iio@vger.kernel.org,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
pmeerw@pmeerw.net, knaack.h@gmx.de
Subject: Re: [PATCH 1/2] staging: iio: ad7606: Move out of staging
Date: Thu, 18 Oct 2018 21:37:40 +0300 [thread overview]
Message-ID: <20181018183740.ynxnplac6ca4wxf7@mwanda> (raw)
In-Reply-To: <2199f866-4c23-5424-3459-b966514414ce@metafoo.de>
On Thu, Oct 18, 2018 at 07:19:36PM +0200, Lars-Peter Clausen wrote:
> On 10/18/2018 02:55 PM, Dan Carpenter wrote:
> > On Thu, Oct 18, 2018 at 12:10:32PM +0300, Stefan Popa wrote:
> >> +static int ad7606_read_samples(struct ad7606_state *st)
> >> +{
> >> + unsigned int num = st->chip_info->num_channels;
> >> + u16 *data = st->data;
> >> + int ret;
> >> +
> >> + /*
> >> + * The frstdata signal is set to high while and after reading the sample
> >> + * of the first channel and low for all other channels. This can be used
> >> + * to check that the incoming data is correctly aligned. During normal
> >> + * operation the data should never become unaligned, but some glitch or
> >> + * electrostatic discharge might cause an extra read or clock cycle.
> >> + * Monitoring the frstdata signal allows to recover from such failure
> >> + * situations.
> >> + */
> >> +
> >> + if (st->gpio_frstdata) {
> >> + ret = st->bops->read_block(st->dev, 1, data);
> >> + if (ret)
> >> + return ret;
> >> +
> >> + if (!gpiod_get_value(st->gpio_frstdata)) {
> >
> > This check should maybe be:
> >
> > if (gpiod_get_value(st->gpio_frstdata) <= 0) {
> >
> > (Or possibly not, I don't know the code very well).
>
> gpiod_get_value() is only allowed to return either 0 or 1.
It looks like it can return negative error codes as well.
regards,
dan carpenter
next prev parent reply other threads:[~2018-10-18 18:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 9:10 [PATCH 1/2] staging: iio: ad7606: Move out of staging Stefan Popa
2018-10-18 12:55 ` Dan Carpenter
2018-10-18 17:19 ` Lars-Peter Clausen
2018-10-18 18:37 ` Dan Carpenter [this message]
2018-10-21 17:40 ` Jonathan Cameron
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=20181018183740.ynxnplac6ca4wxf7@mwanda \
--to=dan.carpenter@oracle.com \
--cc=Michael.Hennerich@analog.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=stefan.popa@analog.com \
/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;
as well as URLs for NNTP newsgroup(s).