core: rework gpiod_chip_find_line()
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Wed, 2 Dec 2020 14:18:36 +0000 (15:18 +0100)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 14 Dec 2020 14:57:07 +0000 (15:57 +0100)
commite6f20c261d810954d4a8dbac6962cf1cc49feac0
treefcc48348169ee94f70d950965e58444a238be57b
parent8496158bc066dbde94c378297f38d685fcbf8b4c
core: rework gpiod_chip_find_line()

GPIO line names are not unique and the library has been incorrectly
making such assumption in v1.x series. We've already dropped interfaces
that would be too complicated to maintain when taking this into account.

Let's now rework the remaming API. This introduces a new function to the
C API: gpiod_chip_find_line_unique() which assumes that the line name is
unique and signals an error if it's not. The previous
gpiod_chip_find_line() function now returns a bulk object containing all
matching lines.

Python and C++ bindings are updated: their find_line() functions return
bulk objects (or an ::std::vector> too now and they take an additional
argument specifying whether we're looking for a unique line or not.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
bindings/cxx/chip.cpp
bindings/cxx/examples/gpiofindcxx.cpp
bindings/cxx/gpiod.hpp
bindings/cxx/tests/tests-chip.cpp
bindings/python/gpiodmodule.c
bindings/python/tests/gpiod_py_test.py
include/gpiod.h
lib/helpers.c
tests/tests-chip.c
tools/gpiofind.c