]> 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>
Fri, 4 Oct 2024 14:29:38 +0000 (16:29 +0200)
commit48617707401e8e2179d749e35d83f36252f232bc
treee37f9b261490ac37b3f72c33b8f2fc9f430b6670
parent30b9bf4b4107ce45316a41cfda2589f70e6a7f9b
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