package/dahdi-linux: backport commits to fix build with recent kernels

Fixes build with kernels >= 6.15.

Fixes:

  https://autobuild.buildroot.net/results/ed73aa844a18cfc15e942ced4ae363c3d0d09015/

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
(cherry picked from commit f57da3c953)
Signed-off-by: Raphaël Mélotte <raphael.melotte@mind.be>
This commit is contained in:
Thomas Petazzoni
2026-08-26 17:06:19 +02:00
committed by Raphaël Mélotte
parent 4e189ef988
commit 827a28714b
3 changed files with 259 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
From 96a67c8e51997a18bfc0942416b815057e279caf Mon Sep 17 00:00:00 2001
From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com>
Date: Tue, 8 Jul 2025 18:35:56 -0400
Subject: [PATCH] kernel.h: Add wrappers for del_timer and del_timer_sync.
del_timer[_sync] was renamed to timer_delete[_sync] in kernel
commit bb663f0f3c396c6d05f6c5eeeea96ced20ff112e, and the
compatibility wrappers were removed completely in kernel commit
8fa7292fee5c5240402371ea89ab285ec856c916. Add the wrappers
back on newer kernels to allow compilation.
Resolves: #91
Upstream: https://github.com/asterisk/dahdi-linux/commit/67d909a8a73364d6fa47bbf8baf314175c94f546
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
include/dahdi/kernel.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index ab129a8..ddd3eb4 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -62,6 +62,11 @@
#define netif_napi_add netif_napi_add_weight
#endif
+#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(5, 18, 0)
#include <linux/pci.h>
#include <linux/dma-mapping.h>
--
2.55.0

View File

@@ -0,0 +1,186 @@
From fc3748466d96fa465fe665403b73d6f4f75c124b Mon Sep 17 00:00:00 2001
From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com>
Date: Fri, 21 Feb 2025 21:42:19 -0500
Subject: [PATCH] Kbuild: Use ccflags-y instead of EXTRA_CFLAGS.
ccflags-y was added to the kernel back in 2007, in commit
f77bf01425b11947eeb3b5b54. Recent kernel commit
dbd83ea09699390892e5efecddd74ae43a00f071 has now completely
removed the deprecated EXTRA_CFLAGS.
Comments in Kbuild and the Makefile for the oct612x library were
added back when it was created in 2013 in commit f65299e8b2e6ffb0b07089759f8c4ff33a695c09
to use the newer ccflags-y based on the kernel version,
but the change was never made to conditionally move away
from the EXTRA_CFLAGS.
Now that the older way no longer exists, always use ccflags-y.
Resolves: #76
Upstream: https://github.com/asterisk/dahdi-linux/commit/9d5b120cb5573d39bcd9e3d8a7b212e25ab5c2c4
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
drivers/dahdi/Kbuild | 4 ++--
drivers/dahdi/oct612x/Kbuild | 5 +----
drivers/dahdi/oct612x/Makefile | 5 +----
drivers/dahdi/voicebus/Kbuild | 4 ++--
drivers/dahdi/wcb4xxp/Kbuild | 2 +-
drivers/dahdi/wct4xxp/Kbuild | 6 +++---
drivers/dahdi/wctc4xxp/Kbuild | 4 ++--
drivers/dahdi/wctdm24xxp/Kbuild | 2 +-
drivers/dahdi/xpp/Kbuild | 4 ++--
9 files changed, 15 insertions(+), 21 deletions(-)
diff --git a/drivers/dahdi/Kbuild b/drivers/dahdi/Kbuild
index cd0365b..9c9355a 100644
--- a/drivers/dahdi/Kbuild
+++ b/drivers/dahdi/Kbuild
@@ -75,13 +75,13 @@ CFLAGS_MODULE += -I$(DAHDI_INCLUDE) -I$(src) -Wno-format-truncation
BAD_KERNELS_VERS := 22 34 34.0.1 34.0.2
BAD_KERNELS := $(foreach ver,$(BAD_KERNELS_VERS),2.6.9-$(ver).EL 2.6.9-$(ver).ELsmp)
ifneq (,$(filter $(KVERS),$(BAD_KERNELS)))
-EXTRA_CFLAGS+=-Drw_lock_t=rwlock_t
+ccflags-y+=-Drw_lock_t=rwlock_t
endif
# A number of Fedora 10 (9 also?) kernels backported hrtimer to 2.6.27
# as part of an ALSA backport. TODO: Any better way to detect that?
ifeq (1,$(shell fgrep -q ' hrtimer_set_expires' include/linux/hrtimer.h 2>/dev/null && echo 1))
-EXTRA_CFLAGS+=-DHAVE_HRTIMER_ACCESSORS=1
+ccflags-y+=-DHAVE_HRTIMER_ACCESSORS=1
endif
ifeq (1,$(shell fgrep -q 'wait_for_completion_timeout' include/linux/completion.h 2>/dev/null && echo 1))
diff --git a/drivers/dahdi/oct612x/Kbuild b/drivers/dahdi/oct612x/Kbuild
index ac53fe7..5015f7e 100644
--- a/drivers/dahdi/oct612x/Kbuild
+++ b/drivers/dahdi/oct612x/Kbuild
@@ -24,9 +24,6 @@ octapi_files = octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o \
apilib/llman/octapi_llman.o \
oct612x-user.o
-# TODO: ccflags was added in 2.6.24 in commit f77bf01425b11947eeb3b5b54. This
-# should be changed to a conditional compilation based on the Kernel Version.
-# ccflags-y := -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
-EXTRA_CFLAGS = -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
+ccflags-y := -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_OCT612X) := oct612x.o
oct612x-objs := $(octapi_files)
diff --git a/drivers/dahdi/oct612x/Makefile b/drivers/dahdi/oct612x/Makefile
index 5d29143..d01997b 100644
--- a/drivers/dahdi/oct612x/Makefile
+++ b/drivers/dahdi/oct612x/Makefile
@@ -23,8 +23,5 @@ octapi_files = octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o \
apilib/largmath/octapi_largmath.o \
apilib/llman/octapi_llman.o
-# TODO: ccflags was added in 2.6.24 in commit f77bf01425b11947eeb3b5b54. This
-# should be changed to a conditional compilation based on the Kernel Version.
-# ccflags-y := -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
-EXTRA_CFLAGS = -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
+ccflags-y := -I$(src)/.. -Wno-undef -I$(src)/include -I$(src)/octdeviceapi -I$(src)/octdeviceapi/oct6100api
lib-y := $(octapi_files)
diff --git a/drivers/dahdi/voicebus/Kbuild b/drivers/dahdi/voicebus/Kbuild
index 3bf9640..45026d9 100644
--- a/drivers/dahdi/voicebus/Kbuild
+++ b/drivers/dahdi/voicebus/Kbuild
@@ -8,10 +8,10 @@ ifneq ($(HOTPLUG_FIRMWARE),yes)
dahdi_voicebus-objs += $(FIRM_DIR)/dahdi-fw-vpmoct032.o
$(warning WARNING: You are compiling firmware into voicebus.ko which is not available under the terms of the GPL. It may be a violation of the GPL to distribute the resulting image since it combines both GPL and non-GPL work. You should consult a lawyer of your own before distributing such an image.)
else
- EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE
+ ccflags-y+=-DHOTPLUG_FIRMWARE
endif
-EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
+ccflags-y += -I$(src)/.. -Wno-undef
$(obj)/$(FIRM_DIR)/dahdi-fw-vpmoct032.o: $(obj)/voicebus.o
$(MAKE) -C $(obj)/$(FIRM_DIR) dahdi-fw-vpmoct032.o
diff --git a/drivers/dahdi/wcb4xxp/Kbuild b/drivers/dahdi/wcb4xxp/Kbuild
index 80606bf..59ffc8d 100644
--- a/drivers/dahdi/wcb4xxp/Kbuild
+++ b/drivers/dahdi/wcb4xxp/Kbuild
@@ -1,6 +1,6 @@
obj-m += wcb4xxp.o
-EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
+ccflags-y += -I$(src)/.. -Wno-undef
wcb4xxp-objs := base.o
diff --git a/drivers/dahdi/wct4xxp/Kbuild b/drivers/dahdi/wct4xxp/Kbuild
index cf01ccf..eeeb2f6 100644
--- a/drivers/dahdi/wct4xxp/Kbuild
+++ b/drivers/dahdi/wct4xxp/Kbuild
@@ -2,16 +2,16 @@ obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCT4XXP) += wct4xxp.o
FIRM_DIR := ../firmware
-EXTRA_CFLAGS += -I$(src)/.. -I$(src)/../oct612x/ $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef
+ccflags-y += -I$(src)/.. -I$(src)/../oct612x/ $(shell $(src)/../oct612x/octasic-helper cflags $(src)/../oct612x) -Wno-undef
# The OCT612X source files are from a vendor drop and we do not want to edit
# them to make this warning go away. Therefore, turn off the
# unused-but-set-variable warning for this driver.
-EXTRA_CFLAGS += $(call cc-option, -Wno-unused-but-set-variable)
+ccflags-y += $(call cc-option, -Wno-unused-but-set-variable)
ifeq ($(HOTPLUG_FIRMWARE),yes)
- EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE
+ ccflags-y+=-DHOTPLUG_FIRMWARE
endif
wct4xxp-objs := base.o vpm450m.o
diff --git a/drivers/dahdi/wctc4xxp/Kbuild b/drivers/dahdi/wctc4xxp/Kbuild
index 9f97498..2f1bfbf 100644
--- a/drivers/dahdi/wctc4xxp/Kbuild
+++ b/drivers/dahdi/wctc4xxp/Kbuild
@@ -2,10 +2,10 @@ obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTC4XXP) += wctc4xxp.o
FIRM_DIR := ../firmware
-EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
+ccflags-y += -I$(src)/.. -Wno-undef
ifeq ($(HOTPLUG_FIRMWARE),yes)
- EXTRA_CFLAGS+=-DHOTPLUG_FIRMWARE
+ ccflags-y+=-DHOTPLUG_FIRMWARE
endif
wctc4xxp-objs := base.o
diff --git a/drivers/dahdi/wctdm24xxp/Kbuild b/drivers/dahdi/wctdm24xxp/Kbuild
index 22cc71a..c9d96b7 100644
--- a/drivers/dahdi/wctdm24xxp/Kbuild
+++ b/drivers/dahdi/wctdm24xxp/Kbuild
@@ -1,5 +1,5 @@
obj-$(DAHDI_BUILD_ALL)$(CONFIG_DAHDI_WCTDM24XXP) += wctdm24xxp.o
-EXTRA_CFLAGS += -I$(src)/.. -Wno-undef
+ccflags-y += -I$(src)/.. -Wno-undef
wctdm24xxp-objs := base.o xhfc.o
diff --git a/drivers/dahdi/xpp/Kbuild b/drivers/dahdi/xpp/Kbuild
index e46a9d7..02d3149 100644
--- a/drivers/dahdi/xpp/Kbuild
+++ b/drivers/dahdi/xpp/Kbuild
@@ -1,4 +1,4 @@
-EXTRA_CFLAGS = $(XPP_LOCAL_CFLAGS) \
+ccflags-y = $(XPP_LOCAL_CFLAGS) \
-DDEBUG \
-DPOLL_DIGITAL_INPUTS \
-DDEBUG_PCMTX \
@@ -32,7 +32,7 @@ xpd_echo-objs += card_echo.o
xpp_mmap-objs += mmapbus.o mmapdrv.o
ifeq (y,$(PARPORT_DEBUG))
-EXTRA_CFLAGS += -DDEBUG_SYNC_PARPORT
+ccflags-y += -DDEBUG_SYNC_PARPORT
obj-m += parport_debug.o
endif
--
2.55.0

View File

@@ -0,0 +1,35 @@
From 13e360f1bc65dba29ba22c46f30ba868bea9805d Mon Sep 17 00:00:00 2001
From: InterLinked1 <24227567+InterLinked1@users.noreply.github.com>
Date: Sat, 12 Jul 2025 17:52:40 -0400
Subject: [PATCH] kernel.h: Add wrapper for renamed from_timer function.
from_timer was renamed to timer_container_of in kernel commit
41cb08555c4164996d67c78b3bf1c658075b75f1 as part of updates to
the timer APIs. Add a compatibility wrapper for kernels >= 6.16.0.
Resolves: #95
Upstream: https://github.com/asterisk/dahdi-linux/commit/0d864e9f97ba22e340380ce24a1bd366ca33ebc2
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
include/dahdi/kernel.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/dahdi/kernel.h b/include/dahdi/kernel.h
index ddd3eb4..01fe113 100644
--- a/include/dahdi/kernel.h
+++ b/include/dahdi/kernel.h
@@ -58,6 +58,10 @@
#include <linux/poll.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 16, 0)
+#define from_timer timer_container_of
+#endif
+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)
#define netif_napi_add netif_napi_add_weight
#endif
--
2.55.0