Re: [PATCH 2/4] iio: adc: ad7768-1: introduce chip info for future multidevice support

From: Jonathan Cameron
Date: Sat Aug 16 2025 - 09:17:02 EST


On Tue, 12 Aug 2025 23:48:57 -0300
Jonathan Santos <Jonathan.Santos@xxxxxxxxxx> wrote:

> Add Chip info struct in SPI device to store channel information for
> each supported part.
>
> Signed-off-by: Jonathan Santos <Jonathan.Santos@xxxxxxxxxx>
Some minor comments

> ---
> drivers/iio/adc/ad7768-1.c | 76 ++++++++++++++++++++++++++------------
> 1 file changed, 53 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7768-1.c b/drivers/iio/adc/ad7768-1.c
> index a2e061f0cb08..36ba208fc119 100644
> --- a/drivers/iio/adc/ad7768-1.c
> +++ b/drivers/iio/adc/ad7768-1.c
> @@ -106,6 +106,7 @@
> #define AD7768_GPIO_READ_MSK GENMASK(3, 0)
>
> #define AD7768_VCM_OFF 0x07
> +#define AD7768_CHAN_INFO_NONE 0

I'm not convinced this is worthwhile vs 0 which is fairly obviously
a 'nothing to see here' value.

>
> #define AD7768_TRIGGER_SOURCE_SYNC_IDX 0
>
> @@ -213,6 +214,13 @@ static const struct iio_scan_type ad7768_scan_type[] = {
> },
> };
>
> +struct ad7768_chip_info {
> + const char *name;
> + const struct iio_chan_spec *channel_spec;
> + const unsigned long *available_masks;
> + int num_channels;

I guess hole concerns pushed num_channels after the pointers.
That's fine but if you move available_masks up one line, then
we can still have channel_spec and the thing that says
how bit it is next to each other.

> +};