diff mbox series

[libgpiod,v2,5/6] line-request: rename wait and read functions

Message ID 20220311073926.78636-6-warthog618@gmail.com
State New
Headers show
Series documentation and other minor tweaks | expand

Commit Message

Kent Gibson March 11, 2022, 7:39 a.m. UTC
Most libgpiod function names follow the gpiod_<object>_<action>_<object>
convention.  gpiod_line_request_edge_event_wait() and
gpiod_line_request_edge_event_read() don't, so rename them
gpiod_line_request_wait_edge_event() and
gpiod_line_request_read_edge_event(), respectively.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
---
 include/gpiod.h          |  4 ++--
 lib/line-request.c       |  4 ++--
 tests/tests-edge-event.c | 38 +++++++++++++++++++-------------------
 tools/gpiomon.c          |  4 ++--
 4 files changed, 25 insertions(+), 25 deletions(-)
diff mbox series

Patch

diff --git a/include/gpiod.h b/include/gpiod.h
index 3f4bedd..90535fa 100644
--- a/include/gpiod.h
+++ b/include/gpiod.h
@@ -1258,7 +1258,7 @@  int gpiod_line_request_get_fd(struct gpiod_line_request *request);
  * @return 0 if wait timed out, -1 if an error occurred, 1 if an event is
  *         pending.
  */
-int gpiod_line_request_edge_event_wait(struct gpiod_line_request *request,
+int gpiod_line_request_wait_edge_event(struct gpiod_line_request *request,
 				       uint64_t timeout_ns);
 
 /**
@@ -1270,7 +1270,7 @@  int gpiod_line_request_edge_event_wait(struct gpiod_line_request *request,
  *         descriptor, on failure return -1.
  * @note This function will block if no event was queued for this line.
  */
-int gpiod_line_request_edge_event_read(struct gpiod_line_request *request,
+int gpiod_line_request_read_edge_event(struct gpiod_line_request *request,
 				       struct gpiod_edge_event_buffer *buffer,
 				       size_t max_events);
 
diff --git a/lib/line-request.c b/lib/line-request.c
index 2c73dba..33dd6b0 100644
--- a/lib/line-request.c
+++ b/lib/line-request.c
@@ -201,14 +201,14 @@  GPIOD_API int gpiod_line_request_get_fd(struct gpiod_line_request *request)
 }
 
 GPIOD_API int
-gpiod_line_request_edge_event_wait(struct gpiod_line_request *request,
+gpiod_line_request_wait_edge_event(struct gpiod_line_request *request,
 				   uint64_t timeout_ns)
 {
 	return gpiod_poll_fd(request->fd, timeout_ns);
 }
 
 GPIOD_API int
-gpiod_line_request_edge_event_read(struct gpiod_line_request *request,
+gpiod_line_request_read_edge_event(struct gpiod_line_request *request,
 				   struct gpiod_edge_event_buffer *buffer,
 				   size_t max_events)
 {
diff --git a/tests/tests-edge-event.c b/tests/tests-edge-event.c
index 399a4b1..28502a8 100644
--- a/tests/tests-edge-event.c
+++ b/tests/tests-edge-event.c
@@ -51,7 +51,7 @@  GPIOD_TEST_CASE(edge_event_wait_timeout)
 
 	request = gpiod_test_request_lines_or_fail(chip, req_cfg, line_cfg);
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000);
 	g_assert_cmpint(ret, ==, 0);
 }
 
@@ -129,11 +129,11 @@  GPIOD_TEST_CASE(read_both_events)
 
 	/* First event. */
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+	ret = gpiod_line_request_read_edge_event(request, buffer, 1);
 	g_assert_cmpint(ret, ==, 1);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -149,11 +149,11 @@  GPIOD_TEST_CASE(read_both_events)
 
 	/* Second event. */
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+	ret = gpiod_line_request_read_edge_event(request, buffer, 1);
 	g_assert_cmpint(ret, ==, 1);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -205,11 +205,11 @@  GPIOD_TEST_CASE(read_rising_edge_event)
 
 	/* First event. */
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+	ret = gpiod_line_request_read_edge_event(request, buffer, 1);
 	g_assert_cmpint(ret, ==, 1);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -224,7 +224,7 @@  GPIOD_TEST_CASE(read_rising_edge_event)
 
 	/* Second event. */
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000);
 	g_assert_cmpint(ret, ==, 0); /* Time-out. */
 
 	g_thread_join(thread);
@@ -263,11 +263,11 @@  GPIOD_TEST_CASE(read_falling_edge_event)
 
 	/* First event is the second generated. */
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+	ret = gpiod_line_request_read_edge_event(request, buffer, 1);
 	g_assert_cmpint(ret, ==, 1);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -282,7 +282,7 @@  GPIOD_TEST_CASE(read_falling_edge_event)
 
 	/* No more events. */
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000);
 	g_assert_cmpint(ret, ==, 0); /* Time-out. */
 
 	g_thread_join(thread);
@@ -336,7 +336,7 @@  GPIOD_TEST_CASE(read_rising_edge_event_polled)
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+	ret = gpiod_line_request_read_edge_event(request, buffer, 1);
 	g_assert_cmpint(ret, ==, 1);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -351,7 +351,7 @@  GPIOD_TEST_CASE(read_rising_edge_event_polled)
 
 	/* Second event. */
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000);
 	g_assert_cmpint(ret, ==, 0); /* Time-out. */
 
 	g_thread_join(thread);
@@ -405,11 +405,11 @@  GPIOD_TEST_CASE(seqno)
 
 	/* First event. */
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+	ret = gpiod_line_request_read_edge_event(request, buffer, 1);
 	g_assert_cmpint(ret, ==, 1);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -424,11 +424,11 @@  GPIOD_TEST_CASE(seqno)
 
 	/* Second event. */
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+	ret = gpiod_line_request_read_edge_event(request, buffer, 1);
 	g_assert_cmpint(ret, ==, 1);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -472,11 +472,11 @@  GPIOD_TEST_CASE(event_copy)
 
 	g_gpiosim_chip_set_pull(sim, 2, G_GPIOSIM_PULL_UP);
 
-	ret = gpiod_line_request_edge_event_wait(request, 1000000000);
+	ret = gpiod_line_request_wait_edge_event(request, 1000000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_return_if_failed();
 
-	ret = gpiod_line_request_edge_event_read(request, buffer, 1);
+	ret = gpiod_line_request_read_edge_event(request, buffer, 1);
 	g_assert_cmpint(ret, ==, 1);
 	gpiod_test_return_if_failed();
 
diff --git a/tools/gpiomon.c b/tools/gpiomon.c
index 2ead5c6..4769e62 100644
--- a/tools/gpiomon.c
+++ b/tools/gpiomon.c
@@ -280,13 +280,13 @@  int main(int argc, char **argv)
 		die_perror("unable to allocate the line event buffer");
 
 	for (;;) {
-		ret = gpiod_line_request_edge_event_wait(request, timeout);
+		ret = gpiod_line_request_wait_edge_event(request, timeout);
 		if (ret < 0)
 			die_perror("error waiting for events");
 		if (ret == 0)
 			continue;
 
-		ret = gpiod_line_request_edge_event_read(request, event_buffer,
+		ret = gpiod_line_request_read_edge_event(request, event_buffer,
 							 EVENT_BUF_SIZE);
 		if (ret < 0)
 			die_perror("error reading line events");