Blob Blame History Raw
From: Thomas Gleixner <tglx@linutronix.de>
Date: Wed, 23 Nov 2022 21:18:44 +0100
Subject: timers: Rename del_timer_sync() to timer_delete_sync()
Patch-mainline: v6.2-rc1
Git-commit: 9b13df3fb64ee95e2397585404e442afee2c7d4f
References: bsc#1213970

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.

SUSE: keep del_timer_sync() in kernel/time/timer.c to not break kABI

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Link: https://lore.kernel.org/r/20221123201624.954785441@linutronix.de
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 include/linux/timer.h |    1 +
 kernel/time/timer.c   |   28 +++++++++++++++++++++-------
 2 files changed, 22 insertions(+), 7 deletions(-)

--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -198,6 +198,7 @@ extern void add_timer(struct timer_list
 
 extern int try_to_del_timer_sync(struct timer_list *timer);
 extern int del_timer_sync(struct timer_list *timer);
+extern int timer_delete_sync(struct timer_list *timer);
 
 #define del_singleshot_timer_sync(t) del_timer_sync(t)
 
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -989,7 +989,7 @@ __mod_timer(struct timer_list *timer, un
 		/*
 		 * We are trying to schedule the timer on the new base.
 		 * However we can't change timer's base while it is running,
-		 * otherwise del_timer_sync() can't detect that the timer's
+		 * otherwise timer_delete_sync() can't detect that the timer's
 		 * handler yet has not finished. This also guarantees that the
 		 * timer is serialized wrt itself.
 		 */
@@ -1148,7 +1148,7 @@ EXPORT_SYMBOL_GPL(add_timer_on);
  * @timer:	The timer to be deactivated
  *
  * The function only deactivates a pending timer, but contrary to
- * del_timer_sync() it does not take into account whether the timer's
+ * timer_delete_sync() it does not take into account whether the timer's
  * callback function is concurrently executed on a different CPU or not.
  * It neither prevents rearming of the timer. If @timer can be rearmed
  * concurrently then the return value of this function is meaningless.
@@ -1211,7 +1211,7 @@ int try_to_del_timer_sync(struct timer_l
 EXPORT_SYMBOL(try_to_del_timer_sync);
 
 /**
- * del_timer_sync - Deactivate a timer and wait for the handler to finish.
+ * timer_delete_sync - Deactivate a timer and wait for the handler to finish.
  * @timer:	The timer to be deactivated
  *
  * Synchronization rules: Callers must prevent restarting of the timer,
@@ -1236,7 +1236,7 @@ EXPORT_SYMBOL(try_to_del_timer_sync);
  *  del_timer_sync(mytimer);
  *   while (base->running_timer == mytimer);
  *
- * Now del_timer_sync() will never return and never release somelock.
+ * Now timer_delete_sync() will never return and never release somelock.
  * The interrupt on the other CPU is waiting to grab somelock but it has
  * interrupted the softirq that CPU0 is waiting to finish.
  *
@@ -1249,7 +1249,7 @@ EXPORT_SYMBOL(try_to_del_timer_sync);
  * * %0	- The timer was not pending
  * * %1	- The timer was pending and deactivated
  */
-int del_timer_sync(struct timer_list *timer)
+int timer_delete_sync(struct timer_list *timer)
 {
 #ifdef CONFIG_LOCKDEP
 	unsigned long flags;
@@ -1275,6 +1275,20 @@ int del_timer_sync(struct timer_list *ti
 		cpu_relax();
 	}
 }
+EXPORT_SYMBOL(timer_delete_sync);
+
+/**
+ * del_timer_sync - Delete a pending timer and wait for a running callback
+ * @timer:     The timer to be deleted
+ *
+ * See timer_delete_sync() for detailed explanation.
+ *
+ * Do not use in new code. Use timer_delete_sync() instead.
+ */
+int del_timer_sync(struct timer_list *timer)
+{
+	return timer_delete_sync(timer);
+}
 EXPORT_SYMBOL(del_timer_sync);
 
 static void call_timer_fn(struct timer_list *timer, void (*fn)(unsigned long),
@@ -1296,8 +1310,8 @@ static void call_timer_fn(struct timer_l
 #endif
 	/*
 	 * Couple the lock chain with the lock chain at
-	 * del_timer_sync() by acquiring the lock_map around the fn()
-	 * call here and in del_timer_sync().
+	 * timer_delete_sync() by acquiring the lock_map around the fn()
+	 * call here and in timer_delete_sync().
 	 */
 	lock_map_acquire(&lockdep_map);