From: Bartosz Golaszewski Date: Mon, 9 Jan 2017 12:01:16 +0000 (+0100) Subject: core: create accessors for up_to_date field of struct gpiod_line X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=a91259c9849efb94ba96511381f3cd7acf562b1a;p=qemu-gpiodev%2Flibgpiod.git core: create accessors for up_to_date field of struct gpiod_line Signed-off-by: Bartosz Golaszewski --- diff --git a/core.c b/core.c index 78e25f2..a832edf 100644 --- a/core.c +++ b/core.c @@ -267,6 +267,16 @@ 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; +} + bool gpiod_line_needs_update(struct gpiod_line *line) { return !line->up_to_date; @@ -288,7 +298,7 @@ int gpiod_line_update(struct gpiod_line *line) if (status < 0) return -1; - line->up_to_date = true; + line_set_updated(line); return 0; } @@ -380,7 +390,7 @@ int gpiod_line_request_bulk(struct gpiod_line_bulk *line_bulk, */ status = gpiod_line_update(line); if (status < 0) - line->up_to_date = false; + line_set_needs_update(line); } return 0; @@ -413,7 +423,7 @@ void gpiod_line_release_bulk(struct gpiod_line_bulk *line_bulk) status = gpiod_line_update(line); if (status < 0) - line->up_to_date = false; + line_set_needs_update(line); } }