* [PATCH] iio: iio_utils: accept channels with no offset
@ 2015-08-07 9:21 Linus Walleij
2015-08-07 14:07 ` Joo Aun Saw
0 siblings, 1 reply; 2+ messages in thread
From: Linus Walleij @ 2015-08-07 9:21 UTC (permalink / raw)
To: Jonathan Cameron, linux-iio; +Cc: Linus Walleij
The function build_channel_array() will currently bail out
if the IIO device does not have a *_offset sysfs file. However
this offset is not compulsory, see
Documentation/ABI/testing/sysfs-bus-iio, and the ST sensors
does not provide an offset so the functions fail with these
sensors.
Fix this by alloing the offset check to return -ENOENT and if
it does, assume the offset is zero as per the ABI.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
tools/iio/iio_utils.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
index ec9ab7f9ae4c..9ea4b7c79558 100644
--- a/tools/iio/iio_utils.c
+++ b/tools/iio/iio_utils.c
@@ -479,7 +479,10 @@ int build_channel_array(const char *device_dir,
device_dir,
current->name,
current->generic_name);
- if (ret < 0)
+ if (ret == -ENOENT) {
+ /* Assume zero offset if not present */
+ current->offset = 0.0;
+ } else if (ret < 0)
goto error_cleanup_array;
ret = iioutils_get_type(¤t->is_signed,
¤t->bytes,
--
2.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: iio_utils: accept channels with no offset
2015-08-07 9:21 [PATCH] iio: iio_utils: accept channels with no offset Linus Walleij
@ 2015-08-07 14:07 ` Joo Aun Saw
0 siblings, 0 replies; 2+ messages in thread
From: Joo Aun Saw @ 2015-08-07 14:07 UTC (permalink / raw)
To: Linus Walleij; +Cc: Jonathan Cameron, linux-iio
On Fri, Aug 7, 2015 at 7:21 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> The function build_channel_array() will currently bail out
> if the IIO device does not have a *_offset sysfs file. However
> this offset is not compulsory, see
> Documentation/ABI/testing/sysfs-bus-iio, and the ST sensors
> does not provide an offset so the functions fail with these
> sensors.
>
> Fix this by alloing the offset check to return -ENOENT and if
> it does, assume the offset is zero as per the ABI.
I've already submitted a patch to fix this some time ago.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> tools/iio/iio_utils.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c
> index ec9ab7f9ae4c..9ea4b7c79558 100644
> --- a/tools/iio/iio_utils.c
> +++ b/tools/iio/iio_utils.c
> @@ -479,7 +479,10 @@ int build_channel_array(const char *device_dir,
> device_dir,
> current->name,
> current->generic_name);
> - if (ret < 0)
> + if (ret == -ENOENT) {
> + /* Assume zero offset if not present */
> + current->offset = 0.0;
> + } else if (ret < 0)
> goto error_cleanup_array;
> ret = iioutils_get_type(¤t->is_signed,
> ¤t->bytes,
> --
> 2.4.3
>
> --
> 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
Joo.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-07 14:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-07 9:21 [PATCH] iio: iio_utils: accept channels with no offset Linus Walleij
2015-08-07 14:07 ` Joo Aun Saw
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.