linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-gpio@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: [libgpiod][PATCH 04/11] treewide: rename EVENT_CLOCK to CLOCK
Date: Wed, 30 Nov 2022 13:42:24 +0100	[thread overview]
Message-ID: <20221130124231.1054001-5-brgl@bgdev.pl> (raw)
In-Reply-To: <20221130124231.1054001-1-brgl@bgdev.pl>

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

While we use it for edge event timestamps exclusively at the moment,
the actual enum names shouldn't limit its application and simply just
refer to existing clock types known by the GPIO uAPI. The relevant
functions are still called set/get_event_clock() as it's in line with
their functionality.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 bindings/cxx/line-info.cpp                |  6 +++---
 bindings/cxx/line-settings.cpp            | 14 ++++++-------
 bindings/python/gpiod/ext/line-settings.c |  2 +-
 bindings/python/gpiod/ext/module.c        |  6 +++---
 bindings/rust/libgpiod/src/lib.rs         | 22 ++++++++++-----------
 include/gpiod.h                           | 20 +++++++++----------
 lib/line-config.c                         |  4 ++--
 lib/line-info.c                           | 10 +++++-----
 lib/line-settings.c                       | 16 +++++++--------
 tests/tests-line-config.c                 |  2 +-
 tests/tests-line-info.c                   | 12 ++++++------
 tests/tests-line-settings.c               | 24 +++++++++++------------
 tools/gpiomon.c                           | 14 ++++++-------
 tools/tools-common.c                      |  4 ++--
 14 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/bindings/cxx/line-info.cpp b/bindings/cxx/line-info.cpp
index 944e34d..5eb2a3f 100644
--- a/bindings/cxx/line-info.cpp
+++ b/bindings/cxx/line-info.cpp
@@ -37,9 +37,9 @@ const ::std::map<int, line::edge> edge_mapping = {
 };
 
 const ::std::map<int, line::clock> clock_mapping = {
-	{ GPIOD_LINE_EVENT_CLOCK_MONOTONIC,	line::clock::MONOTONIC },
-	{ GPIOD_LINE_EVENT_CLOCK_REALTIME,	line::clock::REALTIME },
-	{ GPIOD_LINE_EVENT_CLOCK_HTE,		line::clock::HTE }
+	{ GPIOD_LINE_CLOCK_MONOTONIC,		line::clock::MONOTONIC },
+	{ GPIOD_LINE_CLOCK_REALTIME,		line::clock::REALTIME },
+	{ GPIOD_LINE_CLOCK_HTE,			line::clock::HTE }
 };
 
 } /* namespace */
diff --git a/bindings/cxx/line-settings.cpp b/bindings/cxx/line-settings.cpp
index 17c5ca2..58860db 100644
--- a/bindings/cxx/line-settings.cpp
+++ b/bindings/cxx/line-settings.cpp
@@ -57,13 +57,13 @@ const ::std::map<line::drive, gpiod_line_drive> drive_mapping = {
 
 const ::std::map<gpiod_line_drive, line::drive> reverse_drive_mapping = make_reverse_maping(drive_mapping);
 
-const ::std::map<line::clock, gpiod_line_event_clock> clock_mapping = {
-	{ line::clock::MONOTONIC,	GPIOD_LINE_EVENT_CLOCK_MONOTONIC },
-	{ line::clock::REALTIME,	GPIOD_LINE_EVENT_CLOCK_REALTIME },
-	{ line::clock::HTE,		GPIOD_LINE_EVENT_CLOCK_HTE }
+const ::std::map<line::clock, gpiod_line_clock> clock_mapping = {
+	{ line::clock::MONOTONIC,	GPIOD_LINE_CLOCK_MONOTONIC },
+	{ line::clock::REALTIME,	GPIOD_LINE_CLOCK_REALTIME },
+	{ line::clock::HTE,		GPIOD_LINE_CLOCK_HTE }
 };
 
-const ::std::map<gpiod_line_event_clock, line::clock>
+const ::std::map<gpiod_line_clock, line::clock>
 reverse_clock_mapping = make_reverse_maping(clock_mapping);
 
 const ::std::map<line::value, gpiod_line_value> value_mapping = {
@@ -257,7 +257,7 @@ GPIOD_CXX_API ::std::chrono::microseconds line_settings::debounce_period() const
 
 GPIOD_CXX_API line_settings& line_settings::set_event_clock(line::clock event_clock)
 {
-	set_mapped_value<line::clock, gpiod_line_event_clock,
+	set_mapped_value<line::clock, gpiod_line_clock,
 			 ::gpiod_line_settings_set_event_clock>(this->_m_priv->settings.get(),
 								event_clock, clock_mapping);
 
@@ -266,7 +266,7 @@ GPIOD_CXX_API line_settings& line_settings::set_event_clock(line::clock event_cl
 
 GPIOD_CXX_API line::clock line_settings::event_clock() const
 {
-	return get_mapped_value<line::clock, gpiod_line_event_clock,
+	return get_mapped_value<line::clock, gpiod_line_clock,
 				::gpiod_line_settings_get_event_clock>(
 							this->_m_priv->settings.get(),
 							reverse_clock_mapping);
diff --git a/bindings/python/gpiod/ext/line-settings.c b/bindings/python/gpiod/ext/line-settings.c
index 8ec1390..2cacbef 100644
--- a/bindings/python/gpiod/ext/line-settings.c
+++ b/bindings/python/gpiod/ext/line-settings.c
@@ -29,7 +29,7 @@ line_settings_init(line_settings_object *self, PyObject *args, PyObject *kwargs)
 		NULL
 	};
 
-	enum gpiod_line_event_clock event_clock;
+	enum gpiod_line_clock event_clock;
 	enum gpiod_line_direction direction;
 	enum gpiod_line_value output_value;
 	unsigned long debounce_period;
diff --git a/bindings/python/gpiod/ext/module.c b/bindings/python/gpiod/ext/module.c
index 8725ef2..12fb92c 100644
--- a/bindings/python/gpiod/ext/module.c
+++ b/bindings/python/gpiod/ext/module.c
@@ -80,15 +80,15 @@ static const struct module_const module_constants[] = {
 	},
 	{
 		.name = "CLOCK_MONOTONIC",
-		.val = GPIOD_LINE_EVENT_CLOCK_MONOTONIC,
+		.val = GPIOD_LINE_CLOCK_MONOTONIC,
 	},
 	{
 		.name = "CLOCK_REALTIME",
-		.val = GPIOD_LINE_EVENT_CLOCK_REALTIME,
+		.val = GPIOD_LINE_CLOCK_REALTIME,
 	},
 	{
 		.name = "CLOCK_HTE",
-		.val = GPIOD_LINE_EVENT_CLOCK_HTE,
+		.val = GPIOD_LINE_CLOCK_HTE,
 	},
 	{
 		.name = "EDGE_EVENT_TYPE_RISING",
diff --git a/bindings/rust/libgpiod/src/lib.rs b/bindings/rust/libgpiod/src/lib.rs
index d7a0615..1b2c765 100644
--- a/bindings/rust/libgpiod/src/lib.rs
+++ b/bindings/rust/libgpiod/src/lib.rs
@@ -45,9 +45,9 @@ use gpiod::{
     gpiod_line_edge_GPIOD_LINE_EDGE_FALLING as GPIOD_LINE_EDGE_FALLING,
     gpiod_line_edge_GPIOD_LINE_EDGE_NONE as GPIOD_LINE_EDGE_NONE,
     gpiod_line_edge_GPIOD_LINE_EDGE_RISING as GPIOD_LINE_EDGE_RISING,
-    gpiod_line_event_clock_GPIOD_LINE_EVENT_CLOCK_HTE as GPIOD_LINE_EVENT_CLOCK_HTE,
-    gpiod_line_event_clock_GPIOD_LINE_EVENT_CLOCK_MONOTONIC as GPIOD_LINE_EVENT_CLOCK_MONOTONIC,
-    gpiod_line_event_clock_GPIOD_LINE_EVENT_CLOCK_REALTIME as GPIOD_LINE_EVENT_CLOCK_REALTIME,
+    gpiod_line_clock_GPIOD_LINE_CLOCK_HTE as GPIOD_LINE_CLOCK_HTE,
+    gpiod_line_clock_GPIOD_LINE_CLOCK_MONOTONIC as GPIOD_LINE_CLOCK_MONOTONIC,
+    gpiod_line_clock_GPIOD_LINE_CLOCK_REALTIME as GPIOD_LINE_CLOCK_REALTIME,
     gpiod_line_value_GPIOD_LINE_VALUE_ACTIVE as GPIOD_LINE_VALUE_ACTIVE,
     gpiod_line_value_GPIOD_LINE_VALUE_INACTIVE as GPIOD_LINE_VALUE_INACTIVE,
     gpiod_line_value_GPIOD_LINE_VALUE_ERROR as GPIOD_LINE_VALUE_ERROR,
@@ -393,20 +393,20 @@ pub mod line {
     }
 
     impl EventClock {
-        pub(crate) fn new(clock: gpiod::gpiod_line_event_clock) -> Result<Self> {
+        pub(crate) fn new(clock: gpiod::gpiod_line_clock) -> Result<Self> {
             Ok(match clock {
-                GPIOD_LINE_EVENT_CLOCK_MONOTONIC => EventClock::Monotonic,
-                GPIOD_LINE_EVENT_CLOCK_REALTIME => EventClock::Realtime,
-                GPIOD_LINE_EVENT_CLOCK_HTE => EventClock::HTE,
+                GPIOD_LINE_CLOCK_MONOTONIC => EventClock::Monotonic,
+                GPIOD_LINE_CLOCK_REALTIME => EventClock::Realtime,
+                GPIOD_LINE_CLOCK_HTE => EventClock::HTE,
                 _ => return Err(Error::InvalidEnumValue("Eventclock", clock as i32)),
             })
         }
 
-        pub(crate) fn gpiod_clock(&self) -> gpiod::gpiod_line_event_clock {
+        pub(crate) fn gpiod_clock(&self) -> gpiod::gpiod_line_clock {
             match self {
-                EventClock::Monotonic => GPIOD_LINE_EVENT_CLOCK_MONOTONIC,
-                EventClock::Realtime => GPIOD_LINE_EVENT_CLOCK_REALTIME,
-                EventClock::HTE => GPIOD_LINE_EVENT_CLOCK_HTE,
+                EventClock::Monotonic => GPIOD_LINE_CLOCK_MONOTONIC,
+                EventClock::Realtime => GPIOD_LINE_CLOCK_REALTIME,
+                EventClock::HTE => GPIOD_LINE_CLOCK_HTE,
             }
         }
     }
diff --git a/include/gpiod.h b/include/gpiod.h
index fc9d4c0..2ad028d 100644
--- a/include/gpiod.h
+++ b/include/gpiod.h
@@ -308,14 +308,14 @@ enum gpiod_line_drive {
 };
 
 /**
- * @brief Event clock settings.
+ * @brief Clock settings.
  */
-enum gpiod_line_event_clock {
-	GPIOD_LINE_EVENT_CLOCK_MONOTONIC = 1,
+enum gpiod_line_clock {
+	GPIOD_LINE_CLOCK_MONOTONIC = 1,
 	/**< Line uses the monotonic clock for edge event timestamps. */
-	GPIOD_LINE_EVENT_CLOCK_REALTIME,
+	GPIOD_LINE_CLOCK_REALTIME,
 	/**< Line uses the realtime clock for edge event timestamps. */
-	GPIOD_LINE_EVENT_CLOCK_HTE,
+	GPIOD_LINE_CLOCK_HTE,
 	/**< Line uses the hardware timestamp engine for event timestamps. */
 };
 
@@ -465,10 +465,10 @@ gpiod_line_info_get_debounce_period_us(struct gpiod_line_info *info);
  * @brief Get the event clock setting used for edge event timestamps for the
  *	  line.
  * @param info GPIO line info object.
- * @return Returns ::GPIOD_LINE_EVENT_CLOCK_MONOTONIC or
- *	   ::GPIOD_LINE_EVENT_CLOCK_REALTIME.
+ * @return Returns ::GPIOD_LINE_CLOCK_MONOTONIC, ::GPIOD_LINE_CLOCK_HTE or
+ *	   ::GPIOD_LINE_CLOCK_REALTIME.
  */
-enum gpiod_line_event_clock
+enum gpiod_line_clock
 gpiod_line_info_get_event_clock(struct gpiod_line_info *info);
 
 /**
@@ -684,14 +684,14 @@ gpiod_line_settings_get_debounce_period_us(
  * @return 0 on success, -1 on failure.
  */
 int gpiod_line_settings_set_event_clock(struct gpiod_line_settings *settings,
-				enum gpiod_line_event_clock event_clock);
+				enum gpiod_line_clock event_clock);
 
 /**
  * @brief Get event clock setting.
  * @param settings Line settings object.
  * @return Current event clock setting.
  */
-enum gpiod_line_event_clock
+enum gpiod_line_clock
 gpiod_line_settings_get_event_clock(struct gpiod_line_settings *settings);
 
 /**
diff --git a/lib/line-config.c b/lib/line-config.c
index 436f4e8..ce23792 100644
--- a/lib/line-config.c
+++ b/lib/line-config.c
@@ -343,10 +343,10 @@ static uint64_t make_kernel_flags(struct gpiod_line_settings *settings)
 		flags |= GPIO_V2_LINE_FLAG_ACTIVE_LOW;
 
 	switch (gpiod_line_settings_get_event_clock(settings)) {
-	case GPIOD_LINE_EVENT_CLOCK_REALTIME:
+	case GPIOD_LINE_CLOCK_REALTIME:
 		flags |= GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME;
 		break;
-	case GPIOD_LINE_EVENT_CLOCK_HTE:
+	case GPIOD_LINE_CLOCK_HTE:
 		flags |= GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE;
 		break;
 	default:
diff --git a/lib/line-info.c b/lib/line-info.c
index 75d886f..6c2c9ce 100644
--- a/lib/line-info.c
+++ b/lib/line-info.c
@@ -17,7 +17,7 @@ struct gpiod_line_info {
 	enum gpiod_line_bias bias;
 	enum gpiod_line_drive drive;
 	enum gpiod_line_edge edge;
-	enum gpiod_line_event_clock event_clock;
+	enum gpiod_line_clock event_clock;
 	bool debounced;
 	unsigned long debounce_period_us;
 };
@@ -93,7 +93,7 @@ gpiod_line_info_get_edge_detection(struct gpiod_line_info *info)
 	return info->edge;
 }
 
-GPIOD_API enum gpiod_line_event_clock
+GPIOD_API enum gpiod_line_clock
 gpiod_line_info_get_event_clock(struct gpiod_line_info *info)
 {
 	return info->event_clock;
@@ -164,11 +164,11 @@ gpiod_line_info_from_uapi(struct gpio_v2_line_info *uapi_info)
 		info->edge = GPIOD_LINE_EDGE_NONE;
 
 	if (uapi_info->flags & GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME)
-		info->event_clock = GPIOD_LINE_EVENT_CLOCK_REALTIME;
+		info->event_clock = GPIOD_LINE_CLOCK_REALTIME;
 	else if (uapi_info->flags & GPIO_V2_LINE_FLAG_EVENT_CLOCK_HTE)
-		info->event_clock = GPIOD_LINE_EVENT_CLOCK_HTE;
+		info->event_clock = GPIOD_LINE_CLOCK_HTE;
 	else
-		info->event_clock = GPIOD_LINE_EVENT_CLOCK_MONOTONIC;
+		info->event_clock = GPIOD_LINE_CLOCK_MONOTONIC;
 
 	/*
 	 * We assume that the kernel returns correct configuration and that no
diff --git a/lib/line-settings.c b/lib/line-settings.c
index dcd0f6b..808819c 100644
--- a/lib/line-settings.c
+++ b/lib/line-settings.c
@@ -14,7 +14,7 @@ struct gpiod_line_settings {
 	enum gpiod_line_drive drive;
 	enum gpiod_line_bias bias;
 	bool active_low;
-	enum gpiod_line_event_clock event_clock;
+	enum gpiod_line_clock event_clock;
 	long debounce_period_us;
 	enum gpiod_line_value output_value;
 };
@@ -45,7 +45,7 @@ GPIOD_API void gpiod_line_settings_reset(struct gpiod_line_settings *settings)
 	settings->drive = GPIOD_LINE_DRIVE_PUSH_PULL;
 	settings->active_low = false;
 	settings->debounce_period_us = 0;
-	settings->event_clock = GPIOD_LINE_EVENT_CLOCK_MONOTONIC;
+	settings->event_clock = GPIOD_LINE_CLOCK_MONOTONIC;
 	settings->output_value = GPIOD_LINE_VALUE_INACTIVE;
 }
 
@@ -192,16 +192,16 @@ gpiod_line_settings_get_debounce_period_us(struct gpiod_line_settings *settings)
 
 GPIOD_API int
 gpiod_line_settings_set_event_clock(struct gpiod_line_settings *settings,
-				    enum gpiod_line_event_clock event_clock)
+				    enum gpiod_line_clock event_clock)
 {
 	switch (event_clock) {
-	case GPIOD_LINE_EVENT_CLOCK_MONOTONIC:
-	case GPIOD_LINE_EVENT_CLOCK_REALTIME:
-	case GPIOD_LINE_EVENT_CLOCK_HTE:
+	case GPIOD_LINE_CLOCK_MONOTONIC:
+	case GPIOD_LINE_CLOCK_REALTIME:
+	case GPIOD_LINE_CLOCK_HTE:
 		settings->event_clock = event_clock;
 		break;
 	default:
-		settings->event_clock = GPIOD_LINE_EVENT_CLOCK_MONOTONIC;
+		settings->event_clock = GPIOD_LINE_CLOCK_MONOTONIC;
 		errno = EINVAL;
 		return -1;
 	}
@@ -209,7 +209,7 @@ gpiod_line_settings_set_event_clock(struct gpiod_line_settings *settings,
 	return 0;
 }
 
-GPIOD_API enum gpiod_line_event_clock
+GPIOD_API enum gpiod_line_clock
 gpiod_line_settings_get_event_clock(struct gpiod_line_settings *settings)
 {
 	return settings->event_clock;
diff --git a/tests/tests-line-config.c b/tests/tests-line-config.c
index 5dc9022..c615084 100644
--- a/tests/tests-line-config.c
+++ b/tests/tests-line-config.c
@@ -110,7 +110,7 @@ GPIOD_TEST_CASE(too_many_attrs)
 							 settings);
 
 	gpiod_line_settings_set_event_clock(settings,
-					    GPIOD_LINE_EVENT_CLOCK_REALTIME);
+					    GPIOD_LINE_CLOCK_REALTIME);
 	offset = 7;
 	gpiod_test_line_config_add_line_settings_or_fail(line_cfg, &offset, 1,
 							 settings);
diff --git a/tests/tests-line-info.c b/tests/tests-line-info.c
index 4751db2..1627764 100644
--- a/tests/tests-line-info.c
+++ b/tests/tests-line-info.c
@@ -88,7 +88,7 @@ GPIOD_TEST_CASE(line_info_basic_properties)
 	g_assert_cmpint(gpiod_line_info_get_drive(info4), ==,
 			GPIOD_LINE_DRIVE_PUSH_PULL);
 	g_assert_cmpint(gpiod_line_info_get_event_clock(info4), ==,
-			GPIOD_LINE_EVENT_CLOCK_MONOTONIC);
+			GPIOD_LINE_CLOCK_MONOTONIC);
 	g_assert_false(gpiod_line_info_is_debounced(info4));
 	g_assert_cmpuint(gpiod_line_info_get_debounce_period_us(info4), ==, 0);
 }
@@ -372,13 +372,13 @@ GPIOD_TEST_CASE(event_clock)
 	gpiod_test_line_config_add_line_settings_or_fail(line_cfg, &offset, 1,
 							 settings);
 	gpiod_line_settings_set_event_clock(settings,
-					    GPIOD_LINE_EVENT_CLOCK_REALTIME);
+					    GPIOD_LINE_CLOCK_REALTIME);
 	offset = 1;
 	gpiod_test_line_config_add_line_settings_or_fail(line_cfg, &offset, 1,
 							 settings);
 
 	gpiod_line_settings_set_event_clock(settings,
-					    GPIOD_LINE_EVENT_CLOCK_HTE);
+					    GPIOD_LINE_CLOCK_HTE);
 	offset = 2;
 	gpiod_test_line_config_add_line_settings_or_fail(line_cfg, &offset, 1,
 							 settings);
@@ -396,9 +396,9 @@ GPIOD_TEST_CASE(event_clock)
 	info2 = gpiod_test_get_line_info_or_fail(chip, 2);
 
 	g_assert_cmpint(gpiod_line_info_get_event_clock(info0), ==,
-			GPIOD_LINE_EVENT_CLOCK_MONOTONIC);
+			GPIOD_LINE_CLOCK_MONOTONIC);
 	g_assert_cmpint(gpiod_line_info_get_event_clock(info1), ==,
-			GPIOD_LINE_EVENT_CLOCK_REALTIME);
+			GPIOD_LINE_CLOCK_REALTIME);
 	g_assert_cmpint(gpiod_line_info_get_event_clock(info2), ==,
-			GPIOD_LINE_EVENT_CLOCK_HTE);
+			GPIOD_LINE_CLOCK_HTE);
 }
diff --git a/tests/tests-line-settings.c b/tests/tests-line-settings.c
index e6c0277..b86fd26 100644
--- a/tests/tests-line-settings.c
+++ b/tests/tests-line-settings.c
@@ -28,7 +28,7 @@ GPIOD_TEST_CASE(default_config)
 	g_assert_cmpuint(gpiod_line_settings_get_debounce_period_us(settings),
 			 ==, 0);
 	g_assert_cmpint(gpiod_line_settings_get_event_clock(settings), ==,
-			GPIOD_LINE_EVENT_CLOCK_MONOTONIC);
+			GPIOD_LINE_CLOCK_MONOTONIC);
 	g_assert_cmpint(gpiod_line_settings_get_output_value(settings), ==,
 			GPIOD_LINE_VALUE_INACTIVE);
 }
@@ -207,28 +207,28 @@ GPIOD_TEST_CASE(set_event_clock)
 	settings = gpiod_test_create_line_settings_or_fail();
 
 	ret = gpiod_line_settings_set_event_clock(settings,
-					GPIOD_LINE_EVENT_CLOCK_MONOTONIC);
+					GPIOD_LINE_CLOCK_MONOTONIC);
 	g_assert_cmpint(ret, ==, 0);
 	g_assert_cmpint(gpiod_line_settings_get_event_clock(settings), ==,
-			GPIOD_LINE_EVENT_CLOCK_MONOTONIC);
+			GPIOD_LINE_CLOCK_MONOTONIC);
 
 	ret = gpiod_line_settings_set_event_clock(settings,
-					GPIOD_LINE_EVENT_CLOCK_REALTIME);
+					GPIOD_LINE_CLOCK_REALTIME);
 	g_assert_cmpint(ret, ==, 0);
 	g_assert_cmpint(gpiod_line_settings_get_event_clock(settings), ==,
-			GPIOD_LINE_EVENT_CLOCK_REALTIME);
+			GPIOD_LINE_CLOCK_REALTIME);
 
 	ret = gpiod_line_settings_set_event_clock(settings,
-					GPIOD_LINE_EVENT_CLOCK_HTE);
+					GPIOD_LINE_CLOCK_HTE);
 	g_assert_cmpint(ret, ==, 0);
 	g_assert_cmpint(gpiod_line_settings_get_event_clock(settings), ==,
-			GPIOD_LINE_EVENT_CLOCK_HTE);
+			GPIOD_LINE_CLOCK_HTE);
 
 	ret = gpiod_line_settings_set_event_clock(settings, 999);
 	g_assert_cmpint(ret, <, 0);
 	g_assert_cmpint(errno, ==, EINVAL);
 	g_assert_cmpint(gpiod_line_settings_get_event_clock(settings), ==,
-			GPIOD_LINE_EVENT_CLOCK_MONOTONIC);
+			GPIOD_LINE_CLOCK_MONOTONIC);
 }
 
 GPIOD_TEST_CASE(set_output_value)
@@ -268,7 +268,7 @@ GPIOD_TEST_CASE(copy_line_settings)
 	gpiod_line_settings_set_edge_detection(settings, GPIOD_LINE_EDGE_BOTH);
 	gpiod_line_settings_set_debounce_period_us(settings, 2000);
 	gpiod_line_settings_set_event_clock(settings,
-					    GPIOD_LINE_EVENT_CLOCK_REALTIME);
+					    GPIOD_LINE_CLOCK_REALTIME);
 
 	copy = gpiod_line_settings_copy(settings);
 	g_assert_nonnull(copy);
@@ -281,7 +281,7 @@ GPIOD_TEST_CASE(copy_line_settings)
 	g_assert_cmpint(gpiod_line_settings_get_debounce_period_us(copy), ==,
 			2000);
 	g_assert_cmpint(gpiod_line_settings_get_event_clock(copy), ==,
-			GPIOD_LINE_EVENT_CLOCK_REALTIME);
+			GPIOD_LINE_CLOCK_REALTIME);
 }
 
 GPIOD_TEST_CASE(reset_settings)
@@ -294,7 +294,7 @@ GPIOD_TEST_CASE(reset_settings)
 	gpiod_line_settings_set_edge_detection(settings, GPIOD_LINE_EDGE_BOTH);
 	gpiod_line_settings_set_debounce_period_us(settings, 2000);
 	gpiod_line_settings_set_event_clock(settings,
-					    GPIOD_LINE_EVENT_CLOCK_REALTIME);
+					    GPIOD_LINE_CLOCK_REALTIME);
 
 	gpiod_line_settings_reset(settings);
 
@@ -310,7 +310,7 @@ GPIOD_TEST_CASE(reset_settings)
 	g_assert_cmpuint(gpiod_line_settings_get_debounce_period_us(settings),
 			 ==, 0);
 	g_assert_cmpint(gpiod_line_settings_get_event_clock(settings), ==,
-			GPIOD_LINE_EVENT_CLOCK_MONOTONIC);
+			GPIOD_LINE_CLOCK_MONOTONIC);
 	g_assert_cmpint(gpiod_line_settings_get_output_value(settings), ==,
 			GPIOD_LINE_VALUE_INACTIVE);
 }
diff --git a/tools/gpiomon.c b/tools/gpiomon.c
index 0bc057a..93ff463 100644
--- a/tools/gpiomon.c
+++ b/tools/gpiomon.c
@@ -28,7 +28,7 @@ struct config {
 	const char *chip_id;
 	const char *consumer;
 	const char *fmt;
-	enum gpiod_line_event_clock event_clock;
+	enum gpiod_line_clock event_clock;
 	int timestamp_fmt;
 };
 
@@ -98,13 +98,13 @@ static int parse_edges_or_die(const char *option)
 static int parse_event_clock_or_die(const char *option)
 {
 	if (strcmp(option, "realtime") == 0)
-		return GPIOD_LINE_EVENT_CLOCK_REALTIME;
+		return GPIOD_LINE_CLOCK_REALTIME;
 	if (strcmp(option, "hte") != 0)
-		return GPIOD_LINE_EVENT_CLOCK_HTE;
+		return GPIOD_LINE_CLOCK_HTE;
 	if (strcmp(option, "monotonic") != 0)
 		die("invalid event clock: %s", option);
 
-	return GPIOD_LINE_EVENT_CLOCK_MONOTONIC;
+	return GPIOD_LINE_CLOCK_MONOTONIC;
 }
 
 static int parse_config(int argc, char **argv, struct config *cfg)
@@ -206,10 +206,10 @@ static int parse_config(int argc, char **argv, struct config *cfg)
 	/* setup default clock/format combinations, where not overridden */
 	if (cfg->event_clock == 0) {
 		if (cfg->timestamp_fmt)
-			cfg->event_clock = GPIOD_LINE_EVENT_CLOCK_REALTIME;
+			cfg->event_clock = GPIOD_LINE_CLOCK_REALTIME;
 		else
-			cfg->event_clock = GPIOD_LINE_EVENT_CLOCK_MONOTONIC;
-	} else if ((cfg->event_clock == GPIOD_LINE_EVENT_CLOCK_REALTIME) &&
+			cfg->event_clock = GPIOD_LINE_CLOCK_MONOTONIC;
+	} else if ((cfg->event_clock == GPIOD_LINE_CLOCK_REALTIME) &&
 		   (cfg->timestamp_fmt == 0)) {
 		cfg->timestamp_fmt = 1;
 	}
diff --git a/tools/tools-common.c b/tools/tools-common.c
index 4477ac8..44988d4 100644
--- a/tools/tools-common.c
+++ b/tools/tools-common.c
@@ -286,10 +286,10 @@ static void print_event_clock(struct gpiod_line_info *info)
 	const char *name;
 
 	switch (gpiod_line_info_get_event_clock(info)) {
-	case GPIOD_LINE_EVENT_CLOCK_REALTIME:
+	case GPIOD_LINE_CLOCK_REALTIME:
 		name = "realtime";
 		break;
-	case GPIOD_LINE_EVENT_CLOCK_HTE:
+	case GPIOD_LINE_CLOCK_HTE:
 		name = "hte";
 		break;
 	default:
-- 
2.37.2


  parent reply	other threads:[~2022-11-30 12:42 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-30 12:42 [libgpiod][PATCH 00/11] treewide: an assortment of tweaks and improvements Bartosz Golaszewski
2022-11-30 12:42 ` [libgpiod][PATCH 01/11] treewide: use C enum types explicitly Bartosz Golaszewski
2022-12-01  2:06   ` Viresh Kumar
2022-11-30 12:42 ` [libgpiod][PATCH 02/11] treewide: apply formatting changes with clang-format Bartosz Golaszewski
2022-11-30 13:59   ` Andy Shevchenko
2022-12-01 14:21     ` Bartosz Golaszewski
2022-11-30 12:42 ` [libgpiod][PATCH 03/11] treewide: use plural 'events' in read_edge_event() functions Bartosz Golaszewski
2022-12-01  2:08   ` Viresh Kumar
2022-11-30 12:42 ` Bartosz Golaszewski [this message]
2022-12-01  2:09   ` [libgpiod][PATCH 04/11] treewide: rename EVENT_CLOCK to CLOCK Viresh Kumar
2022-11-30 12:42 ` [libgpiod][PATCH 05/11] gpiosim: rename HOG_DIR to DIRECTION Bartosz Golaszewski
2022-12-01  2:10   ` Viresh Kumar
2022-11-30 12:42 ` [libgpiod][PATCH 06/11] tools: display the correct license with --version Bartosz Golaszewski
2022-11-30 12:42 ` [libgpiod][PATCH 07/11] bindings: rust: make reuse happy Bartosz Golaszewski
2022-11-30 14:05   ` Andy Shevchenko
2022-11-30 16:20     ` Bartosz Golaszewski
2022-12-01  2:20       ` Viresh Kumar
2022-12-01  8:29         ` Bartosz Golaszewski
2022-12-01  9:00           ` Viresh Kumar
2022-12-01  2:14   ` Viresh Kumar
2022-11-30 12:42 ` [libgpiod][PATCH 08/11] bindings: rust: include rust sources in the release tarballs Bartosz Golaszewski
2022-12-01  2:13   ` Viresh Kumar
2022-11-30 12:42 ` [libgpiod][PATCH 09/11] bindings: python: decouple the version of the bindings from libgpiod API version Bartosz Golaszewski
2022-11-30 12:42 ` [libgpiod][PATCH 10/11] bindings: python: fix the GPIOD_WITH_TESTS build flag Bartosz Golaszewski
2022-11-30 12:42 ` [libgpiod][PATCH 11/11] bindings: python: extend setup.py Bartosz Golaszewski
2022-11-30 14:09   ` Andy Shevchenko
2022-11-30 16:16     ` Bartosz Golaszewski
2022-12-07  8:58 ` [libgpiod][PATCH 00/11] treewide: an assortment of tweaks and improvements Bartosz Golaszewski

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=20221130124231.1054001-5-brgl@bgdev.pl \
    --to=brgl@bgdev.pl \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=warthog618@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).