timers: Rename del_timer_sync() to timer_delete_sync()

[ Upstream commit 9b13df3fb6 ]

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 <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
Stable-dep-of: 0f7352557a35 ("wifi: brcmfmac: Fix use-after-free bug in brcmf_cfg80211_detach")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Thomas Gleixner 2022-11-23 21:18:44 +01:00 коммит произвёл Greg Kroah-Hartman
Родитель 2a873e6178
Коммит 2382f2e45c
2 изменённых файлов: 23 добавлений и 10 удалений

Просмотреть файл

@ -183,7 +183,20 @@ extern int timer_reduce(struct timer_list *timer, unsigned long expires);
extern void add_timer(struct timer_list *timer); extern void add_timer(struct timer_list *timer);
extern int try_to_del_timer_sync(struct timer_list *timer); 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);
/**
* 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.
*/
static inline int del_timer_sync(struct timer_list *timer)
{
return timer_delete_sync(timer);
}
#define del_singleshot_timer_sync(t) del_timer_sync(t) #define del_singleshot_timer_sync(t) del_timer_sync(t)

Просмотреть файл

@ -1030,7 +1030,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, unsigned int option
/* /*
* We are trying to schedule the timer on the new base. * We are trying to schedule the timer on the new base.
* However we can't change timer's base while it is running, * 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 * handler yet has not finished. This also guarantees that the
* timer is serialized wrt itself. * timer is serialized wrt itself.
*/ */
@ -1206,7 +1206,7 @@ EXPORT_SYMBOL_GPL(add_timer_on);
* @timer: The timer to be deactivated * @timer: The timer to be deactivated
* *
* The function only deactivates a pending timer, but contrary to * 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. * callback function is concurrently executed on a different CPU or not.
* It neither prevents rearming of the timer. If @timer can be rearmed * It neither prevents rearming of the timer. If @timer can be rearmed
* concurrently then the return value of this function is meaningless. * concurrently then the return value of this function is meaningless.
@ -1342,7 +1342,7 @@ static inline void del_timer_wait_running(struct timer_list *timer) { }
#endif #endif
/** /**
* 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 * @timer: The timer to be deactivated
* *
* Synchronization rules: Callers must prevent restarting of the timer, * Synchronization rules: Callers must prevent restarting of the timer,
@ -1364,10 +1364,10 @@ static inline void del_timer_wait_running(struct timer_list *timer) { }
* spin_lock_irq(somelock); * spin_lock_irq(somelock);
* <IRQ> * <IRQ>
* spin_lock(somelock); * spin_lock(somelock);
* del_timer_sync(mytimer); * timer_delete_sync(mytimer);
* while (base->running_timer == 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 * The interrupt on the other CPU is waiting to grab somelock but it has
* interrupted the softirq that CPU0 is waiting to finish. * interrupted the softirq that CPU0 is waiting to finish.
* *
@ -1380,7 +1380,7 @@ static inline void del_timer_wait_running(struct timer_list *timer) { }
* * %0 - The timer was not pending * * %0 - The timer was not pending
* * %1 - The timer was pending and deactivated * * %1 - The timer was pending and deactivated
*/ */
int del_timer_sync(struct timer_list *timer) int timer_delete_sync(struct timer_list *timer)
{ {
int ret; int ret;
@ -1420,7 +1420,7 @@ int del_timer_sync(struct timer_list *timer)
return ret; return ret;
} }
EXPORT_SYMBOL(del_timer_sync); EXPORT_SYMBOL(timer_delete_sync);
static void call_timer_fn(struct timer_list *timer, static void call_timer_fn(struct timer_list *timer,
void (*fn)(struct timer_list *), void (*fn)(struct timer_list *),
@ -1442,8 +1442,8 @@ static void call_timer_fn(struct timer_list *timer,
#endif #endif
/* /*
* Couple the lock chain with the lock chain at * Couple the lock chain with the lock chain at
* del_timer_sync() by acquiring the lock_map around the fn() * timer_delete_sync() by acquiring the lock_map around the fn()
* call here and in del_timer_sync(). * call here and in timer_delete_sync().
*/ */
lock_map_acquire(&lockdep_map); lock_map_acquire(&lockdep_map);