core: new public macro
authorBartosz Golaszewski <bartekgola@gmail.com>
Wed, 27 Sep 2017 09:10:38 +0000 (11:10 +0200)
committerBartosz Golaszewski <bartekgola@gmail.com>
Wed, 27 Sep 2017 09:10:38 +0000 (11:10 +0200)
Export GPIOD_UNUSED in gpiod.h as it may be useful for users not
using all arguments in certain callback functions.

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
include/gpiod.h
src/lib/simple.c

index 5d52eefe23cc1fd7b20078bd96fc8a3a0ecf2f9f..749752aac8de167e80d488550280f6e049a71375 100644 (file)
@@ -51,6 +51,11 @@ struct gpiod_chip_iter;
  */
 #define GPIOD_BIT(nr)          (1UL << (nr))
 
+/**
+ * @brief Marks a function argument or variable as potentially unused.
+ */
+#define GPIOD_UNUSED           __attribute__((unused))
+
 /**
  * @}
  *
index f7041d5f09b9a84bd4bf2e512f09965af853b731..186564641becd511a8a7f78d51edad36f8cb45fc 100644 (file)
@@ -16,8 +16,6 @@
 #include <errno.h>
 #include <poll.h>
 
-#define UNUSED __attribute__((unused))
-
 int gpiod_simple_get_value(const char *consumer, const char *device,
                           unsigned int offset, bool active_low)
 {
@@ -140,7 +138,7 @@ int gpiod_simple_set_value_multiple(const char *consumer, const char *device,
 static int basic_event_poll(unsigned int num_lines, const int *fds,
                            unsigned int *event_offset,
                            const struct timespec *timeout,
-                           void *data UNUSED)
+                           void *data GPIOD_UNUSED)
 {
        struct pollfd poll_fds[GPIOD_REQUEST_MAX_LINES];
        unsigned int i;