iter: rework chip iterators
authorBartosz Golaszewski <bartekgola@gmail.com>
Sat, 4 Nov 2017 21:39:36 +0000 (22:39 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Sat, 4 Nov 2017 22:18:26 +0000 (23:18 +0100)
commit230868dcfadd24c8a1cbad7ee4a42127cd4fe127
treecdc2b2ec2f9c19f60e0029ba0b4c2c7f4068137a
parentf949d196dab8e7106fd437f9679f8fd5dbbacb82
iter: rework chip iterators

We can significantly simplify the chip iterators by performing all
actions that can yield an error in gpiod_chip_iter_new(). Instead of
opening each subsequent chip in gpiod_chip_iter_next(), open them all
in the new function and make next just return an active handle.

Fix relevant test cases and macros, remove related routines that are
no longer needed.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
include/gpiod.h
src/lib/helpers.c
src/lib/iter.c
src/tools/gpiodetect.c
src/tools/gpioinfo.c
tests/tests-iter.c