From: Bartosz Golaszewski Date: Mon, 2 Jan 2017 17:05:19 +0000 (+0100) Subject: gpiodetect: use the correct gpiod_chip_open() flavor X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=b87d908f53f80981d715526dcba26eb698647587;p=qemu-gpiodev%2Flibgpiod.git gpiodetect: use the correct gpiod_chip_open() flavor gpiod_chip_iter_next() should use gpiod_chip_open_by_name() internally when opening chips by dentry->d_name. Signed-off-by: Bartosz Golaszewski --- diff --git a/core.c b/core.c index 559054c..4ba7bae 100644 --- a/core.c +++ b/core.c @@ -579,6 +579,7 @@ void gpiod_chip_iter_free(struct gpiod_chip_iter *iter) struct gpiod_chip * gpiod_chip_iter_next(struct gpiod_chip_iter *iter) { + struct gpiod_chip *chip; struct dirent *dentry; int status; @@ -593,7 +594,8 @@ struct gpiod_chip * gpiod_chip_iter_next(struct gpiod_chip_iter *iter) status = strncmp(dentry->d_name, cdev_prefix, sizeof(cdev_prefix) - 1); if (status == 0) { - iter->current = gpiod_chip_open(dentry->d_name); + chip = gpiod_chip_open_by_name(dentry->d_name); + iter->current = chip; return iter->current; } }