Commit 5403f280 authored by Mircea Caprioru's avatar Mircea Caprioru Committed by Jonathan Cameron

iio: core: Fix handling of 'dB'

This patch fixes the call to iio_str_to_fixpoint when using 'dB' sufix.
Before this the scale_db was not used when parsing the string written to
the attribute and it failed with invalid value.

Fixes: b8528224 ("iio: core: Handle 'dB' suffix in core")
Signed-off-by: default avatarMircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 6f63c90a
......@@ -909,14 +909,11 @@ static ssize_t iio_write_channel_info(struct device *dev,
return -EINVAL;
integer = ch;
} else {
ret = iio_str_to_fixpoint(buf, fract_mult, &integer, &fract);
ret = __iio_str_to_fixpoint(buf, fract_mult, &integer, &fract,
scale_db);
if (ret)
return ret;
}
ret = __iio_str_to_fixpoint(buf, fract_mult, &integer, &fract,
scale_db);
if (ret)
return ret;
ret = indio_dev->info->write_raw(indio_dev, this_attr->c,
integer, fract, this_attr->address);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment