diff mbox series

[libgpiod,v2,1/3] core: rename gpiod_chip_info_event_wait and gpiod_chip_info_event_read

Message ID 20220315053220.102934-2-warthog618@gmail.com
State New
Headers show
Series api tweaks | expand

Commit Message

Kent Gibson March 15, 2022, 5:32 a.m. UTC
Another couple of functions that don't follow the
gpiod_<object>_<action>_<object> pattern.
So rename gpiod_chip_info_event_wait to gpiod_chip_wait_info_event
and gpiod_chip_info_event_read to gpiod_chip_read_info_event.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
---
 include/gpiod.h          |  4 ++--
 lib/chip.c               |  4 ++--
 tests/tests-info-event.c | 22 +++++++++++-----------
 3 files changed, 15 insertions(+), 15 deletions(-)

Comments

Bartosz Golaszewski March 15, 2022, 11:58 a.m. UTC | #1
On Tue, Mar 15, 2022 at 6:32 AM Kent Gibson <warthog618@gmail.com> wrote:
>
> Another couple of functions that don't follow the
> gpiod_<object>_<action>_<object> pattern.
> So rename gpiod_chip_info_event_wait to gpiod_chip_wait_info_event
> and gpiod_chip_info_event_read to gpiod_chip_read_info_event.
>
> Signed-off-by: Kent Gibson <warthog618@gmail.com>

Applied.

Bart
diff mbox series

Patch

diff --git a/include/gpiod.h b/include/gpiod.h
index 2365630..956ee12 100644
--- a/include/gpiod.h
+++ b/include/gpiod.h
@@ -151,7 +151,7 @@  int gpiod_chip_get_fd(struct gpiod_chip *chip);
  * @return 0 if wait timed out, -1 if an error occurred, 1 if an event is
  *	   pending.
  */
-int gpiod_chip_info_event_wait(struct gpiod_chip *chip, uint64_t timeout_ns);
+int gpiod_chip_wait_info_event(struct gpiod_chip *chip, uint64_t timeout_ns);
 
 /**
  * @brief Read a single line status change event from the chip.
@@ -160,7 +160,7 @@  int gpiod_chip_info_event_wait(struct gpiod_chip *chip, uint64_t timeout_ns);
  *	   freed by the caller using ::gpiod_info_event_free.
  * @note If no events are pending, this function will block.
  */
-struct gpiod_info_event *gpiod_chip_info_event_read(struct gpiod_chip *chip);
+struct gpiod_info_event *gpiod_chip_read_info_event(struct gpiod_chip *chip);
 
 /**
  * @brief Map a line's name to its offset within the chip.
diff --git a/lib/chip.c b/lib/chip.c
index b881be1..50d8312 100644
--- a/lib/chip.c
+++ b/lib/chip.c
@@ -164,14 +164,14 @@  GPIOD_API int gpiod_chip_get_fd(struct gpiod_chip *chip)
 	return chip->fd;
 }
 
-GPIOD_API int gpiod_chip_info_event_wait(struct gpiod_chip *chip,
+GPIOD_API int gpiod_chip_wait_info_event(struct gpiod_chip *chip,
 					 uint64_t timeout_ns)
 {
 	return gpiod_poll_fd(chip->fd, timeout_ns);
 }
 
 GPIOD_API struct gpiod_info_event *
-gpiod_chip_info_event_read(struct gpiod_chip *chip)
+gpiod_chip_read_info_event(struct gpiod_chip *chip)
 {
 	return gpiod_info_event_read_fd(chip->fd);
 }
diff --git a/tests/tests-info-event.c b/tests/tests-info-event.c
index 32ae690..0640d66 100644
--- a/tests/tests-info-event.c
+++ b/tests/tests-info-event.c
@@ -50,7 +50,7 @@  GPIOD_TEST_CASE(event_timeout)
 	g_assert_nonnull(info);
 	gpiod_test_return_if_failed();
 
-	ret = gpiod_chip_info_event_wait(chip, 100000000);
+	ret = gpiod_chip_wait_info_event(chip, 100000000);
 	g_assert_cmpint(ret, ==, 0);
 }
 
@@ -130,11 +130,11 @@  GPIOD_TEST_CASE(request_reconfigure_release_events)
 			      request_reconfigure_release_line, &ctx);
 	g_thread_ref(thread);
 
-	ret = gpiod_chip_info_event_wait(chip, 1000000000);
+	ret = gpiod_chip_wait_info_event(chip, 1000000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	request_event = gpiod_chip_info_event_read(chip);
+	request_event = gpiod_chip_read_info_event(chip);
 	g_assert_nonnull(request_event);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -148,11 +148,11 @@  GPIOD_TEST_CASE(request_reconfigure_release_events)
 	g_assert_cmpint(gpiod_line_info_get_direction(request_info), ==,
 			GPIOD_LINE_DIRECTION_INPUT);
 
-	ret = gpiod_chip_info_event_wait(chip, 1000000000);
+	ret = gpiod_chip_wait_info_event(chip, 1000000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	reconfigure_event = gpiod_chip_info_event_read(chip);
+	reconfigure_event = gpiod_chip_read_info_event(chip);
 	g_assert_nonnull(reconfigure_event);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -166,11 +166,11 @@  GPIOD_TEST_CASE(request_reconfigure_release_events)
 	g_assert_cmpint(gpiod_line_info_get_direction(reconfigure_info), ==,
 			GPIOD_LINE_DIRECTION_OUTPUT);
 
-	ret = gpiod_chip_info_event_wait(chip, 1000000000);
+	ret = gpiod_chip_wait_info_event(chip, 1000000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	release_event = gpiod_chip_info_event_read(chip);
+	release_event = gpiod_chip_read_info_event(chip);
 	g_assert_nonnull(release_event);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -243,7 +243,7 @@  GPIOD_TEST_CASE(chip_fd_can_be_polled)
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
-	event = gpiod_chip_info_event_read(chip);
+	event = gpiod_chip_read_info_event(chip);
 	g_assert_nonnull(event);
 	gpiod_test_join_thread_and_return_if_failed(thread);
 
@@ -283,11 +283,11 @@  GPIOD_TEST_CASE(unwatch_and_check_that_no_events_are_generated)
 
 	request = gpiod_test_request_lines_or_fail(chip, req_cfg, line_cfg);
 
-	ret = gpiod_chip_info_event_wait(chip, 100000000);
+	ret = gpiod_chip_wait_info_event(chip, 100000000);
 	g_assert_cmpint(ret, >, 0);
 	gpiod_test_return_if_failed();
 
-	event = gpiod_chip_info_event_read(chip);
+	event = gpiod_chip_read_info_event(chip);
 	g_assert_nonnull(event);
 	gpiod_test_return_if_failed();
 
@@ -298,6 +298,6 @@  GPIOD_TEST_CASE(unwatch_and_check_that_no_events_are_generated)
 	gpiod_line_request_release(request);
 	request = NULL;
 
-	ret = gpiod_chip_info_event_wait(chip, 100000000);
+	ret = gpiod_chip_wait_info_event(chip, 100000000);
 	g_assert_cmpint(ret, ==, 0);
 }