core: move line-related static functions to more suitable places
authorBartosz Golaszewski <bartekgola@gmail.com>
Wed, 18 Oct 2017 14:39:17 +0000 (16:39 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Wed, 18 Oct 2017 14:40:53 +0000 (16:40 +0200)
Group the line state routines together and put line_bulk_is_requested()
next to verify_line_bulk().

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
src/lib/core.c

index bb9382de2cbc6f16c7d81517fe248429e33c4aeb..d5bbe08447ca40b267c41850c84f0076827d07f4 100644 (file)
@@ -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;