[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181018183740.ynxnplac6ca4wxf7@mwanda>
Date: Thu, 18 Oct 2018 21:37:40 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Lars-Peter Clausen <lars@...afoo.de>
Cc: Stefan Popa <stefan.popa@...log.com>, jic23@...nel.org,
devel@...verdev.osuosl.org, Michael.Hennerich@...log.com,
linux-iio@...r.kernel.org, gregkh@...uxfoundation.org,
linux-kernel@...r.kernel.org, pmeerw@...erw.net, knaack.h@....de
Subject: Re: [PATCH 1/2] staging: iio: ad7606: Move out of staging
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
Powered by blists - more mailing lists