global: fix active state naming
authorBartosz Golaszewski <bartekgola@gmail.com>
Fri, 6 Jan 2017 14:48:45 +0000 (15:48 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Fri, 6 Jan 2017 14:48:45 +0000 (15:48 +0100)
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
core.c
gpiod.h
gpioinfo.c

diff --git a/core.c b/core.c
index 419944062d134da5628c190ec87933e5ecb76629..25f23f0245151acc9c8bf5fcc0afda32f4122a55 100644 (file)
--- a/core.c
+++ b/core.c
@@ -184,11 +184,11 @@ int gpiod_line_direction(struct gpiod_line *line)
                                                       : GPIOD_DIRECTION_INPUT;
 }
 
-int gpiod_line_polarity(struct gpiod_line *line)
+int gpiod_line_active_state(struct gpiod_line *line)
 {
        return line->info.flags & GPIOLINE_FLAG_ACTIVE_LOW
-                                       ? GPIOD_POLARITY_ACTIVE_LOW
-                                       : GPIOD_POLARITY_ACTIVE_HIGH;
+                                       ? GPIOD_ACTIVE_STATE_LOW
+                                       : GPIOD_ACTIVE_STATE_HIGH;
 }
 
 bool gpiod_line_is_used_by_kernel(struct gpiod_line *line)
@@ -287,7 +287,7 @@ int gpiod_line_request_bulk(struct gpiod_line_bulk *line_bulk,
        else if (config->direction == GPIOD_DIRECTION_OUTPUT)
                req->flags |= GPIOHANDLE_REQUEST_OUTPUT;
 
-       if (config->polarity == GPIOD_POLARITY_ACTIVE_LOW)
+       if (config->active_state == GPIOD_ACTIVE_STATE_LOW)
                req->flags |= GPIOHANDLE_REQUEST_ACTIVE_LOW;
 
        req->lines = line_bulk->num_lines;
@@ -469,7 +469,7 @@ int gpiod_line_event_request(struct gpiod_line *line,
        if (config->line_flags & GPIOD_REQUEST_OPEN_SOURCE)
                req->handleflags |= GPIOHANDLE_REQUEST_OPEN_SOURCE;
 
-       if (config->polarity == GPIOD_POLARITY_ACTIVE_LOW)
+       if (config->active_state == GPIOD_ACTIVE_STATE_LOW)
                req->handleflags |= GPIOHANDLE_REQUEST_ACTIVE_LOW;
 
        if (config->event_type == GPIOD_EVENT_RISING_EDGE)
diff --git a/gpiod.h b/gpiod.h
index 9eaa90bbdd2813112ed5a6db5d370cc5eb26d020..f6a010623ddc604c391749e0dd2ac528483df1ab 100644 (file)
--- a/gpiod.h
+++ b/gpiod.h
@@ -139,13 +139,13 @@ enum {
 };
 
 /**
- * @brief Available polarity settings.
+ * @brief Available active state settings.
  */
 enum {
-       GPIOD_POLARITY_ACTIVE_HIGH,
-       /**< The  polarity of a GPIO is active-high. */
-       GPIOD_POLARITY_ACTIVE_LOW,
-       /**< The polarity of a GPIO is active-low. */
+       GPIOD_ACTIVE_STATE_HIGH,
+       /**< The active state of a GPIO is active-high. */
+       GPIOD_ACTIVE_STATE_LOW,
+       /**< The active state of a GPIO is active-low. */
 };
 
 /**
@@ -237,11 +237,11 @@ const char * gpiod_line_consumer(struct gpiod_line *line) GPIOD_API;
 int gpiod_line_direction(struct gpiod_line *line) GPIOD_API;
 
 /**
- * @brief Read the GPIO line polarity setting.
+ * @brief Read the GPIO line active state setting.
  * @param line GPIO line object.
- * @return Returns GPIOD_POLARITY_ACTIVE_HIGH or GPIOD_POLARITY_ACTIVE_LOW.
+ * @return Returns GPIOD_ACTIVE_STATE_HIGH or GPIOD_ACTIVE_STATE_LOW.
  */
-int gpiod_line_polarity(struct gpiod_line *line) GPIOD_API;
+int gpiod_line_active_state(struct gpiod_line *line) GPIOD_API;
 
 /**
  * @brief Check if the line is used by the kernel.
@@ -299,8 +299,8 @@ struct gpiod_line_request_config {
        /**< Name of the consumer. */
        int direction;
        /**< Requested direction. */
-       int polarity;
-       /**< Requested polarity configuration. */
+       int active_state;
+       /**< Requested active state configuration. */
        int flags;
        /**< Other configuration flags. */
 };
@@ -438,8 +438,8 @@ struct gpiod_line_evreq_config {
        /**< Name of the consumer. */
        int event_type;
        /**< Type of the event we want to be notified about. */
-       int polarity;
-       /**< GPIO line polarity. */
+       int active_state;
+       /**< GPIO line active state. */
        int line_flags;
        /**< Misc line flags - same as for line requests. */
 };
index 37fa48de20788aa610be59a57e32897a02346d89..64341cfca74e9c78c1879ae8397039c657dff9bc 100644 (file)
@@ -39,7 +39,7 @@ static const struct flag flags[] = {
 
 int main(int argc, char **argv)
 {
-       int i, direction, flag_printed, polarity;
+       int i, direction, flag_printed, active_state;
        struct gpiod_line_iter iter;
        const char *name, *consumer;
        struct gpiod_line *line;
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
                        name = gpiod_line_name(line);
                        consumer = gpiod_line_consumer(line);
                        direction = gpiod_line_direction(line);
-                       polarity = gpiod_line_polarity(line);
+                       active_state = gpiod_line_active_state(line);
 
                        printf("\tline %2u: ", gpiod_line_offset(line));
 
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
 
                        printf("%s ", direction == GPIOD_DIRECTION_INPUT
                                                        ? "input" : "output");
-                       printf("%s ", polarity == GPIOD_POLARITY_ACTIVE_LOW
+                       printf("%s ", active_state == GPIOD_ACTIVE_STATE_LOW
                                                        ? "active-low"
                                                        : "active-high");