diff mbox series

[03/11] iio: adc: ad7606: fix scales_available attributes

Message ID 20250312-iio-adc-ad7606-improvements-v1-3-d1ec04847aea@baylibre.com (mailing list archive)
State New
Headers show
Series iio: adc: ad7606: improvements and ad7606c parallel interface support | expand

Commit Message

David Lechner March 13, 2025, 1:15 a.m. UTC
Fix the scales_available attributes to return all of the scales, not
just 1/2 of them. Also fix const correctness in the cast while we are
touching this.

Fixes: 94aab7a0f5c7 ("iio: adc: ad7606: rework available attributes for SW channels")
Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/adc/ad7606.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c
index ec444aba25e89ced7b84b723aded3c9dbf2c738b..79929bd24fa40bccfcdd88673107da4bf56e032b 100644
--- a/drivers/iio/adc/ad7606.c
+++ b/drivers/iio/adc/ad7606.c
@@ -1064,8 +1064,8 @@  static int ad7606_read_avail(struct iio_dev *indio_dev,
 			ch = chan->address;
 
 		cs = &st->chan_scales[ch];
-		*vals = (int *)cs->scale_avail;
-		*length = cs->num_scales;
+		*vals = (const int *)cs->scale_avail;
+		*length = cs->num_scales * 2;
 		*type = IIO_VAL_INT_PLUS_MICRO;
 
 		return IIO_AVAIL_LIST;