]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
iio: adc: ad7606: fix oversampling gpio array
authorGuillaume Stols <gstols@baylibre.com>
Tue, 2 Jul 2024 17:34:10 +0000 (17:34 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:06 +0000 (15:11 +0200)
commit2abf0fa4f4b29fe841ede4f006db0f47bc1e7a83
tree6bd1aa267a84d5f044477616b2f686d305513d69
parent7553f7a85cb9001ceaf8a00b8eb0cef39273a81c
iio: adc: ad7606: fix oversampling gpio array

[ Upstream commit 8dc4594b54dbaaba40dc8884ad3d42083de39434 ]

gpiod_set_array_value was misused here: the implementation relied on the
assumption that an unsigned long was required for each gpio, while the
function expects a bit array stored in "as much unsigned long as needed
for storing one bit per GPIO", i.e it is using a bit field.

This leaded to incorrect parameter passed to gpiod_set_array_value, that
would set 1 value instead of 3.
It also prevents to select the software mode correctly for the AD7606B.

Fixes: d2a415c86c6b ("iio: adc: ad7606: Add support for AD7606B ADC")
Fixes: 41f71e5e7daf ("staging: iio: adc: ad7606: Use find_closest() macro")
Signed-off-by: Guillaume Stols <gstols@baylibre.com>
Reviewed-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/iio/adc/ad7606.c
drivers/iio/adc/ad7606_spi.c