From a91259c9849efb94ba96511381f3cd7acf562b1a Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Mon, 9 Jan 2017 13:01:16 +0100 Subject: [PATCH] core: create accessors for up_to_date field of struct gpiod_line Signed-off-by: Bartosz Golaszewski --- core.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) 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); } } -- 2.30.2