* [PATCH] iio: lidar: return -EIO on invalid signal
@ 2015-10-25 23:07 Matt Ranostay
2015-10-31 9:29 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Matt Ranostay @ 2015-10-25 23:07 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, Matt Ranostay
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.
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;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: lidar: return -EIO on invalid signal
2015-10-25 23:07 [PATCH] iio: lidar: return -EIO on invalid signal Matt Ranostay
@ 2015-10-31 9:29 ` Jonathan Cameron
2015-11-01 0:47 ` Matt Ranostay
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2015-10-31 9:29 UTC (permalink / raw)
To: Matt Ranostay; +Cc: linux-iio
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;
> }
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: lidar: return -EIO on invalid signal
2015-10-31 9:29 ` Jonathan Cameron
@ 2015-11-01 0:47 ` Matt Ranostay
2015-11-01 18:31 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Matt Ranostay @ 2015-11-01 0:47 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: linux-iio@vger.kernel.org
Actually the INVALID status happens even it isn't out of range
sometimes roughly once every second or two. This can be from an
invalid second signal return path and etc..
So there are spurious zero readings from the triggered buffer, and
warning messages in the kernel log.
Thanks,
Matt
On Sat, Oct 31, 2015 at 2:29 AM, Jonathan Cameron <jic23@kernel.org> wrote:
> 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;
>> }
>>
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: lidar: return -EIO on invalid signal
2015-11-01 0:47 ` Matt Ranostay
@ 2015-11-01 18:31 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2015-11-01 18:31 UTC (permalink / raw)
To: Matt Ranostay; +Cc: linux-iio@vger.kernel.org
On 01/11/15 00:47, Matt Ranostay wrote:
> Actually the INVALID status happens even it isn't out of range
> sometimes roughly once every second or two. This can be from an
> invalid second signal return path and etc..
>
> So there are spurious zero readings from the triggered buffer, and
> warning messages in the kernel log.
Thanks for the clarification. I've added a version of this response
to the patch description and applied to the fixes-togreg-post-rc1
branch I'm running at the moment as we have a few outstanding fixes
for stuff going in during the merge window that is opening very soon.
>
> Thanks,
>
> Matt
>
> On Sat, Oct 31, 2015 at 2:29 AM, Jonathan Cameron <jic23@kernel.org> wrote:
>> 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;
>>> }
>>>
>>>
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-01 18:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-25 23:07 [PATCH] iio: lidar: return -EIO on invalid signal Matt Ranostay
2015-10-31 9:29 ` Jonathan Cameron
2015-11-01 0:47 ` Matt Ranostay
2015-11-01 18:31 ` Jonathan Cameron
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).