All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] headers: Add timer_shutdown_sync()
@ 2026-05-12  7:13 Yi Cong
  0 siblings, 0 replies; only message in thread
From: Yi Cong @ 2026-05-12  7:13 UTC (permalink / raw)
  To: hauke, backports; +Cc: Yi Cong

From: Yi Cong <yicong@kylinos.cn>

This function need delete timer and set functionm callback
to NULL

Signed-off-by: Yi Cong <yicong@kylinos.cn>
---
 backport/backport-include/linux/timer.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/backport/backport-include/linux/timer.h b/backport/backport-include/linux/timer.h
index 14467fb6..36e15340 100644
--- a/backport/backport-include/linux/timer.h
+++ b/backport/backport-include/linux/timer.h
@@ -79,4 +79,18 @@ static inline int timer_delete_sync(struct timer_list *timer)
 }
 #endif /* < 6.1.84 */
 
+#if LINUX_VERSION_IS_LESS(6,2,0)
+static inline int timer_shutdown_sync(struct timer_list *timer)
+{
+    int ret = del_timer_sync(timer);
+    /*
+     * Emulate shutdown semantics: mark as dead to prevent accidental reuse.
+     * Safe to do after del_timer_sync() because timer is no longer
+     * referenced by the timer subsystem.
+     */
+    timer->function = NULL;
+    return ret;
+}
+#endif
+
 #endif /* _BACKPORT_TIMER_H */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-12  7:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12  7:13 [PATCH] headers: Add timer_shutdown_sync() Yi Cong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.