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)
{
int status, fd;
unsigned int i;
- if (!verify_line_bulk(line_bulk))
+ if (!verify_line_bulk(bulk))
return -1;
handle = zalloc(sizeof(*handle));
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];
}
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);
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);
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;
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;
/**
* @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;
}
/**
/**
* @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.
* 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;
/**
* @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.
/**
* @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.
* 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;
/**
/**
* @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;
/**