]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: adc: ad4030: don't store scan_type in state
authorDavid Lechner <dlechner@baylibre.com>
Mon, 10 Mar 2025 20:43:07 +0000 (15:43 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 7 Apr 2025 18:34:11 +0000 (19:34 +0100)
commit15ffee89c7c6d8ac3509e301dd29bab687323133
treeb0ccfc0183788fa2e93d93aa9a4ee5182d07fd80
parentefaa981e679ac0cbc8d89b69aa4595e422826329
iio: adc: ad4030: don't store scan_type in state

Move getting the scan_type to ad4030_conversion(). Previously, we were
getting the scan_type in two other places, then storing it in the
state struct before using it in ad4030_conversion(). This was a bit
fragile against potential future changes since it isn't obvious that
anything that could potentially change the scan_type would need to
also update the state struct. Also, the non-obviousness of this led to
a redundant call to iio_get_current_scan_type() in
ad4030_single_conversion() since it also calls ad4030_set_mode() which
in turn calls ad4030_conversion().

To simplify things, just call iio_get_current_scan_type() in
ad4030_conversion() where the returned struct is actually used and
don't bother storing it in the state struct.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250310-iio-adc-ad4030-check-scan-type-err-v1-4-589e4ebd9711@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/ad4030.c