diff options
author | Sean Nyekjaer <sean.nyekjaer@prevas.dk> | 2015-11-09 12:55:34 (GMT) |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-11-15 10:53:34 (GMT) |
commit | f47dff323088462e7b0ac52d1ba41ce953a5ce20 (patch) | |
tree | 28f8aa87ee7038d836fa63914f7278a16c9c3b88 /drivers/iio | |
parent | 34dc578d99449a83dcb0f5ef4444215590183af4 (diff) | |
download | linux-f47dff323088462e7b0ac52d1ba41ce953a5ce20.tar.xz |
iio: core: added support for IIO_VAL_INT
Added core support for IIO_VAL_INT in write_raw_get_fmt function.
Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/industrialio-core.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 208358f..d0a84fe 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -512,6 +512,12 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int i = 0, f = 0; bool integer_part = true, negative = false; + if (fract_mult == 0) { + *fract = 0; + + return kstrtoint(str, 0, integer); + } + if (str[0] == '-') { negative = true; str++; @@ -571,6 +577,9 @@ static ssize_t iio_write_channel_info(struct device *dev, if (indio_dev->info->write_raw_get_fmt) switch (indio_dev->info->write_raw_get_fmt(indio_dev, this_attr->c, this_attr->address)) { + case IIO_VAL_INT: + fract_mult = 0; + break; case IIO_VAL_INT_PLUS_MICRO: fract_mult = 100000; break; |