core: un-inline gpiod_line_iter_next()
authorBartosz Golaszewski <bartekgola@gmail.com>
Wed, 11 Jan 2017 13:11:43 +0000 (14:11 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Wed, 11 Jan 2017 13:11:43 +0000 (14:11 +0100)
This function grew to the point where it should go into a .c file.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
core.c
gpiod.h

diff --git a/core.c b/core.c
index e139f22137a07ebf9c94434d56bd15a4b331ade0..805178312005af8e791288b3cc704acdd27ff594 100644 (file)
--- a/core.c
+++ b/core.c
@@ -1077,3 +1077,20 @@ gpiod_chip_iter_failed_chip(struct gpiod_chip_iter *iter)
 {
        return iter->failed_chip;
 }
+
+struct gpiod_line * gpiod_line_iter_next(struct gpiod_line_iter *iter)
+{
+       struct gpiod_line *line;
+
+       if (iter->offset >= gpiod_chip_num_lines(iter->chip)) {
+               iter->state = GPIOD_LINE_ITER_DONE;
+               return NULL;
+       }
+
+       iter->state = GPIOD_LINE_ITER_INIT;
+       line = gpiod_chip_get_line(iter->chip, iter->offset++);
+       if (!line)
+               iter->state = GPIOD_LINE_ITER_ERR;
+
+       return line;
+}
diff --git a/gpiod.h b/gpiod.h
index fca5e0b98c3687dd21a9f87d50860b83ae90bd06..2338ecff971d4fc5fbd86e93d48bb9db0e1ecb18 100644 (file)
--- a/gpiod.h
+++ b/gpiod.h
@@ -835,23 +835,8 @@ static inline void gpiod_line_iter_init(struct gpiod_line_iter *iter,
  * @return Pointer to the next GPIO line handle or NULL if no more lines or
  *         and error occured.
  */
-static inline struct gpiod_line *
-gpiod_line_iter_next(struct gpiod_line_iter *iter)
-{
-       struct gpiod_line *line;
-
-       if (iter->offset >= gpiod_chip_num_lines(iter->chip)) {
-               iter->state = GPIOD_LINE_ITER_DONE;
-               return NULL;
-       }
-
-       iter->state = GPIOD_LINE_ITER_INIT;
-       line = gpiod_chip_get_line(iter->chip, iter->offset++);
-       if (!line)
-               iter->state = GPIOD_LINE_ITER_ERR;
-
-       return line;
-}
+struct gpiod_line *
+gpiod_line_iter_next(struct gpiod_line_iter *iter) GPIOD_API;
 
 /**
  * @brief Check if we're done iterating over lines on this iterator.