diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2022-11-23 21:18:47 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2022-11-24 15:09:11 +0100 |
commit | 87bdd932e85881895d4720255b40ac28749c4e32 (patch) | |
tree | c90bd47e8f27be83ec3cd35fdb3cdd9d6d95d2cf /Documentation/kernel-hacking | |
parent | bb663f0f3c396c6d05f6c5eeeea96ced20ff112e (diff) | |
download | linux-87bdd932e85881895d4720255b40ac28749c4e32.tar.bz2 |
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
Diffstat (limited to 'Documentation/kernel-hacking')
-rw-r--r-- | Documentation/kernel-hacking/locking.rst | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/Documentation/kernel-hacking/locking.rst b/Documentation/kernel-hacking/locking.rst index b26e4a3a9b7e..c5b8678ed232 100644 --- a/Documentation/kernel-hacking/locking.rst +++ b/Documentation/kernel-hacking/locking.rst @@ -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 =================== |