diff options
author | Kees Cook <keescook@chromium.org> | 2017-10-04 19:27:00 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-10-05 09:01:18 -0400 |
commit | 5cd79d6abd2c142352dead0e3df04e86ee32f5d3 (patch) | |
tree | fd76ca94a5814967f58170bd47516cb2266e8c6d | |
parent | df7e828c1b699792b2ff26ebcf0a6d1025b2b790 (diff) |
timer: Remove users of TIMER_DEFERRED_INITIALIZER
This removes uses of TIMER_DEFERRED_INITIALIZER and chooses a location
to call timer_setup() from before add_timer() or mod_timer() is called.
Adjusts callbacks to use from_timer() as needed.
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mips@linux-mips.org
Cc: Petr Mladek <pmladek@suse.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: linux1394-devel@lists.sourceforge.net
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: linux-s390@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Ursula Braun <ubraun@linux.vnet.ibm.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Harish Patil <harish.patil@cavium.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Manish Chopra <manish.chopra@cavium.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-pm@vger.kernel.org
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Mark Gross <mark.gross@intel.com>
Cc: linux-watchdog@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Michael Reed <mdr@sgi.com>
Cc: netdev@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Link: https://lkml.kernel.org/r/1507159627-127660-7-git-send-email-keescook@chromium.org
-rw-r--r-- | arch/s390/kernel/lgr.c | 6 | ||||
-rw-r--r-- | arch/s390/kernel/topology.c | 6 | ||||
-rw-r--r-- | kernel/workqueue.c | 8 |
3 files changed, 9 insertions, 11 deletions
diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c index ae7dff110054..bf9622f0e6b1 100644 --- a/arch/s390/kernel/lgr.c +++ b/arch/s390/kernel/lgr.c | |||
@@ -153,14 +153,13 @@ static void lgr_timer_set(void); | |||
153 | /* | 153 | /* |
154 | * LGR timer callback | 154 | * LGR timer callback |
155 | */ | 155 | */ |
156 | static void lgr_timer_fn(unsigned long ignored) | 156 | static void lgr_timer_fn(struct timer_list *unused) |
157 | { | 157 | { |
158 | lgr_info_log(); | 158 | lgr_info_log(); |
159 | lgr_timer_set(); | 159 | lgr_timer_set(); |
160 | } | 160 | } |
161 | 161 | ||
162 | static struct timer_list lgr_timer = | 162 | static struct timer_list lgr_timer; |
163 | TIMER_DEFERRED_INITIALIZER(lgr_timer_fn, 0, 0); | ||
164 | 163 | ||
165 | /* | 164 | /* |
166 | * Setup next LGR timer | 165 | * Setup next LGR timer |
@@ -181,6 +180,7 @@ static int __init lgr_init(void) | |||
181 | debug_register_view(lgr_dbf, &debug_hex_ascii_view); | 180 | debug_register_view(lgr_dbf, &debug_hex_ascii_view); |
182 | lgr_info_get(&lgr_info_last); | 181 | lgr_info_get(&lgr_info_last); |
183 | debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last)); | 182 | debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last)); |
183 | timer_setup(&lgr_timer, lgr_timer_fn, TIMER_DEFERRABLE); | ||
184 | lgr_timer_set(); | 184 | lgr_timer_set(); |
185 | return 0; | 185 | return 0; |
186 | } | 186 | } |
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index ed0bdd220e1a..d7ece9888c29 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c | |||
@@ -320,15 +320,14 @@ static void topology_flush_work(void) | |||
320 | flush_work(&topology_work); | 320 | flush_work(&topology_work); |
321 | } | 321 | } |
322 | 322 | ||
323 | static void topology_timer_fn(unsigned long ignored) | 323 | static void topology_timer_fn(struct timer_list *unused) |
324 | { | 324 | { |
325 | if (ptf(PTF_CHECK)) | 325 | if (ptf(PTF_CHECK)) |
326 | topology_schedule_update(); | 326 | topology_schedule_update(); |
327 | set_topology_timer(); | 327 | set_topology_timer(); |
328 | } | 328 | } |
329 | 329 | ||
330 | static struct timer_list topology_timer = | 330 | static struct timer_list topology_timer; |
331 | TIMER_DEFERRED_INITIALIZER(topology_timer_fn, 0, 0); | ||
332 | 331 | ||
333 | static atomic_t topology_poll = ATOMIC_INIT(0); | 332 | static atomic_t topology_poll = ATOMIC_INIT(0); |
334 | 333 | ||
@@ -597,6 +596,7 @@ static struct ctl_table topology_dir_table[] = { | |||
597 | 596 | ||
598 | static int __init topology_init(void) | 597 | static int __init topology_init(void) |
599 | { | 598 | { |
599 | timer_setup(&topology_timer, topology_timer_fn, TIMER_DEFERRABLE); | ||
600 | if (MACHINE_HAS_TOPOLOGY) | 600 | if (MACHINE_HAS_TOPOLOGY) |
601 | set_topology_timer(); | 601 | set_topology_timer(); |
602 | else | 602 | else |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 64d0edf428f8..a5361fc6215d 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -5390,11 +5390,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq) { } | |||
5390 | */ | 5390 | */ |
5391 | #ifdef CONFIG_WQ_WATCHDOG | 5391 | #ifdef CONFIG_WQ_WATCHDOG |
5392 | 5392 | ||
5393 | static void wq_watchdog_timer_fn(unsigned long data); | ||
5394 | |||
5395 | static unsigned long wq_watchdog_thresh = 30; | 5393 | static unsigned long wq_watchdog_thresh = 30; |
5396 | static struct timer_list wq_watchdog_timer = | 5394 | static struct timer_list wq_watchdog_timer; |
5397 | TIMER_DEFERRED_INITIALIZER(wq_watchdog_timer_fn, 0, 0); | ||
5398 | 5395 | ||
5399 | static unsigned long wq_watchdog_touched = INITIAL_JIFFIES; | 5396 | static unsigned long wq_watchdog_touched = INITIAL_JIFFIES; |
5400 | static DEFINE_PER_CPU(unsigned long, wq_watchdog_touched_cpu) = INITIAL_JIFFIES; | 5397 | static DEFINE_PER_CPU(unsigned long, wq_watchdog_touched_cpu) = INITIAL_JIFFIES; |
@@ -5408,7 +5405,7 @@ static void wq_watchdog_reset_touched(void) | |||
5408 | per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies; | 5405 | per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies; |
5409 | } | 5406 | } |
5410 | 5407 | ||
5411 | static void wq_watchdog_timer_fn(unsigned long data) | 5408 | static void wq_watchdog_timer_fn(struct timer_list *unused) |
5412 | { | 5409 | { |
5413 | unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ; | 5410 | unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ; |
5414 | bool lockup_detected = false; | 5411 | bool lockup_detected = false; |
@@ -5510,6 +5507,7 @@ module_param_cb(watchdog_thresh, &wq_watchdog_thresh_ops, &wq_watchdog_thresh, | |||
5510 | 5507 | ||
5511 | static void wq_watchdog_init(void) | 5508 | static void wq_watchdog_init(void) |
5512 | { | 5509 | { |
5510 | timer_setup(&wq_watchdog_timer, wq_watchdog_timer_fn, TIMER_DEFERRABLE); | ||
5513 | wq_watchdog_set_thresh(wq_watchdog_thresh); | 5511 | wq_watchdog_set_thresh(wq_watchdog_thresh); |
5514 | } | 5512 | } |
5515 | 5513 | ||