From: Bartosz Golaszewski Date: Mon, 2 Oct 2017 12:41:49 +0000 (+0200) Subject: line: rename the constant defining the max size of a bulk line object X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=9f856266ead30309d3b85e57436c50b57af4d1d3;p=qemu-gpiodev%2Flibgpiod.git line: rename the constant defining the max size of a bulk line object Stay in line with other prefixes and change it to GPIOD_LINE_BULK_MAX_LINES. Signed-off-by: Bartosz Golaszewski --- diff --git a/include/gpiod.h b/include/gpiod.h index 1f7b645..b85f88f 100644 --- a/include/gpiod.h +++ b/include/gpiod.h @@ -421,7 +421,7 @@ enum { /** * @brief Maximum number of GPIO lines that can be requested at once. */ -#define GPIOD_REQUEST_MAX_LINES 64 +#define GPIOD_LINE_BULK_MAX_LINES 64 /** * @brief Helper structure for storing a set of GPIO line objects. @@ -431,7 +431,7 @@ enum { * the result is undefined. */ struct gpiod_line_bulk { - struct gpiod_line *lines[GPIOD_REQUEST_MAX_LINES]; + struct gpiod_line *lines[GPIOD_LINE_BULK_MAX_LINES]; /**< Buffer for line pointers. */ unsigned int num_lines; /**< Number of lines currently held in this structure. */ diff --git a/src/lib/core.c b/src/lib/core.c index e0bba4c..11d03f2 100644 --- a/src/lib/core.c +++ b/src/lib/core.c @@ -994,7 +994,7 @@ int gpiod_line_event_wait_bulk(struct gpiod_line_bulk *bulk, const struct timespec *timeout, struct gpiod_line **line) { - struct pollfd fds[GPIOD_REQUEST_MAX_LINES]; + struct pollfd fds[GPIOD_LINE_BULK_MAX_LINES]; struct gpiod_line *linetmp; unsigned int i; int status; diff --git a/src/lib/simple.c b/src/lib/simple.c index cb53674..88fdeff 100644 --- a/src/lib/simple.c +++ b/src/lib/simple.c @@ -40,7 +40,7 @@ int gpiod_simple_get_value_multiple(const char *consumer, const char *device, int status, flags; unsigned int i; - if (num_lines > GPIOD_REQUEST_MAX_LINES) { + if (num_lines > GPIOD_LINE_BULK_MAX_LINES) { errno = EINVAL; return -1; } @@ -98,7 +98,7 @@ int gpiod_simple_set_value_multiple(const char *consumer, const char *device, int status, flags; unsigned int i; - if (num_lines > GPIOD_REQUEST_MAX_LINES) { + if (num_lines > GPIOD_LINE_BULK_MAX_LINES) { errno = EINVAL; return -1; } @@ -141,7 +141,7 @@ static int basic_event_poll(unsigned int num_lines, const int *fds, const struct timespec *timeout, void *data GPIOD_UNUSED) { - struct pollfd poll_fds[GPIOD_REQUEST_MAX_LINES]; + struct pollfd poll_fds[GPIOD_LINE_BULK_MAX_LINES]; unsigned int i; int status; @@ -189,14 +189,14 @@ int gpiod_simple_event_loop_multiple(const char *consumer, const char *device, void *data) { unsigned int i, event_offset, line_offset; - int fds[GPIOD_REQUEST_MAX_LINES]; + int fds[GPIOD_LINE_BULK_MAX_LINES]; struct gpiod_line_event event; struct gpiod_line_bulk bulk; struct gpiod_chip *chip; struct gpiod_line *line; int ret, flags, evtype; - if (num_lines > GPIOD_REQUEST_MAX_LINES) { + if (num_lines > GPIOD_LINE_BULK_MAX_LINES) { errno = EINVAL; return -1; } diff --git a/src/tools/gpiomon.c b/src/tools/gpiomon.c index c8c6183..ab84a0d 100644 --- a/src/tools/gpiomon.c +++ b/src/tools/gpiomon.c @@ -144,7 +144,7 @@ static int poll_callback(unsigned int num_lines, const int *fds, unsigned int *event_offset, const struct timespec *timeout, void *data) { - struct pollfd pfds[GPIOD_REQUEST_MAX_LINES + 1]; + struct pollfd pfds[GPIOD_LINE_BULK_MAX_LINES + 1]; struct mon_ctx *ctx = data; unsigned int i; int ret, ts; @@ -243,7 +243,7 @@ static int make_signalfd(void) int main(int argc, char **argv) { - unsigned int offsets[GPIOD_REQUEST_MAX_LINES]; + unsigned int offsets[GPIOD_LINE_BULK_MAX_LINES]; struct timespec timeout = { 10, 0 }; unsigned int num_lines = 0, offset; int optc, opti, ret, i; diff --git a/tests/tests-simple-api.c b/tests/tests-simple-api.c index fbf7baf..a2dbee4 100644 --- a/tests/tests-simple-api.c +++ b/tests/tests-simple-api.c @@ -91,12 +91,12 @@ TEST_DEFINE(simple_set_get_value_multiple, static void simple_get_value_multiple_max_lines(void) { - unsigned int offsets[GPIOD_REQUEST_MAX_LINES + 1]; - int values[GPIOD_REQUEST_MAX_LINES + 1], ret; + unsigned int offsets[GPIOD_LINE_BULK_MAX_LINES + 1]; + int values[GPIOD_LINE_BULK_MAX_LINES + 1], ret; ret = gpiod_simple_get_value_multiple(TEST_CONSUMER, test_chip_name(0), offsets, values, - GPIOD_REQUEST_MAX_LINES + 1, + GPIOD_LINE_BULK_MAX_LINES + 1, false); TEST_ASSERT_NOTEQ(ret, 0); TEST_ASSERT_ERRNO_IS(EINVAL); @@ -107,12 +107,12 @@ TEST_DEFINE(simple_get_value_multiple_max_lines, static void simple_set_value_multiple_max_lines(void) { - unsigned int offsets[GPIOD_REQUEST_MAX_LINES + 1]; - int values[GPIOD_REQUEST_MAX_LINES + 1], ret; + unsigned int offsets[GPIOD_LINE_BULK_MAX_LINES + 1]; + int values[GPIOD_LINE_BULK_MAX_LINES + 1], ret; ret = gpiod_simple_set_value_multiple(TEST_CONSUMER, test_chip_name(0), offsets, values, - GPIOD_REQUEST_MAX_LINES + 1, + GPIOD_LINE_BULK_MAX_LINES + 1, false, NULL, NULL); TEST_ASSERT_NOTEQ(ret, 0); TEST_ASSERT_ERRNO_IS(EINVAL);