Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 33 additions & 42 deletions libs/dahdi-linux/patches/210-kernel-h-Add-wrappers-for.patch
Original file line number Diff line number Diff line change
@@ -1,44 +1,35 @@
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -58,6 +58,15 @@
From 0fc7bfe4adf9d0fdd9f1f84122306da196bc187a 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(-)

--- a/drivers/dahdi/dahdi_dummy.c
+++ b/drivers/dahdi/dahdi_dummy.c
@@ -229,12 +229,14 @@ int init_module(void)

#include <linux/poll.h>

+/* Added for DAHDI use of hrtimers (hrtimer_init, etc.) */
+#include <linux/hrtimer.h>
+
+/* del_timer[_sync] was renamed to timer_delete[_sync] in newer kernels */
#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)
+#define del_timer timer_delete
+#define del_timer_sync timer_delete_sync
+#endif
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
#define netif_napi_add netif_napi_add_weight
#endif
@@ -66,6 +75,25 @@
#include <linux/pci.h>
#include <linux/dma-mapping.h>

+/* DAHDI expects hrtimer_init(), but kernels >= 6.8 removed it.
+ * Recreate it using the modern hrtimer_setup() API.
+ */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
+static inline void hrtimer_init(struct hrtimer *timer,
+ clockid_t clock_id,
+ enum hrtimer_mode mode)
+{
+ /* No callback yet — DAHDI sets it later with hrtimer_update_function() */
+ hrtimer_setup(timer, NULL, clock_id, mode);
+}
+#endif
+
+/* from_timer() helper was removed in newer kernels; restore it for DAHDI. */
+#ifndef from_timer
+#define from_timer(var, callback_timer, timer_fieldname) \
+ container_of(callback_timer, typeof(*var), timer_fieldname)
+#endif
+
static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle)
{
return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
+ 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");