From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751820AbdJEN0y (ORCPT ); Thu, 5 Oct 2017 09:26:54 -0400 Received: from terminus.zytor.com ([65.50.211.136]:51775 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751766AbdJEN0v (ORCPT ); Thu, 5 Oct 2017 09:26:51 -0400 Date: Thu, 5 Oct 2017 06:08:11 -0700 From: tip-bot for Kees Cook Message-ID: Cc: tj@kernel.org, arnd@arndb.de, geert@linux-m68k.org, harish.patil@cavium.com, cmetcalf@mellanox.com, benh@kernel.crashing.org, viresh.kumar@linaro.org, pavel@ucw.cz, schwidefsky@de.ibm.com, stefanr@s5r6.in-berlin.de, linux@roeck-us.net, paulus@samba.org, jiangshanlai@gmail.com, sudipm.mukherjee@gmail.com, jejb@linux.vnet.ibm.com, john.stultz@linaro.org, mdr@sgi.com, mark.gross@intel.com, hpa@zytor.com, sboyd@codeaurora.org, akpm@linux-foundation.org, martin.petersen@oracle.com, pmladek@suse.com, tglx@linutronix.de, ralf@linux-mips.org, mpe@ellerman.id.au, ubraun@linux.vnet.ibm.com, manish.chopra@cavium.com, len.brown@intel.com, linux-kernel@vger.kernel.org, heiko.carstens@de.ibm.com, keescook@chromium.org, gregkh@linuxfoundation.org, rjw@rjwysocki.net, wim@iguana.be, jwi@linux.vnet.ibm.com, oleg@redhat.com, sre@kernel.org, mingo@kernel.org, kvalo@qca.qualcomm.com Reply-To: oleg@redhat.com, sre@kernel.org, mingo@kernel.org, kvalo@qca.qualcomm.com, tglx@linutronix.de, pmladek@suse.com, ubraun@linux.vnet.ibm.com, manish.chopra@cavium.com, len.brown@intel.com, mpe@ellerman.id.au, ralf@linux-mips.org, akpm@linux-foundation.org, sboyd@codeaurora.org, martin.petersen@oracle.com, rjw@rjwysocki.net, wim@iguana.be, jwi@linux.vnet.ibm.com, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, keescook@chromium.org, heiko.carstens@de.ibm.com, sudipm.mukherjee@gmail.com, linux@roeck-us.net, paulus@samba.org, jiangshanlai@gmail.com, mark.gross@intel.com, hpa@zytor.com, mdr@sgi.com, john.stultz@linaro.org, jejb@linux.vnet.ibm.com, geert@linux-m68k.org, arnd@arndb.de, harish.patil@cavium.com, cmetcalf@mellanox.com, tj@kernel.org, pavel@ucw.cz, schwidefsky@de.ibm.com, stefanr@s5r6.in-berlin.de, benh@kernel.crashing.org, viresh.kumar@linaro.org In-Reply-To: <1507159627-127660-13-git-send-email-keescook@chromium.org> References: <1507159627-127660-13-git-send-email-keescook@chromium.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] kthread: Convert callback to use from_timer() Git-Commit-ID: fe5c3b69b540e3387223a696f327c1bb8880d1ac X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: fe5c3b69b540e3387223a696f327c1bb8880d1ac Gitweb: https://git.kernel.org/tip/fe5c3b69b540e3387223a696f327c1bb8880d1ac Author: Kees Cook AuthorDate: Wed, 4 Oct 2017 16:27:06 -0700 Committer: Thomas Gleixner CommitDate: Thu, 5 Oct 2017 15:01:22 +0200 kthread: Convert callback to use from_timer() In preparation for unconditionally passing the struct timer_list pointer to all timer callbacks, switch kthread to use from_timer() and pass the timer pointer explicitly. Signed-off-by: Kees Cook Signed-off-by: Thomas Gleixner Cc: linux-mips@linux-mips.org Cc: Len Brown Cc: Benjamin Herrenschmidt Cc: Lai Jiangshan Cc: Sebastian Reichel Cc: Kalle Valo Cc: Paul Mackerras Cc: Pavel Machek Cc: linux1394-devel@lists.sourceforge.net Cc: Chris Metcalf Cc: linux-s390@vger.kernel.org Cc: linux-wireless@vger.kernel.org Cc: "James E.J. Bottomley" Cc: Wim Van Sebroeck Cc: Michael Ellerman Cc: Ursula Braun Cc: Geert Uytterhoeven Cc: Viresh Kumar Cc: Harish Patil Cc: Stephen Boyd Cc: Guenter Roeck Cc: Manish Chopra Cc: Petr Mladek Cc: Arnd Bergmann Cc: linux-pm@vger.kernel.org Cc: Heiko Carstens Cc: Martin Schwidefsky Cc: Julian Wiedmann Cc: John Stultz Cc: Mark Gross Cc: linux-watchdog@vger.kernel.org Cc: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Oleg Nesterov Cc: Ralf Baechle Cc: Stefan Richter Cc: Michael Reed Cc: netdev@vger.kernel.org Cc: Tejun Heo Cc: Andrew Morton Cc: linuxppc-dev@lists.ozlabs.org Cc: Sudip Mukherjee Link: https://lkml.kernel.org/r/1507159627-127660-13-git-send-email-keescook@chromium.org --- include/linux/kthread.h | 10 +++++----- kernel/kthread.c | 10 ++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/linux/kthread.h b/include/linux/kthread.h index 0d622b3..35cbe3b 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -75,7 +75,7 @@ extern int tsk_fork_get_node(struct task_struct *tsk); */ struct kthread_work; typedef void (*kthread_work_func_t)(struct kthread_work *work); -void kthread_delayed_work_timer_fn(unsigned long __data); +void kthread_delayed_work_timer_fn(struct timer_list *t); enum { KTW_FREEZABLE = 1 << 0, /* freeze during suspend */ @@ -116,8 +116,8 @@ struct kthread_delayed_work { #define KTHREAD_DELAYED_WORK_INIT(dwork, fn) { \ .work = KTHREAD_WORK_INIT((dwork).work, (fn)), \ - .timer = __TIMER_INITIALIZER(kthread_delayed_work_timer_fn, \ - (unsigned long)&(dwork), \ + .timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn,\ + (TIMER_DATA_TYPE)&(dwork.timer), \ TIMER_IRQSAFE), \ } @@ -164,8 +164,8 @@ extern void __kthread_init_worker(struct kthread_worker *worker, do { \ kthread_init_work(&(dwork)->work, (fn)); \ __setup_timer(&(dwork)->timer, \ - kthread_delayed_work_timer_fn, \ - (unsigned long)(dwork), \ + (TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn,\ + (TIMER_DATA_TYPE)&(dwork)->timer, \ TIMER_IRQSAFE); \ } while (0) diff --git a/kernel/kthread.c b/kernel/kthread.c index 1c19edf..ba3992c 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -798,15 +798,14 @@ EXPORT_SYMBOL_GPL(kthread_queue_work); /** * kthread_delayed_work_timer_fn - callback that queues the associated kthread * delayed work when the timer expires. - * @__data: pointer to the data associated with the timer + * @t: pointer to the expired timer * * The format of the function is defined by struct timer_list. * It should have been called from irqsafe timer with irq already off. */ -void kthread_delayed_work_timer_fn(unsigned long __data) +void kthread_delayed_work_timer_fn(struct timer_list *t) { - struct kthread_delayed_work *dwork = - (struct kthread_delayed_work *)__data; + struct kthread_delayed_work *dwork = from_timer(dwork, t, timer); struct kthread_work *work = &dwork->work; struct kthread_worker *worker = work->worker; @@ -837,8 +836,7 @@ void __kthread_queue_delayed_work(struct kthread_worker *worker, struct timer_list *timer = &dwork->timer; struct kthread_work *work = &dwork->work; - WARN_ON_ONCE(timer->function != kthread_delayed_work_timer_fn || - timer->data != (unsigned long)dwork); + WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)kthread_delayed_work_timer_fn); /* * If @delay is 0, queue @dwork->work immediately. This is for