Re: [PATCH v6 2/4] iio: backend: add devm_iio_backend_get_by_index()
From: Andy Shevchenko
Date: Fri Mar 13 2026 - 10:20:54 EST
On Fri, Mar 13, 2026 at 01:58:51PM +0200, Antoniu Miclaus wrote:
> Add a new function to get an IIO backend by its index in the
> io-backends device tree property. This is useful for multi-channel
> devices that have multiple backends, where looking up by index is
> more straightforward than using named backends.
>
> Extract __devm_iio_backend_fwnode_get_by_index() from the existing
> __devm_iio_backend_fwnode_get(), taking the index directly as a
> parameter. The new public API devm_iio_backend_get_by_index() uses
> the index to find the backend reference in the io-backends property,
> avoiding the need for io-backend-names.
...
> -static struct iio_backend *__devm_iio_backend_fwnode_get(struct device *dev, const char *name,
> - struct fwnode_handle *fwnode)
> +static struct iio_backend *
> +__devm_iio_backend_fwnode_get_by_index(struct device *dev,
> + struct fwnode_handle *fwnode,
> + unsigned int index)
Why out of a sudden to shorten under 80? The rest seems exercises 100 limit...
static struct iio_backend * __devm_iio_backend_fwnode_get_by_index(struct device *dev,
struct fwnode_handle *fwnode,
unsigned int index)
is under 100.
...
> +struct iio_backend *devm_iio_backend_get_by_index(struct device *dev,
> + unsigned int index)
Ditto.
> +{
> + return __devm_iio_backend_fwnode_get_by_index(dev, dev_fwnode(dev),
> + index);
Ditto.
> +}
> +EXPORT_SYMBOL_NS_GPL(devm_iio_backend_get_by_index, "IIO_BACKEND");
--
With Best Regards,
Andy Shevchenko