uoa: fix build on kernels that renamed from_timer() to timer_container_of() - #1066
Open
pubyun wants to merge 1 commit into
Open
uoa: fix build on kernels that renamed from_timer() to timer_container_of()#1066pubyun wants to merge 1 commit into
pubyun wants to merge 1 commit into
Conversation
Upstream v6.16 renamed from_timer() to timer_container_of(). RHEL/AlmaLinux backport this rename into 5.14.0-based kernels (e.g. AlmaLinux 9.8's 5.14.0-687), where the version number stays at 5.14 but from_timer() is gone, so a LINUX_VERSION_CODE check is unreliable. Detect by macro presence instead and alias from_timer() to timer_container_of() when only the latter exists. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Building the
uoakernel module on AlmaLinux 9.8 (kernel5.14.0-687) fails:Upstream commit (Linux v6.16) renamed the
from_timer()macro totimer_container_of(). RHEL/AlmaLinux backport this rename into their5.14.0-based kernels, so the kernel version number stays at5.14whilefrom_timer()is already gone. ALINUX_VERSION_CODEbased guard cannot detect this case reliably — a>= KERNEL_VERSION(6,16,0)check would miss the backported5.14.0-687, which is exactly what triggers the build failure.Fix
Detect the API by macro presence instead of kernel version, and alias
from_timer()totimer_container_of()only when the new name exists and the old one does not:The shim is placed right after
#include <linux/timer.h>, so the timer helpers are already visible to thedefined()checks.Behavior across kernels:
from_timeris defined natively, the shim is skipped.from_timeris gone,timer_container_ofexists, the shim maps the old name to the new one.#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0)guard at the use site keeps the legacyunsigned longtimer-callback path. No effect.Testing
Verified to build cleanly on AlmaLinux 9.8 (
5.14.0-687.5.4.el9_8.x86_64). The change is a compile-time macro shim with no runtime impact.🤖 Generated with Claude Code