From 92512566da9748e022add2fd51b92b8154b79723 Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Wed, 11 Jan 2017 16:17:40 +0100 Subject: [PATCH] core: rename line_bulk arguments to bulk where applicable Signed-off-by: Bartosz Golaszewski --- core.c | 38 +++++++++++++++++++------------------- gpiod.h | 28 ++++++++++++++-------------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/core.c b/core.c index 6b4772b..abfa8b1 100644 --- a/core.c +++ b/core.c @@ -455,7 +455,7 @@ static bool verify_line_bulk(struct gpiod_line_bulk *line_bulk) return true; } -int gpiod_line_request_bulk(struct gpiod_line_bulk *line_bulk, +int gpiod_line_request_bulk(struct gpiod_line_bulk *bulk, const struct gpiod_line_request_config *config, int *default_vals) { @@ -466,7 +466,7 @@ int gpiod_line_request_bulk(struct gpiod_line_bulk *line_bulk, int status, fd; unsigned int i; - if (!verify_line_bulk(line_bulk)) + if (!verify_line_bulk(bulk)) return -1; handle = zalloc(sizeof(*handle)); @@ -488,10 +488,10 @@ int gpiod_line_request_bulk(struct gpiod_line_bulk *line_bulk, if (config->active_state == GPIOD_ACTIVE_STATE_LOW) req->flags |= GPIOHANDLE_REQUEST_ACTIVE_LOW; - req->lines = line_bulk->num_lines; + req->lines = bulk->num_lines; - for (i = 0; i < line_bulk->num_lines; i++) { - req->lineoffsets[i] = gpiod_line_offset(line_bulk->lines[i]); + for (i = 0; i < bulk->num_lines; i++) { + req->lineoffsets[i] = gpiod_line_offset(bulk->lines[i]); if (config->direction == GPIOD_DIRECTION_OUTPUT) req->default_values[i] = !!default_vals[i]; } @@ -499,15 +499,15 @@ int gpiod_line_request_bulk(struct gpiod_line_bulk *line_bulk, strncpy(req->consumer_label, config->consumer, sizeof(req->consumer_label) - 1); - chip = gpiod_line_get_chip(line_bulk->lines[0]); + chip = gpiod_line_get_chip(bulk->lines[0]); fd = chip->fd; status = gpio_ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, req); if (status < 0) return -1; - for (i = 0; i < line_bulk->num_lines; i++) { - line = line_bulk->lines[i]; + for (i = 0; i < bulk->num_lines; i++) { + line = bulk->lines[i]; line_set_handle(line, handle); line_set_state(line, LINE_TAKEN); @@ -527,13 +527,13 @@ void gpiod_line_release(struct gpiod_line *line) gpiod_line_release_bulk(&bulk); } -void gpiod_line_release_bulk(struct gpiod_line_bulk *line_bulk) +void gpiod_line_release_bulk(struct gpiod_line_bulk *bulk) { struct gpiod_line *line; unsigned int i; - for (i = 0; i < line_bulk->num_lines; i++) { - line = line_bulk->lines[i]; + for (i = 0; i < bulk->num_lines; i++) { + line = bulk->lines[i]; line_remove_handle(line); line_set_state(line, LINE_FREE); @@ -578,25 +578,25 @@ int gpiod_line_get_value(struct gpiod_line *line) return value; } -int gpiod_line_get_value_bulk(struct gpiod_line_bulk *line_bulk, int *values) +int gpiod_line_get_value_bulk(struct gpiod_line_bulk *bulk, int *values) { struct gpiohandle_data data; unsigned int i; int status; - if (!line_bulk_is_reserved(line_bulk)) { + if (!line_bulk_is_reserved(bulk)) { set_last_error(GPIOD_EREQUEST); return -1; } memset(&data, 0, sizeof(data)); - status = gpio_ioctl(line_get_handle_fd(line_bulk->lines[0]), + status = gpio_ioctl(line_get_handle_fd(bulk->lines[0]), GPIOHANDLE_GET_LINE_VALUES_IOCTL, &data); if (status < 0) return -1; - for (i = 0; i < line_bulk->num_lines; i++) + for (i = 0; i < bulk->num_lines; i++) values[i] = data.values[i]; return 0; @@ -612,23 +612,23 @@ int gpiod_line_set_value(struct gpiod_line *line, int value) return gpiod_line_set_value_bulk(&bulk, &value); } -int gpiod_line_set_value_bulk(struct gpiod_line_bulk *line_bulk, int *values) +int gpiod_line_set_value_bulk(struct gpiod_line_bulk *bulk, int *values) { struct gpiohandle_data data; unsigned int i; int status; - if (!line_bulk_is_reserved(line_bulk)) { + if (!line_bulk_is_reserved(bulk)) { set_last_error(GPIOD_EREQUEST); return -1; } memset(&data, 0, sizeof(data)); - for (i = 0; i < line_bulk->num_lines; i++) + for (i = 0; i < bulk->num_lines; i++) data.values[i] = (__u8)!!values[i]; - status = gpio_ioctl(line_get_handle_fd(line_bulk->lines[0]), + status = gpio_ioctl(line_get_handle_fd(bulk->lines[0]), GPIOHANDLE_SET_LINE_VALUES_IOCTL, &data); if (status < 0) return -1; diff --git a/gpiod.h b/gpiod.h index 6195c2e..b5b4e2e 100644 --- a/gpiod.h +++ b/gpiod.h @@ -257,24 +257,24 @@ struct gpiod_line_bulk { /** * @brief Initialize a GPIO bulk object. - * @param line_bulk Line bulk object. + * @param bulk Line bulk object. * * This routine simply sets the internally held number of lines to 0. */ -static inline void gpiod_line_bulk_init(struct gpiod_line_bulk *line_bulk) +static inline void gpiod_line_bulk_init(struct gpiod_line_bulk *bulk) { - line_bulk->num_lines = 0; + bulk->num_lines = 0; } /** * @brief Add a single line to a GPIO bulk object. - * @param line_bulk Line bulk object. + * @param bulk Line bulk object. * @param line Line to add. */ -static inline void gpiod_line_bulk_add(struct gpiod_line_bulk *line_bulk, +static inline void gpiod_line_bulk_add(struct gpiod_line_bulk *bulk, struct gpiod_line *line) { - line_bulk->lines[line_bulk->num_lines++] = line; + bulk->lines[bulk->num_lines++] = line; } /** @@ -439,7 +439,7 @@ static inline int gpiod_line_request_output(struct gpiod_line *line, /** * @brief Reserve a set of GPIO lines. - * @param line_bulk Set of GPIO lines to reserve. + * @param bulk Set of GPIO lines to reserve. * @param config Request options. * @param default_vals Default line values - only relevant if we're setting * the direction to output. @@ -449,7 +449,7 @@ static inline int gpiod_line_request_output(struct gpiod_line *line, * Is this routine succeeds, the caller takes ownership of the GPIO line until * it's released. */ -int gpiod_line_request_bulk(struct gpiod_line_bulk *line_bulk, +int gpiod_line_request_bulk(struct gpiod_line_bulk *bulk, const struct gpiod_line_request_config *config, int *default_vals) GPIOD_API; @@ -505,9 +505,9 @@ void gpiod_line_release(struct gpiod_line *line) GPIOD_API; /** * @brief Release a set of previously reserved lines. - * @param line_bulk Set of GPIO lines to release. + * @param bulk Set of GPIO lines to release. */ -void gpiod_line_release_bulk(struct gpiod_line_bulk *line_bulk) GPIOD_API; +void gpiod_line_release_bulk(struct gpiod_line_bulk *bulk) GPIOD_API; /** * @brief Check if the calling user has ownership of this line. @@ -534,7 +534,7 @@ int gpiod_line_get_value(struct gpiod_line *line) GPIOD_API; /** * @brief Read current values of a set of GPIO lines. - * @param line_bulk Set of GPIO lines to reserve. + * @param bulk Set of GPIO lines to reserve. * @param values An array big enough to hold line_bulk->num_lines values. * @return 0 is the operation succeeds. In case of an error this routine * returns -1 and sets the last error number. @@ -542,7 +542,7 @@ int gpiod_line_get_value(struct gpiod_line *line) GPIOD_API; * If succeeds, this routine fills the values array with a set of values in * the same order, the lines are added to line_bulk. */ -int gpiod_line_get_value_bulk(struct gpiod_line_bulk *line_bulk, +int gpiod_line_get_value_bulk(struct gpiod_line_bulk *bulk, int *values) GPIOD_API; /** @@ -556,12 +556,12 @@ int gpiod_line_set_value(struct gpiod_line *line, int value) GPIOD_API; /** * @brief Set the values of a set of GPIO lines. - * @param line_bulk Set of GPIO lines to reserve. + * @param bulk Set of GPIO lines to reserve. * @param values An array holding line_bulk->num_lines new values for lines. * @return 0 is the operation succeeds. In case of an error this routine * returns -1 and sets the last error number. */ -int gpiod_line_set_value_bulk(struct gpiod_line_bulk *line_bulk, +int gpiod_line_set_value_bulk(struct gpiod_line_bulk *bulk, int *values) GPIOD_API; /** -- 2.30.2