[PATCH 2/2] cobalt/tick: Prepare for removal of CLOCK_EVT_FEAT_KTIME in Linux 7.1

Florian Bezdeka <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
upstream commit
70802807398c ("clockevents: Remove redundant CLOCK_EVT_FEAT_KTIME")
removed CLOCK_EVT_FEAT_KTIME. All remaining users have been migrated
to CLOCK_EVT_FEAT_HRTIMER which we do now as well.

CLOCK_EVT_FEAT_HRTIMER has been around for a long time, but there is
still one difference that changed with the commit referenced above.
That means that we can not migrate to CLOCK_EVT_FEAT_HRTIMER
unconditionally. Older Dovetail versions need the old implementation.

This patch has to reach all Xenomai branches that should support
Dovetail 7.1 and newer.

Signed-off-by: Florian Bezdeka <[email protected]>
---
 kernel/cobalt/dovetail/tick.c                        | 4 ++--
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/dovetail/tick.c b/kernel/cobalt/dovetail/tick.c
index 889d9bfc85df6e8500f8cf9fb617edd17c44c1db..59880a6db1a1f40fcdeef9d2e6738a8b0b8ec17f 100644
--- a/kernel/cobalt/dovetail/tick.c
+++ b/kernel/cobalt/dovetail/tick.c
@@ -34,7 +34,7 @@ void pipeline_set_timer_shot(unsigned long delay) /* ns */
 	ktime_t t;
 	int ret;
 
-	if (real_dev->features & CLOCK_EVT_FEAT_KTIME) {
+	if (real_dev->features & COBALT_CLOCK_EVT_FEAT_HRTIMER) {
 		t = ktime_add(delay, xnclock_core_read_raw());
 		real_dev->set_next_ktime(t, real_dev);
 	} else {
@@ -125,7 +125,7 @@ static void setup_proxy(struct clock_proxy_device *dev)
 
 	dev->handle_oob_event = (typeof(dev->handle_oob_event))
 		xnintr_core_clock_handler;
-	proxy_dev->features |= CLOCK_EVT_FEAT_KTIME;
+	proxy_dev->features |= COBALT_CLOCK_EVT_FEAT_HRTIMER;
 	proxy_dev->set_next_ktime = proxy_set_next_ktime;
 	if (proxy_dev->set_state_oneshot_stopped)
 		proxy_dev->set_state_oneshot_stopped = proxy_set_oneshot_stopped;
diff --git a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
index 27e641fa7f9178229e0616e4de64b0e267910915..838e01327f5fd158ddd9383d000724f527465153 100644
--- a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
+++ b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
@@ -91,4 +91,10 @@
 #endif
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 1, 0)
+#define COBALT_CLOCK_EVT_FEAT_HRTIMER	CLOCK_EVT_FEAT_KTIME
+#else
+#define COBALT_CLOCK_EVT_FEAT_HRTIMER	CLOCK_EVT_FEAT_HRTIMER
+#endif
+
 #endif /* _COBALT_ASM_GENERIC_WRAPPERS_H */

-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.