From: Bartosz Golaszewski Date: Wed, 18 Oct 2017 14:39:17 +0000 (+0200) Subject: core: move line-related static functions to more suitable places X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d5c018ba5d0102abc35aa4539e48a44e8c2f6d3c;p=qemu-gpiodev%2Flibgpiod.git core: move line-related static functions to more suitable places Group the line state routines together and put line_bulk_is_requested() next to verify_line_bulk(). Signed-off-by: Bartosz Golaszewski --- diff --git a/src/lib/core.c b/src/lib/core.c index bb9382d..d5bbe08 100644 --- a/src/lib/core.c +++ b/src/lib/core.c @@ -260,6 +260,25 @@ static void line_set_state(struct gpiod_line *line, int state) line->state = state; } +static void line_set_updated(struct gpiod_line *line) +{ + line->up_to_date = true; +} + +static void line_set_needs_update(struct gpiod_line *line) +{ + line->up_to_date = false; +} + +static void line_maybe_update(struct gpiod_line *line) +{ + int status; + + status = gpiod_line_update(line); + if (status < 0) + line_set_needs_update(line); +} + struct gpiod_chip * gpiod_line_get_chip(struct gpiod_line *line) { return line->chip; @@ -309,37 +328,6 @@ bool gpiod_line_is_open_source(struct gpiod_line *line) return line->info.flags & GPIOLINE_FLAG_OPEN_SOURCE; } -static void line_set_updated(struct gpiod_line *line) -{ - line->up_to_date = true; -} - -static void line_set_needs_update(struct gpiod_line *line) -{ - line->up_to_date = false; -} - -static void line_maybe_update(struct gpiod_line *line) -{ - int status; - - status = gpiod_line_update(line); - if (status < 0) - line_set_needs_update(line); -} - -static bool line_bulk_is_requested(struct gpiod_line_bulk *bulk) -{ - struct gpiod_line *line, **lineptr; - - gpiod_line_bulk_foreach_line(bulk, line, lineptr) { - if (!gpiod_line_is_requested(line)) - return false; - } - - return true; -} - bool gpiod_line_needs_update(struct gpiod_line *line) { return !line->up_to_date; @@ -362,6 +350,18 @@ int gpiod_line_update(struct gpiod_line *line) return 0; } +static bool line_bulk_is_requested(struct gpiod_line_bulk *bulk) +{ + struct gpiod_line *line, **lineptr; + + gpiod_line_bulk_foreach_line(bulk, line, lineptr) { + if (!gpiod_line_is_requested(line)) + return false; + } + + return true; +} + static bool verify_line_bulk(struct gpiod_line_bulk *bulk) { struct gpiod_line *line, **lineptr;