]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
timer: Remove init_timer_pinned_deferrable() in favor of timer_setup()
authorKees Cook <keescook@chromium.org>
Wed, 4 Oct 2017 23:26:56 +0000 (16:26 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 5 Oct 2017 13:01:16 +0000 (15:01 +0200)
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 <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: Tejun Heo <tj@kernel.org>
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: Martin Schwidefsky <schwidefsky@de.ibm.com>
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-3-git-send-email-keescook@chromium.org
drivers/cpufreq/powernv-cpufreq.c
include/linux/timer.h

index 3ff5160451b436ec48511a9428ab611b2291b1f9..b6d7c4c98d0ab67a3d141c0cc8360d722863d388 100644 (file)
@@ -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);
index 5ef5c9e41a093da146a56cb67b395ad61907808a..d11e819a86e286d27ef68ffec495335b5ab80e52 100644 (file)
@@ -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)