]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: consumers: Fix offset handling in iio_convert_raw_to_processed()
authorHans de Goede <hansg@kernel.org>
Sun, 31 Aug 2025 10:48:21 +0000 (12:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 09:56:33 +0000 (11:56 +0200)
commit8bcc2be422920ae5fb2197c1b1a79926dc8681e5
treebaa9a445eef6cb81981a1d1cf0c9dc76d175bf31
parent3ac37e100385b59ac821a62118494442238aaac4
iio: consumers: Fix offset handling in iio_convert_raw_to_processed()

[ Upstream commit 33f5c69c4daff39c010b3ea6da8ebab285f4277b ]

Fix iio_convert_raw_to_processed() offset handling for channels without
a scale attribute.

The offset has been applied to the raw64 value not to the original raw
value. Use the raw64 value so that the offset is taken into account.

Fixes: 14b457fdde38 ("iio: inkern: apply consumer scale when no channel scale is available")
Cc: Liam Beguin <liambeguin@gmail.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hansg@kernel.org>
Link: https://patch.msgid.link/20250831104825.15097-3-hansg@kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/inkern.c