Commit-ID:  1d1fe902afb380571105d05d0be3de61b81bc9a8
Gitweb:     https://git.kernel.org/tip/1d1fe902afb380571105d05d0be3de61b81bc9a8
Author:     Kees Cook <keesc...@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:26:56 -0700
Committer:  Thomas Gleixner <t...@linutronix.de>
CommitDate: Thu, 5 Oct 2017 15:01:16 +0200

timer: Remove init_timer_pinned_deferrable() in favor of timer_setup()

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().

Signed-off-by: Kees Cook <keesc...@chromium.org>
Signed-off-by: Thomas Gleixner <t...@linutronix.de>
Cc: linux-m...@linux-mips.org
Cc: Petr Mladek <pmla...@suse.com>
Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org>
Cc: Lai Jiangshan <jiangshan...@gmail.com>
Cc: Sebastian Reichel <s...@kernel.org>
Cc: Kalle Valo <kv...@qca.qualcomm.com>
Cc: Paul Mackerras <pau...@samba.org>
Cc: Pavel Machek <pa...@ucw.cz>
Cc: linux1394-de...@lists.sourceforge.net
Cc: Chris Metcalf <cmetc...@mellanox.com>
Cc: linux-s...@vger.kernel.org
Cc: linux-wirel...@vger.kernel.org
Cc: "James E.J. Bottomley" <j...@linux.vnet.ibm.com>
Cc: Wim Van Sebroeck <w...@iguana.be>
Cc: Michael Ellerman <m...@ellerman.id.au>
Cc: Ursula Braun <ubr...@linux.vnet.ibm.com>
Cc: Geert Uytterhoeven <ge...@linux-m68k.org>
Cc: Viresh Kumar <viresh.ku...@linaro.org>
Cc: Harish Patil <harish.pa...@cavium.com>
Cc: Stephen Boyd <sb...@codeaurora.org>
Cc: Guenter Roeck <li...@roeck-us.net>
Cc: Manish Chopra <manish.cho...@cavium.com>
Cc: Len Brown <len.br...@intel.com>
Cc: Arnd Bergmann <a...@arndb.de>
Cc: linux...@vger.kernel.org
Cc: Heiko Carstens <heiko.carst...@de.ibm.com>
Cc: Tejun Heo <t...@kernel.org>
Cc: Julian Wiedmann <j...@linux.vnet.ibm.com>
Cc: John Stultz <john.stu...@linaro.org>
Cc: Mark Gross <mark.gr...@intel.com>
Cc: linux-watch...@vger.kernel.org
Cc: linux-s...@vger.kernel.org
Cc: "Martin K. Petersen" <martin.peter...@oracle.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <r...@rjwysocki.net>
Cc: Oleg Nesterov <o...@redhat.com>
Cc: Ralf Baechle <r...@linux-mips.org>
Cc: Stefan Richter <stef...@s5r6.in-berlin.de>
Cc: Michael Reed <m...@sgi.com>
Cc: net...@vger.kernel.org
Cc: Martin Schwidefsky <schwidef...@de.ibm.com>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: linuxppc-...@lists.ozlabs.org
Cc: Sudip Mukherjee <sudipm.mukher...@gmail.com>
Link: 
https://lkml.kernel.org/r/1507159627-127660-3-git-send-email-keesc...@chromium.org

---
 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 3ff5160..b6d7c4c 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 5ef5c9e..d11e819 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)
 

Reply via email to