From: Tristan Lelong <tristan@lelong.xyz>
To: Matt Ranostay <mranostay@gmail.com>
Cc: "Peter Meerwald" <pmeerw@pmeerw.net>,
"Marek Vašut" <marex@denx.de>,
"Jonathan Cameron" <jic23@kernel.org>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Vladimir Barinov" <vladimir.barinov@cogentembedded.com>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] iio: proximity: add support for PulsedLight LIDAR
Date: Tue, 4 Aug 2015 13:35:38 -0700 [thread overview]
Message-ID: <20150804203537.GA22584@localhost.localdomain> (raw)
In-Reply-To: <CAKzfze9ogwcNDw2P4WO1WefTJEuze+zkWVUGPCeFLhQrE6nb=g@mail.gmail.com>
On Mon, Aug 03, 2015 at 01:21:08AM -0700, Matt Ranostay wrote:
> On Sun, Aug 2, 2015 at 11:48 PM, Peter Meerwald <pmeerw@pmeerw.net> wrote:
> > On Sun, 2 Aug 2015, Matt Ranostay wrote:
> >
> >> +
> >> +static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
> >> +{
> >> + struct i2c_client *client = data->client;
> >> + int tries = 10;
> >> + int ret;
> >> +
> >> + /* start sample */
> >> + ret = lidar_write_control(data, LIDAR_REG_CONTROL_ACQUIRE);
> >> + if (ret < 0) {
> >> + dev_err(&client->dev, "cannot send start measurement command");
> >> + return ret;
> >> + }
> >> +
> >> + while (tries--) {
> >> + usleep_range(1000, 2000);
> >> +
> >> + ret = lidar_read_byte(data, LIDAR_REG_STATUS);
> >> + if (ret < 0)
> >> + break;
> >> +
> >> + /* return 0 since laser is likely pointed out of range */
> >> + if (ret & LIDAR_REG_STATUS_INVALID) {
> >> + *reg = 0;
> >> + ret = 0;
> >> + break;
> >> + }
> >> +
> >> + /* sample ready to read */
> >> + if (!(ret & LIDAR_REG_STATUS_READY)) {
> >> + ret = lidar_read_measurement(data, reg);
> >> + break;
> >> + }
> >> + }
> >> +
> >
> > what happens when the timeout occurs?
> > no error code is set
>
> Ah yes it should return an error code. Would a -EIO be a logical choice?
>
I would think -ETIMEDOUT to make more sense here.
next prev parent reply other threads:[~2015-08-04 20:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-03 4:27 [PATCH v2 0/2] iio: proximity: add PulsedLight LIDAR sensor support Matt Ranostay
2015-08-03 4:27 ` [PATCH v2 1/2] devicetree: add PulsedLight vendor prefix Matt Ranostay
2015-08-03 4:27 ` [PATCH v2 2/2] iio: proximity: add support for PulsedLight LIDAR Matt Ranostay
2015-08-03 6:48 ` Peter Meerwald
2015-08-03 8:21 ` Matt Ranostay
2015-08-04 20:35 ` Tristan Lelong [this message]
2015-08-05 1:45 ` Matt Ranostay
2015-08-05 7:13 ` Tristan Lelong
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=20150804203537.GA22584@localhost.localdomain \
--to=tristan@lelong.xyz \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=marex@denx.de \
--cc=mranostay@gmail.com \
--cc=pmeerw@pmeerw.net \
--cc=vladimir.barinov@cogentembedded.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