Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

timer: Remove init_timer() interface

All users of init_timer() have been updated. Remove the ancient interface.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Kees Cook <keescook@chromium.org>

+3 -10
+3 -7
Documentation/core-api/local_ops.rst
··· 177 177 printk("Read : CPU %d, count %ld\n", cpu, 178 178 local_read(&per_cpu(counters, cpu))); 179 179 } 180 - del_timer(&test_timer); 181 - test_timer.expires = jiffies + 1000; 182 - add_timer(&test_timer); 180 + mod_timer(&test_timer, jiffies + 1000); 183 181 } 184 182 185 183 static int __init test_init(void) 186 184 { 187 185 /* initialize the timer that will increment the counter */ 188 - init_timer(&test_timer); 189 - test_timer.function = do_test_timer; 190 - test_timer.expires = jiffies + 1; 191 - add_timer(&test_timer); 186 + timer_setup(&test_timer, do_test_timer, 0); 187 + mod_timer(&test_timer, jiffies + 1); 192 188 193 189 return 0; 194 190 }
-3
include/linux/timer.h
··· 117 117 init_timer_on_stack_key((_timer), (_flags), NULL, NULL) 118 118 #endif 119 119 120 - #define init_timer(timer) \ 121 - __init_timer((timer), 0) 122 - 123 120 #define __setup_timer(_timer, _fn, _data, _flags) \ 124 121 do { \ 125 122 __init_timer((_timer), (_flags)); \