]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: backend: add devm_iio_backend_get_by_index()
authorAntoniu Miclaus <antoniu.miclaus@analog.com>
Mon, 20 Apr 2026 10:12:23 +0000 (13:12 +0300)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 09:59:32 +0000 (10:59 +0100)
commit129c5499819bee611ea1a05f8307692ff75161ce
tree91c83281f1720c7ecf249cea41b365c8c2c0934d
parent793e056d44b76e284afa33d47de4c5ac75c8941a
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>
drivers/iio/industrialio-backend.c
include/linux/iio/backend.h