File 98.patch of Package dahdi-linux

From a0b464a9759da3fe14937cdf8cb5d1d432d0476d Mon Sep 17 00:00:00 2001
From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com>
Date: Tue, 29 Jul 2025 15:19:43 -0400
Subject: [PATCH] dahdi_dummy: Use hrtimer_setup on kernels >= 6.15.0.

Kernel commit 908a1d775422ba2e27a5e33d0c130b522419e121 introduced
hrtimer_setup to eventually replace hrtimer_init, which was done
in kernel commit 9779489a31d77a7b9cb6f20d2d2caced4e29dbe6.
Accordingly, we now use the new setup process on newer kernels.

Resolves: #93
---
 drivers/dahdi/dahdi_dummy.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/dahdi/dahdi_dummy.c b/drivers/dahdi/dahdi_dummy.c
index b1004d992..44cd3ba0c 100644
--- a/drivers/dahdi/dahdi_dummy.c
+++ b/drivers/dahdi/dahdi_dummy.c
@@ -229,12 +229,14 @@ int init_module(void)
 
 #if defined(USE_HIGHRESTIMER)
 	printk(KERN_DEBUG "dahdi_dummy: Trying to load High Resolution Timer\n");
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0)
+	hrtimer_setup(&zaptimer, dahdi_dummy_hr_int, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+#else
 	hrtimer_init(&zaptimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
-	printk(KERN_DEBUG "dahdi_dummy: Initialized High Resolution Timer\n");
-
 	/* Set timer callback function */
 	zaptimer.function = dahdi_dummy_hr_int;
-
+#endif /* LINUX_VERSION_CODE */
+	printk(KERN_DEBUG "dahdi_dummy: Initialized High Resolution Timer\n");
 	printk(KERN_DEBUG "dahdi_dummy: Starting High Resolution Timer\n");
 	hrtimer_start(&zaptimer, ktime_set(0, DAHDI_TIME_NS), HRTIMER_MODE_REL);
 	printk(KERN_INFO "dahdi_dummy: High Resolution Timer started, good to go\n");
openSUSE Build Service is sponsored by