Re: [PATCH 2/2] iio: adc: ad9467: make iio backend optional

From: Nuno Sá

Date: Thu Dec 18 2025 - 08:48:28 EST


On Tue, 2025-12-16 at 11:40 +0000, Tomas Melin wrote:
> Not all users can or want to use the device with an iio-backend.
> For these users, let the driver work in standalone mode, not coupled
> to the backend or the services it provides.
>
> Signed-off-by: Tomas Melin <tomas.melin@xxxxxxxxxxx>
> ---
>  drivers/iio/adc/ad9467.c | 37 +++++++++++++++++++++++++------------
>  1 file changed, 25 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c
> index 60fc3361b2689a4c38287c613ef93fe00338e5fa..37b8f88da6681d44f3fbbb6c8c171ae7117b9090 100644
> --- a/drivers/iio/adc/ad9467.c
> +++ b/drivers/iio/adc/ad9467.c
> @@ -1000,6 +1000,9 @@ static int ad9467_update_scan_mode(struct iio_dev *indio_dev,
>   unsigned int c;
>   int ret;
>  
> + if (!st->back)
> + return -EOPNOTSUPP;
> +

Let's not add the buffering interface if we can't control it.
Having it just to return error does not make sense to me. This means yet another info:

https://elixir.bootlin.com/linux/v6.18.1/source/drivers/iio/adc/ad9467.c#L916

Also the channel definition should not have the scan index. But, given that the IIO device
won't have any buffer I think there's no way to reach ad9467_update_scan_mode() (unless I'm
missing something).

Still, while I understand that updating the channels to not include the scan_index is very
cumbersome, having a new iio_info with no .update_scan_mode() is trivial and make things
more clear and explicit.

- Nuno Sá