From: Bartosz Golaszewski Date: Fri, 6 Jan 2017 14:48:45 +0000 (+0100) Subject: global: fix active state naming X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f4907261bbb9a8e1bc7d1c637af2c107a21a4c58;p=qemu-gpiodev%2Flibgpiod.git global: fix active state naming Signed-off-by: Bartosz Golaszewski --- diff --git a/core.c b/core.c index 4199440..25f23f0 100644 --- 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 9eaa90b..f6a0106 100644 --- 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. */ }; diff --git a/gpioinfo.c b/gpioinfo.c index 37fa48d..64341cf 100644 --- a/gpioinfo.c +++ b/gpioinfo.c @@ -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");