Skip to content

timers: Replace del_timer_sync() with timer_delete_sync() for Linux >= 6.1.84 #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

horseface1110
Copy link
Contributor

To align with the changes introduced in Linux kernel version 6.15, this commit replaces the deprecated del_timer_sync() with timer_delete_sync(), which now serves as its functional replacement. The function parameters remain unchanged, making this a direct drop-in fix.

ref:
torvalds/linux@9b13df3

@jserv jserv requested a review from jychen0611 May 30, 2025 17:39
Copy link
Collaborator

@jychen0611 jychen0611 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since v6.1.84, del_timer_sync() has been redefined as a wrapper for timer_delete_sync(), which is defined in timer.h.

6.1.84 is where the rename happened, not 6.15.0. So checking for 6.15 is too conservative.
Avoiding the wrapper (even if present) is good practice in new code.

You should also modify your commit message description.
e.g.

The "del_timer_sync()" function was renamed to "timer_delete_sync()" in kernel 6.1.84
as part of a naming consistency cleanup. The old function remains as a wrapper for
backward compatibility but is discouraged for use in new code.

Update the version check to use 6.1.84 instead of 6.15.0, so that newer kernels call
"timer_delete_sync()" directly and avoid relying on the deprecated wrapper.

ref:

bootlin

commit 8fa7292fee5c5240402371ea89ab285ec856c916
Author: Thomas Gleixner [email protected]
Date: Sat Apr 5 10:17:26 2025 +0200

treewide: Switch/rename to timer_delete[_sync]()

timer_delete[_sync]() replaces del_timer[_sync](). Convert the whole tree
over and remove the historical wrapper inlines.

Conversion was done with coccinelle plus manual fixups where necessary.

Signed-off-by: Thomas Gleixner <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>

commit 9b13df3fb64ee95e2397585404e442afee2c7d4f
Author: Thomas Gleixner [email protected]
Date: Wed Nov 23 21:18:44 2022 +0100

timers: Rename del_timer_sync() to timer_delete_sync()

The timer related functions do not have a strict timer_ prefixed namespace
which is really annoying.

Rename del_timer_sync() to timer_delete_sync() and provide del_timer_sync()
as a wrapper. Document that del_timer_sync() is not for new code.

Signed-off-by: Thomas Gleixner <[email protected]>
Tested-by: Guenter Roeck <[email protected]>
Reviewed-by: Steven Rostedt (Google) <[email protected]>
Reviewed-by: Jacob Keller <[email protected]>
Reviewed-by: Anna-Maria Behnsen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

@horseface1110 horseface1110 force-pushed the fix/timer-api-linux-6.15 branch from e21e3a4 to 5b52fac Compare June 2, 2025 08:18
@horseface1110
Copy link
Contributor Author

Thanks @jychen0611 for the suggestion. Version check has been updated to KERNEL_VERSION(6, 1, 84) and the commit message rewritten accordingly. Please take another look!

@horseface1110 horseface1110 force-pushed the fix/timer-api-linux-6.15 branch from 5b52fac to a77fec4 Compare June 2, 2025 08:22
@jserv
Copy link
Contributor

jserv commented Jun 2, 2025

Thanks @jychen0611 for the suggestion. Version check has been updated to KERNEL_VERSION(6, 1, 84) and the commit message rewritten accordingly. Please take another look!

Change the subject of this pull request as well.

Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase the latest main branch and refine the subject.

@horseface1110 horseface1110 changed the title Support Linux 6.15 about del_timer_sync timers: Replace del_timer_sync() with timer_delete_sync() for Linux >= 6.1.84 Jun 4, 2025
@horseface1110 horseface1110 force-pushed the fix/timer-api-linux-6.15 branch from a77fec4 to c19af9c Compare June 5, 2025 02:54
Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refine git commit messages.

Update timer deletion to use the new timer_delete_sync() interface
introduced in Linux commit 9b13df3f ("timers: Rename del_timer_sync() to
timer_delete_sync()"), which replaces the older del_timer_sync() for
naming consistency.

The legacy del_timer_sync() interface remains as an inline wrapper but
is discouraged for new code. Compatibility is maintained using a version
check against KERNEL_VERSION(6, 1, 84).
@horseface1110 horseface1110 force-pushed the fix/timer-api-linux-6.15 branch from c19af9c to 75f36f5 Compare June 5, 2025 17:11
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.

3 participants