]> www.infradead.org Git - users/jedix/linux-maple.git/commit
iio: fix scale application in iio_convert_raw_to_processed_unlocked
authorMatteo Martelli <matteomartelli3@gmail.com>
Tue, 30 Jul 2024 08:11:53 +0000 (10:11 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 3 Aug 2024 15:29:32 +0000 (16:29 +0100)
commit8a3dcc970dc57b358c8db2702447bf0af4e0d83a
treed44655e7f946586a31e361fad3f9c0663285f72a
parent2f6b92d0f69f04d9e2ea0db1228ab7f82f3173af
iio: fix scale application in iio_convert_raw_to_processed_unlocked

When the scale_type is IIO_VAL_INT_PLUS_MICRO or IIO_VAL_INT_PLUS_NANO
the scale passed as argument is only applied to the fractional part of
the value. Fix it by also multiplying the integer part by the scale
provided.

Fixes: 48e44ce0f881 ("iio:inkern: Add function to read the processed value")
Signed-off-by: Matteo Martelli <matteomartelli3@gmail.com>
Link: https://patch.msgid.link/20240730-iio-fix-scale-v1-1-6246638c8daa@gmail.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/inkern.c