Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752003AbdHaXdL (ORCPT ); Thu, 31 Aug 2017 19:33:11 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:37137 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751912AbdHaX37 (ORCPT ); Thu, 31 Aug 2017 19:29:59 -0400 X-Google-Smtp-Source: ADKCNb6tQzpFISntq2SCy2++uFEWB1mGTWjjQFQoC3e7OFc8/O6cGmOC9BvTxZhSCCQaX/c6m8LNTQ== From: Kees Cook To: Thomas Gleixner Cc: Kees Cook , linux-kernel@vger.kernel.org Subject: [PATCH 07/31] timer: Remove users of TIMER_DEFERRED_INITIALIZER Date: Thu, 31 Aug 2017 16:29:19 -0700 Message-Id: <1504222183-61202-8-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504222183-61202-1-git-send-email-keescook@chromium.org> References: <1504222183-61202-1-git-send-email-keescook@chromium.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2728 Lines: 82 This removes uses of TIMER_DEFERRED_INITIALIZER and chooses a location to call setup_deferrable_timer() from before add_timer() or mod_timer() is called. Signed-off-by: Kees Cook --- arch/s390/kernel/lgr.c | 4 ++-- arch/s390/kernel/topology.c | 4 ++-- kernel/workqueue.c | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c index ae7dff110054..38ce30215bbe 100644 --- a/arch/s390/kernel/lgr.c +++ b/arch/s390/kernel/lgr.c @@ -159,8 +159,7 @@ static void lgr_timer_fn(unsigned long ignored) lgr_timer_set(); } -static struct timer_list lgr_timer = - TIMER_DEFERRED_INITIALIZER(lgr_timer_fn, 0, 0); +static struct timer_list lgr_timer; /* * Setup next LGR timer @@ -181,6 +180,7 @@ static int __init lgr_init(void) debug_register_view(lgr_dbf, &debug_hex_ascii_view); lgr_info_get(&lgr_info_last); debug_event(lgr_dbf, 1, &lgr_info_last, sizeof(lgr_info_last)); + setup_deferrable_timer(&lgr_timer, lgr_timer_fn, 0UL); lgr_timer_set(); return 0; } diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c index bb47c92476f0..b179dc29b7a2 100644 --- a/arch/s390/kernel/topology.c +++ b/arch/s390/kernel/topology.c @@ -296,8 +296,7 @@ static void topology_timer_fn(unsigned long ignored) set_topology_timer(); } -static struct timer_list topology_timer = - TIMER_DEFERRED_INITIALIZER(topology_timer_fn, 0, 0); +static struct timer_list topology_timer; static atomic_t topology_poll = ATOMIC_INIT(0); @@ -476,6 +475,7 @@ void __init topology_init_early(void) static int __init topology_init(void) { + setup_deferrable_timer(&topology_timer, topology_timer_fn, 0UL); if (MACHINE_HAS_TOPOLOGY) set_topology_timer(); else diff --git a/kernel/workqueue.c b/kernel/workqueue.c index a86688fabc55..0475807cef3e 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5335,11 +5335,8 @@ static void workqueue_sysfs_unregister(struct workqueue_struct *wq) { } */ #ifdef CONFIG_WQ_WATCHDOG -static void wq_watchdog_timer_fn(unsigned long data); - static unsigned long wq_watchdog_thresh = 30; -static struct timer_list wq_watchdog_timer = - TIMER_DEFERRED_INITIALIZER(wq_watchdog_timer_fn, 0, 0); +static struct timer_list wq_watchdog_timer; static unsigned long wq_watchdog_touched = INITIAL_JIFFIES; static DEFINE_PER_CPU(unsigned long, wq_watchdog_touched_cpu) = INITIAL_JIFFIES; @@ -5455,6 +5452,7 @@ module_param_cb(watchdog_thresh, &wq_watchdog_thresh_ops, &wq_watchdog_thresh, static void wq_watchdog_init(void) { + setup_deferrable_timer(&wq_watchdog_timer, wq_watchdog_timer_fn, 0UL); wq_watchdog_set_thresh(wq_watchdog_thresh); } -- 2.7.4