All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: linux-gpio@vger.kernel.org, brgl@bgdev.pl
Cc: Kent Gibson <warthog618@gmail.com>
Subject: [libgpiod v2][PATCH 1/3] core: rename gpiod_chip_info_event_wait and gpiod_chip_info_event_read
Date: Tue, 15 Mar 2022 13:32:18 +0800	[thread overview]
Message-ID: <20220315053220.102934-2-warthog618@gmail.com> (raw)
In-Reply-To: <20220315053220.102934-1-warthog618@gmail.com>

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(-)

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);
 }
-- 
2.35.1


  reply	other threads:[~2022-03-15  5:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-15  5:32 [libgpiod v2][PATCH 0/3] api tweaks Kent Gibson
2022-03-15  5:32 ` Kent Gibson [this message]
2022-03-15 11:58   ` [libgpiod v2][PATCH 1/3] core: rename gpiod_chip_info_event_wait and gpiod_chip_info_event_read Bartosz Golaszewski
2022-03-15  5:32 ` [libgpiod v2][PATCH 2/3] core: split chip_info out of chip Kent Gibson
2022-03-15 11:59   ` Bartosz Golaszewski
2022-03-15 12:12     ` Kent Gibson
2022-03-15 12:15       ` Bartosz Golaszewski
2022-03-15  5:32 ` [libgpiod v2][PATCH 3/3] line-info: rename infobuf to uinfo Kent Gibson
2022-03-15 12:14   ` Bartosz Golaszewski
2022-03-15 12:24     ` Kent Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220315053220.102934-2-warthog618@gmail.com \
    --to=warthog618@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=linux-gpio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.