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.
Unified · Split
| @@ -183,7 +183,20 @@ extern int timer_reduce(struct timer_list *timer, unsigned long expires); · 182 unmodified lines | ||
| 183 | 183 | extern void add_timer(struct timer_list *timer); |
| 184 | 184 | |
| 185 | 185 | 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 | +} | |
| 187 | 200 | |
| 188 | 201 | extern void init_timers(void); |
| 189 | 202 | struct hrtimer; |
| @@ -1083,7 +1083,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, unsigned int option · 1082 unmodified lines | ||
| 1083 | 1083 | /* |
| 1084 | 1084 | * We are trying to schedule the timer on the new base. |
| 1085 | 1085 | * 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 | |
| 1087 | 1087 | * handler yet has not finished. This also guarantees that the |
| 1088 | 1088 | * timer is serialized wrt itself. |
| 1089 | 1089 | */ |
| @@ -1261,7 +1261,7 @@ EXPORT_SYMBOL_GPL(add_timer_on); · 171 unmodified lines | ||
| 1261 | 1261 | * @timer: The timer to be deactivated |
| 1262 | 1262 | * |
| 1263 | 1263 | * 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 | |
| 1265 | 1265 | * callback function is concurrently executed on a different CPU or not. |
| 1266 | 1266 | * It neither prevents rearming of the timer. If @timer can be rearmed |
| 1267 | 1267 | * 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 | ||
| 1397 | 1397 | #endif |
| 1398 | 1398 | |
| 1399 | 1399 | /** |
| 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. | |
| 1401 | 1401 | * @timer: The timer to be deactivated |
| 1402 | 1402 | * |
| 1403 | 1403 | * 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 | ||
| 1419 | 1419 | * spin_lock_irq(somelock); |
| 1420 | 1420 | * <IRQ> |
| 1421 | 1421 | * spin_lock(somelock); |
| 1422 | − * del_timer_sync(mytimer); | |
| 1422 | + * timer_delete_sync(mytimer); | |
| 1423 | 1423 | * while (base->running_timer == mytimer); |
| 1424 | 1424 | * |
| 1425 | − * Now del_timer_sync() will never return and never release somelock. | |
| 1425 | + * Now timer_delete_sync() will never return and never release somelock. | |
| 1426 | 1426 | * The interrupt on the other CPU is waiting to grab somelock but it has |
| 1427 | 1427 | * interrupted the softirq that CPU0 is waiting to finish. |
| 1428 | 1428 | * |
| @@ -1435,7 +1435,7 @@ static inline void del_timer_wait_running(struct timer_list *timer) { } · 6 unmodified lines | ||
| 1435 | 1435 | * * %0 - The timer was not pending |
| 1436 | 1436 | * * %1 - The timer was pending and deactivated |
| 1437 | 1437 | */ |
| 1438 | −int del_timer_sync(struct timer_list *timer) | |
| 1438 | +int timer_delete_sync(struct timer_list *timer) | |
| 1439 | 1439 | { |
| 1440 | 1440 | int ret; |
| 1441 | 1441 | |
| @@ -1475,7 +1475,7 @@ int del_timer_sync(struct timer_list *timer) · 33 unmodified lines | ||
| 1475 | 1475 | |
| 1476 | 1476 | return ret; |
| 1477 | 1477 | } |
| 1478 | −EXPORT_SYMBOL(del_timer_sync); | |
| 1478 | +EXPORT_SYMBOL(timer_delete_sync); | |
| 1479 | 1479 | |
| 1480 | 1480 | static void call_timer_fn(struct timer_list *timer, |
| 1481 | 1481 | void (*fn)(struct timer_list *), |
| @@ -1497,8 +1497,8 @@ static void call_timer_fn(struct timer_list *timer, · 15 unmodified lines | ||
| 1497 | 1497 | #endif |
| 1498 | 1498 | /* |
| 1499 | 1499 | * 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(). | |
| 1502 | 1502 | */ |
| 1503 | 1503 | lock_map_acquire(&lockdep_map); |
| 1504 | 1504 | |