mirror of
https://github.com/torvalds/linux.git
synced 2025-12-01 07:26:02 +07:00
Documentation: Replace del_timer/del_timer_sync()
Adjust to the new preferred function names. Suggested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Reviewed-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Link: https://lore.kernel.org/r/20221123201625.075320635@linutronix.de
This commit is contained in:
@@ -967,7 +967,7 @@ you might do the following::
|
||||
|
||||
while (list) {
|
||||
struct foo *next = list->next;
|
||||
del_timer(&list->timer);
|
||||
timer_delete(&list->timer);
|
||||
kfree(list);
|
||||
list = next;
|
||||
}
|
||||
@@ -981,7 +981,7 @@ the lock after we spin_unlock_bh(), and then try to free
|
||||
the element (which has already been freed!).
|
||||
|
||||
This can be avoided by checking the result of
|
||||
del_timer(): if it returns 1, the timer has been deleted.
|
||||
timer_delete(): if it returns 1, the timer has been deleted.
|
||||
If 0, it means (in this case) that it is currently running, so we can
|
||||
do::
|
||||
|
||||
@@ -990,7 +990,7 @@ do::
|
||||
|
||||
while (list) {
|
||||
struct foo *next = list->next;
|
||||
if (!del_timer(&list->timer)) {
|
||||
if (!timer_delete(&list->timer)) {
|
||||
/* Give timer a chance to delete this */
|
||||
spin_unlock_bh(&list_lock);
|
||||
goto retry;
|
||||
@@ -1005,8 +1005,7 @@ do::
|
||||
Another common problem is deleting timers which restart themselves (by
|
||||
calling add_timer() at the end of their timer function).
|
||||
Because this is a fairly common case which is prone to races, you should
|
||||
use del_timer_sync() (``include/linux/timer.h``) to
|
||||
handle this case.
|
||||
use timer_delete_sync() (``include/linux/timer.h``) to handle this case.
|
||||
|
||||
Locking Speed
|
||||
=============
|
||||
@@ -1334,7 +1333,7 @@ lock.
|
||||
|
||||
- kfree()
|
||||
|
||||
- add_timer() and del_timer()
|
||||
- add_timer() and timer_delete()
|
||||
|
||||
Mutex API reference
|
||||
===================
|
||||
|
||||
Reference in New Issue
Block a user