[PATCH] iio: adc: xilinx-ams: Fix num_channels for PS channels

Michael Tretter m.tretter at pengutronix.de
Wed Jan 19 03:45:13 PST 2022


The IIO channels of the PS are not provided in the sysfs even if the
ams_ps is enabled in the device tree. The reason is that the channels of
the PS are not added to the overall number of IIO channels.

The line somehow got lost between v11 and v12 of the patch series.

Add the number of ams_ps_channels to the number of channels to correctly
register all channels.

Signed-off-by: Michael Tretter <m.tretter at pengutronix.de>
Fixes: d5c70627a794 ("iio: adc: Add Xilinx AMS driver")
---
 drivers/iio/adc/xilinx-ams.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c
index 8343c5f74121..ede968efb77f 100644
--- a/drivers/iio/adc/xilinx-ams.c
+++ b/drivers/iio/adc/xilinx-ams.c
@@ -1224,6 +1224,7 @@ static int ams_init_module(struct iio_dev *indio_dev,
 
 		/* add PS channels to iio device channels */
 		memcpy(channels, ams_ps_channels, sizeof(ams_ps_channels));
+		num_channels += ARRAY_SIZE(ams_ps_channels);
 	} else if (fwnode_property_match_string(fwnode, "compatible",
 						"xlnx,zynqmp-ams-pl") == 0) {
 		ams->pl_base = fwnode_iomap(fwnode, 0);
-- 
2.30.2




More information about the linux-arm-kernel mailing list