iio: gts: Simplify available scale table build
authorMatti Vaittinen <mazziesaccount@gmail.com>
Mon, 16 Dec 2024 08:56:37 +0000 (10:56 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 3 Feb 2025 19:15:38 +0000 (19:15 +0000)
commit32f80e203401da168826a023d667918b936f85a8
treec67d92194616e5039e1eb6291222ba1b89b71ec8
parent6eaf49f1ba15752f2c13621e5ddf27edf34a35a9
iio: gts: Simplify available scale table build

Make available scale building more clear. This hurts the performance
quite a bit by looping throgh the scales many times instead of doing
everything in one loop. It however simplifies logic by:
 - decoupling the gain and scale allocations & computations
 - keeping the temporary 'per_time_gains' table inside the
   per_time_scales computation function.
 - separating building the 'all scales' table in own function and doing
   it based on the already computed per-time scales.

Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Tested-by: subhajit.ghosh@tweaklogic.com
Link: https://patch.msgid.link/Z1_rRXqdhxhL6wBw@mva-rohm
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-gts-helper.c