Add a new cleanup helper which releases a previously requested GPIO
line when a gpiod_line pointer used with GU_CLEANUP() goes out of
scope.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
if (*iter)
gpiod_chip_iter_free(*iter);
}
+
+void gu_release_line(struct gpiod_line **line)
+{
+ if (*line)
+ gpiod_line_release(*line);
+}
void gu_close_chip(struct gpiod_chip **chip);
void gu_free_str(char **str);
void gu_free_chip_iter(struct gpiod_chip_iter **iter);
+void gu_release_line(struct gpiod_line **line);
#define GU_ASSERT(statement) \
do { \