]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: gts-helper: Fix division loop
authorMatti Vaittinen <mazziesaccount@gmail.com>
Mon, 12 Feb 2024 11:20:09 +0000 (13:20 +0200)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:20:05 +0000 (18:20 -0400)
commit9066bec62f52a6a08941689879b79c512a28fed2
tree822fb3f2af894c076a69fa35ddf579863c440efb
parent3328ff75f642b57d98dfa3fe4bd1f2f05cb0454c
iio: gts-helper: Fix division loop

[ Upstream commit bb76cc45dcdfcd962a5994b8fe19ab74fc6c3c3a ]

The loop based 64bit division may run for a long time when dividend is a
lot bigger than the divider. Replace the division loop by the
div64_u64() which implementation may be significantly faster.

Tested-by: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Fixes: 38416c28e168 ("iio: light: Add gain-time-scale helpers")
Link: https://lore.kernel.org/r/Zcn-6e-0-nh2WcfU@drtxq0yyyyyyyyyyyyyby-3.rev.dnainternet.fi
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/industrialio-gts-helper.c