diff mbox series

iio: adc: xilinx-ams: Fix num_channels for PS channels

Message ID 20220119114513.2035609-1-m.tretter@pengutronix.de (mailing list archive)
State Accepted
Headers show
Series iio: adc: xilinx-ams: Fix num_channels for PS channels | expand

Commit Message

Michael Tretter Jan. 19, 2022, 11:45 a.m. UTC
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@pengutronix.de>
Fixes: d5c70627a794 ("iio: adc: Add Xilinx AMS driver")
---
 drivers/iio/adc/xilinx-ams.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jonathan Cameron Jan. 30, 2022, 12:30 p.m. UTC | #1
On Wed, 19 Jan 2022 12:45:13 +0100
Michael Tretter <m.tretter@pengutronix.de> wrote:

> 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@pengutronix.de>
> Fixes: d5c70627a794 ("iio: adc: Add Xilinx AMS driver")
Applied to the fixes togreg branch of iio.git.

Thanks,

Jonathan

> ---
>  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);
Jonathan Cameron Jan. 30, 2022, 12:44 p.m. UTC | #2
On Sun, 30 Jan 2022 12:30:25 +0000
Jonathan Cameron <jic23@kernel.org> wrote:

> On Wed, 19 Jan 2022 12:45:13 +0100
> Michael Tretter <m.tretter@pengutronix.de> wrote:
> 
> > 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@pengutronix.de>
> > Fixes: d5c70627a794 ("iio: adc: Add Xilinx AMS driver")  
> Applied to the fixes togreg branch of iio.git.
> 
Actually change of plan . I'll just pick up the v2 fixes set from
Robert as otherwise I'll loose track of where we are with these.

Thanks,

Jonathan

> Thanks,
> 
> Jonathan
> 
> > ---
> >  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);  
>
diff mbox series

Patch

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);