Skip to content

dahdi-linux: fix hrtimer_init/hrtimer_setup handling on kernel 6.12#944

Open
AgustinLorenzo wants to merge 1 commit into
openwrt:masterfrom
AgustinLorenzo:fix-dahdi
Open

dahdi-linux: fix hrtimer_init/hrtimer_setup handling on kernel 6.12#944
AgustinLorenzo wants to merge 1 commit into
openwrt:masterfrom
AgustinLorenzo:fix-dahdi

Conversation

@AgustinLorenzo

@AgustinLorenzo AgustinLorenzo commented Jul 13, 2026

Copy link
Copy Markdown

Description

The local 210-kernel-h-Add-wrappers-for.patch added a hrtimer_init() compat wrapper in include/dahdi/kernel.h guarded by LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0). This guard is wrong: hrtimer_setup() was only introduced in kernel 6.13 (upstream commit ac8bca2e8f6b3406af10700c427eb9b405c34265), and hrtimer_init() was not actually removed until kernel 6.15 (upstream commit 9779489a31d77a7b9cb6f20d2d2caced4e29dbe6, "hrtimers: Delete hrtimer_init()"). As a result, on kernels 6.8-6.14 (including the 6.12 branch used by qualcommax/ipq807x) the wrapper collides with the kernel's own extern declaration of hrtimer_init(), and also references hrtimer_setup() before it exists on kernels 6.8-6.12, breaking the build:

    error: static declaration of 'hrtimer_init' follows non-static declaration
    error: implicit declaration of function 'hrtimer_setup'

Rather than just fixing the version guard on the local wrapper, adopt upstream's actual fix (asterisk/dahdi-linux@0fc7bfe, "dahdi_dummy: Use hrtimer_setup on kernels >= 6.15.0."), which resolves the same issue (asterisk/dahdi-linux#93) by switching between hrtimer_setup() and hrtimer_init() at the call site in drivers/dahdi/dahdi_dummy.c, guarded correctly by LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0), instead of reimplementing hrtimer_init() as a compat shim in kernel.h.

To Reproduce

Build kmod-dahdi for the qualcommax_ipq807x target with kernel 6.12.94.

Build log

2026-07-13T02:50:01.1550619Z make[5]: Entering directory '/home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/linux-6.12.94'
2026-07-13T02:50:01.6634840Z /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/Kbuild:126: CPU Architecture 'arm64' does not support VPMADT032 or HPEC. Skipping.
2026-07-13T02:50:01.6787126Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.o
2026-07-13T02:50:01.7297346Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.o
2026-07-13T02:50:03.9360642Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.o
2026-07-13T02:50:05.8190932Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.o
2026-07-13T02:50:05.8591575Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.o
2026-07-13T02:50:06.4814426Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.o
2026-07-13T02:50:06.5120432Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_events.o
2026-07-13T02:50:06.7571274Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.o
2026-07-13T02:50:07.2011159Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.o
2026-07-13T02:50:07.2853813Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.o
2026-07-13T02:50:07.3992529Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.o
2026-07-13T02:50:07.5350774Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.o
2026-07-13T02:50:07.5864702Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.o
2026-07-13T02:50:07.7756182Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.o
2026-07-13T02:50:07.8298091Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.o
2026-07-13T02:50:08.1520071Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.o
2026-07-13T02:50:08.3372945Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.o
2026-07-13T02:50:08.3893801Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.o
2026-07-13T02:50:08.4967049Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/apilib/bt/octapi_bt0.o
2026-07-13T02:50:08.5459716Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/apilib/largmath/octapi_largmath.o
2026-07-13T02:50:08.6070667Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/apilib/llman/octapi_llman.o
2026-07-13T02:50:08.6601382Z   CC [M]  /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/oct612x-user.o
2026-07-13T02:50:09.1743536Z In file included from /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/oct612x-user.c:28:
2026-07-13T02:50:09.1745884Z /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/include/dahdi/kernel.h:82:20: error: static declaration of 'hrtimer_init' follows non-static declaration
2026-07-13T02:50:09.1747459Z    82 | static inline void hrtimer_init(struct hrtimer *timer,
2026-07-13T02:50:09.1747911Z       |                    ^~~~~~~~~~~~
2026-07-13T02:50:09.1748328Z In file included from ./include/linux/alarmtimer.h:6,
2026-07-13T02:50:09.1748896Z                  from ./include/linux/posix-timers.h:5,
2026-07-13T02:50:09.1749354Z                  from ./include/linux/sched/signal.h:13,
2026-07-13T02:50:09.1750155Z                  from ./include/linux/rcuwait.h:6,
2026-07-13T02:50:09.1750588Z                  from ./include/linux/percpu-rwsem.h:7,
2026-07-13T02:50:09.1751011Z                  from ./include/linux/fs.h:33,
2026-07-13T02:50:09.1751429Z                  from ./arch/arm64/include/asm/elf.h:141,
2026-07-13T02:50:09.1751854Z                  from ./include/linux/elf.h:6,
2026-07-13T02:50:09.1752252Z                  from ./include/linux/module.h:19,
2026-07-13T02:50:09.1753434Z                  from /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/oct612x-user.c:24:
2026-07-13T02:50:09.1755396Z ./include/linux/hrtimer.h:229:13: note: previous declaration of 'hrtimer_init' with type 'void(struct hrtimer *, clockid_t,  enum hrtimer_mode)' {aka 'void(struct hrtimer *, int,  enum hrtimer_mode)'}
2026-07-13T02:50:09.1756745Z   229 | extern void hrtimer_init(struct hrtimer *timer, clockid_t which_clock,
2026-07-13T02:50:09.1757405Z       |             ^~~~~~~~~~~~
2026-07-13T02:50:09.1882703Z /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/include/dahdi/kernel.h: In function 'hrtimer_init':
2026-07-13T02:50:09.1885221Z /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/include/dahdi/kernel.h:87:5: error: implicit declaration of function 'hrtimer_setup'; did you mean 'timer_setup'? [-Wimplicit-function-declaration]
2026-07-13T02:50:09.1887565Z    87 |     hrtimer_setup(timer, NULL, clock_id, mode);
2026-07-13T02:50:09.1888040Z       |     ^~~~~~~~~~~~~
2026-07-13T02:50:09.1888428Z       |     timer_setup
2026-07-13T02:50:09.2226680Z make[8]: *** [scripts/Makefile.build:229: /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x/oct612x-user.o] Error 1
2026-07-13T02:50:09.2229258Z make[7]: *** [scripts/Makefile.build:466: /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi/oct612x] Error 2
2026-07-13T02:50:09.2233432Z make[6]: *** [/home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/linux-6.12.94/Makefile:1959: /home/runner/actions-runner/_work/openwrt/openwrt/build_dir/target-aarch64_cortex-a53_musl/linux-qualcommax_ipq807x/dahdi-linux-3.4.0/drivers/dahdi] Error 2

Regards, Agustin

FYI @dangowrt @robimarko

@openwrt openwrt Bot added the not following guidelines Pull request does not follow formatting guidelines label Jul 13, 2026
@openwrt

openwrt Bot commented Jul 13, 2026

Copy link
Copy Markdown

Formality Check: Suggestions Available

We completed the verification flow. Please review the formatting overview logs below.

⚠️ STYLISTIC WARNINGS & SUGGESTIONS

Package Release Audit:

  • ⚠️ Package libs/dahdi-linux content changed without a PKG_RELEASE or version bump
  • Do not increment release for minor changes. Cosmetic edits (e.g., typos in comments, copyright updates, formatting/whitespace), changing the package maintainer (PKG_MAINTAINER), or updating source download info (PKG_SOURCE_URL / PKG_HASH) do not require incrementing PKG_RELEASE.

Something broken? Consider reporting an issue.
Running version 1609aa3 deployed on 2026-07-15 00:24:06 CEST

AgustinLorenzo added a commit to AgustinLorenzo/openwrt that referenced this pull request Jul 13, 2026
AgustinLorenzo added a commit to AgustinLorenzo/openwrt that referenced this pull request Jul 13, 2026
AgustinLorenzo added a commit to AgustinLorenzo/openwrt that referenced this pull request Jul 13, 2026
@AgustinLorenzo

Copy link
Copy Markdown
Author

@BKPepe can you review that? The error with the formalities has been occurring ever since that commit was implemented.

@BKPepe

BKPepe commented Jul 14, 2026

Copy link
Copy Markdown
Member

At this point, you have the option to either ask the author who added it (i.e., @graysky2 in pull request #929), or you can add the header yourself on their behalf. There is actually nothing wrong with the bot, and it is correctly pointing this out. :)

Ideally, we need to figure out why the patch is still necessary, whether it was reported as an upstream bug, etc.

@AgustinLorenzo

Copy link
Copy Markdown
Author

At this point, you have the option to either ask the author who added it (i.e., @graysky2 in pull request #929), or you can add the header yourself on their behalf. There is actually nothing wrong with the bot, and it is correctly pointing this out. :)

Ideally, we need to figure out why the patch is still necessary, whether it was reported as an upstream bug, etc.

From what I can see, this has already been reported here: asterisk/dahdi-linux#93, and it has been fixed here: asterisk/dahdi-linux@0fc7bfe. However, no official release including these changes has been published yet.

If we want to avoid applying these patches ourselves, we would need to stop using the 3.4.0 release and instead build from the latest commit on the master branch.

@BKPepe

BKPepe commented Jul 14, 2026

Copy link
Copy Markdown
Member

But nobody ever said we want to avoid applying these patches ourselves. We must have misunderstood each other. Why don't we apply the patch exactly as it is here?

https://github.com/asterisk/dahdi-linux/commit/0fc7bfe4adf9d0fdd9f1f84122306da196bc187a.patch

It has a header, a commit subject, and an author, making it very easy to trace what it does, why it does it, and whether it's part of the upstream and is therefore a backport.

@AgustinLorenzo

Copy link
Copy Markdown
Author

But nobody ever said we want to avoid applying these patches ourselves. We must have misunderstood each other. Why don't we apply the patch exactly as it is here?

https://github.com/asterisk/dahdi-linux/commit/0fc7bfe4adf9d0fdd9f1f84122306da196bc187a.patch

It has a header, a commit subject, and an author, making it very easy to trace what it does, why it does it, and whether it's part of the upstream and is therefore a backport.

Okay, we'll go in that direction. I'll update the PR later.

@openwrt openwrt Bot removed the not following guidelines Pull request does not follow formatting guidelines label Jul 14, 2026
The local 210-kernel-h-Add-wrappers-for.patch added a hrtimer_init()
compat wrapper in include/dahdi/kernel.h guarded by
LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0). This guard is wrong:
hrtimer_setup() was only introduced in kernel 6.13 (upstream commit
ac8bca2e8f6b3406af10700c427eb9b405c34265), and hrtimer_init() was not
actually removed until kernel 6.15 (upstream commit
9779489a31d77a7b9cb6f20d2d2caced4e29dbe6, "hrtimers: Delete
hrtimer_init()"). As a result, on kernels 6.8-6.14 (including the 6.12
branch used by qualcommax/ipq807x) the wrapper collides with the
kernel's own extern declaration of hrtimer_init(), and also references
hrtimer_setup() before it exists on kernels 6.8-6.12, breaking the
build:

    error: static declaration of 'hrtimer_init' follows non-static declaration
    error: implicit declaration of function 'hrtimer_setup'

Rather than just fixing the version guard on the local wrapper, adopt
upstream's actual fix (asterisk/dahdi-linux@0fc7bfe,
"dahdi_dummy: Use hrtimer_setup on kernels >= 6.15.0."), which resolves
the same issue (asterisk/dahdi-linux#93) by switching between
hrtimer_setup() and hrtimer_init() at the call site in
drivers/dahdi/dahdi_dummy.c, guarded correctly by
LINUX_VERSION_CODE >= KERNEL_VERSION(6, 15, 0), instead of
reimplementing hrtimer_init() as a compat shim in kernel.h.

Fixes: 4d8d33a ("dahdi-linux: forward-port to 6.18 kernel APIs, fix build flags")

Signed-off-by: Agustin Lorenzo <agustin.lorenzo@thinco.es>
@AgustinLorenzo AgustinLorenzo changed the title dahdi-linux: hrtimer_init wrapper breaks build on kernel < 6.15 dahdi-linux: fix hrtimer_init/hrtimer_setup handling on kernel 6.12 Jul 14, 2026
@AgustinLorenzo

Copy link
Copy Markdown
Author

PR updated, as discussed @BKPepe

Friendly ping @hauke, @graysky2 and @dangowrt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants