diff options
| author | Antoniu Miclaus <antoniu.miclaus@analog.com> | 2026-04-20 13:12:23 +0300 |
|---|---|---|
| committer | Jonathan Cameron <jic23@kernel.org> | 2026-05-31 10:59:32 +0100 |
| commit | 129c5499819bee611ea1a05f8307692ff75161ce (patch) | |
| tree | 91c83281f1720c7ecf249cea41b365c8c2c0934d /include/linux | |
| parent | 793e056d44b76e284afa33d47de4c5ac75c8941a (diff) | |
| download | lwn-129c5499819bee611ea1a05f8307692ff75161ce.tar.gz lwn-129c5499819bee611ea1a05f8307692ff75161ce.zip | |
iio: backend: add devm_iio_backend_get_by_index()
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.
Reviewed-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/iio/backend.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/iio/backend.h b/include/linux/iio/backend.h index 4d15c2a9802c..3f95ed1fdf9e 100644 --- a/include/linux/iio/backend.h +++ b/include/linux/iio/backend.h @@ -261,6 +261,7 @@ int iio_backend_extend_chan_spec(struct iio_backend *back, bool iio_backend_has_caps(struct iio_backend *back, u32 caps); void *iio_backend_get_priv(const struct iio_backend *conv); struct iio_backend *devm_iio_backend_get(struct device *dev, const char *name); +struct iio_backend *devm_iio_backend_get_by_index(struct device *dev, unsigned int index); struct iio_backend *devm_iio_backend_fwnode_get(struct device *dev, const char *name, struct fwnode_handle *fwnode); |
