From patchwork Wed Oct 4 23:26:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9985969 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 18223602B8 for ; Wed, 4 Oct 2017 23:34:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A5D728B11 for ; Wed, 4 Oct 2017 23:34:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2D9828C35; Wed, 4 Oct 2017 23:34:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EF5B28C21 for ; Wed, 4 Oct 2017 23:34:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751223AbdJDXev (ORCPT ); Wed, 4 Oct 2017 19:34:51 -0400 Received: from mail-pf0-f170.google.com ([209.85.192.170]:45979 "EHLO mail-pf0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751213AbdJDX1y (ORCPT ); Wed, 4 Oct 2017 19:27:54 -0400 Received: by mail-pf0-f170.google.com with SMTP id z84so7040643pfi.2 for ; Wed, 04 Oct 2017 16:27:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ITVgLNE8i9rAfzq2Kc2r6lp0r3r+3s7RVwwO69tcgXU=; b=P6ZY++0x9wt6TdbCRt5x1tyhZRzZ6cGTL4gUmXQwU3fRmTkFzx6NZkJlrux+ulED4L KXh6ARQJBpqR50VHUA2VHcBtnjwSd6aGmCuLGi1VE25X0SP9TQH21uVNBs7uYZT74LfA jHIahkBirmsgmlsdLF4+U4yDBYDTQwfWb9TKQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ITVgLNE8i9rAfzq2Kc2r6lp0r3r+3s7RVwwO69tcgXU=; b=ptD8NAg2FT/FDik8nGh/kzP/uZDoMJRGGYixkj4z9/KoevjApbbq8R7R9jl56I56NW zL0nfgbUdtPnmWlmhwOddcCuUBeZ/W1jQljTWfN2ubG5FtWN6hTqmYXW79DA9KWVNbQ0 AHzNClb0wHrPslHGIdtA1cBZz+X1wn9uPZ5ZsJNag8MsU3jlgOFDWW+Xpv3PXvjEirL6 bKdDgA+ddOj9pYouA1ba9jretO0M9O16FJiiQ1L3mV1uCVXiTeKwr+tTKuAmkrvnbmR7 8G8L3IuPIWiG0tQ2Lb+Po6+7rXqmltp2QOTuoG44UEFzYvOgHYuYKaXLZ5sL2CfD6Sao AwHA== X-Gm-Message-State: AHPjjUj9KfTKuyHEPd+eLq7z68eOlFwhwknsbR5+K1/D8DtHWO1s/uAp 8F0Uo+BqpTN/vIc7SOKcysLlqQ== X-Google-Smtp-Source: AOwi7QDS9taT2iqNfNw4YiUZazaApwNZ3lsPhv8LNud5SnwE8aYCExF239pUvfz6UbV6TsSmYJpqpg== X-Received: by 10.99.9.198 with SMTP id 189mr19278629pgj.395.1507159674359; Wed, 04 Oct 2017 16:27:54 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id p77sm30484216pfa.92.2017.10.04.16.27.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 16:27:51 -0700 (PDT) From: Kees Cook To: Thomas Gleixner Cc: Kees Cook , "Rafael J. Wysocki" , Viresh Kumar , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Andrew Morton , Arnd Bergmann , Chris Metcalf , Geert Uytterhoeven , Greg Kroah-Hartman , Guenter Roeck , Harish Patil , Heiko Carstens , "James E.J. Bottomley" , John Stultz , Julian Wiedmann , Kalle Valo , Lai Jiangshan , Len Brown , Manish Chopra , Mark Gross , "Martin K. Petersen" , Martin Schwidefsky , Michael Reed , netdev@vger.kernel.org, Oleg Nesterov , Pavel Machek , Petr Mladek , Ralf Baechle , Sebastian Reichel , Stefan Richter , Stephen Boyd , Sudip Mukherjee , Tejun Heo , Ursula Braun , Wim Van Sebroeck , linux1394-devel@lists.sourceforge.net, linux-mips@linux-mips.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/13] timer: Remove init_timer_pinned_deferrable() in favor of timer_setup() Date: Wed, 4 Oct 2017 16:26:56 -0700 Message-Id: <1507159627-127660-3-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507159627-127660-1-git-send-email-keescook@chromium.org> References: <1507159627-127660-1-git-send-email-keescook@chromium.org> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This refactors the only user of init_timer_pinned_deferrable() to use the new timer_setup() and from_timer(). Adds a pointer back to the policy, and drops the definition of init_timer_pinned_deferrable(). Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: Thomas Gleixner Cc: linux-pm@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Signed-off-by: Kees Cook --- drivers/cpufreq/powernv-cpufreq.c | 13 +++++++------ include/linux/timer.h | 2 -- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index 3ff5160451b4..b6d7c4c98d0a 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -90,6 +90,7 @@ struct global_pstate_info { int last_gpstate_idx; spinlock_t gpstate_lock; struct timer_list timer; + struct cpufreq_policy *policy; }; static struct cpufreq_frequency_table powernv_freqs[POWERNV_MAX_PSTATES+1]; @@ -625,10 +626,10 @@ static inline void queue_gpstate_timer(struct global_pstate_info *gpstates) * according quadratic equation. Queues a new timer if it is still not equal * to local pstate */ -void gpstate_timer_handler(unsigned long data) +void gpstate_timer_handler(struct timer_list *t) { - struct cpufreq_policy *policy = (struct cpufreq_policy *)data; - struct global_pstate_info *gpstates = policy->driver_data; + struct global_pstate_info *gpstates = from_timer(gpstates, t, timer); + struct cpufreq_policy *policy = gpstates->policy; int gpstate_idx, lpstate_idx; unsigned long val; unsigned int time_diff = jiffies_to_msecs(jiffies) @@ -800,9 +801,9 @@ static int powernv_cpufreq_cpu_init(struct cpufreq_policy *policy) policy->driver_data = gpstates; /* initialize timer */ - init_timer_pinned_deferrable(&gpstates->timer); - gpstates->timer.data = (unsigned long)policy; - gpstates->timer.function = gpstate_timer_handler; + gpstates->policy = policy; + timer_setup(&gpstates->timer, gpstate_timer_handler, + TIMER_PINNED | TIMER_DEFERRABLE); gpstates->timer.expires = jiffies + msecs_to_jiffies(GPSTATE_TIMER_INTERVAL); spin_lock_init(&gpstates->gpstate_lock); diff --git a/include/linux/timer.h b/include/linux/timer.h index 5ef5c9e41a09..d11e819a86e2 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -132,8 +132,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer, __init_timer((timer), TIMER_PINNED) #define init_timer_deferrable(timer) \ __init_timer((timer), TIMER_DEFERRABLE) -#define init_timer_pinned_deferrable(timer) \ - __init_timer((timer), TIMER_DEFERRABLE | TIMER_PINNED) #define init_timer_on_stack(timer) \ __init_timer_on_stack((timer), 0)