All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Matt Ranostay <mranostay@gmail.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: lidar: return -EIO on invalid signal
Date: Sat, 31 Oct 2015 09:29:20 +0000	[thread overview]
Message-ID: <563489F0.3000301@kernel.org> (raw)
In-Reply-To: <1445814438-17163-1-git-send-email-mranostay@gmail.com>

On 25/10/15 23:07, Matt Ranostay wrote:
> Returning zero from the measurment function has the side effect of
> corrupting the triggered buffer readings, better to use -EIO than a
> zero measurement reading.
When you say 'corrupting' what do you mean?  As far as I can quickly see
it will give a spurious 0 distance when it really means a long distance.
Is that what you are referring to?

Jonathan
> 
> Signed-off-by: Matt Ranostay <mranostay@gmail.com>
> ---
>  drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> index 961f9f99..359beac 100644
> --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
> @@ -130,10 +130,10 @@ static int lidar_get_measurement(struct lidar_data *data, u16 *reg)
>  		if (ret < 0)
>  			break;
>  
> -		/* return 0 since laser is likely pointed out of range */
> +		/* return -EIO since laser is likely pointed out of range */
>  		if (ret & LIDAR_REG_STATUS_INVALID) {
>  			*reg = 0;
> -			ret = 0;
> +			ret = -EIO;
>  			break;
>  		}
>  
> 


  reply	other threads:[~2015-10-31  9:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-25 23:07 [PATCH] iio: lidar: return -EIO on invalid signal Matt Ranostay
2015-10-31  9:29 ` Jonathan Cameron [this message]
2015-11-01  0:47   ` Matt Ranostay
2015-11-01 18:31     ` 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=563489F0.3000301@kernel.org \
    --to=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=mranostay@gmail.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 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.