History

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.

Thomas Gleixner committed 3 years ago

Commit 9b13df31 parent 168f6b62 files · +23 −10Browse files

Unified · Split

2 files
  1. include/linux/timer.h +14 −1
  2. kernel/time/timer.c +9 −9
include/linux/timer.h+14−1
@@ -183,7 +183,20 @@ extern int timer_reduce(struct timer_list *timer, unsigned long expires); · 182 unmodified lines
183183 extern void add_timer(struct timer_list *timer);
184184
185185 extern int try_to_del_timer_sync(struct timer_list *timer);
186−extern int del_timer_sync(struct timer_list *timer);
186+extern int timer_delete_sync(struct timer_list *timer);
187+
188+/**
189+ * del_timer_sync - Delete a pending timer and wait for a running callback
190+ * @timer: The timer to be deleted
191+ *
192+ * See timer_delete_sync() for detailed explanation.
193+ *
194+ * Do not use in new code. Use timer_delete_sync() instead.
195+ */
196+static inline int del_timer_sync(struct timer_list *timer)
197+{
198+ return timer_delete_sync(timer);
199+}
187200
188201 extern void init_timers(void);
189202 struct hrtimer;
kernel/time/timer.c+9−9
@@ -1083,7 +1083,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, unsigned int option · 1082 unmodified lines
10831083 /*
10841084 * We are trying to schedule the timer on the new base.
10851085 * However we can't change timer's base while it is running,
1086− * otherwise del_timer_sync() can't detect that the timer's
1086+ * otherwise timer_delete_sync() can't detect that the timer's
10871087 * handler yet has not finished. This also guarantees that the
10881088 * timer is serialized wrt itself.
10891089 */
@@ -1261,7 +1261,7 @@ EXPORT_SYMBOL_GPL(add_timer_on); · 171 unmodified lines
12611261 * @timer: The timer to be deactivated
12621262 *
12631263 * The function only deactivates a pending timer, but contrary to
1264− * del_timer_sync() it does not take into account whether the timer's
1264+ * timer_delete_sync() it does not take into account whether the timer's
12651265 * callback function is concurrently executed on a different CPU or not.
12661266 * It neither prevents rearming of the timer. If @timer can be rearmed
12671267 * concurrently then the return value of this function is meaningless.
@@ -1397,7 +1397,7 @@ static inline void del_timer_wait_running(struct timer_list *timer) { } · 129 unmodified lines
13971397 #endif
13981398
13991399 /**
1400− * del_timer_sync - Deactivate a timer and wait for the handler to finish.
1400+ * timer_delete_sync - Deactivate a timer and wait for the handler to finish.
14011401 * @timer: The timer to be deactivated
14021402 *
14031403 * Synchronization rules: Callers must prevent restarting of the timer,
@@ -1419,10 +1419,10 @@ static inline void del_timer_wait_running(struct timer_list *timer) { } · 15 unmodified lines
14191419 * spin_lock_irq(somelock);
14201420 * <IRQ>
14211421 * spin_lock(somelock);
1422− * del_timer_sync(mytimer);
1422+ * timer_delete_sync(mytimer);
14231423 * while (base->running_timer == mytimer);
14241424 *
1425− * Now del_timer_sync() will never return and never release somelock.
1425+ * Now timer_delete_sync() will never return and never release somelock.
14261426 * The interrupt on the other CPU is waiting to grab somelock but it has
14271427 * interrupted the softirq that CPU0 is waiting to finish.
14281428 *
@@ -1435,7 +1435,7 @@ static inline void del_timer_wait_running(struct timer_list *timer) { } · 6 unmodified lines
14351435 * * %0 - The timer was not pending
14361436 * * %1 - The timer was pending and deactivated
14371437 */
1438−int del_timer_sync(struct timer_list *timer)
1438+int timer_delete_sync(struct timer_list *timer)
14391439 {
14401440 int ret;
14411441
@@ -1475,7 +1475,7 @@ int del_timer_sync(struct timer_list *timer) · 33 unmodified lines
14751475
14761476 return ret;
14771477 }
1478−EXPORT_SYMBOL(del_timer_sync);
1478+EXPORT_SYMBOL(timer_delete_sync);
14791479
14801480 static void call_timer_fn(struct timer_list *timer,
14811481 void (*fn)(struct timer_list *),
@@ -1497,8 +1497,8 @@ static void call_timer_fn(struct timer_list *timer, · 15 unmodified lines
14971497 #endif
14981498 /*
14991499 * Couple the lock chain with the lock chain at
1500− * del_timer_sync() by acquiring the lock_map around the fn()
1501− * call here and in del_timer_sync().
1500+ * timer_delete_sync() by acquiring the lock_map around the fn()
1501+ * call here and in timer_delete_sync().
15021502 */
15031503 lock_map_acquire(&lockdep_map);
15041504

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t