All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] timer: Start conversion to timer_setup()
@ 2017-10-04 23:26 ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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 Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Petr Mladek, Rafael J. Wysocki, Ralf Baechle,
	Sebastian Reichel, Stefan Richter, Stephen Boyd, Sudip Mukherjee,
	Tejun Heo, Ursula Braun, Viresh Kumar, Wim Van Sebroeck,
	linux1394-devel, linux-mips, linux-pm, linuxppc-dev, linux-s390,
	linux-scsi, linux-watchdog, linux-wireless, linux-kernel

Hi,

This is the first of many timer infrastructure cleanups to simplify the
timer API[1]. All of these patches are expected to land via the timer
tree, so Acks (or corrections) appreciated.

These patches refactor various users of timer API that are NOT just using
init_timer() or setup_timer() (which is the vast majority of users,
and are being converted separately). These changes are focused on the
lesser-used init_timer_*(), TIMER_*INITIALIZER(), and DEFINE_TIMER()
methods of preparing a timer.

Thanks!

-Kees

[1] https://git.kernel.org/linus/686fef928bba6be13cabe639f154af7d72b63120

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [PATCH 00/13] timer: Start conversion to timer_setup()
@ 2017-10-04 23:26 ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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

Hi,

This is the first of many timer infrastructure cleanups to simplify the
timer API[1]. All of these patches are expected to land via the timer
tree, so Acks (or corrections) appreciated.

These patches refactor various users of timer API that are NOT just using
init_timer() or setup_timer() (which is the vast majority of users,
and are being converted separately). These changes are focused on the
lesser-used init_timer_*(), TIMER_*INITIALIZER(), and DEFINE_TIMER()
methods of preparing a timer.

Thanks!

-Kees

[1] https://git.kernel.org/linus/686fef928bba6be13cabe639f154af7d72b63120

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [PATCH 00/13] timer: Start conversion to timer_setup()
@ 2017-10-04 23:26 ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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

Hi,

This is the first of many timer infrastructure cleanups to simplify the
timer API[1]. All of these patches are expected to land via the timer
tree, so Acks (or corrections) appreciated.

These patches refactor various users of timer API that are NOT just using
init_timer() or setup_timer() (which is the vast majority of users,
and are being converted separately). These changes are focused on the
lesser-used init_timer_*(), TIMER_*INITIALIZER(), and DEFINE_TIMER()
methods of preparing a timer.

Thanks!

-Kees

[1] https://git.kernel.org/linus/686fef928bba6be13cabe639f154af7d72b63120

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [PATCH 01/13] timer: Convert schedule_timeout() to use from_timer()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, John Stultz, Stephen Boyd, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Greg Kroah-Hartman, Guenter Roeck,
	Harish Patil, Heiko Carstens, James E.J. Bottomley,
	Julian Wiedmann, Kalle Valo, Lai Jiangshan, Len Brown,
	Manish Chopra, Mark Gross, Martin K. Petersen,
	Martin Schwidefsky, Michael Ellerman, Michael Reed, netdev,
	Oleg Nesterov, Paul Mackerras, Pavel Machek, Petr Mladek,
	Rafael J. Wysocki, Ralf Baechle, Sebastian Reichel,
	Stefan Richter, Sudip Mukherjee, Tejun Heo, Ursula Braun,
	Viresh Kumar, Wim Van Sebroeck, linux1394-devel, linux-mips,
	linux-pm, linuxppc-dev, linux-s390, linux-scsi, linux-watchdog,
	linux-wireless, linux-kernel

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new from_timer() helper and passing
the timer pointer explicitly. Since this special timer is on the stack, it
needs to have a wrapper structure to carry state once .data is eliminated.

Cc: John Stultz <john.stultz@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 include/linux/timer.h |  8 ++++++++
 kernel/time/timer.c   | 26 +++++++++++++++++++-------
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/include/linux/timer.h b/include/linux/timer.h
index 6383c528b148..5ef5c9e41a09 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -179,6 +179,14 @@ static inline void timer_setup(struct timer_list *timer,
 		      (TIMER_DATA_TYPE)timer, flags);
 }
 
+static inline void timer_setup_on_stack(struct timer_list *timer,
+			       void (*callback)(struct timer_list *),
+			       unsigned int flags)
+{
+	__setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback,
+			       (TIMER_DATA_TYPE)timer, flags);
+}
+
 #define from_timer(var, callback_timer, timer_fieldname) \
 	container_of(callback_timer, typeof(*var), timer_fieldname)
 
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index f2674a056c26..38613ced2324 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1668,9 +1668,20 @@ void run_local_timers(void)
 	raise_softirq(TIMER_SOFTIRQ);
 }
 
-static void process_timeout(unsigned long __data)
+/*
+ * Since schedule_timeout()'s timer is defined on the stack, it must store
+ * the target task on the stack as well.
+ */
+struct process_timer {
+	struct timer_list timer;
+	struct task_struct *task;
+};
+
+static void process_timeout(struct timer_list *t)
 {
-	wake_up_process((struct task_struct *)__data);
+	struct process_timer *timeout = from_timer(timeout, t, timer);
+
+	wake_up_process(timeout->task);
 }
 
 /**
@@ -1704,7 +1715,7 @@ static void process_timeout(unsigned long __data)
  */
 signed long __sched schedule_timeout(signed long timeout)
 {
-	struct timer_list timer;
+	struct process_timer timer;
 	unsigned long expire;
 
 	switch (timeout)
@@ -1738,13 +1749,14 @@ signed long __sched schedule_timeout(signed long timeout)
 
 	expire = timeout + jiffies;
 
-	setup_timer_on_stack(&timer, process_timeout, (unsigned long)current);
-	__mod_timer(&timer, expire, false);
+	timer.task = current;
+	timer_setup_on_stack(&timer.timer, process_timeout, 0);
+	__mod_timer(&timer.timer, expire, false);
 	schedule();
-	del_singleshot_timer_sync(&timer);
+	del_singleshot_timer_sync(&timer.timer);
 
 	/* Remove the timer from the object tracker */
-	destroy_timer_on_stack(&timer);
+	destroy_timer_on_stack(&timer.timer);
 
 	timeout = expire - jiffies;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 01/13] timer: Convert schedule_timeout() to use from_timer()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, John Stultz, Stephen Boyd, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Greg Kroah-Hartman, Guenter Roeck,
	Harish Patil, Heiko Carstens, James E.J. Bottomley,
	Julian Wiedmann, Kalle Valo, Lai Jiangshan, Len Brown,
	Manish Chopra, Mark Gross

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new from_timer() helper and passing
the timer pointer explicitly. Since this special timer is on the stack, it
needs to have a wrapper structure to carry state once .data is eliminated.

Cc: John Stultz <john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Cc: Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 include/linux/timer.h |  8 ++++++++
 kernel/time/timer.c   | 26 +++++++++++++++++++-------
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/include/linux/timer.h b/include/linux/timer.h
index 6383c528b148..5ef5c9e41a09 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -179,6 +179,14 @@ static inline void timer_setup(struct timer_list *timer,
 		      (TIMER_DATA_TYPE)timer, flags);
 }
 
+static inline void timer_setup_on_stack(struct timer_list *timer,
+			       void (*callback)(struct timer_list *),
+			       unsigned int flags)
+{
+	__setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback,
+			       (TIMER_DATA_TYPE)timer, flags);
+}
+
 #define from_timer(var, callback_timer, timer_fieldname) \
 	container_of(callback_timer, typeof(*var), timer_fieldname)
 
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index f2674a056c26..38613ced2324 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1668,9 +1668,20 @@ void run_local_timers(void)
 	raise_softirq(TIMER_SOFTIRQ);
 }
 
-static void process_timeout(unsigned long __data)
+/*
+ * Since schedule_timeout()'s timer is defined on the stack, it must store
+ * the target task on the stack as well.
+ */
+struct process_timer {
+	struct timer_list timer;
+	struct task_struct *task;
+};
+
+static void process_timeout(struct timer_list *t)
 {
-	wake_up_process((struct task_struct *)__data);
+	struct process_timer *timeout = from_timer(timeout, t, timer);
+
+	wake_up_process(timeout->task);
 }
 
 /**
@@ -1704,7 +1715,7 @@ static void process_timeout(unsigned long __data)
  */
 signed long __sched schedule_timeout(signed long timeout)
 {
-	struct timer_list timer;
+	struct process_timer timer;
 	unsigned long expire;
 
 	switch (timeout)
@@ -1738,13 +1749,14 @@ signed long __sched schedule_timeout(signed long timeout)
 
 	expire = timeout + jiffies;
 
-	setup_timer_on_stack(&timer, process_timeout, (unsigned long)current);
-	__mod_timer(&timer, expire, false);
+	timer.task = current;
+	timer_setup_on_stack(&timer.timer, process_timeout, 0);
+	__mod_timer(&timer.timer, expire, false);
 	schedule();
-	del_singleshot_timer_sync(&timer);
+	del_singleshot_timer_sync(&timer.timer);
 
 	/* Remove the timer from the object tracker */
-	destroy_timer_on_stack(&timer);
+	destroy_timer_on_stack(&timer.timer);
 
 	timeout = expire - jiffies;
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 01/13] timer: Convert schedule_timeout() to use from_timer()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, John Stultz, Stephen Boyd, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Greg Kroah-Hartman, Guenter Roeck,
	Harish Patil, Heiko Carstens, James E.J. Bottomley,
	Julian Wiedmann, Kalle Valo, Lai Jiangshan, Len Brown,
	Manish Chopra, Mark Gross

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new from_timer() helper and passing
the timer pointer explicitly. Since this special timer is on the stack, it
needs to have a wrapper structure to carry state once .data is eliminated.

Cc: John Stultz <john.stultz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
Cc: Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 include/linux/timer.h |  8 ++++++++
 kernel/time/timer.c   | 26 +++++++++++++++++++-------
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/include/linux/timer.h b/include/linux/timer.h
index 6383c528b148..5ef5c9e41a09 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -179,6 +179,14 @@ static inline void timer_setup(struct timer_list *timer,
 		      (TIMER_DATA_TYPE)timer, flags);
 }
 
+static inline void timer_setup_on_stack(struct timer_list *timer,
+			       void (*callback)(struct timer_list *),
+			       unsigned int flags)
+{
+	__setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback,
+			       (TIMER_DATA_TYPE)timer, flags);
+}
+
 #define from_timer(var, callback_timer, timer_fieldname) \
 	container_of(callback_timer, typeof(*var), timer_fieldname)
 
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index f2674a056c26..38613ced2324 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1668,9 +1668,20 @@ void run_local_timers(void)
 	raise_softirq(TIMER_SOFTIRQ);
 }
 
-static void process_timeout(unsigned long __data)
+/*
+ * Since schedule_timeout()'s timer is defined on the stack, it must store
+ * the target task on the stack as well.
+ */
+struct process_timer {
+	struct timer_list timer;
+	struct task_struct *task;
+};
+
+static void process_timeout(struct timer_list *t)
 {
-	wake_up_process((struct task_struct *)__data);
+	struct process_timer *timeout = from_timer(timeout, t, timer);
+
+	wake_up_process(timeout->task);
 }
 
 /**
@@ -1704,7 +1715,7 @@ static void process_timeout(unsigned long __data)
  */
 signed long __sched schedule_timeout(signed long timeout)
 {
-	struct timer_list timer;
+	struct process_timer timer;
 	unsigned long expire;
 
 	switch (timeout)
@@ -1738,13 +1749,14 @@ signed long __sched schedule_timeout(signed long timeout)
 
 	expire = timeout + jiffies;
 
-	setup_timer_on_stack(&timer, process_timeout, (unsigned long)current);
-	__mod_timer(&timer, expire, false);
+	timer.task = current;
+	timer_setup_on_stack(&timer.timer, process_timeout, 0);
+	__mod_timer(&timer.timer, expire, false);
 	schedule();
-	del_singleshot_timer_sync(&timer);
+	del_singleshot_timer_sync(&timer.timer);
 
 	/* Remove the timer from the object tracker */
-	destroy_timer_on_stack(&timer);
+	destroy_timer_on_stack(&timer.timer);
 
 	timeout = expire - jiffies;
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 02/13] timer: Remove init_timer_pinned_deferrable() in favor of timer_setup()
  2017-10-04 23:26 ` Kees Cook
  (?)
@ 2017-10-04 23:26   ` Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Rafael J. Wysocki, Viresh Kumar,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	linux-pm, linuxppc-dev, 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,
	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,
	linux-mips, linux-s390, linux-scsi, linux-watchdog,
	linux-wireless, linux-kernel

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" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-pm@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Kees Cook <keescook@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 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)
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 02/13] timer: Remove init_timer_pinned_deferrable() in favor of timer_setup()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Rafael J. Wysocki, Viresh Kumar,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	linux-pm, linuxppc-dev, 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

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" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-pm@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Kees Cook <keescook@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 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)
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 02/13] timer: Remove init_timer_pinned_deferrable() in favor of timer_setup()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Rafael J. Wysocki, Viresh Kumar,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	linux-pm, linuxppc-dev, 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

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" <rjw@rjwysocki.net>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-pm@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Kees Cook <keescook@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 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)
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 03/13] timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()
  2017-10-04 23:26 ` Kees Cook
  (?)
@ 2017-10-04 23:26   ` Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Rafael J. Wysocki, Pavel Machek, Len Brown,
	Greg Kroah-Hartman, Stefan Richter, Sudip Mukherjee,
	Martin Schwidefsky, Heiko Carstens, Julian Wiedmann,
	Ursula Braun, Michael Reed, James E.J. Bottomley,
	Martin K. Petersen, linux-pm, linux1394-devel, linux-s390,
	linux-scsi, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	Chris Metcalf, Geert Uytterhoeven, Guenter Roeck, Harish Patil,
	John Stultz, Kalle Valo, Lai Jiangshan, Manish Chopra,
	Mark Gross, Michael Ellerman, netdev, Oleg Nesterov,
	Paul Mackerras, Petr Mladek, Ralf Baechle, Sebastian Reichel,
	Stephen Boyd, Tejun Heo, Viresh Kumar, Wim Van Sebroeck,
	linux-mips, linuxppc-dev, linux-watchdog, linux-wireless,
	linux-kernel

Remove uses of init_timer_on_stack() with open-coded function and data
assignments that could be expressed using timer_setup_on_stack(). Several
were removed from the stack entirely since there was a one-to-one mapping
of parent structure to timer, those are switched to using timer_setup()
instead. All related callbacks were adjusted to use from_timer().

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Len Brown <len.brown@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Cc: Ursula Braun <ubraun@linux.vnet.ibm.com>
Cc: Michael Reed <mdr@sgi.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-pm@vger.kernel.org
Cc: linux1394-devel@lists.sourceforge.net
Cc: linux-s390@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/base/power/main.c           |  8 +++-----
 drivers/firewire/core-transaction.c | 10 +++++-----
 drivers/parport/ieee1284.c          | 21 +++++++--------------
 drivers/s390/char/tape.h            |  1 +
 drivers/s390/char/tape_std.c        | 18 ++++++------------
 drivers/s390/net/lcs.c              | 16 ++++++----------
 drivers/s390/net/lcs.h              |  1 +
 drivers/scsi/qla1280.c              | 14 +++++---------
 drivers/scsi/qla1280.h              |  1 +
 include/linux/parport.h             |  1 +
 include/linux/timer.h               |  2 --
 11 files changed, 36 insertions(+), 57 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 770b1539a083..ae47b2ec84b4 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -478,9 +478,9 @@ struct dpm_watchdog {
  * There's not much we can do here to recover so panic() to
  * capture a crash-dump in pstore.
  */
-static void dpm_watchdog_handler(unsigned long data)
+static void dpm_watchdog_handler(struct timer_list *t)
 {
-	struct dpm_watchdog *wd = (void *)data;
+	struct dpm_watchdog *wd = from_timer(wd, t, timer);
 
 	dev_emerg(wd->dev, "**** DPM device timeout ****\n");
 	show_stack(wd->tsk, NULL);
@@ -500,11 +500,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
 	wd->dev = dev;
 	wd->tsk = current;
 
-	init_timer_on_stack(timer);
+	timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
 	/* use same timeout value for both suspend and resume */
 	timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT;
-	timer->function = dpm_watchdog_handler;
-	timer->data = (unsigned long)wd;
 	add_timer(timer);
 }
 
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index d6a09b9cd8cc..4372f9e4b0da 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -137,9 +137,9 @@ int fw_cancel_transaction(struct fw_card *card,
 }
 EXPORT_SYMBOL(fw_cancel_transaction);
 
-static void split_transaction_timeout_callback(unsigned long data)
+static void split_transaction_timeout_callback(struct timer_list *timer)
 {
-	struct fw_transaction *t = (struct fw_transaction *)data;
+	struct fw_transaction *t = from_timer(t, timer, split_timeout_timer);
 	struct fw_card *card = t->card;
 	unsigned long flags;
 
@@ -373,8 +373,8 @@ void fw_send_request(struct fw_card *card, struct fw_transaction *t, int tcode,
 	t->tlabel = tlabel;
 	t->card = card;
 	t->is_split_transaction = false;
-	setup_timer(&t->split_timeout_timer,
-		    split_transaction_timeout_callback, (unsigned long)t);
+	timer_setup(&t->split_timeout_timer,
+		    split_transaction_timeout_callback, 0);
 	t->callback = callback;
 	t->callback_data = callback_data;
 
@@ -423,7 +423,7 @@ int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
 	struct transaction_callback_data d;
 	struct fw_transaction t;
 
-	init_timer_on_stack(&t.split_timeout_timer);
+	timer_setup_on_stack(&t.split_timeout_timer, NULL, 0);
 	init_completion(&d.done);
 	d.payload = payload;
 	fw_send_request(card, &t, tcode, destination_id, generation, speed,
diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c
index 74cc6dd982d2..2d1a5c737c6e 100644
--- a/drivers/parport/ieee1284.c
+++ b/drivers/parport/ieee1284.c
@@ -44,10 +44,11 @@ static void parport_ieee1284_wakeup (struct parport *port)
 	up (&port->physport->ieee1284.irq);
 }
 
-static struct parport *port_from_cookie[PARPORT_MAX];
-static void timeout_waiting_on_port (unsigned long cookie)
+static void timeout_waiting_on_port (struct timer_list *t)
 {
-	parport_ieee1284_wakeup (port_from_cookie[cookie % PARPORT_MAX]);
+	struct parport *port = from_timer(port, t, timer);
+
+	parport_ieee1284_wakeup (port);
 }
 
 /**
@@ -69,27 +70,19 @@ static void timeout_waiting_on_port (unsigned long cookie)
 int parport_wait_event (struct parport *port, signed long timeout)
 {
 	int ret;
-	struct timer_list timer;
 
 	if (!port->physport->cad->timeout)
 		/* Zero timeout is special, and we can't down() the
 		   semaphore. */
 		return 1;
 
-	init_timer_on_stack(&timer);
-	timer.expires = jiffies + timeout;
-	timer.function = timeout_waiting_on_port;
-	port_from_cookie[port->number % PARPORT_MAX] = port;
-	timer.data = port->number;
-
-	add_timer (&timer);
+	timer_setup(&port->timer, timeout_waiting_on_port, 0);
+	mod_timer(&port->timer, jiffies + timeout);
 	ret = down_interruptible (&port->physport->ieee1284.irq);
-	if (!del_timer_sync(&timer) && !ret)
+	if (!del_timer_sync(&port->timer) && !ret)
 		/* Timed out. */
 		ret = 1;
 
-	destroy_timer_on_stack(&timer);
-
 	return ret;
 }
 
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h
index ea664dd4f56d..52fbcd9c3cf8 100644
--- a/drivers/s390/char/tape.h
+++ b/drivers/s390/char/tape.h
@@ -128,6 +128,7 @@ struct tape_request {
 	int options;			/* options for execution. */
 	int retries;			/* retry counter for error recovery. */
 	int rescnt;			/* residual count from devstat. */
+	struct timer_list timer;	/* timer for std_assign_timeout(). */
 
 	/* Callback for delivering final status. */
 	void (*callback)(struct tape_request *, void *);
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c
index 3478e19ae194..cd204abdc0bc 100644
--- a/drivers/s390/char/tape_std.c
+++ b/drivers/s390/char/tape_std.c
@@ -32,14 +32,12 @@
  * tape_std_assign
  */
 static void
-tape_std_assign_timeout(unsigned long data)
+tape_std_assign_timeout(struct timer_list *t)
 {
-	struct tape_request *	request;
-	struct tape_device *	device;
+	struct tape_request *	request = from_timer(request, t, timer);
+	struct tape_device *	device = request->device;
 	int rc;
 
-	request = (struct tape_request *) data;
-	device = request->device;
 	BUG_ON(!device);
 
 	DBF_EVENT(3, "%08x: Assignment timeout. Device busy.\n",
@@ -70,16 +68,12 @@ tape_std_assign(struct tape_device *device)
 	 * to another host (actually this shouldn't happen but it does).
 	 * So we set up a timeout for this call.
 	 */
-	init_timer_on_stack(&timeout);
-	timeout.function = tape_std_assign_timeout;
-	timeout.data     = (unsigned long) request;
-	timeout.expires  = jiffies + 2 * HZ;
-	add_timer(&timeout);
+	timer_setup(&request->timer, tape_std_assign_timeout, 0);
+	mod_timer(&timeout, jiffies + 2 * HZ);
 
 	rc = tape_do_io_interruptible(device, request);
 
-	del_timer_sync(&timeout);
-	destroy_timer_on_stack(&timeout);
+	del_timer_sync(&request->timer);
 
 	if (rc != 0) {
 		DBF_EVENT(3, "%08x: assign failed - device might be busy\n",
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index d01b5c2a7760..21bba406d5be 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -834,9 +834,10 @@ lcs_notify_lancmd_waiters(struct lcs_card *card, struct lcs_cmd *cmd)
  * Emit buffer of a lan command.
  */
 static void
-lcs_lancmd_timeout(unsigned long data)
+lcs_lancmd_timeout(struct timer_list *t)
 {
-	struct lcs_reply *reply, *list_reply, *r;
+	struct lcs_reply *reply = from_timer(reply, t, timer);
+	struct lcs_reply *list_reply, *r;
 	unsigned long flags;
 
 	LCS_DBF_TEXT(4, trace, "timeout");
@@ -864,7 +865,6 @@ lcs_send_lancmd(struct lcs_card *card, struct lcs_buffer *buffer,
 {
 	struct lcs_reply *reply;
 	struct lcs_cmd *cmd;
-	struct timer_list timer;
 	unsigned long flags;
 	int rc;
 
@@ -885,14 +885,10 @@ lcs_send_lancmd(struct lcs_card *card, struct lcs_buffer *buffer,
 	rc = lcs_ready_buffer(&card->write, buffer);
 	if (rc)
 		return rc;
-	init_timer_on_stack(&timer);
-	timer.function = lcs_lancmd_timeout;
-	timer.data = (unsigned long) reply;
-	timer.expires = jiffies + HZ*card->lancmd_timeout;
-	add_timer(&timer);
+	timer_setup(&reply->timer, lcs_lancmd_timeout, 0);
+	mod_timer(&reply->timer, jiffies + HZ * card->lancmd_timeout);
 	wait_event(reply->wait_q, reply->received);
-	del_timer_sync(&timer);
-	destroy_timer_on_stack(&timer);
+	del_timer_sync(&reply->timer);
 	LCS_DBF_TEXT_(4, trace, "rc:%d",reply->rc);
 	rc = reply->rc;
 	lcs_put_reply(reply);
diff --git a/drivers/s390/net/lcs.h b/drivers/s390/net/lcs.h
index 150fcb4cebc3..d44fb8d9378f 100644
--- a/drivers/s390/net/lcs.h
+++ b/drivers/s390/net/lcs.h
@@ -275,6 +275,7 @@ struct lcs_reply {
 	void (*callback)(struct lcs_card *, struct lcs_cmd *);
 	wait_queue_head_t wait_q;
 	struct lcs_card *card;
+	struct timer_list timer;
 	int received;
 	int rc;
 };
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 8a29fb09db14..390775d5c918 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -758,9 +758,9 @@ enum action {
 };
 
 
-static void qla1280_mailbox_timeout(unsigned long __data)
+static void qla1280_mailbox_timeout(struct timer_list *t)
 {
-	struct scsi_qla_host *ha = (struct scsi_qla_host *)__data;
+	struct scsi_qla_host *ha = from_timer(ha, t, mailbox_timer);
 	struct device_reg __iomem *reg;
 	reg = ha->iobase;
 
@@ -2465,7 +2465,6 @@ qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
 	uint16_t __iomem *mptr;
 	uint16_t data;
 	DECLARE_COMPLETION_ONSTACK(wait);
-	struct timer_list timer;
 
 	ENTER("qla1280_mailbox_command");
 
@@ -2494,18 +2493,15 @@ qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
 	/* Issue set host interrupt command. */
 
 	/* set up a timer just in case we're really jammed */
-	init_timer_on_stack(&timer);
-	timer.expires = jiffies + 20*HZ;
-	timer.data = (unsigned long)ha;
-	timer.function = qla1280_mailbox_timeout;
-	add_timer(&timer);
+	timer_setup(&ha->mailbox_timer, qla1280_mailbox_timeout, 0);
+	mod_timer(&ha->mailbox_timer, jiffies + 20 * HZ);
 
 	spin_unlock_irq(ha->host->host_lock);
 	WRT_REG_WORD(&reg->host_cmd, HC_SET_HOST_INT);
 	data = qla1280_debounce_register(&reg->istatus);
 
 	wait_for_completion(&wait);
-	del_timer_sync(&timer);
+	del_timer_sync(&ha->mailbox_timer);
 
 	spin_lock_irq(ha->host->host_lock);
 
diff --git a/drivers/scsi/qla1280.h b/drivers/scsi/qla1280.h
index 834884b9eed5..1522aca2c8c8 100644
--- a/drivers/scsi/qla1280.h
+++ b/drivers/scsi/qla1280.h
@@ -1055,6 +1055,7 @@ struct scsi_qla_host {
 	struct list_head done_q;	/* Done queue */
 
 	struct completion *mailbox_wait;
+	struct timer_list mailbox_timer;
 
 	volatile struct {
 		uint32_t online:1;			/* 0 */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 58e3c64c6b49..397607a0c0eb 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -225,6 +225,7 @@ struct parport {
 	struct pardevice *waittail;
 
 	struct list_head list;
+	struct timer_list timer;
 	unsigned int flags;
 
 	void *sysctl_table;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index d11e819a86e2..b10c4bdc6fbd 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_on_stack(timer)					\
-	__init_timer_on_stack((timer), 0)
 
 #define __setup_timer(_timer, _fn, _data, _flags)			\
 	do {								\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 03/13] timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Rafael J. Wysocki, Pavel Machek, Len Brown,
	Greg Kroah-Hartman, Stefan Richter, Sudip Mukherjee,
	Martin Schwidefsky, Heiko Carstens, Julian Wiedmann,
	Ursula Braun, Michael Reed, James E.J. Bottomley,
	Martin K. Petersen, linux-pm, linux1394-devel, linux-s390,
	linux-scsi, Andrew Morton, Arnd Bergmann

Remove uses of init_timer_on_stack() with open-coded function and data
assignments that could be expressed using timer_setup_on_stack(). Several
were removed from the stack entirely since there was a one-to-one mapping
of parent structure to timer, those are switched to using timer_setup()
instead. All related callbacks were adjusted to use from_timer().

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Len Brown <len.brown@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Cc: Ursula Braun <ubraun@linux.vnet.ibm.com>
Cc: Michael Reed <mdr@sgi.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-pm@vger.kernel.org
Cc: linux1394-devel@lists.sourceforge.net
Cc: linux-s390@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/base/power/main.c           |  8 +++-----
 drivers/firewire/core-transaction.c | 10 +++++-----
 drivers/parport/ieee1284.c          | 21 +++++++--------------
 drivers/s390/char/tape.h            |  1 +
 drivers/s390/char/tape_std.c        | 18 ++++++------------
 drivers/s390/net/lcs.c              | 16 ++++++----------
 drivers/s390/net/lcs.h              |  1 +
 drivers/scsi/qla1280.c              | 14 +++++---------
 drivers/scsi/qla1280.h              |  1 +
 include/linux/parport.h             |  1 +
 include/linux/timer.h               |  2 --
 11 files changed, 36 insertions(+), 57 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 770b1539a083..ae47b2ec84b4 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -478,9 +478,9 @@ struct dpm_watchdog {
  * There's not much we can do here to recover so panic() to
  * capture a crash-dump in pstore.
  */
-static void dpm_watchdog_handler(unsigned long data)
+static void dpm_watchdog_handler(struct timer_list *t)
 {
-	struct dpm_watchdog *wd = (void *)data;
+	struct dpm_watchdog *wd = from_timer(wd, t, timer);
 
 	dev_emerg(wd->dev, "**** DPM device timeout ****\n");
 	show_stack(wd->tsk, NULL);
@@ -500,11 +500,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
 	wd->dev = dev;
 	wd->tsk = current;
 
-	init_timer_on_stack(timer);
+	timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
 	/* use same timeout value for both suspend and resume */
 	timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT;
-	timer->function = dpm_watchdog_handler;
-	timer->data = (unsigned long)wd;
 	add_timer(timer);
 }
 
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index d6a09b9cd8cc..4372f9e4b0da 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -137,9 +137,9 @@ int fw_cancel_transaction(struct fw_card *card,
 }
 EXPORT_SYMBOL(fw_cancel_transaction);
 
-static void split_transaction_timeout_callback(unsigned long data)
+static void split_transaction_timeout_callback(struct timer_list *timer)
 {
-	struct fw_transaction *t = (struct fw_transaction *)data;
+	struct fw_transaction *t = from_timer(t, timer, split_timeout_timer);
 	struct fw_card *card = t->card;
 	unsigned long flags;
 
@@ -373,8 +373,8 @@ void fw_send_request(struct fw_card *card, struct fw_transaction *t, int tcode,
 	t->tlabel = tlabel;
 	t->card = card;
 	t->is_split_transaction = false;
-	setup_timer(&t->split_timeout_timer,
-		    split_transaction_timeout_callback, (unsigned long)t);
+	timer_setup(&t->split_timeout_timer,
+		    split_transaction_timeout_callback, 0);
 	t->callback = callback;
 	t->callback_data = callback_data;
 
@@ -423,7 +423,7 @@ int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
 	struct transaction_callback_data d;
 	struct fw_transaction t;
 
-	init_timer_on_stack(&t.split_timeout_timer);
+	timer_setup_on_stack(&t.split_timeout_timer, NULL, 0);
 	init_completion(&d.done);
 	d.payload = payload;
 	fw_send_request(card, &t, tcode, destination_id, generation, speed,
diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c
index 74cc6dd982d2..2d1a5c737c6e 100644
--- a/drivers/parport/ieee1284.c
+++ b/drivers/parport/ieee1284.c
@@ -44,10 +44,11 @@ static void parport_ieee1284_wakeup (struct parport *port)
 	up (&port->physport->ieee1284.irq);
 }
 
-static struct parport *port_from_cookie[PARPORT_MAX];
-static void timeout_waiting_on_port (unsigned long cookie)
+static void timeout_waiting_on_port (struct timer_list *t)
 {
-	parport_ieee1284_wakeup (port_from_cookie[cookie % PARPORT_MAX]);
+	struct parport *port = from_timer(port, t, timer);
+
+	parport_ieee1284_wakeup (port);
 }
 
 /**
@@ -69,27 +70,19 @@ static void timeout_waiting_on_port (unsigned long cookie)
 int parport_wait_event (struct parport *port, signed long timeout)
 {
 	int ret;
-	struct timer_list timer;
 
 	if (!port->physport->cad->timeout)
 		/* Zero timeout is special, and we can't down() the
 		   semaphore. */
 		return 1;
 
-	init_timer_on_stack(&timer);
-	timer.expires = jiffies + timeout;
-	timer.function = timeout_waiting_on_port;
-	port_from_cookie[port->number % PARPORT_MAX] = port;
-	timer.data = port->number;
-
-	add_timer (&timer);
+	timer_setup(&port->timer, timeout_waiting_on_port, 0);
+	mod_timer(&port->timer, jiffies + timeout);
 	ret = down_interruptible (&port->physport->ieee1284.irq);
-	if (!del_timer_sync(&timer) && !ret)
+	if (!del_timer_sync(&port->timer) && !ret)
 		/* Timed out. */
 		ret = 1;
 
-	destroy_timer_on_stack(&timer);
-
 	return ret;
 }
 
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h
index ea664dd4f56d..52fbcd9c3cf8 100644
--- a/drivers/s390/char/tape.h
+++ b/drivers/s390/char/tape.h
@@ -128,6 +128,7 @@ struct tape_request {
 	int options;			/* options for execution. */
 	int retries;			/* retry counter for error recovery. */
 	int rescnt;			/* residual count from devstat. */
+	struct timer_list timer;	/* timer for std_assign_timeout(). */
 
 	/* Callback for delivering final status. */
 	void (*callback)(struct tape_request *, void *);
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c
index 3478e19ae194..cd204abdc0bc 100644
--- a/drivers/s390/char/tape_std.c
+++ b/drivers/s390/char/tape_std.c
@@ -32,14 +32,12 @@
  * tape_std_assign
  */
 static void
-tape_std_assign_timeout(unsigned long data)
+tape_std_assign_timeout(struct timer_list *t)
 {
-	struct tape_request *	request;
-	struct tape_device *	device;
+	struct tape_request *	request = from_timer(request, t, timer);
+	struct tape_device *	device = request->device;
 	int rc;
 
-	request = (struct tape_request *) data;
-	device = request->device;
 	BUG_ON(!device);
 
 	DBF_EVENT(3, "%08x: Assignment timeout. Device busy.\n",
@@ -70,16 +68,12 @@ tape_std_assign(struct tape_device *device)
 	 * to another host (actually this shouldn't happen but it does).
 	 * So we set up a timeout for this call.
 	 */
-	init_timer_on_stack(&timeout);
-	timeout.function = tape_std_assign_timeout;
-	timeout.data     = (unsigned long) request;
-	timeout.expires  = jiffies + 2 * HZ;
-	add_timer(&timeout);
+	timer_setup(&request->timer, tape_std_assign_timeout, 0);
+	mod_timer(&timeout, jiffies + 2 * HZ);
 
 	rc = tape_do_io_interruptible(device, request);
 
-	del_timer_sync(&timeout);
-	destroy_timer_on_stack(&timeout);
+	del_timer_sync(&request->timer);
 
 	if (rc != 0) {
 		DBF_EVENT(3, "%08x: assign failed - device might be busy\n",
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index d01b5c2a7760..21bba406d5be 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -834,9 +834,10 @@ lcs_notify_lancmd_waiters(struct lcs_card *card, struct lcs_cmd *cmd)
  * Emit buffer of a lan command.
  */
 static void
-lcs_lancmd_timeout(unsigned long data)
+lcs_lancmd_timeout(struct timer_list *t)
 {
-	struct lcs_reply *reply, *list_reply, *r;
+	struct lcs_reply *reply = from_timer(reply, t, timer);
+	struct lcs_reply *list_reply, *r;
 	unsigned long flags;
 
 	LCS_DBF_TEXT(4, trace, "timeout");
@@ -864,7 +865,6 @@ lcs_send_lancmd(struct lcs_card *card, struct lcs_buffer *buffer,
 {
 	struct lcs_reply *reply;
 	struct lcs_cmd *cmd;
-	struct timer_list timer;
 	unsigned long flags;
 	int rc;
 
@@ -885,14 +885,10 @@ lcs_send_lancmd(struct lcs_card *card, struct lcs_buffer *buffer,
 	rc = lcs_ready_buffer(&card->write, buffer);
 	if (rc)
 		return rc;
-	init_timer_on_stack(&timer);
-	timer.function = lcs_lancmd_timeout;
-	timer.data = (unsigned long) reply;
-	timer.expires = jiffies + HZ*card->lancmd_timeout;
-	add_timer(&timer);
+	timer_setup(&reply->timer, lcs_lancmd_timeout, 0);
+	mod_timer(&reply->timer, jiffies + HZ * card->lancmd_timeout);
 	wait_event(reply->wait_q, reply->received);
-	del_timer_sync(&timer);
-	destroy_timer_on_stack(&timer);
+	del_timer_sync(&reply->timer);
 	LCS_DBF_TEXT_(4, trace, "rc:%d",reply->rc);
 	rc = reply->rc;
 	lcs_put_reply(reply);
diff --git a/drivers/s390/net/lcs.h b/drivers/s390/net/lcs.h
index 150fcb4cebc3..d44fb8d9378f 100644
--- a/drivers/s390/net/lcs.h
+++ b/drivers/s390/net/lcs.h
@@ -275,6 +275,7 @@ struct lcs_reply {
 	void (*callback)(struct lcs_card *, struct lcs_cmd *);
 	wait_queue_head_t wait_q;
 	struct lcs_card *card;
+	struct timer_list timer;
 	int received;
 	int rc;
 };
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 8a29fb09db14..390775d5c918 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -758,9 +758,9 @@ enum action {
 };
 
 
-static void qla1280_mailbox_timeout(unsigned long __data)
+static void qla1280_mailbox_timeout(struct timer_list *t)
 {
-	struct scsi_qla_host *ha = (struct scsi_qla_host *)__data;
+	struct scsi_qla_host *ha = from_timer(ha, t, mailbox_timer);
 	struct device_reg __iomem *reg;
 	reg = ha->iobase;
 
@@ -2465,7 +2465,6 @@ qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
 	uint16_t __iomem *mptr;
 	uint16_t data;
 	DECLARE_COMPLETION_ONSTACK(wait);
-	struct timer_list timer;
 
 	ENTER("qla1280_mailbox_command");
 
@@ -2494,18 +2493,15 @@ qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
 	/* Issue set host interrupt command. */
 
 	/* set up a timer just in case we're really jammed */
-	init_timer_on_stack(&timer);
-	timer.expires = jiffies + 20*HZ;
-	timer.data = (unsigned long)ha;
-	timer.function = qla1280_mailbox_timeout;
-	add_timer(&timer);
+	timer_setup(&ha->mailbox_timer, qla1280_mailbox_timeout, 0);
+	mod_timer(&ha->mailbox_timer, jiffies + 20 * HZ);
 
 	spin_unlock_irq(ha->host->host_lock);
 	WRT_REG_WORD(&reg->host_cmd, HC_SET_HOST_INT);
 	data = qla1280_debounce_register(&reg->istatus);
 
 	wait_for_completion(&wait);
-	del_timer_sync(&timer);
+	del_timer_sync(&ha->mailbox_timer);
 
 	spin_lock_irq(ha->host->host_lock);
 
diff --git a/drivers/scsi/qla1280.h b/drivers/scsi/qla1280.h
index 834884b9eed5..1522aca2c8c8 100644
--- a/drivers/scsi/qla1280.h
+++ b/drivers/scsi/qla1280.h
@@ -1055,6 +1055,7 @@ struct scsi_qla_host {
 	struct list_head done_q;	/* Done queue */
 
 	struct completion *mailbox_wait;
+	struct timer_list mailbox_timer;
 
 	volatile struct {
 		uint32_t online:1;			/* 0 */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 58e3c64c6b49..397607a0c0eb 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -225,6 +225,7 @@ struct parport {
 	struct pardevice *waittail;
 
 	struct list_head list;
+	struct timer_list timer;
 	unsigned int flags;
 
 	void *sysctl_table;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index d11e819a86e2..b10c4bdc6fbd 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_on_stack(timer)					\
-	__init_timer_on_stack((timer), 0)
 
 #define __setup_timer(_timer, _fn, _data, _flags)			\
 	do {								\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 03/13] timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Rafael J. Wysocki, Pavel Machek, Len Brown,
	Greg Kroah-Hartman, Stefan Richter, Sudip Mukherjee,
	Martin Schwidefsky, Heiko Carstens, Julian Wiedmann,
	Ursula Braun, Michael Reed, James E.J. Bottomley,
	Martin K. Petersen, linux-pm, linux1394-devel, linux-s390,
	linux-scsi, Andrew Morton, Arnd Bergmann

Remove uses of init_timer_on_stack() with open-coded function and data
assignments that could be expressed using timer_setup_on_stack(). Several
were removed from the stack entirely since there was a one-to-one mapping
of parent structure to timer, those are switched to using timer_setup()
instead. All related callbacks were adjusted to use from_timer().

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Len Brown <len.brown@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Julian Wiedmann <jwi@linux.vnet.ibm.com>
Cc: Ursula Braun <ubraun@linux.vnet.ibm.com>
Cc: Michael Reed <mdr@sgi.com>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-pm@vger.kernel.org
Cc: linux1394-devel@lists.sourceforge.net
Cc: linux-s390@vger.kernel.org
Cc: linux-scsi@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/base/power/main.c           |  8 +++-----
 drivers/firewire/core-transaction.c | 10 +++++-----
 drivers/parport/ieee1284.c          | 21 +++++++--------------
 drivers/s390/char/tape.h            |  1 +
 drivers/s390/char/tape_std.c        | 18 ++++++------------
 drivers/s390/net/lcs.c              | 16 ++++++----------
 drivers/s390/net/lcs.h              |  1 +
 drivers/scsi/qla1280.c              | 14 +++++---------
 drivers/scsi/qla1280.h              |  1 +
 include/linux/parport.h             |  1 +
 include/linux/timer.h               |  2 --
 11 files changed, 36 insertions(+), 57 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 770b1539a083..ae47b2ec84b4 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -478,9 +478,9 @@ struct dpm_watchdog {
  * There's not much we can do here to recover so panic() to
  * capture a crash-dump in pstore.
  */
-static void dpm_watchdog_handler(unsigned long data)
+static void dpm_watchdog_handler(struct timer_list *t)
 {
-	struct dpm_watchdog *wd = (void *)data;
+	struct dpm_watchdog *wd = from_timer(wd, t, timer);
 
 	dev_emerg(wd->dev, "**** DPM device timeout ****\n");
 	show_stack(wd->tsk, NULL);
@@ -500,11 +500,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
 	wd->dev = dev;
 	wd->tsk = current;
 
-	init_timer_on_stack(timer);
+	timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
 	/* use same timeout value for both suspend and resume */
 	timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT;
-	timer->function = dpm_watchdog_handler;
-	timer->data = (unsigned long)wd;
 	add_timer(timer);
 }
 
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index d6a09b9cd8cc..4372f9e4b0da 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -137,9 +137,9 @@ int fw_cancel_transaction(struct fw_card *card,
 }
 EXPORT_SYMBOL(fw_cancel_transaction);
 
-static void split_transaction_timeout_callback(unsigned long data)
+static void split_transaction_timeout_callback(struct timer_list *timer)
 {
-	struct fw_transaction *t = (struct fw_transaction *)data;
+	struct fw_transaction *t = from_timer(t, timer, split_timeout_timer);
 	struct fw_card *card = t->card;
 	unsigned long flags;
 
@@ -373,8 +373,8 @@ void fw_send_request(struct fw_card *card, struct fw_transaction *t, int tcode,
 	t->tlabel = tlabel;
 	t->card = card;
 	t->is_split_transaction = false;
-	setup_timer(&t->split_timeout_timer,
-		    split_transaction_timeout_callback, (unsigned long)t);
+	timer_setup(&t->split_timeout_timer,
+		    split_transaction_timeout_callback, 0);
 	t->callback = callback;
 	t->callback_data = callback_data;
 
@@ -423,7 +423,7 @@ int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
 	struct transaction_callback_data d;
 	struct fw_transaction t;
 
-	init_timer_on_stack(&t.split_timeout_timer);
+	timer_setup_on_stack(&t.split_timeout_timer, NULL, 0);
 	init_completion(&d.done);
 	d.payload = payload;
 	fw_send_request(card, &t, tcode, destination_id, generation, speed,
diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c
index 74cc6dd982d2..2d1a5c737c6e 100644
--- a/drivers/parport/ieee1284.c
+++ b/drivers/parport/ieee1284.c
@@ -44,10 +44,11 @@ static void parport_ieee1284_wakeup (struct parport *port)
 	up (&port->physport->ieee1284.irq);
 }
 
-static struct parport *port_from_cookie[PARPORT_MAX];
-static void timeout_waiting_on_port (unsigned long cookie)
+static void timeout_waiting_on_port (struct timer_list *t)
 {
-	parport_ieee1284_wakeup (port_from_cookie[cookie % PARPORT_MAX]);
+	struct parport *port = from_timer(port, t, timer);
+
+	parport_ieee1284_wakeup (port);
 }
 
 /**
@@ -69,27 +70,19 @@ static void timeout_waiting_on_port (unsigned long cookie)
 int parport_wait_event (struct parport *port, signed long timeout)
 {
 	int ret;
-	struct timer_list timer;
 
 	if (!port->physport->cad->timeout)
 		/* Zero timeout is special, and we can't down() the
 		   semaphore. */
 		return 1;
 
-	init_timer_on_stack(&timer);
-	timer.expires = jiffies + timeout;
-	timer.function = timeout_waiting_on_port;
-	port_from_cookie[port->number % PARPORT_MAX] = port;
-	timer.data = port->number;
-
-	add_timer (&timer);
+	timer_setup(&port->timer, timeout_waiting_on_port, 0);
+	mod_timer(&port->timer, jiffies + timeout);
 	ret = down_interruptible (&port->physport->ieee1284.irq);
-	if (!del_timer_sync(&timer) && !ret)
+	if (!del_timer_sync(&port->timer) && !ret)
 		/* Timed out. */
 		ret = 1;
 
-	destroy_timer_on_stack(&timer);
-
 	return ret;
 }
 
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h
index ea664dd4f56d..52fbcd9c3cf8 100644
--- a/drivers/s390/char/tape.h
+++ b/drivers/s390/char/tape.h
@@ -128,6 +128,7 @@ struct tape_request {
 	int options;			/* options for execution. */
 	int retries;			/* retry counter for error recovery. */
 	int rescnt;			/* residual count from devstat. */
+	struct timer_list timer;	/* timer for std_assign_timeout(). */
 
 	/* Callback for delivering final status. */
 	void (*callback)(struct tape_request *, void *);
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c
index 3478e19ae194..cd204abdc0bc 100644
--- a/drivers/s390/char/tape_std.c
+++ b/drivers/s390/char/tape_std.c
@@ -32,14 +32,12 @@
  * tape_std_assign
  */
 static void
-tape_std_assign_timeout(unsigned long data)
+tape_std_assign_timeout(struct timer_list *t)
 {
-	struct tape_request *	request;
-	struct tape_device *	device;
+	struct tape_request *	request = from_timer(request, t, timer);
+	struct tape_device *	device = request->device;
 	int rc;
 
-	request = (struct tape_request *) data;
-	device = request->device;
 	BUG_ON(!device);
 
 	DBF_EVENT(3, "%08x: Assignment timeout. Device busy.\n",
@@ -70,16 +68,12 @@ tape_std_assign(struct tape_device *device)
 	 * to another host (actually this shouldn't happen but it does).
 	 * So we set up a timeout for this call.
 	 */
-	init_timer_on_stack(&timeout);
-	timeout.function = tape_std_assign_timeout;
-	timeout.data     = (unsigned long) request;
-	timeout.expires  = jiffies + 2 * HZ;
-	add_timer(&timeout);
+	timer_setup(&request->timer, tape_std_assign_timeout, 0);
+	mod_timer(&timeout, jiffies + 2 * HZ);
 
 	rc = tape_do_io_interruptible(device, request);
 
-	del_timer_sync(&timeout);
-	destroy_timer_on_stack(&timeout);
+	del_timer_sync(&request->timer);
 
 	if (rc != 0) {
 		DBF_EVENT(3, "%08x: assign failed - device might be busy\n",
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index d01b5c2a7760..21bba406d5be 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -834,9 +834,10 @@ lcs_notify_lancmd_waiters(struct lcs_card *card, struct lcs_cmd *cmd)
  * Emit buffer of a lan command.
  */
 static void
-lcs_lancmd_timeout(unsigned long data)
+lcs_lancmd_timeout(struct timer_list *t)
 {
-	struct lcs_reply *reply, *list_reply, *r;
+	struct lcs_reply *reply = from_timer(reply, t, timer);
+	struct lcs_reply *list_reply, *r;
 	unsigned long flags;
 
 	LCS_DBF_TEXT(4, trace, "timeout");
@@ -864,7 +865,6 @@ lcs_send_lancmd(struct lcs_card *card, struct lcs_buffer *buffer,
 {
 	struct lcs_reply *reply;
 	struct lcs_cmd *cmd;
-	struct timer_list timer;
 	unsigned long flags;
 	int rc;
 
@@ -885,14 +885,10 @@ lcs_send_lancmd(struct lcs_card *card, struct lcs_buffer *buffer,
 	rc = lcs_ready_buffer(&card->write, buffer);
 	if (rc)
 		return rc;
-	init_timer_on_stack(&timer);
-	timer.function = lcs_lancmd_timeout;
-	timer.data = (unsigned long) reply;
-	timer.expires = jiffies + HZ*card->lancmd_timeout;
-	add_timer(&timer);
+	timer_setup(&reply->timer, lcs_lancmd_timeout, 0);
+	mod_timer(&reply->timer, jiffies + HZ * card->lancmd_timeout);
 	wait_event(reply->wait_q, reply->received);
-	del_timer_sync(&timer);
-	destroy_timer_on_stack(&timer);
+	del_timer_sync(&reply->timer);
 	LCS_DBF_TEXT_(4, trace, "rc:%d",reply->rc);
 	rc = reply->rc;
 	lcs_put_reply(reply);
diff --git a/drivers/s390/net/lcs.h b/drivers/s390/net/lcs.h
index 150fcb4cebc3..d44fb8d9378f 100644
--- a/drivers/s390/net/lcs.h
+++ b/drivers/s390/net/lcs.h
@@ -275,6 +275,7 @@ struct lcs_reply {
 	void (*callback)(struct lcs_card *, struct lcs_cmd *);
 	wait_queue_head_t wait_q;
 	struct lcs_card *card;
+	struct timer_list timer;
 	int received;
 	int rc;
 };
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 8a29fb09db14..390775d5c918 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -758,9 +758,9 @@ enum action {
 };
 
 
-static void qla1280_mailbox_timeout(unsigned long __data)
+static void qla1280_mailbox_timeout(struct timer_list *t)
 {
-	struct scsi_qla_host *ha = (struct scsi_qla_host *)__data;
+	struct scsi_qla_host *ha = from_timer(ha, t, mailbox_timer);
 	struct device_reg __iomem *reg;
 	reg = ha->iobase;
 
@@ -2465,7 +2465,6 @@ qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
 	uint16_t __iomem *mptr;
 	uint16_t data;
 	DECLARE_COMPLETION_ONSTACK(wait);
-	struct timer_list timer;
 
 	ENTER("qla1280_mailbox_command");
 
@@ -2494,18 +2493,15 @@ qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
 	/* Issue set host interrupt command. */
 
 	/* set up a timer just in case we're really jammed */
-	init_timer_on_stack(&timer);
-	timer.expires = jiffies + 20*HZ;
-	timer.data = (unsigned long)ha;
-	timer.function = qla1280_mailbox_timeout;
-	add_timer(&timer);
+	timer_setup(&ha->mailbox_timer, qla1280_mailbox_timeout, 0);
+	mod_timer(&ha->mailbox_timer, jiffies + 20 * HZ);
 
 	spin_unlock_irq(ha->host->host_lock);
 	WRT_REG_WORD(&reg->host_cmd, HC_SET_HOST_INT);
 	data = qla1280_debounce_register(&reg->istatus);
 
 	wait_for_completion(&wait);
-	del_timer_sync(&timer);
+	del_timer_sync(&ha->mailbox_timer);
 
 	spin_lock_irq(ha->host->host_lock);
 
diff --git a/drivers/scsi/qla1280.h b/drivers/scsi/qla1280.h
index 834884b9eed5..1522aca2c8c8 100644
--- a/drivers/scsi/qla1280.h
+++ b/drivers/scsi/qla1280.h
@@ -1055,6 +1055,7 @@ struct scsi_qla_host {
 	struct list_head done_q;	/* Done queue */
 
 	struct completion *mailbox_wait;
+	struct timer_list mailbox_timer;
 
 	volatile struct {
 		uint32_t online:1;			/* 0 */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 58e3c64c6b49..397607a0c0eb 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -225,6 +225,7 @@ struct parport {
 	struct pardevice *waittail;
 
 	struct list_head list;
+	struct timer_list timer;
 	unsigned int flags;
 
 	void *sysctl_table;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index d11e819a86e2..b10c4bdc6fbd 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_on_stack(timer)					\
-	__init_timer_on_stack((timer), 0)
 
 #define __setup_timer(_timer, _fn, _data, _flags)			\
 	do {								\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 04/13] timer: Remove init_timer_pinned() in favor of timer_setup()
  2017-10-04 23:26 ` Kees Cook
  (?)
@ 2017-10-04 23:26   ` Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Chris Metcalf, netdev, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, 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 Ellerman,
	Michael Reed, Oleg Nesterov, Paul Mackerras, Pavel Machek,
	Petr Mladek, Rafael J. Wysocki, Ralf Baechle, Sebastian Reichel,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linuxppc-dev, linux-s390, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

This refactors the only users of init_timer_pinned() to use
the new timer_setup() and from_timer(). Drops the definition of
init_timer_pinned().

Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/net/ethernet/tile/tilepro.c | 9 ++++-----
 include/linux/timer.h               | 2 --
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c
index 49ccee4b9aec..56d06282fbde 100644
--- a/drivers/net/ethernet/tile/tilepro.c
+++ b/drivers/net/ethernet/tile/tilepro.c
@@ -608,9 +608,9 @@ static void tile_net_schedule_egress_timer(struct tile_net_cpu *info)
  * ISSUE: Maybe instead track number of expected completions, and free
  * only that many, resetting to zero if "pending" is ever false.
  */
-static void tile_net_handle_egress_timer(unsigned long arg)
+static void tile_net_handle_egress_timer(struct timer_list *t)
 {
-	struct tile_net_cpu *info = (struct tile_net_cpu *)arg;
+	struct tile_net_cpu *info = from_timer(info, t, egress_timer);
 	struct net_device *dev = info->napi.dev;
 
 	/* The timer is no longer scheduled. */
@@ -1004,9 +1004,8 @@ static void tile_net_register(void *dev_ptr)
 		BUG();
 
 	/* Initialize the egress timer. */
-	init_timer_pinned(&info->egress_timer);
-	info->egress_timer.data = (long)info;
-	info->egress_timer.function = tile_net_handle_egress_timer;
+	timer_setup(&info->egress_timer, tile_net_handle_egress_timer,
+		    TIMER_PINNED);
 
 	u64_stats_init(&info->stats.syncp);
 
diff --git a/include/linux/timer.h b/include/linux/timer.h
index b10c4bdc6fbd..9da903562ed4 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -128,8 +128,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
 
 #define init_timer(timer)						\
 	__init_timer((timer), 0)
-#define init_timer_pinned(timer)					\
-	__init_timer((timer), TIMER_PINNED)
 #define init_timer_deferrable(timer)					\
 	__init_timer((timer), TIMER_DEFERRABLE)
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 04/13] timer: Remove init_timer_pinned() in favor of timer_setup()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Chris Metcalf, netdev, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, 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

This refactors the only users of init_timer_pinned() to use
the new timer_setup() and from_timer(). Drops the definition of
init_timer_pinned().

Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/net/ethernet/tile/tilepro.c | 9 ++++-----
 include/linux/timer.h               | 2 --
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c
index 49ccee4b9aec..56d06282fbde 100644
--- a/drivers/net/ethernet/tile/tilepro.c
+++ b/drivers/net/ethernet/tile/tilepro.c
@@ -608,9 +608,9 @@ static void tile_net_schedule_egress_timer(struct tile_net_cpu *info)
  * ISSUE: Maybe instead track number of expected completions, and free
  * only that many, resetting to zero if "pending" is ever false.
  */
-static void tile_net_handle_egress_timer(unsigned long arg)
+static void tile_net_handle_egress_timer(struct timer_list *t)
 {
-	struct tile_net_cpu *info = (struct tile_net_cpu *)arg;
+	struct tile_net_cpu *info = from_timer(info, t, egress_timer);
 	struct net_device *dev = info->napi.dev;
 
 	/* The timer is no longer scheduled. */
@@ -1004,9 +1004,8 @@ static void tile_net_register(void *dev_ptr)
 		BUG();
 
 	/* Initialize the egress timer. */
-	init_timer_pinned(&info->egress_timer);
-	info->egress_timer.data = (long)info;
-	info->egress_timer.function = tile_net_handle_egress_timer;
+	timer_setup(&info->egress_timer, tile_net_handle_egress_timer,
+		    TIMER_PINNED);
 
 	u64_stats_init(&info->stats.syncp);
 
diff --git a/include/linux/timer.h b/include/linux/timer.h
index b10c4bdc6fbd..9da903562ed4 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -128,8 +128,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
 
 #define init_timer(timer)						\
 	__init_timer((timer), 0)
-#define init_timer_pinned(timer)					\
-	__init_timer((timer), TIMER_PINNED)
 #define init_timer_deferrable(timer)					\
 	__init_timer((timer), TIMER_DEFERRABLE)
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 04/13] timer: Remove init_timer_pinned() in favor of timer_setup()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Chris Metcalf, netdev, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, 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

This refactors the only users of init_timer_pinned() to use
the new timer_setup() and from_timer(). Drops the definition of
init_timer_pinned().

Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: netdev@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/net/ethernet/tile/tilepro.c | 9 ++++-----
 include/linux/timer.h               | 2 --
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c
index 49ccee4b9aec..56d06282fbde 100644
--- a/drivers/net/ethernet/tile/tilepro.c
+++ b/drivers/net/ethernet/tile/tilepro.c
@@ -608,9 +608,9 @@ static void tile_net_schedule_egress_timer(struct tile_net_cpu *info)
  * ISSUE: Maybe instead track number of expected completions, and free
  * only that many, resetting to zero if "pending" is ever false.
  */
-static void tile_net_handle_egress_timer(unsigned long arg)
+static void tile_net_handle_egress_timer(struct timer_list *t)
 {
-	struct tile_net_cpu *info = (struct tile_net_cpu *)arg;
+	struct tile_net_cpu *info = from_timer(info, t, egress_timer);
 	struct net_device *dev = info->napi.dev;
 
 	/* The timer is no longer scheduled. */
@@ -1004,9 +1004,8 @@ static void tile_net_register(void *dev_ptr)
 		BUG();
 
 	/* Initialize the egress timer. */
-	init_timer_pinned(&info->egress_timer);
-	info->egress_timer.data = (long)info;
-	info->egress_timer.function = tile_net_handle_egress_timer;
+	timer_setup(&info->egress_timer, tile_net_handle_egress_timer,
+		    TIMER_PINNED);
 
 	u64_stats_init(&info->stats.syncp);
 
diff --git a/include/linux/timer.h b/include/linux/timer.h
index b10c4bdc6fbd..9da903562ed4 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -128,8 +128,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
 
 #define init_timer(timer)						\
 	__init_timer((timer), 0)
-#define init_timer_pinned(timer)					\
-	__init_timer((timer), TIMER_PINNED)
 #define init_timer_deferrable(timer)					\
 	__init_timer((timer), TIMER_DEFERRABLE)
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 05/13] timer: Remove init_timer_deferrable() in favor of timer_setup()
  2017-10-04 23:26 ` Kees Cook
  (?)
@ 2017-10-04 23:26   ` Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Benjamin Herrenschmidt, Michael Ellerman,
	Sebastian Reichel, Harish Patil, Manish Chopra, Kalle Valo,
	linuxppc-dev, netdev, linux-wireless, Andrew Morton,
	Arnd Bergmann, Chris Metcalf, Geert Uytterhoeven,
	Greg Kroah-Hartman, Guenter Roeck, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann,
	Lai Jiangshan, Len Brown, Mark Gross, Martin K. Petersen,
	Martin Schwidefsky, Michael Reed, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Petr Mladek, Rafael J. Wysocki, Ralf Baechle,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linux-s390, linux-scsi, linux-watchdog,
	linux-kernel

This refactors the only users of init_timer_deferrable() to use
the new timer_setup() and from_timer(). Removes definition of
init_timer_deferrable().

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Harish Patil <harish.patil@cavium.com>
Cc: Manish Chopra <manish.chopra@cavium.com>
Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: netdev@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/powerpc/mm/numa.c                       | 12 +++++------
 drivers/hsi/clients/ssi_protocol.c           | 32 ++++++++++++++++------------
 drivers/net/ethernet/qlogic/qlge/qlge_main.c | 11 ++++------
 drivers/net/vxlan.c                          |  8 +++----
 drivers/net/wireless/ath/ath6kl/recovery.c   |  9 ++++----
 include/linux/timer.h                        |  2 --
 6 files changed, 34 insertions(+), 40 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b95c584ce19d..f9b6107d6854 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1453,7 +1453,7 @@ static void topology_schedule_update(void)
 	schedule_work(&topology_work);
 }
 
-static void topology_timer_fn(unsigned long ignored)
+static void topology_timer_fn(struct timer_list *unused)
 {
 	if (prrn_enabled && cpumask_weight(&cpu_associativity_changes_mask))
 		topology_schedule_update();
@@ -1463,14 +1463,11 @@ static void topology_timer_fn(unsigned long ignored)
 		reset_topology_timer();
 	}
 }
-static struct timer_list topology_timer =
-	TIMER_INITIALIZER(topology_timer_fn, 0, 0);
+static struct timer_list topology_timer;
 
 static void reset_topology_timer(void)
 {
-	topology_timer.data = 0;
-	topology_timer.expires = jiffies + 60 * HZ;
-	mod_timer(&topology_timer, topology_timer.expires);
+	mod_timer(&topology_timer, jiffies + 60 * HZ);
 }
 
 #ifdef CONFIG_SMP
@@ -1530,7 +1527,8 @@ int start_topology_update(void)
 			prrn_enabled = 0;
 			vphn_enabled = 1;
 			setup_cpu_associativity_change_counters();
-			init_timer_deferrable(&topology_timer);
+			timer_setup(&topology_timer, topology_timer_fn,
+				    TIMER_DEFERRABLE);
 			reset_topology_timer();
 		}
 	}
diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 93d28c0ec8bf..67af03d3aeb3 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -464,10 +464,10 @@ static void ssip_error(struct hsi_client *cl)
 	hsi_async_read(cl, msg);
 }
 
-static void ssip_keep_alive(unsigned long data)
+static void ssip_keep_alive(struct timer_list *t)
 {
-	struct hsi_client *cl = (struct hsi_client *)data;
-	struct ssi_protocol *ssi = hsi_client_drvdata(cl);
+	struct ssi_protocol *ssi = from_timer(ssi, t, keep_alive);
+	struct hsi_client *cl = ssi->cl;
 
 	dev_dbg(&cl->device, "Keep alive kick in: m(%d) r(%d) s(%d)\n",
 		ssi->main_state, ssi->recv_state, ssi->send_state);
@@ -490,9 +490,19 @@ static void ssip_keep_alive(unsigned long data)
 	spin_unlock(&ssi->lock);
 }
 
-static void ssip_wd(unsigned long data)
+static void ssip_rx_wd(struct timer_list *t)
+{
+	struct ssi_protocol *ssi = from_timer(ssi, t, rx_wd);
+	struct hsi_client *cl = ssi->cl;
+
+	dev_err(&cl->device, "Watchdog trigerred\n");
+	ssip_error(cl);
+}
+
+static void ssip_tx_wd(unsigned long data)
 {
-	struct hsi_client *cl = (struct hsi_client *)data;
+	struct ssi_protocol *ssi = from_timer(ssi, t, tx_wd);
+	struct hsi_client *cl = ssi->cl;
 
 	dev_err(&cl->device, "Watchdog trigerred\n");
 	ssip_error(cl);
@@ -1084,15 +1094,9 @@ static int ssi_protocol_probe(struct device *dev)
 	}
 
 	spin_lock_init(&ssi->lock);
-	init_timer_deferrable(&ssi->rx_wd);
-	init_timer_deferrable(&ssi->tx_wd);
-	init_timer(&ssi->keep_alive);
-	ssi->rx_wd.data = (unsigned long)cl;
-	ssi->rx_wd.function = ssip_wd;
-	ssi->tx_wd.data = (unsigned long)cl;
-	ssi->tx_wd.function = ssip_wd;
-	ssi->keep_alive.data = (unsigned long)cl;
-	ssi->keep_alive.function = ssip_keep_alive;
+	timer_setup(&ssi->rx_wd, ssip_rx_wd, TIMER_DEFERRABLE);
+	timer_setup(&ssi->tx_wd, ssip_tx_wd, TIMER_DEFERRABLE);
+	timer_setup(&ssi->keep_alive, ssip_keep_alive, 0);
 	INIT_LIST_HEAD(&ssi->txqueue);
 	INIT_LIST_HEAD(&ssi->cmdqueue);
 	atomic_set(&ssi->tx_usecnt, 0);
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 9feec7009443..29fea74bff2e 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4725,9 +4725,9 @@ static const struct net_device_ops qlge_netdev_ops = {
 	.ndo_vlan_rx_kill_vid	= qlge_vlan_rx_kill_vid,
 };
 
-static void ql_timer(unsigned long data)
+static void ql_timer(struct timer_list *t)
 {
-	struct ql_adapter *qdev = (struct ql_adapter *)data;
+	struct ql_adapter *qdev = from_timer(qdev, t, timer);
 	u32 var = 0;
 
 	var = ql_read32(qdev, STS);
@@ -4806,11 +4806,8 @@ static int qlge_probe(struct pci_dev *pdev,
 	/* Start up the timer to trigger EEH if
 	 * the bus goes dead
 	 */
-	init_timer_deferrable(&qdev->timer);
-	qdev->timer.data = (unsigned long)qdev;
-	qdev->timer.function = ql_timer;
-	qdev->timer.expires = jiffies + (5*HZ);
-	add_timer(&qdev->timer);
+	timer_setup(&qdev->timer, ql_timer, TIMER_DEFERRABLE);
+	mod_timer(&qdev->timer, jiffies + (5*HZ));
 	ql_link_off(qdev);
 	ql_display_dev_info(ndev);
 	atomic_set(&qdev->lb_count, 0);
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d7c49cf1d5e9..3247d2feda07 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2325,9 +2325,9 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 }
 
 /* Walk the forwarding table and purge stale entries */
-static void vxlan_cleanup(unsigned long arg)
+static void vxlan_cleanup(struct timer_list *t)
 {
-	struct vxlan_dev *vxlan = (struct vxlan_dev *) arg;
+	struct vxlan_dev *vxlan = from_timer(vxlan, t, age_timer);
 	unsigned long next_timer = jiffies + FDB_AGE_INTERVAL;
 	unsigned int h;
 
@@ -2647,9 +2647,7 @@ static void vxlan_setup(struct net_device *dev)
 	INIT_LIST_HEAD(&vxlan->next);
 	spin_lock_init(&vxlan->hash_lock);
 
-	init_timer_deferrable(&vxlan->age_timer);
-	vxlan->age_timer.function = vxlan_cleanup;
-	vxlan->age_timer.data = (unsigned long) vxlan;
+	timer_setup(&vxlan->age_timer, vxlan_cleanup, TIMER_DEFERRABLE);
 
 	vxlan->dev = dev;
 
diff --git a/drivers/net/wireless/ath/ath6kl/recovery.c b/drivers/net/wireless/ath/ath6kl/recovery.c
index 3a8d5e97dc8e..c09e40c9010f 100644
--- a/drivers/net/wireless/ath/ath6kl/recovery.c
+++ b/drivers/net/wireless/ath/ath6kl/recovery.c
@@ -60,9 +60,9 @@ void ath6kl_recovery_hb_event(struct ath6kl *ar, u32 cookie)
 		ar->fw_recovery.hb_pending = false;
 }
 
-static void ath6kl_recovery_hb_timer(unsigned long data)
+static void ath6kl_recovery_hb_timer(struct timer_list *t)
 {
-	struct ath6kl *ar = (struct ath6kl *) data;
+	struct ath6kl *ar = from_timer(ar, t, fw_recovery.hb_timer);
 	int err;
 
 	if (test_bit(RECOVERY_CLEANUP, &ar->flag) ||
@@ -104,9 +104,8 @@ void ath6kl_recovery_init(struct ath6kl *ar)
 	recovery->seq_num = 0;
 	recovery->hb_misscnt = 0;
 	ar->fw_recovery.hb_pending = false;
-	ar->fw_recovery.hb_timer.function = ath6kl_recovery_hb_timer;
-	ar->fw_recovery.hb_timer.data = (unsigned long) ar;
-	init_timer_deferrable(&ar->fw_recovery.hb_timer);
+	timer_setup(&ar->fw_recovery.hb_timer, ath6kl_recovery_hb_timer,
+		    TIMER_DEFERRABLE);
 
 	if (ar->fw_recovery.hb_poll)
 		mod_timer(&ar->fw_recovery.hb_timer, jiffies +
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 9da903562ed4..10cc45ca5803 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -128,8 +128,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
 
 #define init_timer(timer)						\
 	__init_timer((timer), 0)
-#define init_timer_deferrable(timer)					\
-	__init_timer((timer), TIMER_DEFERRABLE)
 
 #define __setup_timer(_timer, _fn, _data, _flags)			\
 	do {								\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 05/13] timer: Remove init_timer_deferrable() in favor of timer_setup()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Benjamin Herrenschmidt, Michael Ellerman,
	Sebastian Reichel, Harish Patil, Manish Chopra, Kalle Valo,
	linuxppc-dev, netdev, linux-wireless, Andrew Morton,
	Arnd Bergmann, Chris Metcalf, Geert Uytterhoeven,
	Greg Kroah-Hartman, Guenter Roeck, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian

This refactors the only users of init_timer_deferrable() to use
the new timer_setup() and from_timer(). Removes definition of
init_timer_deferrable().

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Harish Patil <harish.patil@cavium.com>
Cc: Manish Chopra <manish.chopra@cavium.com>
Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: netdev@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/powerpc/mm/numa.c                       | 12 +++++------
 drivers/hsi/clients/ssi_protocol.c           | 32 ++++++++++++++++------------
 drivers/net/ethernet/qlogic/qlge/qlge_main.c | 11 ++++------
 drivers/net/vxlan.c                          |  8 +++----
 drivers/net/wireless/ath/ath6kl/recovery.c   |  9 ++++----
 include/linux/timer.h                        |  2 --
 6 files changed, 34 insertions(+), 40 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b95c584ce19d..f9b6107d6854 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1453,7 +1453,7 @@ static void topology_schedule_update(void)
 	schedule_work(&topology_work);
 }
 
-static void topology_timer_fn(unsigned long ignored)
+static void topology_timer_fn(struct timer_list *unused)
 {
 	if (prrn_enabled && cpumask_weight(&cpu_associativity_changes_mask))
 		topology_schedule_update();
@@ -1463,14 +1463,11 @@ static void topology_timer_fn(unsigned long ignored)
 		reset_topology_timer();
 	}
 }
-static struct timer_list topology_timer =
-	TIMER_INITIALIZER(topology_timer_fn, 0, 0);
+static struct timer_list topology_timer;
 
 static void reset_topology_timer(void)
 {
-	topology_timer.data = 0;
-	topology_timer.expires = jiffies + 60 * HZ;
-	mod_timer(&topology_timer, topology_timer.expires);
+	mod_timer(&topology_timer, jiffies + 60 * HZ);
 }
 
 #ifdef CONFIG_SMP
@@ -1530,7 +1527,8 @@ int start_topology_update(void)
 			prrn_enabled = 0;
 			vphn_enabled = 1;
 			setup_cpu_associativity_change_counters();
-			init_timer_deferrable(&topology_timer);
+			timer_setup(&topology_timer, topology_timer_fn,
+				    TIMER_DEFERRABLE);
 			reset_topology_timer();
 		}
 	}
diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 93d28c0ec8bf..67af03d3aeb3 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -464,10 +464,10 @@ static void ssip_error(struct hsi_client *cl)
 	hsi_async_read(cl, msg);
 }
 
-static void ssip_keep_alive(unsigned long data)
+static void ssip_keep_alive(struct timer_list *t)
 {
-	struct hsi_client *cl = (struct hsi_client *)data;
-	struct ssi_protocol *ssi = hsi_client_drvdata(cl);
+	struct ssi_protocol *ssi = from_timer(ssi, t, keep_alive);
+	struct hsi_client *cl = ssi->cl;
 
 	dev_dbg(&cl->device, "Keep alive kick in: m(%d) r(%d) s(%d)\n",
 		ssi->main_state, ssi->recv_state, ssi->send_state);
@@ -490,9 +490,19 @@ static void ssip_keep_alive(unsigned long data)
 	spin_unlock(&ssi->lock);
 }
 
-static void ssip_wd(unsigned long data)
+static void ssip_rx_wd(struct timer_list *t)
+{
+	struct ssi_protocol *ssi = from_timer(ssi, t, rx_wd);
+	struct hsi_client *cl = ssi->cl;
+
+	dev_err(&cl->device, "Watchdog trigerred\n");
+	ssip_error(cl);
+}
+
+static void ssip_tx_wd(unsigned long data)
 {
-	struct hsi_client *cl = (struct hsi_client *)data;
+	struct ssi_protocol *ssi = from_timer(ssi, t, tx_wd);
+	struct hsi_client *cl = ssi->cl;
 
 	dev_err(&cl->device, "Watchdog trigerred\n");
 	ssip_error(cl);
@@ -1084,15 +1094,9 @@ static int ssi_protocol_probe(struct device *dev)
 	}
 
 	spin_lock_init(&ssi->lock);
-	init_timer_deferrable(&ssi->rx_wd);
-	init_timer_deferrable(&ssi->tx_wd);
-	init_timer(&ssi->keep_alive);
-	ssi->rx_wd.data = (unsigned long)cl;
-	ssi->rx_wd.function = ssip_wd;
-	ssi->tx_wd.data = (unsigned long)cl;
-	ssi->tx_wd.function = ssip_wd;
-	ssi->keep_alive.data = (unsigned long)cl;
-	ssi->keep_alive.function = ssip_keep_alive;
+	timer_setup(&ssi->rx_wd, ssip_rx_wd, TIMER_DEFERRABLE);
+	timer_setup(&ssi->tx_wd, ssip_tx_wd, TIMER_DEFERRABLE);
+	timer_setup(&ssi->keep_alive, ssip_keep_alive, 0);
 	INIT_LIST_HEAD(&ssi->txqueue);
 	INIT_LIST_HEAD(&ssi->cmdqueue);
 	atomic_set(&ssi->tx_usecnt, 0);
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 9feec7009443..29fea74bff2e 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4725,9 +4725,9 @@ static const struct net_device_ops qlge_netdev_ops = {
 	.ndo_vlan_rx_kill_vid	= qlge_vlan_rx_kill_vid,
 };
 
-static void ql_timer(unsigned long data)
+static void ql_timer(struct timer_list *t)
 {
-	struct ql_adapter *qdev = (struct ql_adapter *)data;
+	struct ql_adapter *qdev = from_timer(qdev, t, timer);
 	u32 var = 0;
 
 	var = ql_read32(qdev, STS);
@@ -4806,11 +4806,8 @@ static int qlge_probe(struct pci_dev *pdev,
 	/* Start up the timer to trigger EEH if
 	 * the bus goes dead
 	 */
-	init_timer_deferrable(&qdev->timer);
-	qdev->timer.data = (unsigned long)qdev;
-	qdev->timer.function = ql_timer;
-	qdev->timer.expires = jiffies + (5*HZ);
-	add_timer(&qdev->timer);
+	timer_setup(&qdev->timer, ql_timer, TIMER_DEFERRABLE);
+	mod_timer(&qdev->timer, jiffies + (5*HZ));
 	ql_link_off(qdev);
 	ql_display_dev_info(ndev);
 	atomic_set(&qdev->lb_count, 0);
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d7c49cf1d5e9..3247d2feda07 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2325,9 +2325,9 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 }
 
 /* Walk the forwarding table and purge stale entries */
-static void vxlan_cleanup(unsigned long arg)
+static void vxlan_cleanup(struct timer_list *t)
 {
-	struct vxlan_dev *vxlan = (struct vxlan_dev *) arg;
+	struct vxlan_dev *vxlan = from_timer(vxlan, t, age_timer);
 	unsigned long next_timer = jiffies + FDB_AGE_INTERVAL;
 	unsigned int h;
 
@@ -2647,9 +2647,7 @@ static void vxlan_setup(struct net_device *dev)
 	INIT_LIST_HEAD(&vxlan->next);
 	spin_lock_init(&vxlan->hash_lock);
 
-	init_timer_deferrable(&vxlan->age_timer);
-	vxlan->age_timer.function = vxlan_cleanup;
-	vxlan->age_timer.data = (unsigned long) vxlan;
+	timer_setup(&vxlan->age_timer, vxlan_cleanup, TIMER_DEFERRABLE);
 
 	vxlan->dev = dev;
 
diff --git a/drivers/net/wireless/ath/ath6kl/recovery.c b/drivers/net/wireless/ath/ath6kl/recovery.c
index 3a8d5e97dc8e..c09e40c9010f 100644
--- a/drivers/net/wireless/ath/ath6kl/recovery.c
+++ b/drivers/net/wireless/ath/ath6kl/recovery.c
@@ -60,9 +60,9 @@ void ath6kl_recovery_hb_event(struct ath6kl *ar, u32 cookie)
 		ar->fw_recovery.hb_pending = false;
 }
 
-static void ath6kl_recovery_hb_timer(unsigned long data)
+static void ath6kl_recovery_hb_timer(struct timer_list *t)
 {
-	struct ath6kl *ar = (struct ath6kl *) data;
+	struct ath6kl *ar = from_timer(ar, t, fw_recovery.hb_timer);
 	int err;
 
 	if (test_bit(RECOVERY_CLEANUP, &ar->flag) ||
@@ -104,9 +104,8 @@ void ath6kl_recovery_init(struct ath6kl *ar)
 	recovery->seq_num = 0;
 	recovery->hb_misscnt = 0;
 	ar->fw_recovery.hb_pending = false;
-	ar->fw_recovery.hb_timer.function = ath6kl_recovery_hb_timer;
-	ar->fw_recovery.hb_timer.data = (unsigned long) ar;
-	init_timer_deferrable(&ar->fw_recovery.hb_timer);
+	timer_setup(&ar->fw_recovery.hb_timer, ath6kl_recovery_hb_timer,
+		    TIMER_DEFERRABLE);
 
 	if (ar->fw_recovery.hb_poll)
 		mod_timer(&ar->fw_recovery.hb_timer, jiffies +
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 9da903562ed4..10cc45ca5803 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -128,8 +128,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
 
 #define init_timer(timer)						\
 	__init_timer((timer), 0)
-#define init_timer_deferrable(timer)					\
-	__init_timer((timer), TIMER_DEFERRABLE)
 
 #define __setup_timer(_timer, _fn, _data, _flags)			\
 	do {								\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 05/13] timer: Remove init_timer_deferrable() in favor of timer_setup()
@ 2017-10-04 23:26   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:26 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Benjamin Herrenschmidt, Michael Ellerman,
	Sebastian Reichel, Harish Patil, Manish Chopra, Kalle Valo,
	linuxppc-dev, netdev, linux-wireless, Andrew Morton,
	Arnd Bergmann, Chris Metcalf, Geert Uytterhoeven,
	Greg Kroah-Hartman, Guenter Roeck, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian

This refactors the only users of init_timer_deferrable() to use
the new timer_setup() and from_timer(). Removes definition of
init_timer_deferrable().

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Harish Patil <harish.patil@cavium.com>
Cc: Manish Chopra <manish.chopra@cavium.com>
Cc: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: netdev@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/powerpc/mm/numa.c                       | 12 +++++------
 drivers/hsi/clients/ssi_protocol.c           | 32 ++++++++++++++++------------
 drivers/net/ethernet/qlogic/qlge/qlge_main.c | 11 ++++------
 drivers/net/vxlan.c                          |  8 +++----
 drivers/net/wireless/ath/ath6kl/recovery.c   |  9 ++++----
 include/linux/timer.h                        |  2 --
 6 files changed, 34 insertions(+), 40 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b95c584ce19d..f9b6107d6854 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1453,7 +1453,7 @@ static void topology_schedule_update(void)
 	schedule_work(&topology_work);
 }
 
-static void topology_timer_fn(unsigned long ignored)
+static void topology_timer_fn(struct timer_list *unused)
 {
 	if (prrn_enabled && cpumask_weight(&cpu_associativity_changes_mask))
 		topology_schedule_update();
@@ -1463,14 +1463,11 @@ static void topology_timer_fn(unsigned long ignored)
 		reset_topology_timer();
 	}
 }
-static struct timer_list topology_timer =
-	TIMER_INITIALIZER(topology_timer_fn, 0, 0);
+static struct timer_list topology_timer;
 
 static void reset_topology_timer(void)
 {
-	topology_timer.data = 0;
-	topology_timer.expires = jiffies + 60 * HZ;
-	mod_timer(&topology_timer, topology_timer.expires);
+	mod_timer(&topology_timer, jiffies + 60 * HZ);
 }
 
 #ifdef CONFIG_SMP
@@ -1530,7 +1527,8 @@ int start_topology_update(void)
 			prrn_enabled = 0;
 			vphn_enabled = 1;
 			setup_cpu_associativity_change_counters();
-			init_timer_deferrable(&topology_timer);
+			timer_setup(&topology_timer, topology_timer_fn,
+				    TIMER_DEFERRABLE);
 			reset_topology_timer();
 		}
 	}
diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 93d28c0ec8bf..67af03d3aeb3 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -464,10 +464,10 @@ static void ssip_error(struct hsi_client *cl)
 	hsi_async_read(cl, msg);
 }
 
-static void ssip_keep_alive(unsigned long data)
+static void ssip_keep_alive(struct timer_list *t)
 {
-	struct hsi_client *cl = (struct hsi_client *)data;
-	struct ssi_protocol *ssi = hsi_client_drvdata(cl);
+	struct ssi_protocol *ssi = from_timer(ssi, t, keep_alive);
+	struct hsi_client *cl = ssi->cl;
 
 	dev_dbg(&cl->device, "Keep alive kick in: m(%d) r(%d) s(%d)\n",
 		ssi->main_state, ssi->recv_state, ssi->send_state);
@@ -490,9 +490,19 @@ static void ssip_keep_alive(unsigned long data)
 	spin_unlock(&ssi->lock);
 }
 
-static void ssip_wd(unsigned long data)
+static void ssip_rx_wd(struct timer_list *t)
+{
+	struct ssi_protocol *ssi = from_timer(ssi, t, rx_wd);
+	struct hsi_client *cl = ssi->cl;
+
+	dev_err(&cl->device, "Watchdog trigerred\n");
+	ssip_error(cl);
+}
+
+static void ssip_tx_wd(unsigned long data)
 {
-	struct hsi_client *cl = (struct hsi_client *)data;
+	struct ssi_protocol *ssi = from_timer(ssi, t, tx_wd);
+	struct hsi_client *cl = ssi->cl;
 
 	dev_err(&cl->device, "Watchdog trigerred\n");
 	ssip_error(cl);
@@ -1084,15 +1094,9 @@ static int ssi_protocol_probe(struct device *dev)
 	}
 
 	spin_lock_init(&ssi->lock);
-	init_timer_deferrable(&ssi->rx_wd);
-	init_timer_deferrable(&ssi->tx_wd);
-	init_timer(&ssi->keep_alive);
-	ssi->rx_wd.data = (unsigned long)cl;
-	ssi->rx_wd.function = ssip_wd;
-	ssi->tx_wd.data = (unsigned long)cl;
-	ssi->tx_wd.function = ssip_wd;
-	ssi->keep_alive.data = (unsigned long)cl;
-	ssi->keep_alive.function = ssip_keep_alive;
+	timer_setup(&ssi->rx_wd, ssip_rx_wd, TIMER_DEFERRABLE);
+	timer_setup(&ssi->tx_wd, ssip_tx_wd, TIMER_DEFERRABLE);
+	timer_setup(&ssi->keep_alive, ssip_keep_alive, 0);
 	INIT_LIST_HEAD(&ssi->txqueue);
 	INIT_LIST_HEAD(&ssi->cmdqueue);
 	atomic_set(&ssi->tx_usecnt, 0);
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 9feec7009443..29fea74bff2e 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4725,9 +4725,9 @@ static const struct net_device_ops qlge_netdev_ops = {
 	.ndo_vlan_rx_kill_vid	= qlge_vlan_rx_kill_vid,
 };
 
-static void ql_timer(unsigned long data)
+static void ql_timer(struct timer_list *t)
 {
-	struct ql_adapter *qdev = (struct ql_adapter *)data;
+	struct ql_adapter *qdev = from_timer(qdev, t, timer);
 	u32 var = 0;
 
 	var = ql_read32(qdev, STS);
@@ -4806,11 +4806,8 @@ static int qlge_probe(struct pci_dev *pdev,
 	/* Start up the timer to trigger EEH if
 	 * the bus goes dead
 	 */
-	init_timer_deferrable(&qdev->timer);
-	qdev->timer.data = (unsigned long)qdev;
-	qdev->timer.function = ql_timer;
-	qdev->timer.expires = jiffies + (5*HZ);
-	add_timer(&qdev->timer);
+	timer_setup(&qdev->timer, ql_timer, TIMER_DEFERRABLE);
+	mod_timer(&qdev->timer, jiffies + (5*HZ));
 	ql_link_off(qdev);
 	ql_display_dev_info(ndev);
 	atomic_set(&qdev->lb_count, 0);
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d7c49cf1d5e9..3247d2feda07 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2325,9 +2325,9 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 }
 
 /* Walk the forwarding table and purge stale entries */
-static void vxlan_cleanup(unsigned long arg)
+static void vxlan_cleanup(struct timer_list *t)
 {
-	struct vxlan_dev *vxlan = (struct vxlan_dev *) arg;
+	struct vxlan_dev *vxlan = from_timer(vxlan, t, age_timer);
 	unsigned long next_timer = jiffies + FDB_AGE_INTERVAL;
 	unsigned int h;
 
@@ -2647,9 +2647,7 @@ static void vxlan_setup(struct net_device *dev)
 	INIT_LIST_HEAD(&vxlan->next);
 	spin_lock_init(&vxlan->hash_lock);
 
-	init_timer_deferrable(&vxlan->age_timer);
-	vxlan->age_timer.function = vxlan_cleanup;
-	vxlan->age_timer.data = (unsigned long) vxlan;
+	timer_setup(&vxlan->age_timer, vxlan_cleanup, TIMER_DEFERRABLE);
 
 	vxlan->dev = dev;
 
diff --git a/drivers/net/wireless/ath/ath6kl/recovery.c b/drivers/net/wireless/ath/ath6kl/recovery.c
index 3a8d5e97dc8e..c09e40c9010f 100644
--- a/drivers/net/wireless/ath/ath6kl/recovery.c
+++ b/drivers/net/wireless/ath/ath6kl/recovery.c
@@ -60,9 +60,9 @@ void ath6kl_recovery_hb_event(struct ath6kl *ar, u32 cookie)
 		ar->fw_recovery.hb_pending = false;
 }
 
-static void ath6kl_recovery_hb_timer(unsigned long data)
+static void ath6kl_recovery_hb_timer(struct timer_list *t)
 {
-	struct ath6kl *ar = (struct ath6kl *) data;
+	struct ath6kl *ar = from_timer(ar, t, fw_recovery.hb_timer);
 	int err;
 
 	if (test_bit(RECOVERY_CLEANUP, &ar->flag) ||
@@ -104,9 +104,8 @@ void ath6kl_recovery_init(struct ath6kl *ar)
 	recovery->seq_num = 0;
 	recovery->hb_misscnt = 0;
 	ar->fw_recovery.hb_pending = false;
-	ar->fw_recovery.hb_timer.function = ath6kl_recovery_hb_timer;
-	ar->fw_recovery.hb_timer.data = (unsigned long) ar;
-	init_timer_deferrable(&ar->fw_recovery.hb_timer);
+	timer_setup(&ar->fw_recovery.hb_timer, ath6kl_recovery_hb_timer,
+		    TIMER_DEFERRABLE);
 
 	if (ar->fw_recovery.hb_poll)
 		mod_timer(&ar->fw_recovery.hb_timer, jiffies +
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 9da903562ed4..10cc45ca5803 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -128,8 +128,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
 
 #define init_timer(timer)						\
 	__init_timer((timer), 0)
-#define init_timer_deferrable(timer)					\
-	__init_timer((timer), TIMER_DEFERRABLE)
 
 #define __setup_timer(_timer, _fn, _data, _flags)			\
 	do {								\
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 06/13] timer: Remove users of TIMER_DEFERRED_INITIALIZER
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Martin Schwidefsky, Heiko Carstens, Tejun Heo,
	Lai Jiangshan, linux-s390, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Greg Kroah-Hartman, Guenter Roeck, Harish Patil,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Len Brown, Manish Chopra, Mark Gross, Martin K. Petersen,
	Michael Ellerman, Michael Reed, netdev, Oleg Nesterov,
	Paul Mackerras, Pavel Machek, Petr Mladek, Rafael J. Wysocki,
	Ralf Baechle, Sebastian Reichel, Stefan Richter, Stephen Boyd,
	Sudip Mukherjee, Ursula Braun, Viresh Kumar, Wim Van Sebroeck,
	linux1394-devel, linux-mips, linux-pm, linuxppc-dev, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

This removes uses of TIMER_DEFERRED_INITIALIZER and chooses a location
to call timer_setup() from before add_timer() or mod_timer() is called.
Adjusts callbacks to use from_timer() as needed.

Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: linux-s390@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/s390/kernel/lgr.c      | 6 +++---
 arch/s390/kernel/topology.c | 6 +++---
 kernel/workqueue.c          | 8 +++-----
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c
index ae7dff110054..bf9622f0e6b1 100644
--- a/arch/s390/kernel/lgr.c
+++ b/arch/s390/kernel/lgr.c
@@ -153,14 +153,13 @@ static void lgr_timer_set(void);
 /*
  * LGR timer callback
  */
-static void lgr_timer_fn(unsigned long ignored)
+static void lgr_timer_fn(struct timer_list *unused)
 {
 	lgr_info_log();
 	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));
+	timer_setup(&lgr_timer, lgr_timer_fn, TIMER_DEFERRABLE);
 	lgr_timer_set();
 	return 0;
 }
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index ed0bdd220e1a..d7ece9888c29 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -320,15 +320,14 @@ static void topology_flush_work(void)
 	flush_work(&topology_work);
 }
 
-static void topology_timer_fn(unsigned long ignored)
+static void topology_timer_fn(struct timer_list *unused)
 {
 	if (ptf(PTF_CHECK))
 		topology_schedule_update();
 	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);
 
@@ -597,6 +596,7 @@ static struct ctl_table topology_dir_table[] = {
 
 static int __init topology_init(void)
 {
+	timer_setup(&topology_timer, topology_timer_fn, TIMER_DEFERRABLE);
 	if (MACHINE_HAS_TOPOLOGY)
 		set_topology_timer();
 	else
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 64d0edf428f8..a5361fc6215d 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5390,11 +5390,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;
@@ -5408,7 +5405,7 @@ static void wq_watchdog_reset_touched(void)
 		per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
 }
 
-static void wq_watchdog_timer_fn(unsigned long data)
+static void wq_watchdog_timer_fn(struct timer_list *unused)
 {
 	unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ;
 	bool lockup_detected = false;
@@ -5510,6 +5507,7 @@ module_param_cb(watchdog_thresh, &wq_watchdog_thresh_ops, &wq_watchdog_thresh,
 
 static void wq_watchdog_init(void)
 {
+	timer_setup(&wq_watchdog_timer, wq_watchdog_timer_fn, TIMER_DEFERRABLE);
 	wq_watchdog_set_thresh(wq_watchdog_thresh);
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 06/13] timer: Remove users of TIMER_DEFERRED_INITIALIZER
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Martin Schwidefsky, Heiko Carstens, Tejun Heo,
	Lai Jiangshan, linux-s390-u79uwXL29TY76Z2rM5mHXA, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Greg Kroah-Hartman, Guenter Roeck,
	Harish Patil, James E.J. Bottomley, John Stultz, Julian Wiedmann,
	Kalle Valo, Len Brown

This removes uses of TIMER_DEFERRED_INITIALIZER and chooses a location
to call timer_setup() from before add_timer() or mod_timer() is called.
Adjusts callbacks to use from_timer() as needed.

Cc: Martin Schwidefsky <schwidefsky-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
Cc: Heiko Carstens <heiko.carstens-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Lai Jiangshan <jiangshanlai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 arch/s390/kernel/lgr.c      | 6 +++---
 arch/s390/kernel/topology.c | 6 +++---
 kernel/workqueue.c          | 8 +++-----
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c
index ae7dff110054..bf9622f0e6b1 100644
--- a/arch/s390/kernel/lgr.c
+++ b/arch/s390/kernel/lgr.c
@@ -153,14 +153,13 @@ static void lgr_timer_set(void);
 /*
  * LGR timer callback
  */
-static void lgr_timer_fn(unsigned long ignored)
+static void lgr_timer_fn(struct timer_list *unused)
 {
 	lgr_info_log();
 	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));
+	timer_setup(&lgr_timer, lgr_timer_fn, TIMER_DEFERRABLE);
 	lgr_timer_set();
 	return 0;
 }
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index ed0bdd220e1a..d7ece9888c29 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -320,15 +320,14 @@ static void topology_flush_work(void)
 	flush_work(&topology_work);
 }
 
-static void topology_timer_fn(unsigned long ignored)
+static void topology_timer_fn(struct timer_list *unused)
 {
 	if (ptf(PTF_CHECK))
 		topology_schedule_update();
 	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);
 
@@ -597,6 +596,7 @@ static struct ctl_table topology_dir_table[] = {
 
 static int __init topology_init(void)
 {
+	timer_setup(&topology_timer, topology_timer_fn, TIMER_DEFERRABLE);
 	if (MACHINE_HAS_TOPOLOGY)
 		set_topology_timer();
 	else
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 64d0edf428f8..a5361fc6215d 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5390,11 +5390,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;
@@ -5408,7 +5405,7 @@ static void wq_watchdog_reset_touched(void)
 		per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
 }
 
-static void wq_watchdog_timer_fn(unsigned long data)
+static void wq_watchdog_timer_fn(struct timer_list *unused)
 {
 	unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ;
 	bool lockup_detected = false;
@@ -5510,6 +5507,7 @@ module_param_cb(watchdog_thresh, &wq_watchdog_thresh_ops, &wq_watchdog_thresh,
 
 static void wq_watchdog_init(void)
 {
+	timer_setup(&wq_watchdog_timer, wq_watchdog_timer_fn, TIMER_DEFERRABLE);
 	wq_watchdog_set_thresh(wq_watchdog_thresh);
 }
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 06/13] timer: Remove users of TIMER_DEFERRED_INITIALIZER
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Martin Schwidefsky, Heiko Carstens, Tejun Heo,
	Lai Jiangshan, linux-s390-u79uwXL29TY76Z2rM5mHXA, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Greg Kroah-Hartman, Guenter Roeck,
	Harish Patil, James E.J. Bottomley, John Stultz, Julian Wiedmann,
	Kalle Valo, Len Brown

This removes uses of TIMER_DEFERRED_INITIALIZER and chooses a location
to call timer_setup() from before add_timer() or mod_timer() is called.
Adjusts callbacks to use from_timer() as needed.

Cc: Martin Schwidefsky <schwidefsky-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
Cc: Heiko Carstens <heiko.carstens-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Lai Jiangshan <jiangshanlai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 arch/s390/kernel/lgr.c      | 6 +++---
 arch/s390/kernel/topology.c | 6 +++---
 kernel/workqueue.c          | 8 +++-----
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c
index ae7dff110054..bf9622f0e6b1 100644
--- a/arch/s390/kernel/lgr.c
+++ b/arch/s390/kernel/lgr.c
@@ -153,14 +153,13 @@ static void lgr_timer_set(void);
 /*
  * LGR timer callback
  */
-static void lgr_timer_fn(unsigned long ignored)
+static void lgr_timer_fn(struct timer_list *unused)
 {
 	lgr_info_log();
 	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));
+	timer_setup(&lgr_timer, lgr_timer_fn, TIMER_DEFERRABLE);
 	lgr_timer_set();
 	return 0;
 }
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index ed0bdd220e1a..d7ece9888c29 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -320,15 +320,14 @@ static void topology_flush_work(void)
 	flush_work(&topology_work);
 }
 
-static void topology_timer_fn(unsigned long ignored)
+static void topology_timer_fn(struct timer_list *unused)
 {
 	if (ptf(PTF_CHECK))
 		topology_schedule_update();
 	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);
 
@@ -597,6 +596,7 @@ static struct ctl_table topology_dir_table[] = {
 
 static int __init topology_init(void)
 {
+	timer_setup(&topology_timer, topology_timer_fn, TIMER_DEFERRABLE);
 	if (MACHINE_HAS_TOPOLOGY)
 		set_topology_timer();
 	else
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 64d0edf428f8..a5361fc6215d 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5390,11 +5390,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;
@@ -5408,7 +5405,7 @@ static void wq_watchdog_reset_touched(void)
 		per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
 }
 
-static void wq_watchdog_timer_fn(unsigned long data)
+static void wq_watchdog_timer_fn(struct timer_list *unused)
 {
 	unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ;
 	bool lockup_detected = false;
@@ -5510,6 +5507,7 @@ module_param_cb(watchdog_thresh, &wq_watchdog_thresh_ops, &wq_watchdog_thresh,
 
 static void wq_watchdog_init(void)
 {
+	timer_setup(&wq_watchdog_timer, wq_watchdog_timer_fn, TIMER_DEFERRABLE);
 	wq_watchdog_set_thresh(wq_watchdog_thresh);
 }
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER
  2017-10-04 23:26 ` Kees Cook
  (?)
@ 2017-10-04 23:27   ` Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Arnd Bergmann, Greg Kroah-Hartman, Mark Gross,
	Andrew Morton, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Len Brown, Manish Chopra, Martin K. Petersen,
	Martin Schwidefsky, Michael Ellerman, Michael Reed, netdev,
	Oleg Nesterov, Paul Mackerras, Pavel Machek, Petr Mladek,
	Rafael J. Wysocki, Ralf Baechle, Sebastian Reichel,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linuxppc-dev, linux-s390, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the
internal version.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Gross <mark.gross@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/char/tlclk.c  | 12 +++++-------
 include/linux/timer.h |  2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 6210bff46341..8eeb4190207d 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -184,9 +184,8 @@ static unsigned int telclk_interrupt;
 static int int_events;		/* Event that generate a interrupt */
 static int got_event;		/* if events processing have been done */
 
-static void switchover_timeout(unsigned long data);
-static struct timer_list switchover_timer =
-	TIMER_INITIALIZER(switchover_timeout , 0, 0);
+static void switchover_timeout(struct timer_list *t);
+static struct timer_list switchover_timer;
 static unsigned long tlclk_timer_data;
 
 static struct tlclk_alarms *alarm_events;
@@ -805,7 +804,7 @@ static int __init tlclk_init(void)
 		goto out3;
 	}
 
-	init_timer(&switchover_timer);
+	timer_setup(&switchover_timer, switchover_timeout, 0);
 
 	ret = misc_register(&tlclk_miscdev);
 	if (ret < 0) {
@@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void)
 
 }
 
-static void switchover_timeout(unsigned long data)
+static void switchover_timeout(struct timer_list *unused)
 {
-	unsigned long flags = *(unsigned long *) data;
+	unsigned long flags = tlclk_timer_data;
 
 	if ((flags & 1)) {
 		if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08))
@@ -922,7 +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
 		/* TIMEOUT in ~10ms */
 		switchover_timer.expires = jiffies + msecs_to_jiffies(10);
 		tlclk_timer_data = inb(TLCLK_REG1);
-		switchover_timer.data = (unsigned long) &tlclk_timer_data;
 		mod_timer(&switchover_timer, switchover_timer.expires);
 	} else {
 		got_event = 1;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 10cc45ca5803..4f7476e4a727 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -87,7 +87,7 @@ struct timer_list {
 
 #define DEFINE_TIMER(_name, _function, _expires, _data)		\
 	struct timer_list _name =				\
-		TIMER_INITIALIZER(_function, _expires, _data)
+		__TIMER_INITIALIZER(_function, _expires, _data, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Arnd Bergmann, Greg Kroah-Hartman, Mark Gross,
	Andrew Morton, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Len Brown, Manish Chopra, Martin K. Petersen

Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the
internal version.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Gross <mark.gross@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/char/tlclk.c  | 12 +++++-------
 include/linux/timer.h |  2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 6210bff46341..8eeb4190207d 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -184,9 +184,8 @@ static unsigned int telclk_interrupt;
 static int int_events;		/* Event that generate a interrupt */
 static int got_event;		/* if events processing have been done */
 
-static void switchover_timeout(unsigned long data);
-static struct timer_list switchover_timer =
-	TIMER_INITIALIZER(switchover_timeout , 0, 0);
+static void switchover_timeout(struct timer_list *t);
+static struct timer_list switchover_timer;
 static unsigned long tlclk_timer_data;
 
 static struct tlclk_alarms *alarm_events;
@@ -805,7 +804,7 @@ static int __init tlclk_init(void)
 		goto out3;
 	}
 
-	init_timer(&switchover_timer);
+	timer_setup(&switchover_timer, switchover_timeout, 0);
 
 	ret = misc_register(&tlclk_miscdev);
 	if (ret < 0) {
@@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void)
 
 }
 
-static void switchover_timeout(unsigned long data)
+static void switchover_timeout(struct timer_list *unused)
 {
-	unsigned long flags = *(unsigned long *) data;
+	unsigned long flags = tlclk_timer_data;
 
 	if ((flags & 1)) {
 		if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08))
@@ -922,7 +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
 		/* TIMEOUT in ~10ms */
 		switchover_timer.expires = jiffies + msecs_to_jiffies(10);
 		tlclk_timer_data = inb(TLCLK_REG1);
-		switchover_timer.data = (unsigned long) &tlclk_timer_data;
 		mod_timer(&switchover_timer, switchover_timer.expires);
 	} else {
 		got_event = 1;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 10cc45ca5803..4f7476e4a727 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -87,7 +87,7 @@ struct timer_list {
 
 #define DEFINE_TIMER(_name, _function, _expires, _data)		\
 	struct timer_list _name =				\
-		TIMER_INITIALIZER(_function, _expires, _data)
+		__TIMER_INITIALIZER(_function, _expires, _data, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Arnd Bergmann, Greg Kroah-Hartman, Mark Gross,
	Andrew Morton, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Len Brown, Manish Chopra, Martin K. Petersen

Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the
internal version.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Mark Gross <mark.gross@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 drivers/char/tlclk.c  | 12 +++++-------
 include/linux/timer.h |  2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 6210bff46341..8eeb4190207d 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -184,9 +184,8 @@ static unsigned int telclk_interrupt;
 static int int_events;		/* Event that generate a interrupt */
 static int got_event;		/* if events processing have been done */
 
-static void switchover_timeout(unsigned long data);
-static struct timer_list switchover_timer =
-	TIMER_INITIALIZER(switchover_timeout , 0, 0);
+static void switchover_timeout(struct timer_list *t);
+static struct timer_list switchover_timer;
 static unsigned long tlclk_timer_data;
 
 static struct tlclk_alarms *alarm_events;
@@ -805,7 +804,7 @@ static int __init tlclk_init(void)
 		goto out3;
 	}
 
-	init_timer(&switchover_timer);
+	timer_setup(&switchover_timer, switchover_timeout, 0);
 
 	ret = misc_register(&tlclk_miscdev);
 	if (ret < 0) {
@@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void)
 
 }
 
-static void switchover_timeout(unsigned long data)
+static void switchover_timeout(struct timer_list *unused)
 {
-	unsigned long flags = *(unsigned long *) data;
+	unsigned long flags = tlclk_timer_data;
 
 	if ((flags & 1)) {
 		if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08))
@@ -922,7 +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
 		/* TIMEOUT in ~10ms */
 		switchover_timer.expires = jiffies + msecs_to_jiffies(10);
 		tlclk_timer_data = inb(TLCLK_REG1);
-		switchover_timer.data = (unsigned long) &tlclk_timer_data;
 		mod_timer(&switchover_timer, switchover_timer.expires);
 	} else {
 		got_event = 1;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 10cc45ca5803..4f7476e4a727 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -87,7 +87,7 @@ struct timer_list {
 
 #define DEFINE_TIMER(_name, _function, _expires, _data)		\
 	struct timer_list _name =				\
-		TIMER_INITIALIZER(_function, _expires, _data)
+		__TIMER_INITIALIZER(_function, _expires, _data, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 08/13] timer: Remove unused static initializer macros
  2017-10-04 23:26 ` Kees Cook
  (?)
@ 2017-10-04 23:27   ` Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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 Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Petr Mladek, Rafael J. Wysocki, Ralf Baechle,
	Sebastian Reichel, Stefan Richter, Stephen Boyd, Sudip Mukherjee,
	Tejun Heo, Ursula Braun, Viresh Kumar, Wim Van Sebroeck,
	linux1394-devel, linux-mips, linux-pm, linuxppc-dev, linux-s390,
	linux-scsi, linux-watchdog, linux-wireless, linux-kernel

This removes the now unused TIMER_*INITIALIZER macros:

TIMER_INITIALIZER
TIMER_PINNED_INITIALIZER
TIMER_DEFERRED_INITIALIZER
TIMER_PINNED_DEFERRED_INITIALIZER

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 include/linux/timer.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/include/linux/timer.h b/include/linux/timer.h
index 4f7476e4a727..a33220311361 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -73,18 +73,6 @@ struct timer_list {
 			__FILE__ ":" __stringify(__LINE__))	\
 	}
 
-#define TIMER_INITIALIZER(_function, _expires, _data)		\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), 0)
-
-#define TIMER_PINNED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_PINNED)
-
-#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE)
-
-#define TIMER_PINNED_DEFERRED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE | TIMER_PINNED)
-
 #define DEFINE_TIMER(_name, _function, _expires, _data)		\
 	struct timer_list _name =				\
 		__TIMER_INITIALIZER(_function, _expires, _data, 0)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 08/13] timer: Remove unused static initializer macros
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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

This removes the now unused TIMER_*INITIALIZER macros:

TIMER_INITIALIZER
TIMER_PINNED_INITIALIZER
TIMER_DEFERRED_INITIALIZER
TIMER_PINNED_DEFERRED_INITIALIZER

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 include/linux/timer.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/include/linux/timer.h b/include/linux/timer.h
index 4f7476e4a727..a33220311361 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -73,18 +73,6 @@ struct timer_list {
 			__FILE__ ":" __stringify(__LINE__))	\
 	}
 
-#define TIMER_INITIALIZER(_function, _expires, _data)		\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), 0)
-
-#define TIMER_PINNED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_PINNED)
-
-#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE)
-
-#define TIMER_PINNED_DEFERRED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE | TIMER_PINNED)
-
 #define DEFINE_TIMER(_name, _function, _expires, _data)		\
 	struct timer_list _name =				\
 		__TIMER_INITIALIZER(_function, _expires, _data, 0)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 08/13] timer: Remove unused static initializer macros
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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

This removes the now unused TIMER_*INITIALIZER macros:

TIMER_INITIALIZER
TIMER_PINNED_INITIALIZER
TIMER_DEFERRED_INITIALIZER
TIMER_PINNED_DEFERRED_INITIALIZER

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 include/linux/timer.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/include/linux/timer.h b/include/linux/timer.h
index 4f7476e4a727..a33220311361 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -73,18 +73,6 @@ struct timer_list {
 			__FILE__ ":" __stringify(__LINE__))	\
 	}
 
-#define TIMER_INITIALIZER(_function, _expires, _data)		\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), 0)
-
-#define TIMER_PINNED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_PINNED)
-
-#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE)
-
-#define TIMER_PINNED_DEFERRED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE | TIMER_PINNED)
-
 #define DEFINE_TIMER(_name, _function, _expires, _data)		\
 	struct timer_list _name =				\
 		__TIMER_INITIALIZER(_function, _expires, _data, 0)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER
  2017-10-04 23:26 ` Kees Cook
  (?)
@ 2017-10-04 23:27   ` Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Ralf Baechle, Wim Van Sebroeck, Guenter Roeck,
	Geert Uytterhoeven, linux-mips, linux-watchdog, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Greg Kroah-Hartman, 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 Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Petr Mladek, Rafael J. Wysocki, Sebastian Reichel,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, linux1394-devel, linux-pm,
	linuxppc-dev, linux-s390, linux-scsi, linux-wireless,
	linux-kernel

The expire and data arguments of DEFINE_TIMER are only used in two places
and are ignored by the code (malta-display.c only uses mod_timer(),
never add_timer(), so the preset expires value is ignored). Set both
sets of arguments to zero.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-mips@linux-mips.org
Cc: linux-watchdog@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/mips/mti-malta/malta-display.c | 6 +++---
 drivers/watchdog/alim7101_wdt.c     | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
index d4f807191ecd..ac813158b9b8 100644
--- a/arch/mips/mti-malta/malta-display.c
+++ b/arch/mips/mti-malta/malta-display.c
@@ -36,10 +36,10 @@ void mips_display_message(const char *str)
 	}
 }
 
-static void scroll_display_message(unsigned long data);
-static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
+static void scroll_display_message(unsigned long unused);
+static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
 
-static void scroll_display_message(unsigned long data)
+static void scroll_display_message(unsigned long unused)
 {
 	mips_display_message(&display_string[display_count++]);
 	if (display_count == max_display_count)
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 665e0e7dfe1e..3c1f6ac68ea9 100644
--- a/drivers/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
@@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
 		"Use the gpio watchdog (required by old cobalt boards).");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1);
+static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
@@ -87,7 +87,7 @@ MODULE_PARM_DESC(nowayout,
  *	Whack the dog
  */
 
-static void wdt_timer_ping(unsigned long data)
+static void wdt_timer_ping(unsigned long unused)
 {
 	/* If we got a heartbeat pulse within the WDT_US_INTERVAL
 	 * we agree to ping the WDT
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Ralf Baechle, Wim Van Sebroeck, Guenter Roeck,
	Geert Uytterhoeven, linux-mips, linux-watchdog, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Greg Kroah-Hartman, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Len

The expire and data arguments of DEFINE_TIMER are only used in two places
and are ignored by the code (malta-display.c only uses mod_timer(),
never add_timer(), so the preset expires value is ignored). Set both
sets of arguments to zero.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-mips@linux-mips.org
Cc: linux-watchdog@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/mips/mti-malta/malta-display.c | 6 +++---
 drivers/watchdog/alim7101_wdt.c     | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
index d4f807191ecd..ac813158b9b8 100644
--- a/arch/mips/mti-malta/malta-display.c
+++ b/arch/mips/mti-malta/malta-display.c
@@ -36,10 +36,10 @@ void mips_display_message(const char *str)
 	}
 }
 
-static void scroll_display_message(unsigned long data);
-static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
+static void scroll_display_message(unsigned long unused);
+static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
 
-static void scroll_display_message(unsigned long data)
+static void scroll_display_message(unsigned long unused)
 {
 	mips_display_message(&display_string[display_count++]);
 	if (display_count == max_display_count)
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 665e0e7dfe1e..3c1f6ac68ea9 100644
--- a/drivers/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
@@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
 		"Use the gpio watchdog (required by old cobalt boards).");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1);
+static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
@@ -87,7 +87,7 @@ MODULE_PARM_DESC(nowayout,
  *	Whack the dog
  */
 
-static void wdt_timer_ping(unsigned long data)
+static void wdt_timer_ping(unsigned long unused)
 {
 	/* If we got a heartbeat pulse within the WDT_US_INTERVAL
 	 * we agree to ping the WDT
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Ralf Baechle, Wim Van Sebroeck, Guenter Roeck,
	Geert Uytterhoeven, linux-mips, linux-watchdog, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Greg Kroah-Hartman, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Len

The expire and data arguments of DEFINE_TIMER are only used in two places
and are ignored by the code (malta-display.c only uses mod_timer(),
never add_timer(), so the preset expires value is ignored). Set both
sets of arguments to zero.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-mips@linux-mips.org
Cc: linux-watchdog@vger.kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/mips/mti-malta/malta-display.c | 6 +++---
 drivers/watchdog/alim7101_wdt.c     | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
index d4f807191ecd..ac813158b9b8 100644
--- a/arch/mips/mti-malta/malta-display.c
+++ b/arch/mips/mti-malta/malta-display.c
@@ -36,10 +36,10 @@ void mips_display_message(const char *str)
 	}
 }
 
-static void scroll_display_message(unsigned long data);
-static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
+static void scroll_display_message(unsigned long unused);
+static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
 
-static void scroll_display_message(unsigned long data)
+static void scroll_display_message(unsigned long unused)
 {
 	mips_display_message(&display_string[display_count++]);
 	if (display_count == max_display_count)
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 665e0e7dfe1e..3c1f6ac68ea9 100644
--- a/drivers/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
@@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
 		"Use the gpio watchdog (required by old cobalt boards).");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1);
+static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
@@ -87,7 +87,7 @@ MODULE_PARM_DESC(nowayout,
  *	Whack the dog
  */
 
-static void wdt_timer_ping(unsigned long data)
+static void wdt_timer_ping(unsigned long unused)
 {
 	/* If we got a heartbeat pulse within the WDT_US_INTERVAL
 	 * we agree to ping the WDT
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
  2017-10-04 23:26 ` Kees Cook
  (?)
@ 2017-10-04 23:27   ` Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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 Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Petr Mladek, Rafael J. Wysocki, Ralf Baechle,
	Sebastian Reichel, Stefan Richter, Stephen Boyd, Sudip Mukherjee,
	Tejun Heo, Ursula Braun, Viresh Kumar, Wim Van Sebroeck,
	linux1394-devel, linux-mips, linux-pm, linuxppc-dev, linux-s390,
	linux-scsi, linux-watchdog, linux-wireless, linux-kernel

Drop the arguments from the macro and adjust all callers with the
following script:

  perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
    $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts
---
 arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
 arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
 arch/m68k/amiga/amisound.c                | 2 +-
 arch/m68k/mac/macboing.c                  | 2 +-
 arch/mips/mti-malta/malta-display.c       | 2 +-
 arch/parisc/kernel/pdc_cons.c             | 2 +-
 arch/s390/mm/cmm.c                        | 2 +-
 drivers/atm/idt77105.c                    | 4 ++--
 drivers/atm/iphase.c                      | 2 +-
 drivers/block/ataflop.c                   | 8 ++++----
 drivers/char/dtlk.c                       | 2 +-
 drivers/char/hangcheck-timer.c            | 2 +-
 drivers/char/nwbutton.c                   | 2 +-
 drivers/char/rtc.c                        | 2 +-
 drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
 drivers/net/cris/eth_v10.c                | 6 +++---
 drivers/net/hamradio/yam.c                | 2 +-
 drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
 drivers/staging/speakup/main.c            | 2 +-
 drivers/staging/speakup/synth.c           | 2 +-
 drivers/tty/cyclades.c                    | 2 +-
 drivers/tty/isicom.c                      | 2 +-
 drivers/tty/moxa.c                        | 2 +-
 drivers/tty/rocket.c                      | 2 +-
 drivers/tty/vt/keyboard.c                 | 2 +-
 drivers/tty/vt/vt.c                       | 2 +-
 drivers/watchdog/alim7101_wdt.c           | 2 +-
 drivers/watchdog/machzwd.c                | 2 +-
 drivers/watchdog/mixcomwd.c               | 2 +-
 drivers/watchdog/sbc60xxwdt.c             | 2 +-
 drivers/watchdog/sc520_wdt.c              | 2 +-
 drivers/watchdog/via_wdt.c                | 2 +-
 drivers/watchdog/w83877f_wdt.c            | 2 +-
 drivers/xen/grant-table.c                 | 2 +-
 fs/pstore/platform.c                      | 2 +-
 include/linux/timer.h                     | 4 ++--
 kernel/irq/spurious.c                     | 2 +-
 lib/random32.c                            | 2 +-
 net/atm/mpc.c                             | 2 +-
 net/decnet/dn_route.c                     | 2 +-
 net/ipv6/ip6_flowlabel.c                  | 2 +-
 net/netrom/nr_loopback.c                  | 2 +-
 security/keys/gc.c                        | 2 +-
 sound/oss/midibuf.c                       | 2 +-
 sound/oss/soundcard.c                     | 2 +-
 sound/oss/sys_timer.c                     | 2 +-
 sound/oss/uart6850.c                      | 2 +-
 47 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index b3bd0e137f6d..b3689a141ec6 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -174,7 +174,7 @@ static int power_button_countdown;
 #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
 
 static void dsmg600_power_handler(unsigned long data);
-static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0);
+static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler);
 
 static void dsmg600_power_handler(unsigned long data)
 {
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 4e0f762bc651..562d05f9888e 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -197,7 +197,7 @@ static int power_button_countdown;
 #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
 
 static void nas100d_power_handler(unsigned long data);
-static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0);
+static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler);
 
 static void nas100d_power_handler(unsigned long data)
 {
diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
index 90a60d758f8b..a23f48181fd6 100644
--- a/arch/m68k/amiga/amisound.c
+++ b/arch/m68k/amiga/amisound.c
@@ -66,7 +66,7 @@ void __init amiga_init_sound(void)
 }
 
 static void nosound( unsigned long ignored );
-static DEFINE_TIMER(sound_timer, nosound, 0, 0);
+static DEFINE_TIMER(sound_timer, nosound);
 
 void amiga_mksound( unsigned int hz, unsigned int ticks )
 {
diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c
index ffaa1f6439ae..9a52aff183d0 100644
--- a/arch/m68k/mac/macboing.c
+++ b/arch/m68k/mac/macboing.c
@@ -56,7 +56,7 @@ static void ( *mac_special_bell )( unsigned int, unsigned int, unsigned int );
 /*
  * our timer to start/continue/stop the bell
  */
-static DEFINE_TIMER(mac_sound_timer, mac_nosound, 0, 0);
+static DEFINE_TIMER(mac_sound_timer, mac_nosound);
 
 /*
  * Sort of initialize the sound chip (called from mac_mksound on the first
diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
index ac813158b9b8..063de44675ce 100644
--- a/arch/mips/mti-malta/malta-display.c
+++ b/arch/mips/mti-malta/malta-display.c
@@ -37,7 +37,7 @@ void mips_display_message(const char *str)
 }
 
 static void scroll_display_message(unsigned long unused);
-static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
+static DEFINE_TIMER(mips_scroll_timer, scroll_display_message);
 
 static void scroll_display_message(unsigned long unused)
 {
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
index 10a5ae9553fd..27a2dd616a7d 100644
--- a/arch/parisc/kernel/pdc_cons.c
+++ b/arch/parisc/kernel/pdc_cons.c
@@ -92,7 +92,7 @@ static int pdc_console_setup(struct console *co, char *options)
 #define PDC_CONS_POLL_DELAY (30 * HZ / 1000)
 
 static void pdc_console_poll(unsigned long unused);
-static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0);
+static DEFINE_TIMER(pdc_console_timer, pdc_console_poll);
 static struct tty_port tty_port;
 
 static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 829c63dbc81a..2dbdcd85b68f 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(cmm_lock);
 
 static struct task_struct *cmm_thread_ptr;
 static DECLARE_WAIT_QUEUE_HEAD(cmm_thread_wait);
-static DEFINE_TIMER(cmm_timer, NULL, 0, 0);
+static DEFINE_TIMER(cmm_timer, NULL);
 
 static void cmm_timer_fn(unsigned long);
 static void cmm_set_timer(void);
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 082aa02abc57..57af9fd198e4 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -49,8 +49,8 @@ static void idt77105_stats_timer_func(unsigned long);
 static void idt77105_restart_timer_func(unsigned long);
 
 
-static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func, 0, 0);
-static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func, 0, 0);
+static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func);
+static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func);
 static int start_timer = 1;
 static struct idt77105_priv *idt77105_all = NULL;
 
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index fc72b763fdd7..ad6b582c268e 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -76,7 +76,7 @@ static IADEV *ia_dev[8];
 static struct atm_dev *_ia_dev[8];
 static int iadev_count;
 static void ia_led_timer(unsigned long arg);
-static DEFINE_TIMER(ia_timer, ia_led_timer, 0, 0);
+static DEFINE_TIMER(ia_timer, ia_led_timer);
 static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ;
 static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ;
 static uint IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 92da886180aa..ae596e55bcb6 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -373,10 +373,10 @@ static void floppy_release(struct gendisk *disk, fmode_t mode);
 
 /************************* End of Prototypes **************************/
 
-static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer, 0, 0);
-static DEFINE_TIMER(readtrack_timer, fd_readtrack_check, 0, 0);
-static DEFINE_TIMER(timeout_timer, fd_times_out, 0, 0);
-static DEFINE_TIMER(fd_timer, check_change, 0, 0);
+static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer);
+static DEFINE_TIMER(readtrack_timer, fd_readtrack_check);
+static DEFINE_TIMER(timeout_timer, fd_times_out);
+static DEFINE_TIMER(fd_timer, check_change);
 	
 static void fd_end_request_cur(blk_status_t err)
 {
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
index 58471394beb9..1a0385ed6417 100644
--- a/drivers/char/dtlk.c
+++ b/drivers/char/dtlk.c
@@ -84,7 +84,7 @@ static int dtlk_has_indexing;
 static unsigned int dtlk_portlist[] =
 {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
 static wait_queue_head_t dtlk_process_list;
-static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0);
+static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick);
 
 /* prototypes for file_operations struct */
 static ssize_t dtlk_read(struct file *, char __user *,
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c
index 5406b90bf626..5b8db2ed844d 100644
--- a/drivers/char/hangcheck-timer.c
+++ b/drivers/char/hangcheck-timer.c
@@ -124,7 +124,7 @@ static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;
 
 static void hangcheck_fire(unsigned long);
 
-static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire, 0, 0);
+static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire);
 
 static void hangcheck_fire(unsigned long data)
 {
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
index e6d0d271c58c..44006ed9558f 100644
--- a/drivers/char/nwbutton.c
+++ b/drivers/char/nwbutton.c
@@ -27,7 +27,7 @@ static void button_sequence_finished (unsigned long parameters);
 
 static int button_press_count;		/* The count of button presses */
 /* Times for the end of a sequence */
-static DEFINE_TIMER(button_timer, button_sequence_finished, 0, 0);
+static DEFINE_TIMER(button_timer, button_sequence_finished);
 static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
 static char button_output_buffer[32];	/* Stores data to write out of device */
 static int bcount;			/* The number of bytes in the buffer */
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 974d48927b07..616871e68e09 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -137,7 +137,7 @@ static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
 #ifdef RTC_IRQ
 static void rtc_dropped_irq(unsigned long data);
 
-static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
+static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq);
 #endif
 
 static ssize_t rtc_read(struct file *file, char __user *buf,
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 3b3db8c868e0..d3265b6b58b8 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -145,7 +145,7 @@ static void touch_timer_fire(unsigned long data)
 	}
 }
 
-static DEFINE_TIMER(touch_timer, touch_timer_fire, 0, 0);
+static DEFINE_TIMER(touch_timer, touch_timer_fire);
 
 /**
  * stylus_irq - touchscreen stylus event interrupt
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index 017f48cdcab9..1fcc86fa4e05 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -165,8 +165,8 @@ static unsigned int network_rec_config_shadow = 0;
 static unsigned int network_tr_ctrl_shadow = 0;
 
 /* Network speed indication. */
-static DEFINE_TIMER(speed_timer, NULL, 0, 0);
-static DEFINE_TIMER(clear_led_timer, NULL, 0, 0);
+static DEFINE_TIMER(speed_timer, NULL);
+static DEFINE_TIMER(clear_led_timer, NULL);
 static int current_speed; /* Speed read from transceiver */
 static int current_speed_selection; /* Speed selected by user */
 static unsigned long led_next_time;
@@ -174,7 +174,7 @@ static int led_active;
 static int rx_queue_len;
 
 /* Duplex */
-static DEFINE_TIMER(duplex_timer, NULL, 0, 0);
+static DEFINE_TIMER(duplex_timer, NULL);
 static int full_duplex;
 static enum duplex current_duplex;
 
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 7a7c5224a336..104f71fa9c5e 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -157,7 +157,7 @@ static struct net_device *yam_devs[NR_PORTS];
 
 static struct yam_mcs *yam_data;
 
-static DEFINE_TIMER(yam_timer, NULL, 0, 0);
+static DEFINE_TIMER(yam_timer, NULL);
 
 /* --------------------------------------------------------------------- */
 
diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
index 94bf01f8b2a8..ede89d4ffc88 100644
--- a/drivers/net/wireless/atmel/at76c50x-usb.c
+++ b/drivers/net/wireless/atmel/at76c50x-usb.c
@@ -519,7 +519,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 /* LED trigger */
 static int tx_activity;
 static void at76_ledtrig_tx_timerfunc(unsigned long data);
-static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc, 0, 0);
+static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc);
 DEFINE_LED_TRIGGER(ledtrig_tx);
 
 static void at76_ledtrig_tx_timerfunc(unsigned long data)
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 67956e24779c..b61e9becb612 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1165,7 +1165,7 @@ static const int NUM_CTL_LABELS = (MSG_CTL_END - MSG_CTL_START + 1);
 
 static void read_all_doc(struct vc_data *vc);
 static void cursor_done(u_long data);
-static DEFINE_TIMER(cursor_timer, cursor_done, 0, 0);
+static DEFINE_TIMER(cursor_timer, cursor_done);
 
 static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
 {
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index a1ca68c76579..6ddd3fc3f08d 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -158,7 +158,7 @@ static void thread_wake_up(u_long data)
 	wake_up_interruptible_all(&speakup_event);
 }
 
-static DEFINE_TIMER(thread_timer, thread_wake_up, 0, 0);
+static DEFINE_TIMER(thread_timer, thread_wake_up);
 
 void synth_start(void)
 {
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index d272bc4e7fb5..dac8a1a8e4ac 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -283,7 +283,7 @@ static void cyz_poll(unsigned long);
 /* The Cyclades-Z polling cycle is defined by this variable */
 static long cyz_polling_cycle = CZ_DEF_POLL;
 
-static DEFINE_TIMER(cyz_timerlist, cyz_poll, 0, 0);
+static DEFINE_TIMER(cyz_timerlist, cyz_poll);
 
 #else				/* CONFIG_CYZ_INTR */
 static void cyz_rx_restart(unsigned long);
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
index 61ecdd6b2fc2..40af32108ff5 100644
--- a/drivers/tty/isicom.c
+++ b/drivers/tty/isicom.c
@@ -177,7 +177,7 @@ static struct tty_driver *isicom_normal;
 static void isicom_tx(unsigned long _data);
 static void isicom_start(struct tty_struct *tty);
 
-static DEFINE_TIMER(tx, isicom_tx, 0, 0);
+static DEFINE_TIMER(tx, isicom_tx);
 
 /*   baud index mappings from linux defns to isi */
 
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 7f3d4cb0341b..93d37655d928 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -428,7 +428,7 @@ static const struct tty_port_operations moxa_port_ops = {
 };
 
 static struct tty_driver *moxaDriver;
-static DEFINE_TIMER(moxaTimer, moxa_poll, 0, 0);
+static DEFINE_TIMER(moxaTimer, moxa_poll);
 
 /*
  * HW init
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 20d79a6007d5..aa695fda1084 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -111,7 +111,7 @@ static struct r_port *rp_table[MAX_RP_PORTS];	       /*  The main repository of
 static unsigned int xmit_flags[NUM_BOARDS];	       /*  Bit significant, indicates port had data to transmit. */
 						       /*  eg.  Bit 0 indicates port 0 has xmit data, ...        */
 static atomic_t rp_num_ports_open;	               /*  Number of serial ports open                           */
-static DEFINE_TIMER(rocket_timer, rp_do_poll, 0, 0);
+static DEFINE_TIMER(rocket_timer, rp_do_poll);
 
 static unsigned long board1;	                       /* ISA addresses, retrieved from rocketport.conf          */
 static unsigned long board2;
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index f4166263bb3a..f974d6340d04 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -250,7 +250,7 @@ static void kd_nosound(unsigned long ignored)
 	input_handler_for_each_handle(&kbd_handler, &zero, kd_sound_helper);
 }
 
-static DEFINE_TIMER(kd_mksound_timer, kd_nosound, 0, 0);
+static DEFINE_TIMER(kd_mksound_timer, kd_nosound);
 
 void kd_mksound(unsigned int hz, unsigned int ticks)
 {
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 2ebaba16f785..602d71630952 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -228,7 +228,7 @@ static int scrollback_delta;
  */
 int (*console_blank_hook)(int);
 
-static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
+static DEFINE_TIMER(console_timer, blank_screen_t);
 static int blank_state;
 static int blank_timer_expired;
 enum {
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 3c1f6ac68ea9..18e896eeca62 100644
--- a/drivers/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
@@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
 		"Use the gpio watchdog (required by old cobalt boards).");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c
index 9826b59ef734..8a616a57bb90 100644
--- a/drivers/watchdog/machzwd.c
+++ b/drivers/watchdog/machzwd.c
@@ -127,7 +127,7 @@ static int zf_action = GEN_RESET;
 static unsigned long zf_is_open;
 static char zf_expect_close;
 static DEFINE_SPINLOCK(zf_port_lock);
-static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
+static DEFINE_TIMER(zf_timer, zf_ping);
 static unsigned long next_heartbeat;
 
 
diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c
index be86ea359eee..c9e38096ea91 100644
--- a/drivers/watchdog/mixcomwd.c
+++ b/drivers/watchdog/mixcomwd.c
@@ -105,7 +105,7 @@ static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */
 
 static int watchdog_port;
 static int mixcomwd_timer_alive;
-static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0);
+static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun);
 static char expect_close;
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
index 2eef58a0cf05..8d589939bc84 100644
--- a/drivers/watchdog/sbc60xxwdt.c
+++ b/drivers/watchdog/sbc60xxwdt.c
@@ -113,7 +113,7 @@ MODULE_PARM_DESC(nowayout,
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
index 1cfd3f6a13d5..3e9bbaa37bf4 100644
--- a/drivers/watchdog/sc520_wdt.c
+++ b/drivers/watchdog/sc520_wdt.c
@@ -124,7 +124,7 @@ MODULE_PARM_DESC(nowayout,
 static __u16 __iomem *wdtmrctl;
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/via_wdt.c b/drivers/watchdog/via_wdt.c
index 5f9cbc37520d..ad3c3be13b40 100644
--- a/drivers/watchdog/via_wdt.c
+++ b/drivers/watchdog/via_wdt.c
@@ -68,7 +68,7 @@ static struct resource wdt_res;
 static void __iomem *wdt_mem;
 static unsigned int mmio;
 static void wdt_timer_tick(unsigned long data);
-static DEFINE_TIMER(timer, wdt_timer_tick, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_tick);
 					/* The timer that pings the watchdog */
 static unsigned long next_heartbeat;	/* the next_heartbeat for the timer */
 
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
index f0483c75ed32..ba6b680af100 100644
--- a/drivers/watchdog/w83877f_wdt.c
+++ b/drivers/watchdog/w83877f_wdt.c
@@ -98,7 +98,7 @@ MODULE_PARM_DESC(nowayout,
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 2c6a9114d332..a8721d718186 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -305,7 +305,7 @@ struct deferred_entry {
 };
 static LIST_HEAD(deferred_list);
 static void gnttab_handle_deferred(unsigned long);
-static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred, 0, 0);
+static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred);
 
 static void gnttab_handle_deferred(unsigned long unused)
 {
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 2b21d180157c..ec7199e859d2 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -62,7 +62,7 @@ MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content "
 static int pstore_new_entry;
 
 static void pstore_timefunc(unsigned long);
-static DEFINE_TIMER(pstore_timer, pstore_timefunc, 0, 0);
+static DEFINE_TIMER(pstore_timer, pstore_timefunc);
 
 static void pstore_dowork(struct work_struct *);
 static DECLARE_WORK(pstore_work, pstore_dowork);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index a33220311361..91e5a2cc81b5 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -73,9 +73,9 @@ struct timer_list {
 			__FILE__ ":" __stringify(__LINE__))	\
 	}
 
-#define DEFINE_TIMER(_name, _function, _expires, _data)		\
+#define DEFINE_TIMER(_name, _function)				\
 	struct timer_list _name =				\
-		__TIMER_INITIALIZER(_function, _expires, _data, 0)
+		__TIMER_INITIALIZER(_function, 0, 0, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 061ba7eed4ed..c805e8691c22 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -20,7 +20,7 @@ static int irqfixup __read_mostly;
 
 #define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
 static void poll_spurious_irqs(unsigned long dummy);
-static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0);
+static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs);
 static int irq_poll_cpu;
 static atomic_t irq_poll_active;
 
diff --git a/lib/random32.c b/lib/random32.c
index fa594b1140e6..6e91b75c113f 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -214,7 +214,7 @@ core_initcall(prandom_init);
 
 static void __prandom_timer(unsigned long dontcare);
 
-static DEFINE_TIMER(seed_timer, __prandom_timer, 0, 0);
+static DEFINE_TIMER(seed_timer, __prandom_timer);
 
 static void __prandom_timer(unsigned long dontcare)
 {
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 5677147209e8..63138c8c2269 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -121,7 +121,7 @@ static struct notifier_block mpoa_notifier = {
 
 struct mpoa_client *mpcs = NULL; /* FIXME */
 static struct atm_mpoa_qos *qos_head = NULL;
-static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
+static DEFINE_TIMER(mpc_timer, NULL);
 
 
 static struct mpoa_client *find_mpc_by_itfnum(int itf)
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 0bd3afd01dd2..6538632fbd03 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -131,7 +131,7 @@ static struct dn_rt_hash_bucket *dn_rt_hash_table;
 static unsigned int dn_rt_hash_mask;
 
 static struct timer_list dn_route_timer;
-static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush, 0, 0);
+static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush);
 int decnet_dst_gc_interval = 2;
 
 static struct dst_ops dn_dst_ops = {
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 8081bafe441b..b39d0908be2e 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -47,7 +47,7 @@ static atomic_t fl_size = ATOMIC_INIT(0);
 static struct ip6_flowlabel __rcu *fl_ht[FL_HASH_MASK+1];
 
 static void ip6_fl_gc(unsigned long dummy);
-static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc, 0, 0);
+static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc);
 
 /* FL hash table lock: it protects only of GC */
 
diff --git a/net/netrom/nr_loopback.c b/net/netrom/nr_loopback.c
index 94d4e922af53..989ae647825e 100644
--- a/net/netrom/nr_loopback.c
+++ b/net/netrom/nr_loopback.c
@@ -18,7 +18,7 @@
 static void nr_loopback_timer(unsigned long);
 
 static struct sk_buff_head loopback_queue;
-static DEFINE_TIMER(loopback_timer, nr_loopback_timer, 0, 0);
+static DEFINE_TIMER(loopback_timer, nr_loopback_timer);
 
 void __init nr_loopback_init(void)
 {
diff --git a/security/keys/gc.c b/security/keys/gc.c
index 87cb260e4890..8673f7f58ead 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -30,7 +30,7 @@ DECLARE_WORK(key_gc_work, key_garbage_collector);
  * Reaper for links from keyrings to dead keys.
  */
 static void key_gc_timer_func(unsigned long);
-static DEFINE_TIMER(key_gc_timer, key_gc_timer_func, 0, 0);
+static DEFINE_TIMER(key_gc_timer, key_gc_timer_func);
 
 static time_t key_gc_next_run = LONG_MAX;
 static struct key_type *key_gc_dead_keytype;
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c
index 701c7625c971..1277df815d5b 100644
--- a/sound/oss/midibuf.c
+++ b/sound/oss/midibuf.c
@@ -52,7 +52,7 @@ static struct midi_parms parms[MAX_MIDI_DEV];
 static void midi_poll(unsigned long dummy);
 
 
-static DEFINE_TIMER(poll_timer, midi_poll, 0, 0);
+static DEFINE_TIMER(poll_timer, midi_poll);
 
 static volatile int open_devs;
 static DEFINE_SPINLOCK(lock);
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index b70c7c8f9c5d..4391062e5cfd 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -662,7 +662,7 @@ static void do_sequencer_timer(unsigned long dummy)
 }
 
 
-static DEFINE_TIMER(seq_timer, do_sequencer_timer, 0, 0);
+static DEFINE_TIMER(seq_timer, do_sequencer_timer);
 
 void request_sound_timer(int count)
 {
diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
index d17019d25b99..8a4b5625dba6 100644
--- a/sound/oss/sys_timer.c
+++ b/sound/oss/sys_timer.c
@@ -28,7 +28,7 @@ static unsigned long prev_event_time;
 
 static void     poll_def_tmr(unsigned long dummy);
 static DEFINE_SPINLOCK(lock);
-static DEFINE_TIMER(def_tmr, poll_def_tmr, 0, 0);
+static DEFINE_TIMER(def_tmr, poll_def_tmr);
 
 static unsigned long
 tmr2ticks(int tmr_value)
diff --git a/sound/oss/uart6850.c b/sound/oss/uart6850.c
index eda32d7eddbd..a9d3f7568525 100644
--- a/sound/oss/uart6850.c
+++ b/sound/oss/uart6850.c
@@ -78,7 +78,7 @@ static void (*midi_input_intr) (int dev, unsigned char data);
 static void poll_uart6850(unsigned long dummy);
 
 
-static DEFINE_TIMER(uart6850_timer, poll_uart6850, 0, 0);
+static DEFINE_TIMER(uart6850_timer, poll_uart6850);
 
 static void uart6850_input_loop(void)
 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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

Drop the arguments from the macro and adjust all callers with the
following script:

  perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
    $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts
---
 arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
 arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
 arch/m68k/amiga/amisound.c                | 2 +-
 arch/m68k/mac/macboing.c                  | 2 +-
 arch/mips/mti-malta/malta-display.c       | 2 +-
 arch/parisc/kernel/pdc_cons.c             | 2 +-
 arch/s390/mm/cmm.c                        | 2 +-
 drivers/atm/idt77105.c                    | 4 ++--
 drivers/atm/iphase.c                      | 2 +-
 drivers/block/ataflop.c                   | 8 ++++----
 drivers/char/dtlk.c                       | 2 +-
 drivers/char/hangcheck-timer.c            | 2 +-
 drivers/char/nwbutton.c                   | 2 +-
 drivers/char/rtc.c                        | 2 +-
 drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
 drivers/net/cris/eth_v10.c                | 6 +++---
 drivers/net/hamradio/yam.c                | 2 +-
 drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
 drivers/staging/speakup/main.c            | 2 +-
 drivers/staging/speakup/synth.c           | 2 +-
 drivers/tty/cyclades.c                    | 2 +-
 drivers/tty/isicom.c                      | 2 +-
 drivers/tty/moxa.c                        | 2 +-
 drivers/tty/rocket.c                      | 2 +-
 drivers/tty/vt/keyboard.c                 | 2 +-
 drivers/tty/vt/vt.c                       | 2 +-
 drivers/watchdog/alim7101_wdt.c           | 2 +-
 drivers/watchdog/machzwd.c                | 2 +-
 drivers/watchdog/mixcomwd.c               | 2 +-
 drivers/watchdog/sbc60xxwdt.c             | 2 +-
 drivers/watchdog/sc520_wdt.c              | 2 +-
 drivers/watchdog/via_wdt.c                | 2 +-
 drivers/watchdog/w83877f_wdt.c            | 2 +-
 drivers/xen/grant-table.c                 | 2 +-
 fs/pstore/platform.c                      | 2 +-
 include/linux/timer.h                     | 4 ++--
 kernel/irq/spurious.c                     | 2 +-
 lib/random32.c                            | 2 +-
 net/atm/mpc.c                             | 2 +-
 net/decnet/dn_route.c                     | 2 +-
 net/ipv6/ip6_flowlabel.c                  | 2 +-
 net/netrom/nr_loopback.c                  | 2 +-
 security/keys/gc.c                        | 2 +-
 sound/oss/midibuf.c                       | 2 +-
 sound/oss/soundcard.c                     | 2 +-
 sound/oss/sys_timer.c                     | 2 +-
 sound/oss/uart6850.c                      | 2 +-
 47 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index b3bd0e137f6d..b3689a141ec6 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -174,7 +174,7 @@ static int power_button_countdown;
 #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
 
 static void dsmg600_power_handler(unsigned long data);
-static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0);
+static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler);
 
 static void dsmg600_power_handler(unsigned long data)
 {
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 4e0f762bc651..562d05f9888e 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -197,7 +197,7 @@ static int power_button_countdown;
 #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
 
 static void nas100d_power_handler(unsigned long data);
-static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0);
+static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler);
 
 static void nas100d_power_handler(unsigned long data)
 {
diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
index 90a60d758f8b..a23f48181fd6 100644
--- a/arch/m68k/amiga/amisound.c
+++ b/arch/m68k/amiga/amisound.c
@@ -66,7 +66,7 @@ void __init amiga_init_sound(void)
 }
 
 static void nosound( unsigned long ignored );
-static DEFINE_TIMER(sound_timer, nosound, 0, 0);
+static DEFINE_TIMER(sound_timer, nosound);
 
 void amiga_mksound( unsigned int hz, unsigned int ticks )
 {
diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c
index ffaa1f6439ae..9a52aff183d0 100644
--- a/arch/m68k/mac/macboing.c
+++ b/arch/m68k/mac/macboing.c
@@ -56,7 +56,7 @@ static void ( *mac_special_bell )( unsigned int, unsigned int, unsigned int );
 /*
  * our timer to start/continue/stop the bell
  */
-static DEFINE_TIMER(mac_sound_timer, mac_nosound, 0, 0);
+static DEFINE_TIMER(mac_sound_timer, mac_nosound);
 
 /*
  * Sort of initialize the sound chip (called from mac_mksound on the first
diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
index ac813158b9b8..063de44675ce 100644
--- a/arch/mips/mti-malta/malta-display.c
+++ b/arch/mips/mti-malta/malta-display.c
@@ -37,7 +37,7 @@ void mips_display_message(const char *str)
 }
 
 static void scroll_display_message(unsigned long unused);
-static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
+static DEFINE_TIMER(mips_scroll_timer, scroll_display_message);
 
 static void scroll_display_message(unsigned long unused)
 {
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
index 10a5ae9553fd..27a2dd616a7d 100644
--- a/arch/parisc/kernel/pdc_cons.c
+++ b/arch/parisc/kernel/pdc_cons.c
@@ -92,7 +92,7 @@ static int pdc_console_setup(struct console *co, char *options)
 #define PDC_CONS_POLL_DELAY (30 * HZ / 1000)
 
 static void pdc_console_poll(unsigned long unused);
-static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0);
+static DEFINE_TIMER(pdc_console_timer, pdc_console_poll);
 static struct tty_port tty_port;
 
 static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 829c63dbc81a..2dbdcd85b68f 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(cmm_lock);
 
 static struct task_struct *cmm_thread_ptr;
 static DECLARE_WAIT_QUEUE_HEAD(cmm_thread_wait);
-static DEFINE_TIMER(cmm_timer, NULL, 0, 0);
+static DEFINE_TIMER(cmm_timer, NULL);
 
 static void cmm_timer_fn(unsigned long);
 static void cmm_set_timer(void);
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 082aa02abc57..57af9fd198e4 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -49,8 +49,8 @@ static void idt77105_stats_timer_func(unsigned long);
 static void idt77105_restart_timer_func(unsigned long);
 
 
-static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func, 0, 0);
-static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func, 0, 0);
+static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func);
+static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func);
 static int start_timer = 1;
 static struct idt77105_priv *idt77105_all = NULL;
 
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index fc72b763fdd7..ad6b582c268e 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -76,7 +76,7 @@ static IADEV *ia_dev[8];
 static struct atm_dev *_ia_dev[8];
 static int iadev_count;
 static void ia_led_timer(unsigned long arg);
-static DEFINE_TIMER(ia_timer, ia_led_timer, 0, 0);
+static DEFINE_TIMER(ia_timer, ia_led_timer);
 static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ;
 static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ;
 static uint IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 92da886180aa..ae596e55bcb6 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -373,10 +373,10 @@ static void floppy_release(struct gendisk *disk, fmode_t mode);
 
 /************************* End of Prototypes **************************/
 
-static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer, 0, 0);
-static DEFINE_TIMER(readtrack_timer, fd_readtrack_check, 0, 0);
-static DEFINE_TIMER(timeout_timer, fd_times_out, 0, 0);
-static DEFINE_TIMER(fd_timer, check_change, 0, 0);
+static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer);
+static DEFINE_TIMER(readtrack_timer, fd_readtrack_check);
+static DEFINE_TIMER(timeout_timer, fd_times_out);
+static DEFINE_TIMER(fd_timer, check_change);
 	
 static void fd_end_request_cur(blk_status_t err)
 {
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
index 58471394beb9..1a0385ed6417 100644
--- a/drivers/char/dtlk.c
+++ b/drivers/char/dtlk.c
@@ -84,7 +84,7 @@ static int dtlk_has_indexing;
 static unsigned int dtlk_portlist[] =
 {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
 static wait_queue_head_t dtlk_process_list;
-static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0);
+static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick);
 
 /* prototypes for file_operations struct */
 static ssize_t dtlk_read(struct file *, char __user *,
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c
index 5406b90bf626..5b8db2ed844d 100644
--- a/drivers/char/hangcheck-timer.c
+++ b/drivers/char/hangcheck-timer.c
@@ -124,7 +124,7 @@ static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;
 
 static void hangcheck_fire(unsigned long);
 
-static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire, 0, 0);
+static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire);
 
 static void hangcheck_fire(unsigned long data)
 {
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
index e6d0d271c58c..44006ed9558f 100644
--- a/drivers/char/nwbutton.c
+++ b/drivers/char/nwbutton.c
@@ -27,7 +27,7 @@ static void button_sequence_finished (unsigned long parameters);
 
 static int button_press_count;		/* The count of button presses */
 /* Times for the end of a sequence */
-static DEFINE_TIMER(button_timer, button_sequence_finished, 0, 0);
+static DEFINE_TIMER(button_timer, button_sequence_finished);
 static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
 static char button_output_buffer[32];	/* Stores data to write out of device */
 static int bcount;			/* The number of bytes in the buffer */
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 974d48927b07..616871e68e09 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -137,7 +137,7 @@ static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
 #ifdef RTC_IRQ
 static void rtc_dropped_irq(unsigned long data);
 
-static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
+static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq);
 #endif
 
 static ssize_t rtc_read(struct file *file, char __user *buf,
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 3b3db8c868e0..d3265b6b58b8 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -145,7 +145,7 @@ static void touch_timer_fire(unsigned long data)
 	}
 }
 
-static DEFINE_TIMER(touch_timer, touch_timer_fire, 0, 0);
+static DEFINE_TIMER(touch_timer, touch_timer_fire);
 
 /**
  * stylus_irq - touchscreen stylus event interrupt
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index 017f48cdcab9..1fcc86fa4e05 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -165,8 +165,8 @@ static unsigned int network_rec_config_shadow = 0;
 static unsigned int network_tr_ctrl_shadow = 0;
 
 /* Network speed indication. */
-static DEFINE_TIMER(speed_timer, NULL, 0, 0);
-static DEFINE_TIMER(clear_led_timer, NULL, 0, 0);
+static DEFINE_TIMER(speed_timer, NULL);
+static DEFINE_TIMER(clear_led_timer, NULL);
 static int current_speed; /* Speed read from transceiver */
 static int current_speed_selection; /* Speed selected by user */
 static unsigned long led_next_time;
@@ -174,7 +174,7 @@ static int led_active;
 static int rx_queue_len;
 
 /* Duplex */
-static DEFINE_TIMER(duplex_timer, NULL, 0, 0);
+static DEFINE_TIMER(duplex_timer, NULL);
 static int full_duplex;
 static enum duplex current_duplex;
 
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 7a7c5224a336..104f71fa9c5e 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -157,7 +157,7 @@ static struct net_device *yam_devs[NR_PORTS];
 
 static struct yam_mcs *yam_data;
 
-static DEFINE_TIMER(yam_timer, NULL, 0, 0);
+static DEFINE_TIMER(yam_timer, NULL);
 
 /* --------------------------------------------------------------------- */
 
diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
index 94bf01f8b2a8..ede89d4ffc88 100644
--- a/drivers/net/wireless/atmel/at76c50x-usb.c
+++ b/drivers/net/wireless/atmel/at76c50x-usb.c
@@ -519,7 +519,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 /* LED trigger */
 static int tx_activity;
 static void at76_ledtrig_tx_timerfunc(unsigned long data);
-static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc, 0, 0);
+static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc);
 DEFINE_LED_TRIGGER(ledtrig_tx);
 
 static void at76_ledtrig_tx_timerfunc(unsigned long data)
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 67956e24779c..b61e9becb612 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1165,7 +1165,7 @@ static const int NUM_CTL_LABELS = (MSG_CTL_END - MSG_CTL_START + 1);
 
 static void read_all_doc(struct vc_data *vc);
 static void cursor_done(u_long data);
-static DEFINE_TIMER(cursor_timer, cursor_done, 0, 0);
+static DEFINE_TIMER(cursor_timer, cursor_done);
 
 static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
 {
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index a1ca68c76579..6ddd3fc3f08d 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -158,7 +158,7 @@ static void thread_wake_up(u_long data)
 	wake_up_interruptible_all(&speakup_event);
 }
 
-static DEFINE_TIMER(thread_timer, thread_wake_up, 0, 0);
+static DEFINE_TIMER(thread_timer, thread_wake_up);
 
 void synth_start(void)
 {
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index d272bc4e7fb5..dac8a1a8e4ac 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -283,7 +283,7 @@ static void cyz_poll(unsigned long);
 /* The Cyclades-Z polling cycle is defined by this variable */
 static long cyz_polling_cycle = CZ_DEF_POLL;
 
-static DEFINE_TIMER(cyz_timerlist, cyz_poll, 0, 0);
+static DEFINE_TIMER(cyz_timerlist, cyz_poll);
 
 #else				/* CONFIG_CYZ_INTR */
 static void cyz_rx_restart(unsigned long);
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
index 61ecdd6b2fc2..40af32108ff5 100644
--- a/drivers/tty/isicom.c
+++ b/drivers/tty/isicom.c
@@ -177,7 +177,7 @@ static struct tty_driver *isicom_normal;
 static void isicom_tx(unsigned long _data);
 static void isicom_start(struct tty_struct *tty);
 
-static DEFINE_TIMER(tx, isicom_tx, 0, 0);
+static DEFINE_TIMER(tx, isicom_tx);
 
 /*   baud index mappings from linux defns to isi */
 
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 7f3d4cb0341b..93d37655d928 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -428,7 +428,7 @@ static const struct tty_port_operations moxa_port_ops = {
 };
 
 static struct tty_driver *moxaDriver;
-static DEFINE_TIMER(moxaTimer, moxa_poll, 0, 0);
+static DEFINE_TIMER(moxaTimer, moxa_poll);
 
 /*
  * HW init
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 20d79a6007d5..aa695fda1084 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -111,7 +111,7 @@ static struct r_port *rp_table[MAX_RP_PORTS];	       /*  The main repository of
 static unsigned int xmit_flags[NUM_BOARDS];	       /*  Bit significant, indicates port had data to transmit. */
 						       /*  eg.  Bit 0 indicates port 0 has xmit data, ...        */
 static atomic_t rp_num_ports_open;	               /*  Number of serial ports open                           */
-static DEFINE_TIMER(rocket_timer, rp_do_poll, 0, 0);
+static DEFINE_TIMER(rocket_timer, rp_do_poll);
 
 static unsigned long board1;	                       /* ISA addresses, retrieved from rocketport.conf          */
 static unsigned long board2;
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index f4166263bb3a..f974d6340d04 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -250,7 +250,7 @@ static void kd_nosound(unsigned long ignored)
 	input_handler_for_each_handle(&kbd_handler, &zero, kd_sound_helper);
 }
 
-static DEFINE_TIMER(kd_mksound_timer, kd_nosound, 0, 0);
+static DEFINE_TIMER(kd_mksound_timer, kd_nosound);
 
 void kd_mksound(unsigned int hz, unsigned int ticks)
 {
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 2ebaba16f785..602d71630952 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -228,7 +228,7 @@ static int scrollback_delta;
  */
 int (*console_blank_hook)(int);
 
-static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
+static DEFINE_TIMER(console_timer, blank_screen_t);
 static int blank_state;
 static int blank_timer_expired;
 enum {
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 3c1f6ac68ea9..18e896eeca62 100644
--- a/drivers/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
@@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
 		"Use the gpio watchdog (required by old cobalt boards).");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c
index 9826b59ef734..8a616a57bb90 100644
--- a/drivers/watchdog/machzwd.c
+++ b/drivers/watchdog/machzwd.c
@@ -127,7 +127,7 @@ static int zf_action = GEN_RESET;
 static unsigned long zf_is_open;
 static char zf_expect_close;
 static DEFINE_SPINLOCK(zf_port_lock);
-static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
+static DEFINE_TIMER(zf_timer, zf_ping);
 static unsigned long next_heartbeat;
 
 
diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c
index be86ea359eee..c9e38096ea91 100644
--- a/drivers/watchdog/mixcomwd.c
+++ b/drivers/watchdog/mixcomwd.c
@@ -105,7 +105,7 @@ static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */
 
 static int watchdog_port;
 static int mixcomwd_timer_alive;
-static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0);
+static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun);
 static char expect_close;
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
index 2eef58a0cf05..8d589939bc84 100644
--- a/drivers/watchdog/sbc60xxwdt.c
+++ b/drivers/watchdog/sbc60xxwdt.c
@@ -113,7 +113,7 @@ MODULE_PARM_DESC(nowayout,
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
index 1cfd3f6a13d5..3e9bbaa37bf4 100644
--- a/drivers/watchdog/sc520_wdt.c
+++ b/drivers/watchdog/sc520_wdt.c
@@ -124,7 +124,7 @@ MODULE_PARM_DESC(nowayout,
 static __u16 __iomem *wdtmrctl;
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/via_wdt.c b/drivers/watchdog/via_wdt.c
index 5f9cbc37520d..ad3c3be13b40 100644
--- a/drivers/watchdog/via_wdt.c
+++ b/drivers/watchdog/via_wdt.c
@@ -68,7 +68,7 @@ static struct resource wdt_res;
 static void __iomem *wdt_mem;
 static unsigned int mmio;
 static void wdt_timer_tick(unsigned long data);
-static DEFINE_TIMER(timer, wdt_timer_tick, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_tick);
 					/* The timer that pings the watchdog */
 static unsigned long next_heartbeat;	/* the next_heartbeat for the timer */
 
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
index f0483c75ed32..ba6b680af100 100644
--- a/drivers/watchdog/w83877f_wdt.c
+++ b/drivers/watchdog/w83877f_wdt.c
@@ -98,7 +98,7 @@ MODULE_PARM_DESC(nowayout,
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 2c6a9114d332..a8721d718186 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -305,7 +305,7 @@ struct deferred_entry {
 };
 static LIST_HEAD(deferred_list);
 static void gnttab_handle_deferred(unsigned long);
-static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred, 0, 0);
+static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred);
 
 static void gnttab_handle_deferred(unsigned long unused)
 {
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 2b21d180157c..ec7199e859d2 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -62,7 +62,7 @@ MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content "
 static int pstore_new_entry;
 
 static void pstore_timefunc(unsigned long);
-static DEFINE_TIMER(pstore_timer, pstore_timefunc, 0, 0);
+static DEFINE_TIMER(pstore_timer, pstore_timefunc);
 
 static void pstore_dowork(struct work_struct *);
 static DECLARE_WORK(pstore_work, pstore_dowork);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index a33220311361..91e5a2cc81b5 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -73,9 +73,9 @@ struct timer_list {
 			__FILE__ ":" __stringify(__LINE__))	\
 	}
 
-#define DEFINE_TIMER(_name, _function, _expires, _data)		\
+#define DEFINE_TIMER(_name, _function)				\
 	struct timer_list _name =				\
-		__TIMER_INITIALIZER(_function, _expires, _data, 0)
+		__TIMER_INITIALIZER(_function, 0, 0, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 061ba7eed4ed..c805e8691c22 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -20,7 +20,7 @@ static int irqfixup __read_mostly;
 
 #define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
 static void poll_spurious_irqs(unsigned long dummy);
-static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0);
+static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs);
 static int irq_poll_cpu;
 static atomic_t irq_poll_active;
 
diff --git a/lib/random32.c b/lib/random32.c
index fa594b1140e6..6e91b75c113f 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -214,7 +214,7 @@ core_initcall(prandom_init);
 
 static void __prandom_timer(unsigned long dontcare);
 
-static DEFINE_TIMER(seed_timer, __prandom_timer, 0, 0);
+static DEFINE_TIMER(seed_timer, __prandom_timer);
 
 static void __prandom_timer(unsigned long dontcare)
 {
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 5677147209e8..63138c8c2269 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -121,7 +121,7 @@ static struct notifier_block mpoa_notifier = {
 
 struct mpoa_client *mpcs = NULL; /* FIXME */
 static struct atm_mpoa_qos *qos_head = NULL;
-static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
+static DEFINE_TIMER(mpc_timer, NULL);
 
 
 static struct mpoa_client *find_mpc_by_itfnum(int itf)
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 0bd3afd01dd2..6538632fbd03 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -131,7 +131,7 @@ static struct dn_rt_hash_bucket *dn_rt_hash_table;
 static unsigned int dn_rt_hash_mask;
 
 static struct timer_list dn_route_timer;
-static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush, 0, 0);
+static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush);
 int decnet_dst_gc_interval = 2;
 
 static struct dst_ops dn_dst_ops = {
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 8081bafe441b..b39d0908be2e 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -47,7 +47,7 @@ static atomic_t fl_size = ATOMIC_INIT(0);
 static struct ip6_flowlabel __rcu *fl_ht[FL_HASH_MASK+1];
 
 static void ip6_fl_gc(unsigned long dummy);
-static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc, 0, 0);
+static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc);
 
 /* FL hash table lock: it protects only of GC */
 
diff --git a/net/netrom/nr_loopback.c b/net/netrom/nr_loopback.c
index 94d4e922af53..989ae647825e 100644
--- a/net/netrom/nr_loopback.c
+++ b/net/netrom/nr_loopback.c
@@ -18,7 +18,7 @@
 static void nr_loopback_timer(unsigned long);
 
 static struct sk_buff_head loopback_queue;
-static DEFINE_TIMER(loopback_timer, nr_loopback_timer, 0, 0);
+static DEFINE_TIMER(loopback_timer, nr_loopback_timer);
 
 void __init nr_loopback_init(void)
 {
diff --git a/security/keys/gc.c b/security/keys/gc.c
index 87cb260e4890..8673f7f58ead 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -30,7 +30,7 @@ DECLARE_WORK(key_gc_work, key_garbage_collector);
  * Reaper for links from keyrings to dead keys.
  */
 static void key_gc_timer_func(unsigned long);
-static DEFINE_TIMER(key_gc_timer, key_gc_timer_func, 0, 0);
+static DEFINE_TIMER(key_gc_timer, key_gc_timer_func);
 
 static time_t key_gc_next_run = LONG_MAX;
 static struct key_type *key_gc_dead_keytype;
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c
index 701c7625c971..1277df815d5b 100644
--- a/sound/oss/midibuf.c
+++ b/sound/oss/midibuf.c
@@ -52,7 +52,7 @@ static struct midi_parms parms[MAX_MIDI_DEV];
 static void midi_poll(unsigned long dummy);
 
 
-static DEFINE_TIMER(poll_timer, midi_poll, 0, 0);
+static DEFINE_TIMER(poll_timer, midi_poll);
 
 static volatile int open_devs;
 static DEFINE_SPINLOCK(lock);
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index b70c7c8f9c5d..4391062e5cfd 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -662,7 +662,7 @@ static void do_sequencer_timer(unsigned long dummy)
 }
 
 
-static DEFINE_TIMER(seq_timer, do_sequencer_timer, 0, 0);
+static DEFINE_TIMER(seq_timer, do_sequencer_timer);
 
 void request_sound_timer(int count)
 {
diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
index d17019d25b99..8a4b5625dba6 100644
--- a/sound/oss/sys_timer.c
+++ b/sound/oss/sys_timer.c
@@ -28,7 +28,7 @@ static unsigned long prev_event_time;
 
 static void     poll_def_tmr(unsigned long dummy);
 static DEFINE_SPINLOCK(lock);
-static DEFINE_TIMER(def_tmr, poll_def_tmr, 0, 0);
+static DEFINE_TIMER(def_tmr, poll_def_tmr);
 
 static unsigned long
 tmr2ticks(int tmr_value)
diff --git a/sound/oss/uart6850.c b/sound/oss/uart6850.c
index eda32d7eddbd..a9d3f7568525 100644
--- a/sound/oss/uart6850.c
+++ b/sound/oss/uart6850.c
@@ -78,7 +78,7 @@ static void (*midi_input_intr) (int dev, unsigned char data);
 static void poll_uart6850(unsigned long dummy);
 
 
-static DEFINE_TIMER(uart6850_timer, poll_uart6850, 0, 0);
+static DEFINE_TIMER(uart6850_timer, poll_uart6850);
 
 static void uart6850_input_loop(void)
 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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

Drop the arguments from the macro and adjust all callers with the
following script:

  perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
    $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts
---
 arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
 arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
 arch/m68k/amiga/amisound.c                | 2 +-
 arch/m68k/mac/macboing.c                  | 2 +-
 arch/mips/mti-malta/malta-display.c       | 2 +-
 arch/parisc/kernel/pdc_cons.c             | 2 +-
 arch/s390/mm/cmm.c                        | 2 +-
 drivers/atm/idt77105.c                    | 4 ++--
 drivers/atm/iphase.c                      | 2 +-
 drivers/block/ataflop.c                   | 8 ++++----
 drivers/char/dtlk.c                       | 2 +-
 drivers/char/hangcheck-timer.c            | 2 +-
 drivers/char/nwbutton.c                   | 2 +-
 drivers/char/rtc.c                        | 2 +-
 drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
 drivers/net/cris/eth_v10.c                | 6 +++---
 drivers/net/hamradio/yam.c                | 2 +-
 drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
 drivers/staging/speakup/main.c            | 2 +-
 drivers/staging/speakup/synth.c           | 2 +-
 drivers/tty/cyclades.c                    | 2 +-
 drivers/tty/isicom.c                      | 2 +-
 drivers/tty/moxa.c                        | 2 +-
 drivers/tty/rocket.c                      | 2 +-
 drivers/tty/vt/keyboard.c                 | 2 +-
 drivers/tty/vt/vt.c                       | 2 +-
 drivers/watchdog/alim7101_wdt.c           | 2 +-
 drivers/watchdog/machzwd.c                | 2 +-
 drivers/watchdog/mixcomwd.c               | 2 +-
 drivers/watchdog/sbc60xxwdt.c             | 2 +-
 drivers/watchdog/sc520_wdt.c              | 2 +-
 drivers/watchdog/via_wdt.c                | 2 +-
 drivers/watchdog/w83877f_wdt.c            | 2 +-
 drivers/xen/grant-table.c                 | 2 +-
 fs/pstore/platform.c                      | 2 +-
 include/linux/timer.h                     | 4 ++--
 kernel/irq/spurious.c                     | 2 +-
 lib/random32.c                            | 2 +-
 net/atm/mpc.c                             | 2 +-
 net/decnet/dn_route.c                     | 2 +-
 net/ipv6/ip6_flowlabel.c                  | 2 +-
 net/netrom/nr_loopback.c                  | 2 +-
 security/keys/gc.c                        | 2 +-
 sound/oss/midibuf.c                       | 2 +-
 sound/oss/soundcard.c                     | 2 +-
 sound/oss/sys_timer.c                     | 2 +-
 sound/oss/uart6850.c                      | 2 +-
 47 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index b3bd0e137f6d..b3689a141ec6 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -174,7 +174,7 @@ static int power_button_countdown;
 #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
 
 static void dsmg600_power_handler(unsigned long data);
-static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0);
+static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler);
 
 static void dsmg600_power_handler(unsigned long data)
 {
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 4e0f762bc651..562d05f9888e 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -197,7 +197,7 @@ static int power_button_countdown;
 #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
 
 static void nas100d_power_handler(unsigned long data);
-static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0);
+static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler);
 
 static void nas100d_power_handler(unsigned long data)
 {
diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
index 90a60d758f8b..a23f48181fd6 100644
--- a/arch/m68k/amiga/amisound.c
+++ b/arch/m68k/amiga/amisound.c
@@ -66,7 +66,7 @@ void __init amiga_init_sound(void)
 }
 
 static void nosound( unsigned long ignored );
-static DEFINE_TIMER(sound_timer, nosound, 0, 0);
+static DEFINE_TIMER(sound_timer, nosound);
 
 void amiga_mksound( unsigned int hz, unsigned int ticks )
 {
diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c
index ffaa1f6439ae..9a52aff183d0 100644
--- a/arch/m68k/mac/macboing.c
+++ b/arch/m68k/mac/macboing.c
@@ -56,7 +56,7 @@ static void ( *mac_special_bell )( unsigned int, unsigned int, unsigned int );
 /*
  * our timer to start/continue/stop the bell
  */
-static DEFINE_TIMER(mac_sound_timer, mac_nosound, 0, 0);
+static DEFINE_TIMER(mac_sound_timer, mac_nosound);
 
 /*
  * Sort of initialize the sound chip (called from mac_mksound on the first
diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
index ac813158b9b8..063de44675ce 100644
--- a/arch/mips/mti-malta/malta-display.c
+++ b/arch/mips/mti-malta/malta-display.c
@@ -37,7 +37,7 @@ void mips_display_message(const char *str)
 }
 
 static void scroll_display_message(unsigned long unused);
-static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
+static DEFINE_TIMER(mips_scroll_timer, scroll_display_message);
 
 static void scroll_display_message(unsigned long unused)
 {
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
index 10a5ae9553fd..27a2dd616a7d 100644
--- a/arch/parisc/kernel/pdc_cons.c
+++ b/arch/parisc/kernel/pdc_cons.c
@@ -92,7 +92,7 @@ static int pdc_console_setup(struct console *co, char *options)
 #define PDC_CONS_POLL_DELAY (30 * HZ / 1000)
 
 static void pdc_console_poll(unsigned long unused);
-static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0);
+static DEFINE_TIMER(pdc_console_timer, pdc_console_poll);
 static struct tty_port tty_port;
 
 static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 829c63dbc81a..2dbdcd85b68f 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(cmm_lock);
 
 static struct task_struct *cmm_thread_ptr;
 static DECLARE_WAIT_QUEUE_HEAD(cmm_thread_wait);
-static DEFINE_TIMER(cmm_timer, NULL, 0, 0);
+static DEFINE_TIMER(cmm_timer, NULL);
 
 static void cmm_timer_fn(unsigned long);
 static void cmm_set_timer(void);
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 082aa02abc57..57af9fd198e4 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -49,8 +49,8 @@ static void idt77105_stats_timer_func(unsigned long);
 static void idt77105_restart_timer_func(unsigned long);
 
 
-static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func, 0, 0);
-static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func, 0, 0);
+static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func);
+static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func);
 static int start_timer = 1;
 static struct idt77105_priv *idt77105_all = NULL;
 
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index fc72b763fdd7..ad6b582c268e 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -76,7 +76,7 @@ static IADEV *ia_dev[8];
 static struct atm_dev *_ia_dev[8];
 static int iadev_count;
 static void ia_led_timer(unsigned long arg);
-static DEFINE_TIMER(ia_timer, ia_led_timer, 0, 0);
+static DEFINE_TIMER(ia_timer, ia_led_timer);
 static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ;
 static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ;
 static uint IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 92da886180aa..ae596e55bcb6 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -373,10 +373,10 @@ static void floppy_release(struct gendisk *disk, fmode_t mode);
 
 /************************* End of Prototypes **************************/
 
-static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer, 0, 0);
-static DEFINE_TIMER(readtrack_timer, fd_readtrack_check, 0, 0);
-static DEFINE_TIMER(timeout_timer, fd_times_out, 0, 0);
-static DEFINE_TIMER(fd_timer, check_change, 0, 0);
+static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer);
+static DEFINE_TIMER(readtrack_timer, fd_readtrack_check);
+static DEFINE_TIMER(timeout_timer, fd_times_out);
+static DEFINE_TIMER(fd_timer, check_change);
 	
 static void fd_end_request_cur(blk_status_t err)
 {
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
index 58471394beb9..1a0385ed6417 100644
--- a/drivers/char/dtlk.c
+++ b/drivers/char/dtlk.c
@@ -84,7 +84,7 @@ static int dtlk_has_indexing;
 static unsigned int dtlk_portlist[] =
 {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
 static wait_queue_head_t dtlk_process_list;
-static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0);
+static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick);
 
 /* prototypes for file_operations struct */
 static ssize_t dtlk_read(struct file *, char __user *,
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c
index 5406b90bf626..5b8db2ed844d 100644
--- a/drivers/char/hangcheck-timer.c
+++ b/drivers/char/hangcheck-timer.c
@@ -124,7 +124,7 @@ static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;
 
 static void hangcheck_fire(unsigned long);
 
-static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire, 0, 0);
+static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire);
 
 static void hangcheck_fire(unsigned long data)
 {
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
index e6d0d271c58c..44006ed9558f 100644
--- a/drivers/char/nwbutton.c
+++ b/drivers/char/nwbutton.c
@@ -27,7 +27,7 @@ static void button_sequence_finished (unsigned long parameters);
 
 static int button_press_count;		/* The count of button presses */
 /* Times for the end of a sequence */
-static DEFINE_TIMER(button_timer, button_sequence_finished, 0, 0);
+static DEFINE_TIMER(button_timer, button_sequence_finished);
 static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
 static char button_output_buffer[32];	/* Stores data to write out of device */
 static int bcount;			/* The number of bytes in the buffer */
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 974d48927b07..616871e68e09 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -137,7 +137,7 @@ static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
 #ifdef RTC_IRQ
 static void rtc_dropped_irq(unsigned long data);
 
-static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
+static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq);
 #endif
 
 static ssize_t rtc_read(struct file *file, char __user *buf,
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 3b3db8c868e0..d3265b6b58b8 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -145,7 +145,7 @@ static void touch_timer_fire(unsigned long data)
 	}
 }
 
-static DEFINE_TIMER(touch_timer, touch_timer_fire, 0, 0);
+static DEFINE_TIMER(touch_timer, touch_timer_fire);
 
 /**
  * stylus_irq - touchscreen stylus event interrupt
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index 017f48cdcab9..1fcc86fa4e05 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -165,8 +165,8 @@ static unsigned int network_rec_config_shadow = 0;
 static unsigned int network_tr_ctrl_shadow = 0;
 
 /* Network speed indication. */
-static DEFINE_TIMER(speed_timer, NULL, 0, 0);
-static DEFINE_TIMER(clear_led_timer, NULL, 0, 0);
+static DEFINE_TIMER(speed_timer, NULL);
+static DEFINE_TIMER(clear_led_timer, NULL);
 static int current_speed; /* Speed read from transceiver */
 static int current_speed_selection; /* Speed selected by user */
 static unsigned long led_next_time;
@@ -174,7 +174,7 @@ static int led_active;
 static int rx_queue_len;
 
 /* Duplex */
-static DEFINE_TIMER(duplex_timer, NULL, 0, 0);
+static DEFINE_TIMER(duplex_timer, NULL);
 static int full_duplex;
 static enum duplex current_duplex;
 
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 7a7c5224a336..104f71fa9c5e 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -157,7 +157,7 @@ static struct net_device *yam_devs[NR_PORTS];
 
 static struct yam_mcs *yam_data;
 
-static DEFINE_TIMER(yam_timer, NULL, 0, 0);
+static DEFINE_TIMER(yam_timer, NULL);
 
 /* --------------------------------------------------------------------- */
 
diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
index 94bf01f8b2a8..ede89d4ffc88 100644
--- a/drivers/net/wireless/atmel/at76c50x-usb.c
+++ b/drivers/net/wireless/atmel/at76c50x-usb.c
@@ -519,7 +519,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 /* LED trigger */
 static int tx_activity;
 static void at76_ledtrig_tx_timerfunc(unsigned long data);
-static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc, 0, 0);
+static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc);
 DEFINE_LED_TRIGGER(ledtrig_tx);
 
 static void at76_ledtrig_tx_timerfunc(unsigned long data)
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 67956e24779c..b61e9becb612 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1165,7 +1165,7 @@ static const int NUM_CTL_LABELS = (MSG_CTL_END - MSG_CTL_START + 1);
 
 static void read_all_doc(struct vc_data *vc);
 static void cursor_done(u_long data);
-static DEFINE_TIMER(cursor_timer, cursor_done, 0, 0);
+static DEFINE_TIMER(cursor_timer, cursor_done);
 
 static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
 {
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index a1ca68c76579..6ddd3fc3f08d 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -158,7 +158,7 @@ static void thread_wake_up(u_long data)
 	wake_up_interruptible_all(&speakup_event);
 }
 
-static DEFINE_TIMER(thread_timer, thread_wake_up, 0, 0);
+static DEFINE_TIMER(thread_timer, thread_wake_up);
 
 void synth_start(void)
 {
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index d272bc4e7fb5..dac8a1a8e4ac 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -283,7 +283,7 @@ static void cyz_poll(unsigned long);
 /* The Cyclades-Z polling cycle is defined by this variable */
 static long cyz_polling_cycle = CZ_DEF_POLL;
 
-static DEFINE_TIMER(cyz_timerlist, cyz_poll, 0, 0);
+static DEFINE_TIMER(cyz_timerlist, cyz_poll);
 
 #else				/* CONFIG_CYZ_INTR */
 static void cyz_rx_restart(unsigned long);
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
index 61ecdd6b2fc2..40af32108ff5 100644
--- a/drivers/tty/isicom.c
+++ b/drivers/tty/isicom.c
@@ -177,7 +177,7 @@ static struct tty_driver *isicom_normal;
 static void isicom_tx(unsigned long _data);
 static void isicom_start(struct tty_struct *tty);
 
-static DEFINE_TIMER(tx, isicom_tx, 0, 0);
+static DEFINE_TIMER(tx, isicom_tx);
 
 /*   baud index mappings from linux defns to isi */
 
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 7f3d4cb0341b..93d37655d928 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -428,7 +428,7 @@ static const struct tty_port_operations moxa_port_ops = {
 };
 
 static struct tty_driver *moxaDriver;
-static DEFINE_TIMER(moxaTimer, moxa_poll, 0, 0);
+static DEFINE_TIMER(moxaTimer, moxa_poll);
 
 /*
  * HW init
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 20d79a6007d5..aa695fda1084 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -111,7 +111,7 @@ static struct r_port *rp_table[MAX_RP_PORTS];	       /*  The main repository of
 static unsigned int xmit_flags[NUM_BOARDS];	       /*  Bit significant, indicates port had data to transmit. */
 						       /*  eg.  Bit 0 indicates port 0 has xmit data, ...        */
 static atomic_t rp_num_ports_open;	               /*  Number of serial ports open                           */
-static DEFINE_TIMER(rocket_timer, rp_do_poll, 0, 0);
+static DEFINE_TIMER(rocket_timer, rp_do_poll);
 
 static unsigned long board1;	                       /* ISA addresses, retrieved from rocketport.conf          */
 static unsigned long board2;
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index f4166263bb3a..f974d6340d04 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -250,7 +250,7 @@ static void kd_nosound(unsigned long ignored)
 	input_handler_for_each_handle(&kbd_handler, &zero, kd_sound_helper);
 }
 
-static DEFINE_TIMER(kd_mksound_timer, kd_nosound, 0, 0);
+static DEFINE_TIMER(kd_mksound_timer, kd_nosound);
 
 void kd_mksound(unsigned int hz, unsigned int ticks)
 {
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 2ebaba16f785..602d71630952 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -228,7 +228,7 @@ static int scrollback_delta;
  */
 int (*console_blank_hook)(int);
 
-static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
+static DEFINE_TIMER(console_timer, blank_screen_t);
 static int blank_state;
 static int blank_timer_expired;
 enum {
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 3c1f6ac68ea9..18e896eeca62 100644
--- a/drivers/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
@@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
 		"Use the gpio watchdog (required by old cobalt boards).");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c
index 9826b59ef734..8a616a57bb90 100644
--- a/drivers/watchdog/machzwd.c
+++ b/drivers/watchdog/machzwd.c
@@ -127,7 +127,7 @@ static int zf_action = GEN_RESET;
 static unsigned long zf_is_open;
 static char zf_expect_close;
 static DEFINE_SPINLOCK(zf_port_lock);
-static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
+static DEFINE_TIMER(zf_timer, zf_ping);
 static unsigned long next_heartbeat;
 
 
diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c
index be86ea359eee..c9e38096ea91 100644
--- a/drivers/watchdog/mixcomwd.c
+++ b/drivers/watchdog/mixcomwd.c
@@ -105,7 +105,7 @@ static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */
 
 static int watchdog_port;
 static int mixcomwd_timer_alive;
-static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0);
+static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun);
 static char expect_close;
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
index 2eef58a0cf05..8d589939bc84 100644
--- a/drivers/watchdog/sbc60xxwdt.c
+++ b/drivers/watchdog/sbc60xxwdt.c
@@ -113,7 +113,7 @@ MODULE_PARM_DESC(nowayout,
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
index 1cfd3f6a13d5..3e9bbaa37bf4 100644
--- a/drivers/watchdog/sc520_wdt.c
+++ b/drivers/watchdog/sc520_wdt.c
@@ -124,7 +124,7 @@ MODULE_PARM_DESC(nowayout,
 static __u16 __iomem *wdtmrctl;
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/via_wdt.c b/drivers/watchdog/via_wdt.c
index 5f9cbc37520d..ad3c3be13b40 100644
--- a/drivers/watchdog/via_wdt.c
+++ b/drivers/watchdog/via_wdt.c
@@ -68,7 +68,7 @@ static struct resource wdt_res;
 static void __iomem *wdt_mem;
 static unsigned int mmio;
 static void wdt_timer_tick(unsigned long data);
-static DEFINE_TIMER(timer, wdt_timer_tick, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_tick);
 					/* The timer that pings the watchdog */
 static unsigned long next_heartbeat;	/* the next_heartbeat for the timer */
 
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
index f0483c75ed32..ba6b680af100 100644
--- a/drivers/watchdog/w83877f_wdt.c
+++ b/drivers/watchdog/w83877f_wdt.c
@@ -98,7 +98,7 @@ MODULE_PARM_DESC(nowayout,
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 2c6a9114d332..a8721d718186 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -305,7 +305,7 @@ struct deferred_entry {
 };
 static LIST_HEAD(deferred_list);
 static void gnttab_handle_deferred(unsigned long);
-static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred, 0, 0);
+static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred);
 
 static void gnttab_handle_deferred(unsigned long unused)
 {
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 2b21d180157c..ec7199e859d2 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -62,7 +62,7 @@ MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content "
 static int pstore_new_entry;
 
 static void pstore_timefunc(unsigned long);
-static DEFINE_TIMER(pstore_timer, pstore_timefunc, 0, 0);
+static DEFINE_TIMER(pstore_timer, pstore_timefunc);
 
 static void pstore_dowork(struct work_struct *);
 static DECLARE_WORK(pstore_work, pstore_dowork);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index a33220311361..91e5a2cc81b5 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -73,9 +73,9 @@ struct timer_list {
 			__FILE__ ":" __stringify(__LINE__))	\
 	}
 
-#define DEFINE_TIMER(_name, _function, _expires, _data)		\
+#define DEFINE_TIMER(_name, _function)				\
 	struct timer_list _name =				\
-		__TIMER_INITIALIZER(_function, _expires, _data, 0)
+		__TIMER_INITIALIZER(_function, 0, 0, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 061ba7eed4ed..c805e8691c22 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -20,7 +20,7 @@ static int irqfixup __read_mostly;
 
 #define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
 static void poll_spurious_irqs(unsigned long dummy);
-static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0);
+static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs);
 static int irq_poll_cpu;
 static atomic_t irq_poll_active;
 
diff --git a/lib/random32.c b/lib/random32.c
index fa594b1140e6..6e91b75c113f 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -214,7 +214,7 @@ core_initcall(prandom_init);
 
 static void __prandom_timer(unsigned long dontcare);
 
-static DEFINE_TIMER(seed_timer, __prandom_timer, 0, 0);
+static DEFINE_TIMER(seed_timer, __prandom_timer);
 
 static void __prandom_timer(unsigned long dontcare)
 {
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 5677147209e8..63138c8c2269 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -121,7 +121,7 @@ static struct notifier_block mpoa_notifier = {
 
 struct mpoa_client *mpcs = NULL; /* FIXME */
 static struct atm_mpoa_qos *qos_head = NULL;
-static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
+static DEFINE_TIMER(mpc_timer, NULL);
 
 
 static struct mpoa_client *find_mpc_by_itfnum(int itf)
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 0bd3afd01dd2..6538632fbd03 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -131,7 +131,7 @@ static struct dn_rt_hash_bucket *dn_rt_hash_table;
 static unsigned int dn_rt_hash_mask;
 
 static struct timer_list dn_route_timer;
-static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush, 0, 0);
+static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush);
 int decnet_dst_gc_interval = 2;
 
 static struct dst_ops dn_dst_ops = {
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 8081bafe441b..b39d0908be2e 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -47,7 +47,7 @@ static atomic_t fl_size = ATOMIC_INIT(0);
 static struct ip6_flowlabel __rcu *fl_ht[FL_HASH_MASK+1];
 
 static void ip6_fl_gc(unsigned long dummy);
-static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc, 0, 0);
+static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc);
 
 /* FL hash table lock: it protects only of GC */
 
diff --git a/net/netrom/nr_loopback.c b/net/netrom/nr_loopback.c
index 94d4e922af53..989ae647825e 100644
--- a/net/netrom/nr_loopback.c
+++ b/net/netrom/nr_loopback.c
@@ -18,7 +18,7 @@
 static void nr_loopback_timer(unsigned long);
 
 static struct sk_buff_head loopback_queue;
-static DEFINE_TIMER(loopback_timer, nr_loopback_timer, 0, 0);
+static DEFINE_TIMER(loopback_timer, nr_loopback_timer);
 
 void __init nr_loopback_init(void)
 {
diff --git a/security/keys/gc.c b/security/keys/gc.c
index 87cb260e4890..8673f7f58ead 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -30,7 +30,7 @@ DECLARE_WORK(key_gc_work, key_garbage_collector);
  * Reaper for links from keyrings to dead keys.
  */
 static void key_gc_timer_func(unsigned long);
-static DEFINE_TIMER(key_gc_timer, key_gc_timer_func, 0, 0);
+static DEFINE_TIMER(key_gc_timer, key_gc_timer_func);
 
 static time_t key_gc_next_run = LONG_MAX;
 static struct key_type *key_gc_dead_keytype;
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c
index 701c7625c971..1277df815d5b 100644
--- a/sound/oss/midibuf.c
+++ b/sound/oss/midibuf.c
@@ -52,7 +52,7 @@ static struct midi_parms parms[MAX_MIDI_DEV];
 static void midi_poll(unsigned long dummy);
 
 
-static DEFINE_TIMER(poll_timer, midi_poll, 0, 0);
+static DEFINE_TIMER(poll_timer, midi_poll);
 
 static volatile int open_devs;
 static DEFINE_SPINLOCK(lock);
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index b70c7c8f9c5d..4391062e5cfd 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -662,7 +662,7 @@ static void do_sequencer_timer(unsigned long dummy)
 }
 
 
-static DEFINE_TIMER(seq_timer, do_sequencer_timer, 0, 0);
+static DEFINE_TIMER(seq_timer, do_sequencer_timer);
 
 void request_sound_timer(int count)
 {
diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
index d17019d25b99..8a4b5625dba6 100644
--- a/sound/oss/sys_timer.c
+++ b/sound/oss/sys_timer.c
@@ -28,7 +28,7 @@ static unsigned long prev_event_time;
 
 static void     poll_def_tmr(unsigned long dummy);
 static DEFINE_SPINLOCK(lock);
-static DEFINE_TIMER(def_tmr, poll_def_tmr, 0, 0);
+static DEFINE_TIMER(def_tmr, poll_def_tmr);
 
 static unsigned long
 tmr2ticks(int tmr_value)
diff --git a/sound/oss/uart6850.c b/sound/oss/uart6850.c
index eda32d7eddbd..a9d3f7568525 100644
--- a/sound/oss/uart6850.c
+++ b/sound/oss/uart6850.c
@@ -78,7 +78,7 @@ static void (*midi_input_intr) (int dev, unsigned char data);
 static void poll_uart6850(unsigned long dummy);
 
 
-static DEFINE_TIMER(uart6850_timer, poll_uart6850, 0, 0);
+static DEFINE_TIMER(uart6850_timer, poll_uart6850);
 
 static void uart6850_input_loop(void)
 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 11/13] timer: Remove expires argument from __TIMER_INITIALIZER()
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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 Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Petr Mladek, Rafael J. Wysocki, Ralf Baechle,
	Sebastian Reichel, Stefan Richter, Stephen Boyd, Sudip Mukherjee,
	Tejun Heo, Ursula Braun, Viresh Kumar, Wim Van Sebroeck,
	linux1394-devel, linux-mips, linux-pm, linuxppc-dev, linux-s390,
	linux-scsi, linux-watchdog, linux-wireless, linux-kernel

The expires field is normally initialized during the first mod_timer()
call. It was unused by all callers, so remove it from the macro.

Signed-off-by: Kees Cook <keescook@chromium.org>
---
 include/linux/kthread.h   | 2 +-
 include/linux/timer.h     | 5 ++---
 include/linux/workqueue.h | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 82e197eeac91..0d622b350d3f 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -117,7 +117,7 @@ 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,	\
-				     0, (unsigned long)&(dwork),	\
+				     (unsigned long)&(dwork),		\
 				     TIMER_IRQSAFE),			\
 	}
 
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 91e5a2cc81b5..10685c33e679 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -63,10 +63,9 @@ struct timer_list {
 
 #define TIMER_TRACE_FLAGMASK	(TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE)
 
-#define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \
+#define __TIMER_INITIALIZER(_function, _data, _flags) {		\
 		.entry = { .next = TIMER_ENTRY_STATIC },	\
 		.function = (_function),			\
-		.expires = (_expires),				\
 		.data = (_data),				\
 		.flags = (_flags),				\
 		__TIMER_LOCKDEP_MAP_INITIALIZER(		\
@@ -75,7 +74,7 @@ struct timer_list {
 
 #define DEFINE_TIMER(_name, _function)				\
 	struct timer_list _name =				\
-		__TIMER_INITIALIZER(_function, 0, 0, 0)
+		__TIMER_INITIALIZER(_function, 0, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 1c49431f3121..f4960260feaf 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -176,7 +176,7 @@ struct execute_work {
 #define __DELAYED_WORK_INITIALIZER(n, f, tflags) {			\
 	.work = __WORK_INITIALIZER((n).work, (f)),			\
 	.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,		\
-				     0, (unsigned long)&(n),		\
+				     (unsigned long)&(n),		\
 				     (tflags) | TIMER_IRQSAFE),		\
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 11/13] timer: Remove expires argument from __TIMER_INITIALIZER()
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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

The expires field is normally initialized during the first mod_timer()
call. It was unused by all callers, so remove it from the macro.

Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 include/linux/kthread.h   | 2 +-
 include/linux/timer.h     | 5 ++---
 include/linux/workqueue.h | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 82e197eeac91..0d622b350d3f 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -117,7 +117,7 @@ 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,	\
-				     0, (unsigned long)&(dwork),	\
+				     (unsigned long)&(dwork),		\
 				     TIMER_IRQSAFE),			\
 	}
 
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 91e5a2cc81b5..10685c33e679 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -63,10 +63,9 @@ struct timer_list {
 
 #define TIMER_TRACE_FLAGMASK	(TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE)
 
-#define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \
+#define __TIMER_INITIALIZER(_function, _data, _flags) {		\
 		.entry = { .next = TIMER_ENTRY_STATIC },	\
 		.function = (_function),			\
-		.expires = (_expires),				\
 		.data = (_data),				\
 		.flags = (_flags),				\
 		__TIMER_LOCKDEP_MAP_INITIALIZER(		\
@@ -75,7 +74,7 @@ struct timer_list {
 
 #define DEFINE_TIMER(_name, _function)				\
 	struct timer_list _name =				\
-		__TIMER_INITIALIZER(_function, 0, 0, 0)
+		__TIMER_INITIALIZER(_function, 0, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 1c49431f3121..f4960260feaf 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -176,7 +176,7 @@ struct execute_work {
 #define __DELAYED_WORK_INITIALIZER(n, f, tflags) {			\
 	.work = __WORK_INITIALIZER((n).work, (f)),			\
 	.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,		\
-				     0, (unsigned long)&(n),		\
+				     (unsigned long)&(n),		\
 				     (tflags) | TIMER_IRQSAFE),		\
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 11/13] timer: Remove expires argument from __TIMER_INITIALIZER()
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	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

The expires field is normally initialized during the first mod_timer()
call. It was unused by all callers, so remove it from the macro.

Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 include/linux/kthread.h   | 2 +-
 include/linux/timer.h     | 5 ++---
 include/linux/workqueue.h | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 82e197eeac91..0d622b350d3f 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -117,7 +117,7 @@ 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,	\
-				     0, (unsigned long)&(dwork),	\
+				     (unsigned long)&(dwork),		\
 				     TIMER_IRQSAFE),			\
 	}
 
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 91e5a2cc81b5..10685c33e679 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -63,10 +63,9 @@ struct timer_list {
 
 #define TIMER_TRACE_FLAGMASK	(TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE)
 
-#define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \
+#define __TIMER_INITIALIZER(_function, _data, _flags) {		\
 		.entry = { .next = TIMER_ENTRY_STATIC },	\
 		.function = (_function),			\
-		.expires = (_expires),				\
 		.data = (_data),				\
 		.flags = (_flags),				\
 		__TIMER_LOCKDEP_MAP_INITIALIZER(		\
@@ -75,7 +74,7 @@ struct timer_list {
 
 #define DEFINE_TIMER(_name, _function)				\
 	struct timer_list _name =				\
-		__TIMER_INITIALIZER(_function, 0, 0, 0)
+		__TIMER_INITIALIZER(_function, 0, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 1c49431f3121..f4960260feaf 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -176,7 +176,7 @@ struct execute_work {
 #define __DELAYED_WORK_INITIALIZER(n, f, tflags) {			\
 	.work = __WORK_INITIALIZER((n).work, (f)),			\
 	.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,		\
-				     0, (unsigned long)&(n),		\
+				     (unsigned long)&(n),		\
 				     (tflags) | TIMER_IRQSAFE),		\
 	}
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 12/13] kthread: Convert callback to use from_timer()
  2017-10-04 23:26 ` Kees Cook
  (?)
@ 2017-10-04 23:27   ` Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Petr Mladek, Tejun Heo, Oleg Nesterov,
	Arnd Bergmann, Benjamin Herrenschmidt, 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 Ellerman, Michael Reed, netdev,
	Paul Mackerras, Pavel Machek, Rafael J. Wysocki, Ralf Baechle,
	Sebastian Reichel, Stefan Richter, Stephen Boyd, Sudip Mukherjee,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linuxppc-dev, linux-s390, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

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.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Kees Cook <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 0d622b350d3f..35cbe3b0ce5b 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 1c19edf82427..ba3992c8c375 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
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 12/13] kthread: Convert callback to use from_timer()
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Petr Mladek, Tejun Heo, Oleg Nesterov,
	Arnd Bergmann, Benjamin Herrenschmidt, 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

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.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Kees Cook <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 0d622b350d3f..35cbe3b0ce5b 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 1c19edf82427..ba3992c8c375 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
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 12/13] kthread: Convert callback to use from_timer()
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Andrew Morton, Petr Mladek, Tejun Heo, Oleg Nesterov,
	Arnd Bergmann, Benjamin Herrenschmidt, 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

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.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Kees Cook <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 0d622b350d3f..35cbe3b0ce5b 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 1c19edf82427..ba3992c8c375 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
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 13/13] workqueue: Convert callback to use from_timer()
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Tejun Heo, Lai Jiangshan, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Greg Kroah-Hartman, Guenter Roeck,
	Harish Patil, Heiko Carstens, James E.J. Bottomley, John Stultz,
	Julian Wiedmann, Kalle Valo, Len Brown, Manish Chopra,
	Mark Gross, Martin K. Petersen, Martin Schwidefsky,
	Michael Ellerman, Michael Reed, netdev, Oleg Nesterov,
	Paul Mackerras, Pavel Machek, Petr Mladek, Rafael J. Wysocki,
	Ralf Baechle, Sebastian Reichel, Stefan Richter, Stephen Boyd,
	Sudip Mukherjee, Ursula Braun, Viresh Kumar, Wim Van Sebroeck,
	linux1394-devel, linux-mips, linux-pm, linuxppc-dev, linux-s390,
	linux-scsi, linux-watchdog, linux-wireless, linux-kernel

In preparation for unconditionally passing the struct timer_list pointer
to all timer callbacks, switch workqueue to use from_timer() and pass the
timer pointer explicitly.

Cc: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 include/linux/workqueue.h | 15 ++++++++-------
 kernel/workqueue.c        |  7 +++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index f4960260feaf..f3c47a05fd06 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -17,7 +17,7 @@ struct workqueue_struct;
 
 struct work_struct;
 typedef void (*work_func_t)(struct work_struct *work);
-void delayed_work_timer_fn(unsigned long __data);
+void delayed_work_timer_fn(struct timer_list *t);
 
 /*
  * The first word is the work queue pointer and the flags rolled into
@@ -175,8 +175,8 @@ struct execute_work {
 
 #define __DELAYED_WORK_INITIALIZER(n, f, tflags) {			\
 	.work = __WORK_INITIALIZER((n).work, (f)),			\
-	.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,		\
-				     (unsigned long)&(n),		\
+	.timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)delayed_work_timer_fn,\
+				     (TIMER_DATA_TYPE)&(n.timer),	\
 				     (tflags) | TIMER_IRQSAFE),		\
 	}
 
@@ -241,8 +241,9 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
 #define __INIT_DELAYED_WORK(_work, _func, _tflags)			\
 	do {								\
 		INIT_WORK(&(_work)->work, (_func));			\
-		__setup_timer(&(_work)->timer, delayed_work_timer_fn,	\
-			      (unsigned long)(_work),			\
+		__setup_timer(&(_work)->timer,				\
+			      (TIMER_FUNC_TYPE)delayed_work_timer_fn,	\
+			      (TIMER_DATA_TYPE)&(_work)->timer,		\
 			      (_tflags) | TIMER_IRQSAFE);		\
 	} while (0)
 
@@ -250,8 +251,8 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
 	do {								\
 		INIT_WORK_ONSTACK(&(_work)->work, (_func));		\
 		__setup_timer_on_stack(&(_work)->timer,			\
-				       delayed_work_timer_fn,		\
-				       (unsigned long)(_work),		\
+				       (TIMER_FUNC_TYPE)delayed_work_timer_fn,\
+				       (TIMER_DATA_TYPE)&(_work)->timer,\
 				       (_tflags) | TIMER_IRQSAFE);	\
 	} while (0)
 
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index a5361fc6215d..c77fdf6bf24f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1492,9 +1492,9 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq,
 }
 EXPORT_SYMBOL(queue_work_on);
 
-void delayed_work_timer_fn(unsigned long __data)
+void delayed_work_timer_fn(struct timer_list *t)
 {
-	struct delayed_work *dwork = (struct delayed_work *)__data;
+	struct delayed_work *dwork = from_timer(dwork, t, timer);
 
 	/* should have been called from irqsafe timer with irq already off */
 	__queue_work(dwork->cpu, dwork->wq, &dwork->work);
@@ -1508,8 +1508,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
 	struct work_struct *work = &dwork->work;
 
 	WARN_ON_ONCE(!wq);
-	WARN_ON_ONCE(timer->function != delayed_work_timer_fn ||
-		     timer->data != (unsigned long)dwork);
+	WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)delayed_work_timer_fn);
 	WARN_ON_ONCE(timer_pending(timer));
 	WARN_ON_ONCE(!list_empty(&work->entry));
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 13/13] workqueue: Convert callback to use from_timer()
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Tejun Heo, Lai Jiangshan, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Greg Kroah-Hartman, Guenter Roeck,
	Harish Patil, Heiko Carstens, James E.J. Bottomley, John Stultz,
	Julian Wiedmann, Kalle Valo, Len Brown, Manish Chopra,
	Mark Gross

In preparation for unconditionally passing the struct timer_list pointer
to all timer callbacks, switch workqueue to use from_timer() and pass the
timer pointer explicitly.

Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Lai Jiangshan <jiangshanlai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 include/linux/workqueue.h | 15 ++++++++-------
 kernel/workqueue.c        |  7 +++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index f4960260feaf..f3c47a05fd06 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -17,7 +17,7 @@ struct workqueue_struct;
 
 struct work_struct;
 typedef void (*work_func_t)(struct work_struct *work);
-void delayed_work_timer_fn(unsigned long __data);
+void delayed_work_timer_fn(struct timer_list *t);
 
 /*
  * The first word is the work queue pointer and the flags rolled into
@@ -175,8 +175,8 @@ struct execute_work {
 
 #define __DELAYED_WORK_INITIALIZER(n, f, tflags) {			\
 	.work = __WORK_INITIALIZER((n).work, (f)),			\
-	.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,		\
-				     (unsigned long)&(n),		\
+	.timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)delayed_work_timer_fn,\
+				     (TIMER_DATA_TYPE)&(n.timer),	\
 				     (tflags) | TIMER_IRQSAFE),		\
 	}
 
@@ -241,8 +241,9 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
 #define __INIT_DELAYED_WORK(_work, _func, _tflags)			\
 	do {								\
 		INIT_WORK(&(_work)->work, (_func));			\
-		__setup_timer(&(_work)->timer, delayed_work_timer_fn,	\
-			      (unsigned long)(_work),			\
+		__setup_timer(&(_work)->timer,				\
+			      (TIMER_FUNC_TYPE)delayed_work_timer_fn,	\
+			      (TIMER_DATA_TYPE)&(_work)->timer,		\
 			      (_tflags) | TIMER_IRQSAFE);		\
 	} while (0)
 
@@ -250,8 +251,8 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
 	do {								\
 		INIT_WORK_ONSTACK(&(_work)->work, (_func));		\
 		__setup_timer_on_stack(&(_work)->timer,			\
-				       delayed_work_timer_fn,		\
-				       (unsigned long)(_work),		\
+				       (TIMER_FUNC_TYPE)delayed_work_timer_fn,\
+				       (TIMER_DATA_TYPE)&(_work)->timer,\
 				       (_tflags) | TIMER_IRQSAFE);	\
 	} while (0)
 
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index a5361fc6215d..c77fdf6bf24f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1492,9 +1492,9 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq,
 }
 EXPORT_SYMBOL(queue_work_on);
 
-void delayed_work_timer_fn(unsigned long __data)
+void delayed_work_timer_fn(struct timer_list *t)
 {
-	struct delayed_work *dwork = (struct delayed_work *)__data;
+	struct delayed_work *dwork = from_timer(dwork, t, timer);
 
 	/* should have been called from irqsafe timer with irq already off */
 	__queue_work(dwork->cpu, dwork->wq, &dwork->work);
@@ -1508,8 +1508,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
 	struct work_struct *work = &dwork->work;
 
 	WARN_ON_ONCE(!wq);
-	WARN_ON_ONCE(timer->function != delayed_work_timer_fn ||
-		     timer->data != (unsigned long)dwork);
+	WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)delayed_work_timer_fn);
 	WARN_ON_ONCE(timer_pending(timer));
 	WARN_ON_ONCE(!list_empty(&work->entry));
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [PATCH 13/13] workqueue: Convert callback to use from_timer()
@ 2017-10-04 23:27   ` Kees Cook
  0 siblings, 0 replies; 98+ messages in thread
From: Kees Cook @ 2017-10-04 23:27 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Kees Cook, Tejun Heo, Lai Jiangshan, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Geert Uytterhoeven, Greg Kroah-Hartman, Guenter Roeck,
	Harish Patil, Heiko Carstens, James E.J. Bottomley, John Stultz,
	Julian Wiedmann, Kalle Valo, Len Brown, Manish Chopra,
	Mark Gross

In preparation for unconditionally passing the struct timer_list pointer
to all timer callbacks, switch workqueue to use from_timer() and pass the
timer pointer explicitly.

Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Lai Jiangshan <jiangshanlai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 include/linux/workqueue.h | 15 ++++++++-------
 kernel/workqueue.c        |  7 +++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index f4960260feaf..f3c47a05fd06 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -17,7 +17,7 @@ struct workqueue_struct;
 
 struct work_struct;
 typedef void (*work_func_t)(struct work_struct *work);
-void delayed_work_timer_fn(unsigned long __data);
+void delayed_work_timer_fn(struct timer_list *t);
 
 /*
  * The first word is the work queue pointer and the flags rolled into
@@ -175,8 +175,8 @@ struct execute_work {
 
 #define __DELAYED_WORK_INITIALIZER(n, f, tflags) {			\
 	.work = __WORK_INITIALIZER((n).work, (f)),			\
-	.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,		\
-				     (unsigned long)&(n),		\
+	.timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)delayed_work_timer_fn,\
+				     (TIMER_DATA_TYPE)&(n.timer),	\
 				     (tflags) | TIMER_IRQSAFE),		\
 	}
 
@@ -241,8 +241,9 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
 #define __INIT_DELAYED_WORK(_work, _func, _tflags)			\
 	do {								\
 		INIT_WORK(&(_work)->work, (_func));			\
-		__setup_timer(&(_work)->timer, delayed_work_timer_fn,	\
-			      (unsigned long)(_work),			\
+		__setup_timer(&(_work)->timer,				\
+			      (TIMER_FUNC_TYPE)delayed_work_timer_fn,	\
+			      (TIMER_DATA_TYPE)&(_work)->timer,		\
 			      (_tflags) | TIMER_IRQSAFE);		\
 	} while (0)
 
@@ -250,8 +251,8 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
 	do {								\
 		INIT_WORK_ONSTACK(&(_work)->work, (_func));		\
 		__setup_timer_on_stack(&(_work)->timer,			\
-				       delayed_work_timer_fn,		\
-				       (unsigned long)(_work),		\
+				       (TIMER_FUNC_TYPE)delayed_work_timer_fn,\
+				       (TIMER_DATA_TYPE)&(_work)->timer,\
 				       (_tflags) | TIMER_IRQSAFE);	\
 	} while (0)
 
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index a5361fc6215d..c77fdf6bf24f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1492,9 +1492,9 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq,
 }
 EXPORT_SYMBOL(queue_work_on);
 
-void delayed_work_timer_fn(unsigned long __data)
+void delayed_work_timer_fn(struct timer_list *t)
 {
-	struct delayed_work *dwork = (struct delayed_work *)__data;
+	struct delayed_work *dwork = from_timer(dwork, t, timer);
 
 	/* should have been called from irqsafe timer with irq already off */
 	__queue_work(dwork->cpu, dwork->wq, &dwork->work);
@@ -1508,8 +1508,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
 	struct work_struct *work = &dwork->work;
 
 	WARN_ON_ONCE(!wq);
-	WARN_ON_ONCE(timer->function != delayed_work_timer_fn ||
-		     timer->data != (unsigned long)dwork);
+	WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)delayed_work_timer_fn);
 	WARN_ON_ONCE(timer_pending(timer));
 	WARN_ON_ONCE(!list_empty(&work->entry));
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* Re: [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER
  2017-10-04 23:27   ` Kees Cook
  (?)
@ 2017-10-05  0:12     ` Guenter Roeck
  -1 siblings, 0 replies; 98+ messages in thread
From: Guenter Roeck @ 2017-10-05  0:12 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Ralf Baechle, Wim Van Sebroeck, Geert Uytterhoeven, linux-mips,
	linux-watchdog, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Greg Kroah-Hartman,
	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 Ellerman, Michael Reed, netdev,
	Oleg Nesterov, Paul Mackerras, Pavel Machek, Petr Mladek,
	Rafael J. Wysocki, Sebastian Reichel, Stefan Richter,
	Stephen Boyd, Sudip Mukherjee, Tejun Heo, Ursula Braun,
	Viresh Kumar, linux1394-devel, linux-pm, linuxppc-dev,
	linux-s390, linux-scsi, linux-wireless, linux-kernel

On 10/04/2017 04:27 PM, Kees Cook wrote:
> The expire and data arguments of DEFINE_TIMER are only used in two places
> and are ignored by the code (malta-display.c only uses mod_timer(),
> never add_timer(), so the preset expires value is ignored). Set both
> sets of arguments to zero.
> 
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: linux-mips@linux-mips.org
> Cc: linux-watchdog@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

For watchdog:

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   arch/mips/mti-malta/malta-display.c | 6 +++---
>   drivers/watchdog/alim7101_wdt.c     | 4 ++--
>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
> index d4f807191ecd..ac813158b9b8 100644
> --- a/arch/mips/mti-malta/malta-display.c
> +++ b/arch/mips/mti-malta/malta-display.c
> @@ -36,10 +36,10 @@ void mips_display_message(const char *str)
>   	}
>   }
>   
> -static void scroll_display_message(unsigned long data);
> -static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
> +static void scroll_display_message(unsigned long unused);
> +static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
>   
> -static void scroll_display_message(unsigned long data)
> +static void scroll_display_message(unsigned long unused)
>   {
>   	mips_display_message(&display_string[display_count++]);
>   	if (display_count == max_display_count)
> diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
> index 665e0e7dfe1e..3c1f6ac68ea9 100644
> --- a/drivers/watchdog/alim7101_wdt.c
> +++ b/drivers/watchdog/alim7101_wdt.c
> @@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
>   		"Use the gpio watchdog (required by old cobalt boards).");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1);
> +static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> @@ -87,7 +87,7 @@ MODULE_PARM_DESC(nowayout,
>    *	Whack the dog
>    */
>   
> -static void wdt_timer_ping(unsigned long data)
> +static void wdt_timer_ping(unsigned long unused)
>   {
>   	/* If we got a heartbeat pulse within the WDT_US_INTERVAL
>   	 * we agree to ping the WDT
> 

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER
@ 2017-10-05  0:12     ` Guenter Roeck
  0 siblings, 0 replies; 98+ messages in thread
From: Guenter Roeck @ 2017-10-05  0:12 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Ralf Baechle, Wim Van Sebroeck, Geert Uytterhoeven, linux-mips,
	linux-watchdog, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Greg Kroah-Hartman,
	Harish Patil, Heiko Carstens, James E.J. Bottomley, John Stultz,
	Julian Wiedmann, Kalle Valo, Lai Jiangshan, Len Brown,
	Manish Chopra, M

On 10/04/2017 04:27 PM, Kees Cook wrote:
> The expire and data arguments of DEFINE_TIMER are only used in two places
> and are ignored by the code (malta-display.c only uses mod_timer(),
> never add_timer(), so the preset expires value is ignored). Set both
> sets of arguments to zero.
> 
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: linux-mips@linux-mips.org
> Cc: linux-watchdog@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

For watchdog:

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   arch/mips/mti-malta/malta-display.c | 6 +++---
>   drivers/watchdog/alim7101_wdt.c     | 4 ++--
>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
> index d4f807191ecd..ac813158b9b8 100644
> --- a/arch/mips/mti-malta/malta-display.c
> +++ b/arch/mips/mti-malta/malta-display.c
> @@ -36,10 +36,10 @@ void mips_display_message(const char *str)
>   	}
>   }
>   
> -static void scroll_display_message(unsigned long data);
> -static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
> +static void scroll_display_message(unsigned long unused);
> +static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
>   
> -static void scroll_display_message(unsigned long data)
> +static void scroll_display_message(unsigned long unused)
>   {
>   	mips_display_message(&display_string[display_count++]);
>   	if (display_count == max_display_count)
> diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
> index 665e0e7dfe1e..3c1f6ac68ea9 100644
> --- a/drivers/watchdog/alim7101_wdt.c
> +++ b/drivers/watchdog/alim7101_wdt.c
> @@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
>   		"Use the gpio watchdog (required by old cobalt boards).");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1);
> +static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> @@ -87,7 +87,7 @@ MODULE_PARM_DESC(nowayout,
>    *	Whack the dog
>    */
>   
> -static void wdt_timer_ping(unsigned long data)
> +static void wdt_timer_ping(unsigned long unused)
>   {
>   	/* If we got a heartbeat pulse within the WDT_US_INTERVAL
>   	 * we agree to ping the WDT
> 

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER
@ 2017-10-05  0:12     ` Guenter Roeck
  0 siblings, 0 replies; 98+ messages in thread
From: Guenter Roeck @ 2017-10-05  0:12 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Ralf Baechle, Wim Van Sebroeck, Geert Uytterhoeven, linux-mips,
	linux-watchdog, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Greg Kroah-Hartman,
	Harish Patil, Heiko Carstens, James E.J. Bottomley, John Stultz,
	Julian Wiedmann, Kalle Valo, Lai Jiangshan, Len Brown,
	Manish Chopra

On 10/04/2017 04:27 PM, Kees Cook wrote:
> The expire and data arguments of DEFINE_TIMER are only used in two places
> and are ignored by the code (malta-display.c only uses mod_timer(),
> never add_timer(), so the preset expires value is ignored). Set both
> sets of arguments to zero.
> 
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: linux-mips@linux-mips.org
> Cc: linux-watchdog@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

For watchdog:

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   arch/mips/mti-malta/malta-display.c | 6 +++---
>   drivers/watchdog/alim7101_wdt.c     | 4 ++--
>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
> index d4f807191ecd..ac813158b9b8 100644
> --- a/arch/mips/mti-malta/malta-display.c
> +++ b/arch/mips/mti-malta/malta-display.c
> @@ -36,10 +36,10 @@ void mips_display_message(const char *str)
>   	}
>   }
>   
> -static void scroll_display_message(unsigned long data);
> -static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
> +static void scroll_display_message(unsigned long unused);
> +static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
>   
> -static void scroll_display_message(unsigned long data)
> +static void scroll_display_message(unsigned long unused)
>   {
>   	mips_display_message(&display_string[display_count++]);
>   	if (display_count == max_display_count)
> diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
> index 665e0e7dfe1e..3c1f6ac68ea9 100644
> --- a/drivers/watchdog/alim7101_wdt.c
> +++ b/drivers/watchdog/alim7101_wdt.c
> @@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
>   		"Use the gpio watchdog (required by old cobalt boards).");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1);
> +static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> @@ -87,7 +87,7 @@ MODULE_PARM_DESC(nowayout,
>    *	Whack the dog
>    */
>   
> -static void wdt_timer_ping(unsigned long data)
> +static void wdt_timer_ping(unsigned long unused)
>   {
>   	/* If we got a heartbeat pulse within the WDT_US_INTERVAL
>   	 * we agree to ping the WDT
> 

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  0:13     ` Guenter Roeck
  0 siblings, 0 replies; 98+ messages in thread
From: Guenter Roeck @ 2017-10-05  0:13 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	Chris Metcalf, Geert Uytterhoeven, Greg Kroah-Hartman,
	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 Ellerman, Michael Reed, netdev,
	Oleg Nesterov, Paul Mackerras, Pavel Machek, Petr Mladek,
	Rafael J. Wysocki, Ralf Baechle, Sebastian Reichel,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linuxppc-dev, linux-s390, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

On 10/04/2017 04:27 PM, Kees Cook wrote:
> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>    perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>      $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

For watchdog:

Acked-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
>   arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
>   arch/m68k/amiga/amisound.c                | 2 +-
>   arch/m68k/mac/macboing.c                  | 2 +-
>   arch/mips/mti-malta/malta-display.c       | 2 +-
>   arch/parisc/kernel/pdc_cons.c             | 2 +-
>   arch/s390/mm/cmm.c                        | 2 +-
>   drivers/atm/idt77105.c                    | 4 ++--
>   drivers/atm/iphase.c                      | 2 +-
>   drivers/block/ataflop.c                   | 8 ++++----
>   drivers/char/dtlk.c                       | 2 +-
>   drivers/char/hangcheck-timer.c            | 2 +-
>   drivers/char/nwbutton.c                   | 2 +-
>   drivers/char/rtc.c                        | 2 +-
>   drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
>   drivers/net/cris/eth_v10.c                | 6 +++---
>   drivers/net/hamradio/yam.c                | 2 +-
>   drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
>   drivers/staging/speakup/main.c            | 2 +-
>   drivers/staging/speakup/synth.c           | 2 +-
>   drivers/tty/cyclades.c                    | 2 +-
>   drivers/tty/isicom.c                      | 2 +-
>   drivers/tty/moxa.c                        | 2 +-
>   drivers/tty/rocket.c                      | 2 +-
>   drivers/tty/vt/keyboard.c                 | 2 +-
>   drivers/tty/vt/vt.c                       | 2 +-
>   drivers/watchdog/alim7101_wdt.c           | 2 +-
>   drivers/watchdog/machzwd.c                | 2 +-
>   drivers/watchdog/mixcomwd.c               | 2 +-
>   drivers/watchdog/sbc60xxwdt.c             | 2 +-
>   drivers/watchdog/sc520_wdt.c              | 2 +-
>   drivers/watchdog/via_wdt.c                | 2 +-
>   drivers/watchdog/w83877f_wdt.c            | 2 +-
>   drivers/xen/grant-table.c                 | 2 +-
>   fs/pstore/platform.c                      | 2 +-
>   include/linux/timer.h                     | 4 ++--
>   kernel/irq/spurious.c                     | 2 +-
>   lib/random32.c                            | 2 +-
>   net/atm/mpc.c                             | 2 +-
>   net/decnet/dn_route.c                     | 2 +-
>   net/ipv6/ip6_flowlabel.c                  | 2 +-
>   net/netrom/nr_loopback.c                  | 2 +-
>   security/keys/gc.c                        | 2 +-
>   sound/oss/midibuf.c                       | 2 +-
>   sound/oss/soundcard.c                     | 2 +-
>   sound/oss/sys_timer.c                     | 2 +-
>   sound/oss/uart6850.c                      | 2 +-
>   47 files changed, 54 insertions(+), 54 deletions(-)
> 
> diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
> index b3bd0e137f6d..b3689a141ec6 100644
> --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
> +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
> @@ -174,7 +174,7 @@ static int power_button_countdown;
>   #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
>   
>   static void dsmg600_power_handler(unsigned long data);
> -static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0);
> +static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler);
>   
>   static void dsmg600_power_handler(unsigned long data)
>   {
> diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
> index 4e0f762bc651..562d05f9888e 100644
> --- a/arch/arm/mach-ixp4xx/nas100d-setup.c
> +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
> @@ -197,7 +197,7 @@ static int power_button_countdown;
>   #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
>   
>   static void nas100d_power_handler(unsigned long data);
> -static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0);
> +static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler);
>   
>   static void nas100d_power_handler(unsigned long data)
>   {
> diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
> index 90a60d758f8b..a23f48181fd6 100644
> --- a/arch/m68k/amiga/amisound.c
> +++ b/arch/m68k/amiga/amisound.c
> @@ -66,7 +66,7 @@ void __init amiga_init_sound(void)
>   }
>   
>   static void nosound( unsigned long ignored );
> -static DEFINE_TIMER(sound_timer, nosound, 0, 0);
> +static DEFINE_TIMER(sound_timer, nosound);
>   
>   void amiga_mksound( unsigned int hz, unsigned int ticks )
>   {
> diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c
> index ffaa1f6439ae..9a52aff183d0 100644
> --- a/arch/m68k/mac/macboing.c
> +++ b/arch/m68k/mac/macboing.c
> @@ -56,7 +56,7 @@ static void ( *mac_special_bell )( unsigned int, unsigned int, unsigned int );
>   /*
>    * our timer to start/continue/stop the bell
>    */
> -static DEFINE_TIMER(mac_sound_timer, mac_nosound, 0, 0);
> +static DEFINE_TIMER(mac_sound_timer, mac_nosound);
>   
>   /*
>    * Sort of initialize the sound chip (called from mac_mksound on the first
> diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
> index ac813158b9b8..063de44675ce 100644
> --- a/arch/mips/mti-malta/malta-display.c
> +++ b/arch/mips/mti-malta/malta-display.c
> @@ -37,7 +37,7 @@ void mips_display_message(const char *str)
>   }
>   
>   static void scroll_display_message(unsigned long unused);
> -static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
> +static DEFINE_TIMER(mips_scroll_timer, scroll_display_message);
>   
>   static void scroll_display_message(unsigned long unused)
>   {
> diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
> index 10a5ae9553fd..27a2dd616a7d 100644
> --- a/arch/parisc/kernel/pdc_cons.c
> +++ b/arch/parisc/kernel/pdc_cons.c
> @@ -92,7 +92,7 @@ static int pdc_console_setup(struct console *co, char *options)
>   #define PDC_CONS_POLL_DELAY (30 * HZ / 1000)
>   
>   static void pdc_console_poll(unsigned long unused);
> -static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0);
> +static DEFINE_TIMER(pdc_console_timer, pdc_console_poll);
>   static struct tty_port tty_port;
>   
>   static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
> diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
> index 829c63dbc81a..2dbdcd85b68f 100644
> --- a/arch/s390/mm/cmm.c
> +++ b/arch/s390/mm/cmm.c
> @@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(cmm_lock);
>   
>   static struct task_struct *cmm_thread_ptr;
>   static DECLARE_WAIT_QUEUE_HEAD(cmm_thread_wait);
> -static DEFINE_TIMER(cmm_timer, NULL, 0, 0);
> +static DEFINE_TIMER(cmm_timer, NULL);
>   
>   static void cmm_timer_fn(unsigned long);
>   static void cmm_set_timer(void);
> diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
> index 082aa02abc57..57af9fd198e4 100644
> --- a/drivers/atm/idt77105.c
> +++ b/drivers/atm/idt77105.c
> @@ -49,8 +49,8 @@ static void idt77105_stats_timer_func(unsigned long);
>   static void idt77105_restart_timer_func(unsigned long);
>   
>   
> -static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func, 0, 0);
> -static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func, 0, 0);
> +static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func);
> +static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func);
>   static int start_timer = 1;
>   static struct idt77105_priv *idt77105_all = NULL;
>   
> diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
> index fc72b763fdd7..ad6b582c268e 100644
> --- a/drivers/atm/iphase.c
> +++ b/drivers/atm/iphase.c
> @@ -76,7 +76,7 @@ static IADEV *ia_dev[8];
>   static struct atm_dev *_ia_dev[8];
>   static int iadev_count;
>   static void ia_led_timer(unsigned long arg);
> -static DEFINE_TIMER(ia_timer, ia_led_timer, 0, 0);
> +static DEFINE_TIMER(ia_timer, ia_led_timer);
>   static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ;
>   static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ;
>   static uint IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER
> diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
> index 92da886180aa..ae596e55bcb6 100644
> --- a/drivers/block/ataflop.c
> +++ b/drivers/block/ataflop.c
> @@ -373,10 +373,10 @@ static void floppy_release(struct gendisk *disk, fmode_t mode);
>   
>   /************************* End of Prototypes **************************/
>   
> -static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer, 0, 0);
> -static DEFINE_TIMER(readtrack_timer, fd_readtrack_check, 0, 0);
> -static DEFINE_TIMER(timeout_timer, fd_times_out, 0, 0);
> -static DEFINE_TIMER(fd_timer, check_change, 0, 0);
> +static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer);
> +static DEFINE_TIMER(readtrack_timer, fd_readtrack_check);
> +static DEFINE_TIMER(timeout_timer, fd_times_out);
> +static DEFINE_TIMER(fd_timer, check_change);
>   	
>   static void fd_end_request_cur(blk_status_t err)
>   {
> diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
> index 58471394beb9..1a0385ed6417 100644
> --- a/drivers/char/dtlk.c
> +++ b/drivers/char/dtlk.c
> @@ -84,7 +84,7 @@ static int dtlk_has_indexing;
>   static unsigned int dtlk_portlist[] =
>   {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
>   static wait_queue_head_t dtlk_process_list;
> -static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0);
> +static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick);
>   
>   /* prototypes for file_operations struct */
>   static ssize_t dtlk_read(struct file *, char __user *,
> diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c
> index 5406b90bf626..5b8db2ed844d 100644
> --- a/drivers/char/hangcheck-timer.c
> +++ b/drivers/char/hangcheck-timer.c
> @@ -124,7 +124,7 @@ static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;
>   
>   static void hangcheck_fire(unsigned long);
>   
> -static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire, 0, 0);
> +static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire);
>   
>   static void hangcheck_fire(unsigned long data)
>   {
> diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
> index e6d0d271c58c..44006ed9558f 100644
> --- a/drivers/char/nwbutton.c
> +++ b/drivers/char/nwbutton.c
> @@ -27,7 +27,7 @@ static void button_sequence_finished (unsigned long parameters);
>   
>   static int button_press_count;		/* The count of button presses */
>   /* Times for the end of a sequence */
> -static DEFINE_TIMER(button_timer, button_sequence_finished, 0, 0);
> +static DEFINE_TIMER(button_timer, button_sequence_finished);
>   static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
>   static char button_output_buffer[32];	/* Stores data to write out of device */
>   static int bcount;			/* The number of bytes in the buffer */
> diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
> index 974d48927b07..616871e68e09 100644
> --- a/drivers/char/rtc.c
> +++ b/drivers/char/rtc.c
> @@ -137,7 +137,7 @@ static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
>   #ifdef RTC_IRQ
>   static void rtc_dropped_irq(unsigned long data);
>   
> -static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
> +static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq);
>   #endif
>   
>   static ssize_t rtc_read(struct file *file, char __user *buf,
> diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
> index 3b3db8c868e0..d3265b6b58b8 100644
> --- a/drivers/input/touchscreen/s3c2410_ts.c
> +++ b/drivers/input/touchscreen/s3c2410_ts.c
> @@ -145,7 +145,7 @@ static void touch_timer_fire(unsigned long data)
>   	}
>   }
>   
> -static DEFINE_TIMER(touch_timer, touch_timer_fire, 0, 0);
> +static DEFINE_TIMER(touch_timer, touch_timer_fire);
>   
>   /**
>    * stylus_irq - touchscreen stylus event interrupt
> diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
> index 017f48cdcab9..1fcc86fa4e05 100644
> --- a/drivers/net/cris/eth_v10.c
> +++ b/drivers/net/cris/eth_v10.c
> @@ -165,8 +165,8 @@ static unsigned int network_rec_config_shadow = 0;
>   static unsigned int network_tr_ctrl_shadow = 0;
>   
>   /* Network speed indication. */
> -static DEFINE_TIMER(speed_timer, NULL, 0, 0);
> -static DEFINE_TIMER(clear_led_timer, NULL, 0, 0);
> +static DEFINE_TIMER(speed_timer, NULL);
> +static DEFINE_TIMER(clear_led_timer, NULL);
>   static int current_speed; /* Speed read from transceiver */
>   static int current_speed_selection; /* Speed selected by user */
>   static unsigned long led_next_time;
> @@ -174,7 +174,7 @@ static int led_active;
>   static int rx_queue_len;
>   
>   /* Duplex */
> -static DEFINE_TIMER(duplex_timer, NULL, 0, 0);
> +static DEFINE_TIMER(duplex_timer, NULL);
>   static int full_duplex;
>   static enum duplex current_duplex;
>   
> diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
> index 7a7c5224a336..104f71fa9c5e 100644
> --- a/drivers/net/hamradio/yam.c
> +++ b/drivers/net/hamradio/yam.c
> @@ -157,7 +157,7 @@ static struct net_device *yam_devs[NR_PORTS];
>   
>   static struct yam_mcs *yam_data;
>   
> -static DEFINE_TIMER(yam_timer, NULL, 0, 0);
> +static DEFINE_TIMER(yam_timer, NULL);
>   
>   /* --------------------------------------------------------------------- */
>   
> diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
> index 94bf01f8b2a8..ede89d4ffc88 100644
> --- a/drivers/net/wireless/atmel/at76c50x-usb.c
> +++ b/drivers/net/wireless/atmel/at76c50x-usb.c
> @@ -519,7 +519,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
>   /* LED trigger */
>   static int tx_activity;
>   static void at76_ledtrig_tx_timerfunc(unsigned long data);
> -static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc, 0, 0);
> +static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc);
>   DEFINE_LED_TRIGGER(ledtrig_tx);
>   
>   static void at76_ledtrig_tx_timerfunc(unsigned long data)
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index 67956e24779c..b61e9becb612 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1165,7 +1165,7 @@ static const int NUM_CTL_LABELS = (MSG_CTL_END - MSG_CTL_START + 1);
>   
>   static void read_all_doc(struct vc_data *vc);
>   static void cursor_done(u_long data);
> -static DEFINE_TIMER(cursor_timer, cursor_done, 0, 0);
> +static DEFINE_TIMER(cursor_timer, cursor_done);
>   
>   static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
>   {
> diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
> index a1ca68c76579..6ddd3fc3f08d 100644
> --- a/drivers/staging/speakup/synth.c
> +++ b/drivers/staging/speakup/synth.c
> @@ -158,7 +158,7 @@ static void thread_wake_up(u_long data)
>   	wake_up_interruptible_all(&speakup_event);
>   }
>   
> -static DEFINE_TIMER(thread_timer, thread_wake_up, 0, 0);
> +static DEFINE_TIMER(thread_timer, thread_wake_up);
>   
>   void synth_start(void)
>   {
> diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
> index d272bc4e7fb5..dac8a1a8e4ac 100644
> --- a/drivers/tty/cyclades.c
> +++ b/drivers/tty/cyclades.c
> @@ -283,7 +283,7 @@ static void cyz_poll(unsigned long);
>   /* The Cyclades-Z polling cycle is defined by this variable */
>   static long cyz_polling_cycle = CZ_DEF_POLL;
>   
> -static DEFINE_TIMER(cyz_timerlist, cyz_poll, 0, 0);
> +static DEFINE_TIMER(cyz_timerlist, cyz_poll);
>   
>   #else				/* CONFIG_CYZ_INTR */
>   static void cyz_rx_restart(unsigned long);
> diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
> index 61ecdd6b2fc2..40af32108ff5 100644
> --- a/drivers/tty/isicom.c
> +++ b/drivers/tty/isicom.c
> @@ -177,7 +177,7 @@ static struct tty_driver *isicom_normal;
>   static void isicom_tx(unsigned long _data);
>   static void isicom_start(struct tty_struct *tty);
>   
> -static DEFINE_TIMER(tx, isicom_tx, 0, 0);
> +static DEFINE_TIMER(tx, isicom_tx);
>   
>   /*   baud index mappings from linux defns to isi */
>   
> diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
> index 7f3d4cb0341b..93d37655d928 100644
> --- a/drivers/tty/moxa.c
> +++ b/drivers/tty/moxa.c
> @@ -428,7 +428,7 @@ static const struct tty_port_operations moxa_port_ops = {
>   };
>   
>   static struct tty_driver *moxaDriver;
> -static DEFINE_TIMER(moxaTimer, moxa_poll, 0, 0);
> +static DEFINE_TIMER(moxaTimer, moxa_poll);
>   
>   /*
>    * HW init
> diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
> index 20d79a6007d5..aa695fda1084 100644
> --- a/drivers/tty/rocket.c
> +++ b/drivers/tty/rocket.c
> @@ -111,7 +111,7 @@ static struct r_port *rp_table[MAX_RP_PORTS];	       /*  The main repository of
>   static unsigned int xmit_flags[NUM_BOARDS];	       /*  Bit significant, indicates port had data to transmit. */
>   						       /*  eg.  Bit 0 indicates port 0 has xmit data, ...        */
>   static atomic_t rp_num_ports_open;	               /*  Number of serial ports open                           */
> -static DEFINE_TIMER(rocket_timer, rp_do_poll, 0, 0);
> +static DEFINE_TIMER(rocket_timer, rp_do_poll);
>   
>   static unsigned long board1;	                       /* ISA addresses, retrieved from rocketport.conf          */
>   static unsigned long board2;
> diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
> index f4166263bb3a..f974d6340d04 100644
> --- a/drivers/tty/vt/keyboard.c
> +++ b/drivers/tty/vt/keyboard.c
> @@ -250,7 +250,7 @@ static void kd_nosound(unsigned long ignored)
>   	input_handler_for_each_handle(&kbd_handler, &zero, kd_sound_helper);
>   }
>   
> -static DEFINE_TIMER(kd_mksound_timer, kd_nosound, 0, 0);
> +static DEFINE_TIMER(kd_mksound_timer, kd_nosound);
>   
>   void kd_mksound(unsigned int hz, unsigned int ticks)
>   {
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 2ebaba16f785..602d71630952 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -228,7 +228,7 @@ static int scrollback_delta;
>    */
>   int (*console_blank_hook)(int);
>   
> -static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
> +static DEFINE_TIMER(console_timer, blank_screen_t);
>   static int blank_state;
>   static int blank_timer_expired;
>   enum {
> diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
> index 3c1f6ac68ea9..18e896eeca62 100644
> --- a/drivers/watchdog/alim7101_wdt.c
> +++ b/drivers/watchdog/alim7101_wdt.c
> @@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
>   		"Use the gpio watchdog (required by old cobalt boards).");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c
> index 9826b59ef734..8a616a57bb90 100644
> --- a/drivers/watchdog/machzwd.c
> +++ b/drivers/watchdog/machzwd.c
> @@ -127,7 +127,7 @@ static int zf_action = GEN_RESET;
>   static unsigned long zf_is_open;
>   static char zf_expect_close;
>   static DEFINE_SPINLOCK(zf_port_lock);
> -static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
> +static DEFINE_TIMER(zf_timer, zf_ping);
>   static unsigned long next_heartbeat;
>   
>   
> diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c
> index be86ea359eee..c9e38096ea91 100644
> --- a/drivers/watchdog/mixcomwd.c
> +++ b/drivers/watchdog/mixcomwd.c
> @@ -105,7 +105,7 @@ static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */
>   
>   static int watchdog_port;
>   static int mixcomwd_timer_alive;
> -static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0);
> +static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun);
>   static char expect_close;
>   
>   static bool nowayout = WATCHDOG_NOWAYOUT;
> diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
> index 2eef58a0cf05..8d589939bc84 100644
> --- a/drivers/watchdog/sbc60xxwdt.c
> +++ b/drivers/watchdog/sbc60xxwdt.c
> @@ -113,7 +113,7 @@ MODULE_PARM_DESC(nowayout,
>   				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
> index 1cfd3f6a13d5..3e9bbaa37bf4 100644
> --- a/drivers/watchdog/sc520_wdt.c
> +++ b/drivers/watchdog/sc520_wdt.c
> @@ -124,7 +124,7 @@ MODULE_PARM_DESC(nowayout,
>   static __u16 __iomem *wdtmrctl;
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/watchdog/via_wdt.c b/drivers/watchdog/via_wdt.c
> index 5f9cbc37520d..ad3c3be13b40 100644
> --- a/drivers/watchdog/via_wdt.c
> +++ b/drivers/watchdog/via_wdt.c
> @@ -68,7 +68,7 @@ static struct resource wdt_res;
>   static void __iomem *wdt_mem;
>   static unsigned int mmio;
>   static void wdt_timer_tick(unsigned long data);
> -static DEFINE_TIMER(timer, wdt_timer_tick, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_tick);
>   					/* The timer that pings the watchdog */
>   static unsigned long next_heartbeat;	/* the next_heartbeat for the timer */
>   
> diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
> index f0483c75ed32..ba6b680af100 100644
> --- a/drivers/watchdog/w83877f_wdt.c
> +++ b/drivers/watchdog/w83877f_wdt.c
> @@ -98,7 +98,7 @@ MODULE_PARM_DESC(nowayout,
>   				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
> index 2c6a9114d332..a8721d718186 100644
> --- a/drivers/xen/grant-table.c
> +++ b/drivers/xen/grant-table.c
> @@ -305,7 +305,7 @@ struct deferred_entry {
>   };
>   static LIST_HEAD(deferred_list);
>   static void gnttab_handle_deferred(unsigned long);
> -static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred, 0, 0);
> +static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred);
>   
>   static void gnttab_handle_deferred(unsigned long unused)
>   {
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index 2b21d180157c..ec7199e859d2 100644
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -62,7 +62,7 @@ MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content "
>   static int pstore_new_entry;
>   
>   static void pstore_timefunc(unsigned long);
> -static DEFINE_TIMER(pstore_timer, pstore_timefunc, 0, 0);
> +static DEFINE_TIMER(pstore_timer, pstore_timefunc);
>   
>   static void pstore_dowork(struct work_struct *);
>   static DECLARE_WORK(pstore_work, pstore_dowork);
> diff --git a/include/linux/timer.h b/include/linux/timer.h
> index a33220311361..91e5a2cc81b5 100644
> --- a/include/linux/timer.h
> +++ b/include/linux/timer.h
> @@ -73,9 +73,9 @@ struct timer_list {
>   			__FILE__ ":" __stringify(__LINE__))	\
>   	}
>   
> -#define DEFINE_TIMER(_name, _function, _expires, _data)		\
> +#define DEFINE_TIMER(_name, _function)				\
>   	struct timer_list _name =				\
> -		__TIMER_INITIALIZER(_function, _expires, _data, 0)
> +		__TIMER_INITIALIZER(_function, 0, 0, 0)
>   
>   void init_timer_key(struct timer_list *timer, unsigned int flags,
>   		    const char *name, struct lock_class_key *key);
> diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
> index 061ba7eed4ed..c805e8691c22 100644
> --- a/kernel/irq/spurious.c
> +++ b/kernel/irq/spurious.c
> @@ -20,7 +20,7 @@ static int irqfixup __read_mostly;
>   
>   #define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
>   static void poll_spurious_irqs(unsigned long dummy);
> -static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0);
> +static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs);
>   static int irq_poll_cpu;
>   static atomic_t irq_poll_active;
>   
> diff --git a/lib/random32.c b/lib/random32.c
> index fa594b1140e6..6e91b75c113f 100644
> --- a/lib/random32.c
> +++ b/lib/random32.c
> @@ -214,7 +214,7 @@ core_initcall(prandom_init);
>   
>   static void __prandom_timer(unsigned long dontcare);
>   
> -static DEFINE_TIMER(seed_timer, __prandom_timer, 0, 0);
> +static DEFINE_TIMER(seed_timer, __prandom_timer);
>   
>   static void __prandom_timer(unsigned long dontcare)
>   {
> diff --git a/net/atm/mpc.c b/net/atm/mpc.c
> index 5677147209e8..63138c8c2269 100644
> --- a/net/atm/mpc.c
> +++ b/net/atm/mpc.c
> @@ -121,7 +121,7 @@ static struct notifier_block mpoa_notifier = {
>   
>   struct mpoa_client *mpcs = NULL; /* FIXME */
>   static struct atm_mpoa_qos *qos_head = NULL;
> -static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
> +static DEFINE_TIMER(mpc_timer, NULL);
>   
>   
>   static struct mpoa_client *find_mpc_by_itfnum(int itf)
> diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
> index 0bd3afd01dd2..6538632fbd03 100644
> --- a/net/decnet/dn_route.c
> +++ b/net/decnet/dn_route.c
> @@ -131,7 +131,7 @@ static struct dn_rt_hash_bucket *dn_rt_hash_table;
>   static unsigned int dn_rt_hash_mask;
>   
>   static struct timer_list dn_route_timer;
> -static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush, 0, 0);
> +static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush);
>   int decnet_dst_gc_interval = 2;
>   
>   static struct dst_ops dn_dst_ops = {
> diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
> index 8081bafe441b..b39d0908be2e 100644
> --- a/net/ipv6/ip6_flowlabel.c
> +++ b/net/ipv6/ip6_flowlabel.c
> @@ -47,7 +47,7 @@ static atomic_t fl_size = ATOMIC_INIT(0);
>   static struct ip6_flowlabel __rcu *fl_ht[FL_HASH_MASK+1];
>   
>   static void ip6_fl_gc(unsigned long dummy);
> -static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc, 0, 0);
> +static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc);
>   
>   /* FL hash table lock: it protects only of GC */
>   
> diff --git a/net/netrom/nr_loopback.c b/net/netrom/nr_loopback.c
> index 94d4e922af53..989ae647825e 100644
> --- a/net/netrom/nr_loopback.c
> +++ b/net/netrom/nr_loopback.c
> @@ -18,7 +18,7 @@
>   static void nr_loopback_timer(unsigned long);
>   
>   static struct sk_buff_head loopback_queue;
> -static DEFINE_TIMER(loopback_timer, nr_loopback_timer, 0, 0);
> +static DEFINE_TIMER(loopback_timer, nr_loopback_timer);
>   
>   void __init nr_loopback_init(void)
>   {
> diff --git a/security/keys/gc.c b/security/keys/gc.c
> index 87cb260e4890..8673f7f58ead 100644
> --- a/security/keys/gc.c
> +++ b/security/keys/gc.c
> @@ -30,7 +30,7 @@ DECLARE_WORK(key_gc_work, key_garbage_collector);
>    * Reaper for links from keyrings to dead keys.
>    */
>   static void key_gc_timer_func(unsigned long);
> -static DEFINE_TIMER(key_gc_timer, key_gc_timer_func, 0, 0);
> +static DEFINE_TIMER(key_gc_timer, key_gc_timer_func);
>   
>   static time_t key_gc_next_run = LONG_MAX;
>   static struct key_type *key_gc_dead_keytype;
> diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c
> index 701c7625c971..1277df815d5b 100644
> --- a/sound/oss/midibuf.c
> +++ b/sound/oss/midibuf.c
> @@ -52,7 +52,7 @@ static struct midi_parms parms[MAX_MIDI_DEV];
>   static void midi_poll(unsigned long dummy);
>   
>   
> -static DEFINE_TIMER(poll_timer, midi_poll, 0, 0);
> +static DEFINE_TIMER(poll_timer, midi_poll);
>   
>   static volatile int open_devs;
>   static DEFINE_SPINLOCK(lock);
> diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
> index b70c7c8f9c5d..4391062e5cfd 100644
> --- a/sound/oss/soundcard.c
> +++ b/sound/oss/soundcard.c
> @@ -662,7 +662,7 @@ static void do_sequencer_timer(unsigned long dummy)
>   }
>   
>   
> -static DEFINE_TIMER(seq_timer, do_sequencer_timer, 0, 0);
> +static DEFINE_TIMER(seq_timer, do_sequencer_timer);
>   
>   void request_sound_timer(int count)
>   {
> diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
> index d17019d25b99..8a4b5625dba6 100644
> --- a/sound/oss/sys_timer.c
> +++ b/sound/oss/sys_timer.c
> @@ -28,7 +28,7 @@ static unsigned long prev_event_time;
>   
>   static void     poll_def_tmr(unsigned long dummy);
>   static DEFINE_SPINLOCK(lock);
> -static DEFINE_TIMER(def_tmr, poll_def_tmr, 0, 0);
> +static DEFINE_TIMER(def_tmr, poll_def_tmr);
>   
>   static unsigned long
>   tmr2ticks(int tmr_value)
> diff --git a/sound/oss/uart6850.c b/sound/oss/uart6850.c
> index eda32d7eddbd..a9d3f7568525 100644
> --- a/sound/oss/uart6850.c
> +++ b/sound/oss/uart6850.c
> @@ -78,7 +78,7 @@ static void (*midi_input_intr) (int dev, unsigned char data);
>   static void poll_uart6850(unsigned long dummy);
>   
>   
> -static DEFINE_TIMER(uart6850_timer, poll_uart6850, 0, 0);
> +static DEFINE_TIMER(uart6850_timer, poll_uart6850);
>   
>   static void uart6850_input_loop(void)
>   {
> 

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  0:13     ` Guenter Roeck
  0 siblings, 0 replies; 98+ messages in thread
From: Guenter Roeck @ 2017-10-05  0:13 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	Chris Metcalf, Geert Uytterhoeven, Greg Kroah-Hartman,
	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

On 10/04/2017 04:27 PM, Kees Cook wrote:
> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>    perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>      $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Acked-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> # for m68k parts

For watchdog:

Acked-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>

> ---
>   arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
>   arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
>   arch/m68k/amiga/amisound.c                | 2 +-
>   arch/m68k/mac/macboing.c                  | 2 +-
>   arch/mips/mti-malta/malta-display.c       | 2 +-
>   arch/parisc/kernel/pdc_cons.c             | 2 +-
>   arch/s390/mm/cmm.c                        | 2 +-
>   drivers/atm/idt77105.c                    | 4 ++--
>   drivers/atm/iphase.c                      | 2 +-
>   drivers/block/ataflop.c                   | 8 ++++----
>   drivers/char/dtlk.c                       | 2 +-
>   drivers/char/hangcheck-timer.c            | 2 +-
>   drivers/char/nwbutton.c                   | 2 +-
>   drivers/char/rtc.c                        | 2 +-
>   drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
>   drivers/net/cris/eth_v10.c                | 6 +++---
>   drivers/net/hamradio/yam.c                | 2 +-
>   drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
>   drivers/staging/speakup/main.c            | 2 +-
>   drivers/staging/speakup/synth.c           | 2 +-
>   drivers/tty/cyclades.c                    | 2 +-
>   drivers/tty/isicom.c                      | 2 +-
>   drivers/tty/moxa.c                        | 2 +-
>   drivers/tty/rocket.c                      | 2 +-
>   drivers/tty/vt/keyboard.c                 | 2 +-
>   drivers/tty/vt/vt.c                       | 2 +-
>   drivers/watchdog/alim7101_wdt.c           | 2 +-
>   drivers/watchdog/machzwd.c                | 2 +-
>   drivers/watchdog/mixcomwd.c               | 2 +-
>   drivers/watchdog/sbc60xxwdt.c             | 2 +-
>   drivers/watchdog/sc520_wdt.c              | 2 +-
>   drivers/watchdog/via_wdt.c                | 2 +-
>   drivers/watchdog/w83877f_wdt.c            | 2 +-
>   drivers/xen/grant-table.c                 | 2 +-
>   fs/pstore/platform.c                      | 2 +-
>   include/linux/timer.h                     | 4 ++--
>   kernel/irq/spurious.c                     | 2 +-
>   lib/random32.c                            | 2 +-
>   net/atm/mpc.c                             | 2 +-
>   net/decnet/dn_route.c                     | 2 +-
>   net/ipv6/ip6_flowlabel.c                  | 2 +-
>   net/netrom/nr_loopback.c                  | 2 +-
>   security/keys/gc.c                        | 2 +-
>   sound/oss/midibuf.c                       | 2 +-
>   sound/oss/soundcard.c                     | 2 +-
>   sound/oss/sys_timer.c                     | 2 +-
>   sound/oss/uart6850.c                      | 2 +-
>   47 files changed, 54 insertions(+), 54 deletions(-)
> 
> diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
> index b3bd0e137f6d..b3689a141ec6 100644
> --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
> +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
> @@ -174,7 +174,7 @@ static int power_button_countdown;
>   #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
>   
>   static void dsmg600_power_handler(unsigned long data);
> -static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0);
> +static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler);
>   
>   static void dsmg600_power_handler(unsigned long data)
>   {
> diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
> index 4e0f762bc651..562d05f9888e 100644
> --- a/arch/arm/mach-ixp4xx/nas100d-setup.c
> +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
> @@ -197,7 +197,7 @@ static int power_button_countdown;
>   #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
>   
>   static void nas100d_power_handler(unsigned long data);
> -static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0);
> +static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler);
>   
>   static void nas100d_power_handler(unsigned long data)
>   {
> diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
> index 90a60d758f8b..a23f48181fd6 100644
> --- a/arch/m68k/amiga/amisound.c
> +++ b/arch/m68k/amiga/amisound.c
> @@ -66,7 +66,7 @@ void __init amiga_init_sound(void)
>   }
>   
>   static void nosound( unsigned long ignored );
> -static DEFINE_TIMER(sound_timer, nosound, 0, 0);
> +static DEFINE_TIMER(sound_timer, nosound);
>   
>   void amiga_mksound( unsigned int hz, unsigned int ticks )
>   {
> diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c
> index ffaa1f6439ae..9a52aff183d0 100644
> --- a/arch/m68k/mac/macboing.c
> +++ b/arch/m68k/mac/macboing.c
> @@ -56,7 +56,7 @@ static void ( *mac_special_bell )( unsigned int, unsigned int, unsigned int );
>   /*
>    * our timer to start/continue/stop the bell
>    */
> -static DEFINE_TIMER(mac_sound_timer, mac_nosound, 0, 0);
> +static DEFINE_TIMER(mac_sound_timer, mac_nosound);
>   
>   /*
>    * Sort of initialize the sound chip (called from mac_mksound on the first
> diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
> index ac813158b9b8..063de44675ce 100644
> --- a/arch/mips/mti-malta/malta-display.c
> +++ b/arch/mips/mti-malta/malta-display.c
> @@ -37,7 +37,7 @@ void mips_display_message(const char *str)
>   }
>   
>   static void scroll_display_message(unsigned long unused);
> -static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
> +static DEFINE_TIMER(mips_scroll_timer, scroll_display_message);
>   
>   static void scroll_display_message(unsigned long unused)
>   {
> diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
> index 10a5ae9553fd..27a2dd616a7d 100644
> --- a/arch/parisc/kernel/pdc_cons.c
> +++ b/arch/parisc/kernel/pdc_cons.c
> @@ -92,7 +92,7 @@ static int pdc_console_setup(struct console *co, char *options)
>   #define PDC_CONS_POLL_DELAY (30 * HZ / 1000)
>   
>   static void pdc_console_poll(unsigned long unused);
> -static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0);
> +static DEFINE_TIMER(pdc_console_timer, pdc_console_poll);
>   static struct tty_port tty_port;
>   
>   static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
> diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
> index 829c63dbc81a..2dbdcd85b68f 100644
> --- a/arch/s390/mm/cmm.c
> +++ b/arch/s390/mm/cmm.c
> @@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(cmm_lock);
>   
>   static struct task_struct *cmm_thread_ptr;
>   static DECLARE_WAIT_QUEUE_HEAD(cmm_thread_wait);
> -static DEFINE_TIMER(cmm_timer, NULL, 0, 0);
> +static DEFINE_TIMER(cmm_timer, NULL);
>   
>   static void cmm_timer_fn(unsigned long);
>   static void cmm_set_timer(void);
> diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
> index 082aa02abc57..57af9fd198e4 100644
> --- a/drivers/atm/idt77105.c
> +++ b/drivers/atm/idt77105.c
> @@ -49,8 +49,8 @@ static void idt77105_stats_timer_func(unsigned long);
>   static void idt77105_restart_timer_func(unsigned long);
>   
>   
> -static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func, 0, 0);
> -static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func, 0, 0);
> +static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func);
> +static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func);
>   static int start_timer = 1;
>   static struct idt77105_priv *idt77105_all = NULL;
>   
> diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
> index fc72b763fdd7..ad6b582c268e 100644
> --- a/drivers/atm/iphase.c
> +++ b/drivers/atm/iphase.c
> @@ -76,7 +76,7 @@ static IADEV *ia_dev[8];
>   static struct atm_dev *_ia_dev[8];
>   static int iadev_count;
>   static void ia_led_timer(unsigned long arg);
> -static DEFINE_TIMER(ia_timer, ia_led_timer, 0, 0);
> +static DEFINE_TIMER(ia_timer, ia_led_timer);
>   static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ;
>   static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ;
>   static uint IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER
> diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
> index 92da886180aa..ae596e55bcb6 100644
> --- a/drivers/block/ataflop.c
> +++ b/drivers/block/ataflop.c
> @@ -373,10 +373,10 @@ static void floppy_release(struct gendisk *disk, fmode_t mode);
>   
>   /************************* End of Prototypes **************************/
>   
> -static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer, 0, 0);
> -static DEFINE_TIMER(readtrack_timer, fd_readtrack_check, 0, 0);
> -static DEFINE_TIMER(timeout_timer, fd_times_out, 0, 0);
> -static DEFINE_TIMER(fd_timer, check_change, 0, 0);
> +static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer);
> +static DEFINE_TIMER(readtrack_timer, fd_readtrack_check);
> +static DEFINE_TIMER(timeout_timer, fd_times_out);
> +static DEFINE_TIMER(fd_timer, check_change);
>   	
>   static void fd_end_request_cur(blk_status_t err)
>   {
> diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
> index 58471394beb9..1a0385ed6417 100644
> --- a/drivers/char/dtlk.c
> +++ b/drivers/char/dtlk.c
> @@ -84,7 +84,7 @@ static int dtlk_has_indexing;
>   static unsigned int dtlk_portlist[] =
>   {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
>   static wait_queue_head_t dtlk_process_list;
> -static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0);
> +static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick);
>   
>   /* prototypes for file_operations struct */
>   static ssize_t dtlk_read(struct file *, char __user *,
> diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c
> index 5406b90bf626..5b8db2ed844d 100644
> --- a/drivers/char/hangcheck-timer.c
> +++ b/drivers/char/hangcheck-timer.c
> @@ -124,7 +124,7 @@ static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;
>   
>   static void hangcheck_fire(unsigned long);
>   
> -static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire, 0, 0);
> +static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire);
>   
>   static void hangcheck_fire(unsigned long data)
>   {
> diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
> index e6d0d271c58c..44006ed9558f 100644
> --- a/drivers/char/nwbutton.c
> +++ b/drivers/char/nwbutton.c
> @@ -27,7 +27,7 @@ static void button_sequence_finished (unsigned long parameters);
>   
>   static int button_press_count;		/* The count of button presses */
>   /* Times for the end of a sequence */
> -static DEFINE_TIMER(button_timer, button_sequence_finished, 0, 0);
> +static DEFINE_TIMER(button_timer, button_sequence_finished);
>   static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
>   static char button_output_buffer[32];	/* Stores data to write out of device */
>   static int bcount;			/* The number of bytes in the buffer */
> diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
> index 974d48927b07..616871e68e09 100644
> --- a/drivers/char/rtc.c
> +++ b/drivers/char/rtc.c
> @@ -137,7 +137,7 @@ static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
>   #ifdef RTC_IRQ
>   static void rtc_dropped_irq(unsigned long data);
>   
> -static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
> +static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq);
>   #endif
>   
>   static ssize_t rtc_read(struct file *file, char __user *buf,
> diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
> index 3b3db8c868e0..d3265b6b58b8 100644
> --- a/drivers/input/touchscreen/s3c2410_ts.c
> +++ b/drivers/input/touchscreen/s3c2410_ts.c
> @@ -145,7 +145,7 @@ static void touch_timer_fire(unsigned long data)
>   	}
>   }
>   
> -static DEFINE_TIMER(touch_timer, touch_timer_fire, 0, 0);
> +static DEFINE_TIMER(touch_timer, touch_timer_fire);
>   
>   /**
>    * stylus_irq - touchscreen stylus event interrupt
> diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
> index 017f48cdcab9..1fcc86fa4e05 100644
> --- a/drivers/net/cris/eth_v10.c
> +++ b/drivers/net/cris/eth_v10.c
> @@ -165,8 +165,8 @@ static unsigned int network_rec_config_shadow = 0;
>   static unsigned int network_tr_ctrl_shadow = 0;
>   
>   /* Network speed indication. */
> -static DEFINE_TIMER(speed_timer, NULL, 0, 0);
> -static DEFINE_TIMER(clear_led_timer, NULL, 0, 0);
> +static DEFINE_TIMER(speed_timer, NULL);
> +static DEFINE_TIMER(clear_led_timer, NULL);
>   static int current_speed; /* Speed read from transceiver */
>   static int current_speed_selection; /* Speed selected by user */
>   static unsigned long led_next_time;
> @@ -174,7 +174,7 @@ static int led_active;
>   static int rx_queue_len;
>   
>   /* Duplex */
> -static DEFINE_TIMER(duplex_timer, NULL, 0, 0);
> +static DEFINE_TIMER(duplex_timer, NULL);
>   static int full_duplex;
>   static enum duplex current_duplex;
>   
> diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
> index 7a7c5224a336..104f71fa9c5e 100644
> --- a/drivers/net/hamradio/yam.c
> +++ b/drivers/net/hamradio/yam.c
> @@ -157,7 +157,7 @@ static struct net_device *yam_devs[NR_PORTS];
>   
>   static struct yam_mcs *yam_data;
>   
> -static DEFINE_TIMER(yam_timer, NULL, 0, 0);
> +static DEFINE_TIMER(yam_timer, NULL);
>   
>   /* --------------------------------------------------------------------- */
>   
> diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
> index 94bf01f8b2a8..ede89d4ffc88 100644
> --- a/drivers/net/wireless/atmel/at76c50x-usb.c
> +++ b/drivers/net/wireless/atmel/at76c50x-usb.c
> @@ -519,7 +519,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
>   /* LED trigger */
>   static int tx_activity;
>   static void at76_ledtrig_tx_timerfunc(unsigned long data);
> -static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc, 0, 0);
> +static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc);
>   DEFINE_LED_TRIGGER(ledtrig_tx);
>   
>   static void at76_ledtrig_tx_timerfunc(unsigned long data)
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index 67956e24779c..b61e9becb612 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1165,7 +1165,7 @@ static const int NUM_CTL_LABELS = (MSG_CTL_END - MSG_CTL_START + 1);
>   
>   static void read_all_doc(struct vc_data *vc);
>   static void cursor_done(u_long data);
> -static DEFINE_TIMER(cursor_timer, cursor_done, 0, 0);
> +static DEFINE_TIMER(cursor_timer, cursor_done);
>   
>   static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
>   {
> diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
> index a1ca68c76579..6ddd3fc3f08d 100644
> --- a/drivers/staging/speakup/synth.c
> +++ b/drivers/staging/speakup/synth.c
> @@ -158,7 +158,7 @@ static void thread_wake_up(u_long data)
>   	wake_up_interruptible_all(&speakup_event);
>   }
>   
> -static DEFINE_TIMER(thread_timer, thread_wake_up, 0, 0);
> +static DEFINE_TIMER(thread_timer, thread_wake_up);
>   
>   void synth_start(void)
>   {
> diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
> index d272bc4e7fb5..dac8a1a8e4ac 100644
> --- a/drivers/tty/cyclades.c
> +++ b/drivers/tty/cyclades.c
> @@ -283,7 +283,7 @@ static void cyz_poll(unsigned long);
>   /* The Cyclades-Z polling cycle is defined by this variable */
>   static long cyz_polling_cycle = CZ_DEF_POLL;
>   
> -static DEFINE_TIMER(cyz_timerlist, cyz_poll, 0, 0);
> +static DEFINE_TIMER(cyz_timerlist, cyz_poll);
>   
>   #else				/* CONFIG_CYZ_INTR */
>   static void cyz_rx_restart(unsigned long);
> diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
> index 61ecdd6b2fc2..40af32108ff5 100644
> --- a/drivers/tty/isicom.c
> +++ b/drivers/tty/isicom.c
> @@ -177,7 +177,7 @@ static struct tty_driver *isicom_normal;
>   static void isicom_tx(unsigned long _data);
>   static void isicom_start(struct tty_struct *tty);
>   
> -static DEFINE_TIMER(tx, isicom_tx, 0, 0);
> +static DEFINE_TIMER(tx, isicom_tx);
>   
>   /*   baud index mappings from linux defns to isi */
>   
> diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
> index 7f3d4cb0341b..93d37655d928 100644
> --- a/drivers/tty/moxa.c
> +++ b/drivers/tty/moxa.c
> @@ -428,7 +428,7 @@ static const struct tty_port_operations moxa_port_ops = {
>   };
>   
>   static struct tty_driver *moxaDriver;
> -static DEFINE_TIMER(moxaTimer, moxa_poll, 0, 0);
> +static DEFINE_TIMER(moxaTimer, moxa_poll);
>   
>   /*
>    * HW init
> diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
> index 20d79a6007d5..aa695fda1084 100644
> --- a/drivers/tty/rocket.c
> +++ b/drivers/tty/rocket.c
> @@ -111,7 +111,7 @@ static struct r_port *rp_table[MAX_RP_PORTS];	       /*  The main repository of
>   static unsigned int xmit_flags[NUM_BOARDS];	       /*  Bit significant, indicates port had data to transmit. */
>   						       /*  eg.  Bit 0 indicates port 0 has xmit data, ...        */
>   static atomic_t rp_num_ports_open;	               /*  Number of serial ports open                           */
> -static DEFINE_TIMER(rocket_timer, rp_do_poll, 0, 0);
> +static DEFINE_TIMER(rocket_timer, rp_do_poll);
>   
>   static unsigned long board1;	                       /* ISA addresses, retrieved from rocketport.conf          */
>   static unsigned long board2;
> diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
> index f4166263bb3a..f974d6340d04 100644
> --- a/drivers/tty/vt/keyboard.c
> +++ b/drivers/tty/vt/keyboard.c
> @@ -250,7 +250,7 @@ static void kd_nosound(unsigned long ignored)
>   	input_handler_for_each_handle(&kbd_handler, &zero, kd_sound_helper);
>   }
>   
> -static DEFINE_TIMER(kd_mksound_timer, kd_nosound, 0, 0);
> +static DEFINE_TIMER(kd_mksound_timer, kd_nosound);
>   
>   void kd_mksound(unsigned int hz, unsigned int ticks)
>   {
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 2ebaba16f785..602d71630952 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -228,7 +228,7 @@ static int scrollback_delta;
>    */
>   int (*console_blank_hook)(int);
>   
> -static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
> +static DEFINE_TIMER(console_timer, blank_screen_t);
>   static int blank_state;
>   static int blank_timer_expired;
>   enum {
> diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
> index 3c1f6ac68ea9..18e896eeca62 100644
> --- a/drivers/watchdog/alim7101_wdt.c
> +++ b/drivers/watchdog/alim7101_wdt.c
> @@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
>   		"Use the gpio watchdog (required by old cobalt boards).");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c
> index 9826b59ef734..8a616a57bb90 100644
> --- a/drivers/watchdog/machzwd.c
> +++ b/drivers/watchdog/machzwd.c
> @@ -127,7 +127,7 @@ static int zf_action = GEN_RESET;
>   static unsigned long zf_is_open;
>   static char zf_expect_close;
>   static DEFINE_SPINLOCK(zf_port_lock);
> -static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
> +static DEFINE_TIMER(zf_timer, zf_ping);
>   static unsigned long next_heartbeat;
>   
>   
> diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c
> index be86ea359eee..c9e38096ea91 100644
> --- a/drivers/watchdog/mixcomwd.c
> +++ b/drivers/watchdog/mixcomwd.c
> @@ -105,7 +105,7 @@ static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */
>   
>   static int watchdog_port;
>   static int mixcomwd_timer_alive;
> -static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0);
> +static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun);
>   static char expect_close;
>   
>   static bool nowayout = WATCHDOG_NOWAYOUT;
> diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
> index 2eef58a0cf05..8d589939bc84 100644
> --- a/drivers/watchdog/sbc60xxwdt.c
> +++ b/drivers/watchdog/sbc60xxwdt.c
> @@ -113,7 +113,7 @@ MODULE_PARM_DESC(nowayout,
>   				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
> index 1cfd3f6a13d5..3e9bbaa37bf4 100644
> --- a/drivers/watchdog/sc520_wdt.c
> +++ b/drivers/watchdog/sc520_wdt.c
> @@ -124,7 +124,7 @@ MODULE_PARM_DESC(nowayout,
>   static __u16 __iomem *wdtmrctl;
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/watchdog/via_wdt.c b/drivers/watchdog/via_wdt.c
> index 5f9cbc37520d..ad3c3be13b40 100644
> --- a/drivers/watchdog/via_wdt.c
> +++ b/drivers/watchdog/via_wdt.c
> @@ -68,7 +68,7 @@ static struct resource wdt_res;
>   static void __iomem *wdt_mem;
>   static unsigned int mmio;
>   static void wdt_timer_tick(unsigned long data);
> -static DEFINE_TIMER(timer, wdt_timer_tick, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_tick);
>   					/* The timer that pings the watchdog */
>   static unsigned long next_heartbeat;	/* the next_heartbeat for the timer */
>   
> diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
> index f0483c75ed32..ba6b680af100 100644
> --- a/drivers/watchdog/w83877f_wdt.c
> +++ b/drivers/watchdog/w83877f_wdt.c
> @@ -98,7 +98,7 @@ MODULE_PARM_DESC(nowayout,
>   				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
> index 2c6a9114d332..a8721d718186 100644
> --- a/drivers/xen/grant-table.c
> +++ b/drivers/xen/grant-table.c
> @@ -305,7 +305,7 @@ struct deferred_entry {
>   };
>   static LIST_HEAD(deferred_list);
>   static void gnttab_handle_deferred(unsigned long);
> -static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred, 0, 0);
> +static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred);
>   
>   static void gnttab_handle_deferred(unsigned long unused)
>   {
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index 2b21d180157c..ec7199e859d2 100644
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -62,7 +62,7 @@ MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content "
>   static int pstore_new_entry;
>   
>   static void pstore_timefunc(unsigned long);
> -static DEFINE_TIMER(pstore_timer, pstore_timefunc, 0, 0);
> +static DEFINE_TIMER(pstore_timer, pstore_timefunc);
>   
>   static void pstore_dowork(struct work_struct *);
>   static DECLARE_WORK(pstore_work, pstore_dowork);
> diff --git a/include/linux/timer.h b/include/linux/timer.h
> index a33220311361..91e5a2cc81b5 100644
> --- a/include/linux/timer.h
> +++ b/include/linux/timer.h
> @@ -73,9 +73,9 @@ struct timer_list {
>   			__FILE__ ":" __stringify(__LINE__))	\
>   	}
>   
> -#define DEFINE_TIMER(_name, _function, _expires, _data)		\
> +#define DEFINE_TIMER(_name, _function)				\
>   	struct timer_list _name =				\
> -		__TIMER_INITIALIZER(_function, _expires, _data, 0)
> +		__TIMER_INITIALIZER(_function, 0, 0, 0)
>   
>   void init_timer_key(struct timer_list *timer, unsigned int flags,
>   		    const char *name, struct lock_class_key *key);
> diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
> index 061ba7eed4ed..c805e8691c22 100644
> --- a/kernel/irq/spurious.c
> +++ b/kernel/irq/spurious.c
> @@ -20,7 +20,7 @@ static int irqfixup __read_mostly;
>   
>   #define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
>   static void poll_spurious_irqs(unsigned long dummy);
> -static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0);
> +static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs);
>   static int irq_poll_cpu;
>   static atomic_t irq_poll_active;
>   
> diff --git a/lib/random32.c b/lib/random32.c
> index fa594b1140e6..6e91b75c113f 100644
> --- a/lib/random32.c
> +++ b/lib/random32.c
> @@ -214,7 +214,7 @@ core_initcall(prandom_init);
>   
>   static void __prandom_timer(unsigned long dontcare);
>   
> -static DEFINE_TIMER(seed_timer, __prandom_timer, 0, 0);
> +static DEFINE_TIMER(seed_timer, __prandom_timer);
>   
>   static void __prandom_timer(unsigned long dontcare)
>   {
> diff --git a/net/atm/mpc.c b/net/atm/mpc.c
> index 5677147209e8..63138c8c2269 100644
> --- a/net/atm/mpc.c
> +++ b/net/atm/mpc.c
> @@ -121,7 +121,7 @@ static struct notifier_block mpoa_notifier = {
>   
>   struct mpoa_client *mpcs = NULL; /* FIXME */
>   static struct atm_mpoa_qos *qos_head = NULL;
> -static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
> +static DEFINE_TIMER(mpc_timer, NULL);
>   
>   
>   static struct mpoa_client *find_mpc_by_itfnum(int itf)
> diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
> index 0bd3afd01dd2..6538632fbd03 100644
> --- a/net/decnet/dn_route.c
> +++ b/net/decnet/dn_route.c
> @@ -131,7 +131,7 @@ static struct dn_rt_hash_bucket *dn_rt_hash_table;
>   static unsigned int dn_rt_hash_mask;
>   
>   static struct timer_list dn_route_timer;
> -static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush, 0, 0);
> +static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush);
>   int decnet_dst_gc_interval = 2;
>   
>   static struct dst_ops dn_dst_ops = {
> diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
> index 8081bafe441b..b39d0908be2e 100644
> --- a/net/ipv6/ip6_flowlabel.c
> +++ b/net/ipv6/ip6_flowlabel.c
> @@ -47,7 +47,7 @@ static atomic_t fl_size = ATOMIC_INIT(0);
>   static struct ip6_flowlabel __rcu *fl_ht[FL_HASH_MASK+1];
>   
>   static void ip6_fl_gc(unsigned long dummy);
> -static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc, 0, 0);
> +static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc);
>   
>   /* FL hash table lock: it protects only of GC */
>   
> diff --git a/net/netrom/nr_loopback.c b/net/netrom/nr_loopback.c
> index 94d4e922af53..989ae647825e 100644
> --- a/net/netrom/nr_loopback.c
> +++ b/net/netrom/nr_loopback.c
> @@ -18,7 +18,7 @@
>   static void nr_loopback_timer(unsigned long);
>   
>   static struct sk_buff_head loopback_queue;
> -static DEFINE_TIMER(loopback_timer, nr_loopback_timer, 0, 0);
> +static DEFINE_TIMER(loopback_timer, nr_loopback_timer);
>   
>   void __init nr_loopback_init(void)
>   {
> diff --git a/security/keys/gc.c b/security/keys/gc.c
> index 87cb260e4890..8673f7f58ead 100644
> --- a/security/keys/gc.c
> +++ b/security/keys/gc.c
> @@ -30,7 +30,7 @@ DECLARE_WORK(key_gc_work, key_garbage_collector);
>    * Reaper for links from keyrings to dead keys.
>    */
>   static void key_gc_timer_func(unsigned long);
> -static DEFINE_TIMER(key_gc_timer, key_gc_timer_func, 0, 0);
> +static DEFINE_TIMER(key_gc_timer, key_gc_timer_func);
>   
>   static time_t key_gc_next_run = LONG_MAX;
>   static struct key_type *key_gc_dead_keytype;
> diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c
> index 701c7625c971..1277df815d5b 100644
> --- a/sound/oss/midibuf.c
> +++ b/sound/oss/midibuf.c
> @@ -52,7 +52,7 @@ static struct midi_parms parms[MAX_MIDI_DEV];
>   static void midi_poll(unsigned long dummy);
>   
>   
> -static DEFINE_TIMER(poll_timer, midi_poll, 0, 0);
> +static DEFINE_TIMER(poll_timer, midi_poll);
>   
>   static volatile int open_devs;
>   static DEFINE_SPINLOCK(lock);
> diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
> index b70c7c8f9c5d..4391062e5cfd 100644
> --- a/sound/oss/soundcard.c
> +++ b/sound/oss/soundcard.c
> @@ -662,7 +662,7 @@ static void do_sequencer_timer(unsigned long dummy)
>   }
>   
>   
> -static DEFINE_TIMER(seq_timer, do_sequencer_timer, 0, 0);
> +static DEFINE_TIMER(seq_timer, do_sequencer_timer);
>   
>   void request_sound_timer(int count)
>   {
> diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
> index d17019d25b99..8a4b5625dba6 100644
> --- a/sound/oss/sys_timer.c
> +++ b/sound/oss/sys_timer.c
> @@ -28,7 +28,7 @@ static unsigned long prev_event_time;
>   
>   static void     poll_def_tmr(unsigned long dummy);
>   static DEFINE_SPINLOCK(lock);
> -static DEFINE_TIMER(def_tmr, poll_def_tmr, 0, 0);
> +static DEFINE_TIMER(def_tmr, poll_def_tmr);
>   
>   static unsigned long
>   tmr2ticks(int tmr_value)
> diff --git a/sound/oss/uart6850.c b/sound/oss/uart6850.c
> index eda32d7eddbd..a9d3f7568525 100644
> --- a/sound/oss/uart6850.c
> +++ b/sound/oss/uart6850.c
> @@ -78,7 +78,7 @@ static void (*midi_input_intr) (int dev, unsigned char data);
>   static void poll_uart6850(unsigned long dummy);
>   
>   
> -static DEFINE_TIMER(uart6850_timer, poll_uart6850, 0, 0);
> +static DEFINE_TIMER(uart6850_timer, poll_uart6850);
>   
>   static void uart6850_input_loop(void)
>   {
> 

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  0:13     ` Guenter Roeck
  0 siblings, 0 replies; 98+ messages in thread
From: Guenter Roeck @ 2017-10-05  0:13 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Andrew Morton, Arnd Bergmann, Benjamin Herrenschmidt,
	Chris Metcalf, Geert Uytterhoeven, Greg Kroah-Hartman,
	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

On 10/04/2017 04:27 PM, Kees Cook wrote:
> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>    perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>      $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Acked-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> # for m68k parts

For watchdog:

Acked-by: Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>

> ---
>   arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
>   arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
>   arch/m68k/amiga/amisound.c                | 2 +-
>   arch/m68k/mac/macboing.c                  | 2 +-
>   arch/mips/mti-malta/malta-display.c       | 2 +-
>   arch/parisc/kernel/pdc_cons.c             | 2 +-
>   arch/s390/mm/cmm.c                        | 2 +-
>   drivers/atm/idt77105.c                    | 4 ++--
>   drivers/atm/iphase.c                      | 2 +-
>   drivers/block/ataflop.c                   | 8 ++++----
>   drivers/char/dtlk.c                       | 2 +-
>   drivers/char/hangcheck-timer.c            | 2 +-
>   drivers/char/nwbutton.c                   | 2 +-
>   drivers/char/rtc.c                        | 2 +-
>   drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
>   drivers/net/cris/eth_v10.c                | 6 +++---
>   drivers/net/hamradio/yam.c                | 2 +-
>   drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
>   drivers/staging/speakup/main.c            | 2 +-
>   drivers/staging/speakup/synth.c           | 2 +-
>   drivers/tty/cyclades.c                    | 2 +-
>   drivers/tty/isicom.c                      | 2 +-
>   drivers/tty/moxa.c                        | 2 +-
>   drivers/tty/rocket.c                      | 2 +-
>   drivers/tty/vt/keyboard.c                 | 2 +-
>   drivers/tty/vt/vt.c                       | 2 +-
>   drivers/watchdog/alim7101_wdt.c           | 2 +-
>   drivers/watchdog/machzwd.c                | 2 +-
>   drivers/watchdog/mixcomwd.c               | 2 +-
>   drivers/watchdog/sbc60xxwdt.c             | 2 +-
>   drivers/watchdog/sc520_wdt.c              | 2 +-
>   drivers/watchdog/via_wdt.c                | 2 +-
>   drivers/watchdog/w83877f_wdt.c            | 2 +-
>   drivers/xen/grant-table.c                 | 2 +-
>   fs/pstore/platform.c                      | 2 +-
>   include/linux/timer.h                     | 4 ++--
>   kernel/irq/spurious.c                     | 2 +-
>   lib/random32.c                            | 2 +-
>   net/atm/mpc.c                             | 2 +-
>   net/decnet/dn_route.c                     | 2 +-
>   net/ipv6/ip6_flowlabel.c                  | 2 +-
>   net/netrom/nr_loopback.c                  | 2 +-
>   security/keys/gc.c                        | 2 +-
>   sound/oss/midibuf.c                       | 2 +-
>   sound/oss/soundcard.c                     | 2 +-
>   sound/oss/sys_timer.c                     | 2 +-
>   sound/oss/uart6850.c                      | 2 +-
>   47 files changed, 54 insertions(+), 54 deletions(-)
> 
> diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
> index b3bd0e137f6d..b3689a141ec6 100644
> --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
> +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
> @@ -174,7 +174,7 @@ static int power_button_countdown;
>   #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
>   
>   static void dsmg600_power_handler(unsigned long data);
> -static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0);
> +static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler);
>   
>   static void dsmg600_power_handler(unsigned long data)
>   {
> diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
> index 4e0f762bc651..562d05f9888e 100644
> --- a/arch/arm/mach-ixp4xx/nas100d-setup.c
> +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
> @@ -197,7 +197,7 @@ static int power_button_countdown;
>   #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
>   
>   static void nas100d_power_handler(unsigned long data);
> -static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0);
> +static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler);
>   
>   static void nas100d_power_handler(unsigned long data)
>   {
> diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
> index 90a60d758f8b..a23f48181fd6 100644
> --- a/arch/m68k/amiga/amisound.c
> +++ b/arch/m68k/amiga/amisound.c
> @@ -66,7 +66,7 @@ void __init amiga_init_sound(void)
>   }
>   
>   static void nosound( unsigned long ignored );
> -static DEFINE_TIMER(sound_timer, nosound, 0, 0);
> +static DEFINE_TIMER(sound_timer, nosound);
>   
>   void amiga_mksound( unsigned int hz, unsigned int ticks )
>   {
> diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c
> index ffaa1f6439ae..9a52aff183d0 100644
> --- a/arch/m68k/mac/macboing.c
> +++ b/arch/m68k/mac/macboing.c
> @@ -56,7 +56,7 @@ static void ( *mac_special_bell )( unsigned int, unsigned int, unsigned int );
>   /*
>    * our timer to start/continue/stop the bell
>    */
> -static DEFINE_TIMER(mac_sound_timer, mac_nosound, 0, 0);
> +static DEFINE_TIMER(mac_sound_timer, mac_nosound);
>   
>   /*
>    * Sort of initialize the sound chip (called from mac_mksound on the first
> diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
> index ac813158b9b8..063de44675ce 100644
> --- a/arch/mips/mti-malta/malta-display.c
> +++ b/arch/mips/mti-malta/malta-display.c
> @@ -37,7 +37,7 @@ void mips_display_message(const char *str)
>   }
>   
>   static void scroll_display_message(unsigned long unused);
> -static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
> +static DEFINE_TIMER(mips_scroll_timer, scroll_display_message);
>   
>   static void scroll_display_message(unsigned long unused)
>   {
> diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
> index 10a5ae9553fd..27a2dd616a7d 100644
> --- a/arch/parisc/kernel/pdc_cons.c
> +++ b/arch/parisc/kernel/pdc_cons.c
> @@ -92,7 +92,7 @@ static int pdc_console_setup(struct console *co, char *options)
>   #define PDC_CONS_POLL_DELAY (30 * HZ / 1000)
>   
>   static void pdc_console_poll(unsigned long unused);
> -static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0);
> +static DEFINE_TIMER(pdc_console_timer, pdc_console_poll);
>   static struct tty_port tty_port;
>   
>   static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
> diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
> index 829c63dbc81a..2dbdcd85b68f 100644
> --- a/arch/s390/mm/cmm.c
> +++ b/arch/s390/mm/cmm.c
> @@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(cmm_lock);
>   
>   static struct task_struct *cmm_thread_ptr;
>   static DECLARE_WAIT_QUEUE_HEAD(cmm_thread_wait);
> -static DEFINE_TIMER(cmm_timer, NULL, 0, 0);
> +static DEFINE_TIMER(cmm_timer, NULL);
>   
>   static void cmm_timer_fn(unsigned long);
>   static void cmm_set_timer(void);
> diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
> index 082aa02abc57..57af9fd198e4 100644
> --- a/drivers/atm/idt77105.c
> +++ b/drivers/atm/idt77105.c
> @@ -49,8 +49,8 @@ static void idt77105_stats_timer_func(unsigned long);
>   static void idt77105_restart_timer_func(unsigned long);
>   
>   
> -static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func, 0, 0);
> -static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func, 0, 0);
> +static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func);
> +static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func);
>   static int start_timer = 1;
>   static struct idt77105_priv *idt77105_all = NULL;
>   
> diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
> index fc72b763fdd7..ad6b582c268e 100644
> --- a/drivers/atm/iphase.c
> +++ b/drivers/atm/iphase.c
> @@ -76,7 +76,7 @@ static IADEV *ia_dev[8];
>   static struct atm_dev *_ia_dev[8];
>   static int iadev_count;
>   static void ia_led_timer(unsigned long arg);
> -static DEFINE_TIMER(ia_timer, ia_led_timer, 0, 0);
> +static DEFINE_TIMER(ia_timer, ia_led_timer);
>   static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ;
>   static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ;
>   static uint IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER
> diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
> index 92da886180aa..ae596e55bcb6 100644
> --- a/drivers/block/ataflop.c
> +++ b/drivers/block/ataflop.c
> @@ -373,10 +373,10 @@ static void floppy_release(struct gendisk *disk, fmode_t mode);
>   
>   /************************* End of Prototypes **************************/
>   
> -static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer, 0, 0);
> -static DEFINE_TIMER(readtrack_timer, fd_readtrack_check, 0, 0);
> -static DEFINE_TIMER(timeout_timer, fd_times_out, 0, 0);
> -static DEFINE_TIMER(fd_timer, check_change, 0, 0);
> +static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer);
> +static DEFINE_TIMER(readtrack_timer, fd_readtrack_check);
> +static DEFINE_TIMER(timeout_timer, fd_times_out);
> +static DEFINE_TIMER(fd_timer, check_change);
>   	
>   static void fd_end_request_cur(blk_status_t err)
>   {
> diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
> index 58471394beb9..1a0385ed6417 100644
> --- a/drivers/char/dtlk.c
> +++ b/drivers/char/dtlk.c
> @@ -84,7 +84,7 @@ static int dtlk_has_indexing;
>   static unsigned int dtlk_portlist[] =
>   {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
>   static wait_queue_head_t dtlk_process_list;
> -static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0);
> +static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick);
>   
>   /* prototypes for file_operations struct */
>   static ssize_t dtlk_read(struct file *, char __user *,
> diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c
> index 5406b90bf626..5b8db2ed844d 100644
> --- a/drivers/char/hangcheck-timer.c
> +++ b/drivers/char/hangcheck-timer.c
> @@ -124,7 +124,7 @@ static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;
>   
>   static void hangcheck_fire(unsigned long);
>   
> -static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire, 0, 0);
> +static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire);
>   
>   static void hangcheck_fire(unsigned long data)
>   {
> diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
> index e6d0d271c58c..44006ed9558f 100644
> --- a/drivers/char/nwbutton.c
> +++ b/drivers/char/nwbutton.c
> @@ -27,7 +27,7 @@ static void button_sequence_finished (unsigned long parameters);
>   
>   static int button_press_count;		/* The count of button presses */
>   /* Times for the end of a sequence */
> -static DEFINE_TIMER(button_timer, button_sequence_finished, 0, 0);
> +static DEFINE_TIMER(button_timer, button_sequence_finished);
>   static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
>   static char button_output_buffer[32];	/* Stores data to write out of device */
>   static int bcount;			/* The number of bytes in the buffer */
> diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
> index 974d48927b07..616871e68e09 100644
> --- a/drivers/char/rtc.c
> +++ b/drivers/char/rtc.c
> @@ -137,7 +137,7 @@ static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
>   #ifdef RTC_IRQ
>   static void rtc_dropped_irq(unsigned long data);
>   
> -static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
> +static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq);
>   #endif
>   
>   static ssize_t rtc_read(struct file *file, char __user *buf,
> diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
> index 3b3db8c868e0..d3265b6b58b8 100644
> --- a/drivers/input/touchscreen/s3c2410_ts.c
> +++ b/drivers/input/touchscreen/s3c2410_ts.c
> @@ -145,7 +145,7 @@ static void touch_timer_fire(unsigned long data)
>   	}
>   }
>   
> -static DEFINE_TIMER(touch_timer, touch_timer_fire, 0, 0);
> +static DEFINE_TIMER(touch_timer, touch_timer_fire);
>   
>   /**
>    * stylus_irq - touchscreen stylus event interrupt
> diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
> index 017f48cdcab9..1fcc86fa4e05 100644
> --- a/drivers/net/cris/eth_v10.c
> +++ b/drivers/net/cris/eth_v10.c
> @@ -165,8 +165,8 @@ static unsigned int network_rec_config_shadow = 0;
>   static unsigned int network_tr_ctrl_shadow = 0;
>   
>   /* Network speed indication. */
> -static DEFINE_TIMER(speed_timer, NULL, 0, 0);
> -static DEFINE_TIMER(clear_led_timer, NULL, 0, 0);
> +static DEFINE_TIMER(speed_timer, NULL);
> +static DEFINE_TIMER(clear_led_timer, NULL);
>   static int current_speed; /* Speed read from transceiver */
>   static int current_speed_selection; /* Speed selected by user */
>   static unsigned long led_next_time;
> @@ -174,7 +174,7 @@ static int led_active;
>   static int rx_queue_len;
>   
>   /* Duplex */
> -static DEFINE_TIMER(duplex_timer, NULL, 0, 0);
> +static DEFINE_TIMER(duplex_timer, NULL);
>   static int full_duplex;
>   static enum duplex current_duplex;
>   
> diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
> index 7a7c5224a336..104f71fa9c5e 100644
> --- a/drivers/net/hamradio/yam.c
> +++ b/drivers/net/hamradio/yam.c
> @@ -157,7 +157,7 @@ static struct net_device *yam_devs[NR_PORTS];
>   
>   static struct yam_mcs *yam_data;
>   
> -static DEFINE_TIMER(yam_timer, NULL, 0, 0);
> +static DEFINE_TIMER(yam_timer, NULL);
>   
>   /* --------------------------------------------------------------------- */
>   
> diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
> index 94bf01f8b2a8..ede89d4ffc88 100644
> --- a/drivers/net/wireless/atmel/at76c50x-usb.c
> +++ b/drivers/net/wireless/atmel/at76c50x-usb.c
> @@ -519,7 +519,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
>   /* LED trigger */
>   static int tx_activity;
>   static void at76_ledtrig_tx_timerfunc(unsigned long data);
> -static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc, 0, 0);
> +static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc);
>   DEFINE_LED_TRIGGER(ledtrig_tx);
>   
>   static void at76_ledtrig_tx_timerfunc(unsigned long data)
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index 67956e24779c..b61e9becb612 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -1165,7 +1165,7 @@ static const int NUM_CTL_LABELS = (MSG_CTL_END - MSG_CTL_START + 1);
>   
>   static void read_all_doc(struct vc_data *vc);
>   static void cursor_done(u_long data);
> -static DEFINE_TIMER(cursor_timer, cursor_done, 0, 0);
> +static DEFINE_TIMER(cursor_timer, cursor_done);
>   
>   static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
>   {
> diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
> index a1ca68c76579..6ddd3fc3f08d 100644
> --- a/drivers/staging/speakup/synth.c
> +++ b/drivers/staging/speakup/synth.c
> @@ -158,7 +158,7 @@ static void thread_wake_up(u_long data)
>   	wake_up_interruptible_all(&speakup_event);
>   }
>   
> -static DEFINE_TIMER(thread_timer, thread_wake_up, 0, 0);
> +static DEFINE_TIMER(thread_timer, thread_wake_up);
>   
>   void synth_start(void)
>   {
> diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
> index d272bc4e7fb5..dac8a1a8e4ac 100644
> --- a/drivers/tty/cyclades.c
> +++ b/drivers/tty/cyclades.c
> @@ -283,7 +283,7 @@ static void cyz_poll(unsigned long);
>   /* The Cyclades-Z polling cycle is defined by this variable */
>   static long cyz_polling_cycle = CZ_DEF_POLL;
>   
> -static DEFINE_TIMER(cyz_timerlist, cyz_poll, 0, 0);
> +static DEFINE_TIMER(cyz_timerlist, cyz_poll);
>   
>   #else				/* CONFIG_CYZ_INTR */
>   static void cyz_rx_restart(unsigned long);
> diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
> index 61ecdd6b2fc2..40af32108ff5 100644
> --- a/drivers/tty/isicom.c
> +++ b/drivers/tty/isicom.c
> @@ -177,7 +177,7 @@ static struct tty_driver *isicom_normal;
>   static void isicom_tx(unsigned long _data);
>   static void isicom_start(struct tty_struct *tty);
>   
> -static DEFINE_TIMER(tx, isicom_tx, 0, 0);
> +static DEFINE_TIMER(tx, isicom_tx);
>   
>   /*   baud index mappings from linux defns to isi */
>   
> diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
> index 7f3d4cb0341b..93d37655d928 100644
> --- a/drivers/tty/moxa.c
> +++ b/drivers/tty/moxa.c
> @@ -428,7 +428,7 @@ static const struct tty_port_operations moxa_port_ops = {
>   };
>   
>   static struct tty_driver *moxaDriver;
> -static DEFINE_TIMER(moxaTimer, moxa_poll, 0, 0);
> +static DEFINE_TIMER(moxaTimer, moxa_poll);
>   
>   /*
>    * HW init
> diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
> index 20d79a6007d5..aa695fda1084 100644
> --- a/drivers/tty/rocket.c
> +++ b/drivers/tty/rocket.c
> @@ -111,7 +111,7 @@ static struct r_port *rp_table[MAX_RP_PORTS];	       /*  The main repository of
>   static unsigned int xmit_flags[NUM_BOARDS];	       /*  Bit significant, indicates port had data to transmit. */
>   						       /*  eg.  Bit 0 indicates port 0 has xmit data, ...        */
>   static atomic_t rp_num_ports_open;	               /*  Number of serial ports open                           */
> -static DEFINE_TIMER(rocket_timer, rp_do_poll, 0, 0);
> +static DEFINE_TIMER(rocket_timer, rp_do_poll);
>   
>   static unsigned long board1;	                       /* ISA addresses, retrieved from rocketport.conf          */
>   static unsigned long board2;
> diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
> index f4166263bb3a..f974d6340d04 100644
> --- a/drivers/tty/vt/keyboard.c
> +++ b/drivers/tty/vt/keyboard.c
> @@ -250,7 +250,7 @@ static void kd_nosound(unsigned long ignored)
>   	input_handler_for_each_handle(&kbd_handler, &zero, kd_sound_helper);
>   }
>   
> -static DEFINE_TIMER(kd_mksound_timer, kd_nosound, 0, 0);
> +static DEFINE_TIMER(kd_mksound_timer, kd_nosound);
>   
>   void kd_mksound(unsigned int hz, unsigned int ticks)
>   {
> diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
> index 2ebaba16f785..602d71630952 100644
> --- a/drivers/tty/vt/vt.c
> +++ b/drivers/tty/vt/vt.c
> @@ -228,7 +228,7 @@ static int scrollback_delta;
>    */
>   int (*console_blank_hook)(int);
>   
> -static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
> +static DEFINE_TIMER(console_timer, blank_screen_t);
>   static int blank_state;
>   static int blank_timer_expired;
>   enum {
> diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
> index 3c1f6ac68ea9..18e896eeca62 100644
> --- a/drivers/watchdog/alim7101_wdt.c
> +++ b/drivers/watchdog/alim7101_wdt.c
> @@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
>   		"Use the gpio watchdog (required by old cobalt boards).");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c
> index 9826b59ef734..8a616a57bb90 100644
> --- a/drivers/watchdog/machzwd.c
> +++ b/drivers/watchdog/machzwd.c
> @@ -127,7 +127,7 @@ static int zf_action = GEN_RESET;
>   static unsigned long zf_is_open;
>   static char zf_expect_close;
>   static DEFINE_SPINLOCK(zf_port_lock);
> -static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
> +static DEFINE_TIMER(zf_timer, zf_ping);
>   static unsigned long next_heartbeat;
>   
>   
> diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c
> index be86ea359eee..c9e38096ea91 100644
> --- a/drivers/watchdog/mixcomwd.c
> +++ b/drivers/watchdog/mixcomwd.c
> @@ -105,7 +105,7 @@ static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */
>   
>   static int watchdog_port;
>   static int mixcomwd_timer_alive;
> -static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0);
> +static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun);
>   static char expect_close;
>   
>   static bool nowayout = WATCHDOG_NOWAYOUT;
> diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
> index 2eef58a0cf05..8d589939bc84 100644
> --- a/drivers/watchdog/sbc60xxwdt.c
> +++ b/drivers/watchdog/sbc60xxwdt.c
> @@ -113,7 +113,7 @@ MODULE_PARM_DESC(nowayout,
>   				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
> index 1cfd3f6a13d5..3e9bbaa37bf4 100644
> --- a/drivers/watchdog/sc520_wdt.c
> +++ b/drivers/watchdog/sc520_wdt.c
> @@ -124,7 +124,7 @@ MODULE_PARM_DESC(nowayout,
>   static __u16 __iomem *wdtmrctl;
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/watchdog/via_wdt.c b/drivers/watchdog/via_wdt.c
> index 5f9cbc37520d..ad3c3be13b40 100644
> --- a/drivers/watchdog/via_wdt.c
> +++ b/drivers/watchdog/via_wdt.c
> @@ -68,7 +68,7 @@ static struct resource wdt_res;
>   static void __iomem *wdt_mem;
>   static unsigned int mmio;
>   static void wdt_timer_tick(unsigned long data);
> -static DEFINE_TIMER(timer, wdt_timer_tick, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_tick);
>   					/* The timer that pings the watchdog */
>   static unsigned long next_heartbeat;	/* the next_heartbeat for the timer */
>   
> diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
> index f0483c75ed32..ba6b680af100 100644
> --- a/drivers/watchdog/w83877f_wdt.c
> +++ b/drivers/watchdog/w83877f_wdt.c
> @@ -98,7 +98,7 @@ MODULE_PARM_DESC(nowayout,
>   				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
>   
>   static void wdt_timer_ping(unsigned long);
> -static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
> +static DEFINE_TIMER(timer, wdt_timer_ping);
>   static unsigned long next_heartbeat;
>   static unsigned long wdt_is_open;
>   static char wdt_expect_close;
> diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
> index 2c6a9114d332..a8721d718186 100644
> --- a/drivers/xen/grant-table.c
> +++ b/drivers/xen/grant-table.c
> @@ -305,7 +305,7 @@ struct deferred_entry {
>   };
>   static LIST_HEAD(deferred_list);
>   static void gnttab_handle_deferred(unsigned long);
> -static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred, 0, 0);
> +static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred);
>   
>   static void gnttab_handle_deferred(unsigned long unused)
>   {
> diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
> index 2b21d180157c..ec7199e859d2 100644
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -62,7 +62,7 @@ MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content "
>   static int pstore_new_entry;
>   
>   static void pstore_timefunc(unsigned long);
> -static DEFINE_TIMER(pstore_timer, pstore_timefunc, 0, 0);
> +static DEFINE_TIMER(pstore_timer, pstore_timefunc);
>   
>   static void pstore_dowork(struct work_struct *);
>   static DECLARE_WORK(pstore_work, pstore_dowork);
> diff --git a/include/linux/timer.h b/include/linux/timer.h
> index a33220311361..91e5a2cc81b5 100644
> --- a/include/linux/timer.h
> +++ b/include/linux/timer.h
> @@ -73,9 +73,9 @@ struct timer_list {
>   			__FILE__ ":" __stringify(__LINE__))	\
>   	}
>   
> -#define DEFINE_TIMER(_name, _function, _expires, _data)		\
> +#define DEFINE_TIMER(_name, _function)				\
>   	struct timer_list _name =				\
> -		__TIMER_INITIALIZER(_function, _expires, _data, 0)
> +		__TIMER_INITIALIZER(_function, 0, 0, 0)
>   
>   void init_timer_key(struct timer_list *timer, unsigned int flags,
>   		    const char *name, struct lock_class_key *key);
> diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
> index 061ba7eed4ed..c805e8691c22 100644
> --- a/kernel/irq/spurious.c
> +++ b/kernel/irq/spurious.c
> @@ -20,7 +20,7 @@ static int irqfixup __read_mostly;
>   
>   #define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
>   static void poll_spurious_irqs(unsigned long dummy);
> -static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0);
> +static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs);
>   static int irq_poll_cpu;
>   static atomic_t irq_poll_active;
>   
> diff --git a/lib/random32.c b/lib/random32.c
> index fa594b1140e6..6e91b75c113f 100644
> --- a/lib/random32.c
> +++ b/lib/random32.c
> @@ -214,7 +214,7 @@ core_initcall(prandom_init);
>   
>   static void __prandom_timer(unsigned long dontcare);
>   
> -static DEFINE_TIMER(seed_timer, __prandom_timer, 0, 0);
> +static DEFINE_TIMER(seed_timer, __prandom_timer);
>   
>   static void __prandom_timer(unsigned long dontcare)
>   {
> diff --git a/net/atm/mpc.c b/net/atm/mpc.c
> index 5677147209e8..63138c8c2269 100644
> --- a/net/atm/mpc.c
> +++ b/net/atm/mpc.c
> @@ -121,7 +121,7 @@ static struct notifier_block mpoa_notifier = {
>   
>   struct mpoa_client *mpcs = NULL; /* FIXME */
>   static struct atm_mpoa_qos *qos_head = NULL;
> -static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
> +static DEFINE_TIMER(mpc_timer, NULL);
>   
>   
>   static struct mpoa_client *find_mpc_by_itfnum(int itf)
> diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
> index 0bd3afd01dd2..6538632fbd03 100644
> --- a/net/decnet/dn_route.c
> +++ b/net/decnet/dn_route.c
> @@ -131,7 +131,7 @@ static struct dn_rt_hash_bucket *dn_rt_hash_table;
>   static unsigned int dn_rt_hash_mask;
>   
>   static struct timer_list dn_route_timer;
> -static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush, 0, 0);
> +static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush);
>   int decnet_dst_gc_interval = 2;
>   
>   static struct dst_ops dn_dst_ops = {
> diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
> index 8081bafe441b..b39d0908be2e 100644
> --- a/net/ipv6/ip6_flowlabel.c
> +++ b/net/ipv6/ip6_flowlabel.c
> @@ -47,7 +47,7 @@ static atomic_t fl_size = ATOMIC_INIT(0);
>   static struct ip6_flowlabel __rcu *fl_ht[FL_HASH_MASK+1];
>   
>   static void ip6_fl_gc(unsigned long dummy);
> -static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc, 0, 0);
> +static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc);
>   
>   /* FL hash table lock: it protects only of GC */
>   
> diff --git a/net/netrom/nr_loopback.c b/net/netrom/nr_loopback.c
> index 94d4e922af53..989ae647825e 100644
> --- a/net/netrom/nr_loopback.c
> +++ b/net/netrom/nr_loopback.c
> @@ -18,7 +18,7 @@
>   static void nr_loopback_timer(unsigned long);
>   
>   static struct sk_buff_head loopback_queue;
> -static DEFINE_TIMER(loopback_timer, nr_loopback_timer, 0, 0);
> +static DEFINE_TIMER(loopback_timer, nr_loopback_timer);
>   
>   void __init nr_loopback_init(void)
>   {
> diff --git a/security/keys/gc.c b/security/keys/gc.c
> index 87cb260e4890..8673f7f58ead 100644
> --- a/security/keys/gc.c
> +++ b/security/keys/gc.c
> @@ -30,7 +30,7 @@ DECLARE_WORK(key_gc_work, key_garbage_collector);
>    * Reaper for links from keyrings to dead keys.
>    */
>   static void key_gc_timer_func(unsigned long);
> -static DEFINE_TIMER(key_gc_timer, key_gc_timer_func, 0, 0);
> +static DEFINE_TIMER(key_gc_timer, key_gc_timer_func);
>   
>   static time_t key_gc_next_run = LONG_MAX;
>   static struct key_type *key_gc_dead_keytype;
> diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c
> index 701c7625c971..1277df815d5b 100644
> --- a/sound/oss/midibuf.c
> +++ b/sound/oss/midibuf.c
> @@ -52,7 +52,7 @@ static struct midi_parms parms[MAX_MIDI_DEV];
>   static void midi_poll(unsigned long dummy);
>   
>   
> -static DEFINE_TIMER(poll_timer, midi_poll, 0, 0);
> +static DEFINE_TIMER(poll_timer, midi_poll);
>   
>   static volatile int open_devs;
>   static DEFINE_SPINLOCK(lock);
> diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
> index b70c7c8f9c5d..4391062e5cfd 100644
> --- a/sound/oss/soundcard.c
> +++ b/sound/oss/soundcard.c
> @@ -662,7 +662,7 @@ static void do_sequencer_timer(unsigned long dummy)
>   }
>   
>   
> -static DEFINE_TIMER(seq_timer, do_sequencer_timer, 0, 0);
> +static DEFINE_TIMER(seq_timer, do_sequencer_timer);
>   
>   void request_sound_timer(int count)
>   {
> diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
> index d17019d25b99..8a4b5625dba6 100644
> --- a/sound/oss/sys_timer.c
> +++ b/sound/oss/sys_timer.c
> @@ -28,7 +28,7 @@ static unsigned long prev_event_time;
>   
>   static void     poll_def_tmr(unsigned long dummy);
>   static DEFINE_SPINLOCK(lock);
> -static DEFINE_TIMER(def_tmr, poll_def_tmr, 0, 0);
> +static DEFINE_TIMER(def_tmr, poll_def_tmr);
>   
>   static unsigned long
>   tmr2ticks(int tmr_value)
> diff --git a/sound/oss/uart6850.c b/sound/oss/uart6850.c
> index eda32d7eddbd..a9d3f7568525 100644
> --- a/sound/oss/uart6850.c
> +++ b/sound/oss/uart6850.c
> @@ -78,7 +78,7 @@ static void (*midi_input_intr) (int dev, unsigned char data);
>   static void poll_uart6850(unsigned long dummy);
>   
>   
> -static DEFINE_TIMER(uart6850_timer, poll_uart6850, 0, 0);
> +static DEFINE_TIMER(uart6850_timer, poll_uart6850);
>   
>   static void uart6850_input_loop(void)
>   {
> 

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
  2017-10-04 23:27   ` Kees Cook
@ 2017-10-05  0:40     ` David Miller
  -1 siblings, 0 replies; 98+ messages in thread
From: David Miller @ 2017-10-05  0:40 UTC (permalink / raw)
  To: keescook
  Cc: tglx, akpm, arnd, benh, cmetcalf, geert, gregkh, linux,
	harish.patil, heiko.carstens, jejb, john.stultz, jwi, kvalo,
	jiangshanlai, len.brown, manish.chopra, mark.gross,
	martin.petersen, schwidefsky, mpe, mdr, netdev, oleg, paulus,
	pavel, pmladek, rjw, ralf, sre, stefanr, sboyd, sudipm.mukherjee,
	tj, ubraun, viresh.kumar, wim, linux1394-devel, linux-mips,
	linux-pm, linuxppc-dev, linux-s390, linux-scsi, linux-watchdog,
	linux-wireless, linux-kernel

From: Kees Cook <keescook@chromium.org>
Date: Wed,  4 Oct 2017 16:27:04 -0700

> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

For networking:

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  0:40     ` David Miller
  0 siblings, 0 replies; 98+ messages in thread
From: David Miller @ 2017-10-05  0:40 UTC (permalink / raw)
  To: keescook
  Cc: tglx, akpm, arnd, benh, cmetcalf, geert, gregkh, linux,
	harish.patil, heiko.carstens, jejb, john.stultz, jwi, kvalo,
	jiangshanlai, len.brown, manish.chopra, mark.gross,
	martin.petersen, schwidefsky, mpe, mdr, netdev, oleg, paulus,
	pavel, pmladek, rjw, ralf, sre, stefanr, sboyd, sudipm.mukherjee,
	tj, ubraun, viresh.kum

From: Kees Cook <keescook@chromium.org>
Date: Wed,  4 Oct 2017 16:27:04 -0700

> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

For networking:

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 05/13] timer: Remove init_timer_deferrable() in favor of timer_setup()
  2017-10-04 23:26   ` Kees Cook
@ 2017-10-05  0:41     ` David Miller
  -1 siblings, 0 replies; 98+ messages in thread
From: David Miller @ 2017-10-05  0:41 UTC (permalink / raw)
  To: keescook
  Cc: tglx, benh, mpe, sre, harish.patil, manish.chopra, kvalo,
	linuxppc-dev, netdev, linux-wireless, akpm, arnd, cmetcalf,
	geert, gregkh, linux, heiko.carstens, jejb, john.stultz, jwi,
	jiangshanlai, len.brown, mark.gross, martin.petersen,
	schwidefsky, mdr, oleg, paulus, pavel, pmladek, rjw, ralf,
	stefanr, sboyd, sudipm.mukherjee, tj, ubraun, viresh.kumar, wim,
	linux1394-devel, linux-mips, linux-pm, linux-s390, linux-scsi,
	linux-watchdog, linux-kernel

From: Kees Cook <keescook@chromium.org>
Date: Wed,  4 Oct 2017 16:26:59 -0700

> This refactors the only users of init_timer_deferrable() to use
> the new timer_setup() and from_timer(). Removes definition of
> init_timer_deferrable().
> 
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Harish Patil <harish.patil@cavium.com>
> Cc: Manish Chopra <manish.chopra@cavium.com>
> Cc: Kalle Valo <kvalo@qca.qualcomm.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: netdev@vger.kernel.org
> Cc: linux-wireless@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

For networking:

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 05/13] timer: Remove init_timer_deferrable() in favor of timer_setup()
@ 2017-10-05  0:41     ` David Miller
  0 siblings, 0 replies; 98+ messages in thread
From: David Miller @ 2017-10-05  0:41 UTC (permalink / raw)
  To: keescook
  Cc: tglx, benh, mpe, sre, harish.patil, manish.chopra, kvalo,
	linuxppc-dev, netdev, linux-wireless, akpm, arnd, cmetcalf,
	geert, gregkh, linux, heiko.carstens, jejb, john.stultz, jwi,
	jiangshanlai, len.brown, mark.gross, martin.petersen,
	schwidefsky, mdr, oleg, paulus, pavel, pmladek, rjw, ralf,
	stefanr, sboyd, sudipm.mukherjee

From: Kees Cook <keescook@chromium.org>
Date: Wed,  4 Oct 2017 16:26:59 -0700

> This refactors the only users of init_timer_deferrable() to use
> the new timer_setup() and from_timer(). Removes definition of
> init_timer_deferrable().
> 
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Sebastian Reichel <sre@kernel.org>
> Cc: Harish Patil <harish.patil@cavium.com>
> Cc: Manish Chopra <manish.chopra@cavium.com>
> Cc: Kalle Valo <kvalo@qca.qualcomm.com>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: netdev@vger.kernel.org
> Cc: linux-wireless@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

For networking:

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 04/13] timer: Remove init_timer_pinned() in favor of timer_setup()
  2017-10-04 23:26   ` Kees Cook
@ 2017-10-05  0:41     ` David Miller
  -1 siblings, 0 replies; 98+ messages in thread
From: David Miller @ 2017-10-05  0:41 UTC (permalink / raw)
  To: keescook
  Cc: tglx, cmetcalf, netdev, akpm, arnd, benh, geert, gregkh, linux,
	harish.patil, heiko.carstens, jejb, john.stultz, jwi, kvalo,
	jiangshanlai, len.brown, manish.chopra, mark.gross,
	martin.petersen, schwidefsky, mpe, mdr, oleg, paulus, pavel,
	pmladek, rjw, ralf, sre, stefanr, sboyd, sudipm.mukherjee, tj,
	ubraun, viresh.kumar, wim, linux1394-devel, linux-mips, linux-pm,
	linuxppc-dev, linux-s390, linux-scsi, linux-watchdog,
	linux-wireless, linux-kernel

From: Kees Cook <keescook@chromium.org>
Date: Wed,  4 Oct 2017 16:26:58 -0700

> This refactors the only users of init_timer_pinned() to use
> the new timer_setup() and from_timer(). Drops the definition of
> init_timer_pinned().
> 
> Cc: Chris Metcalf <cmetcalf@mellanox.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

For networking:

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 04/13] timer: Remove init_timer_pinned() in favor of timer_setup()
@ 2017-10-05  0:41     ` David Miller
  0 siblings, 0 replies; 98+ messages in thread
From: David Miller @ 2017-10-05  0:41 UTC (permalink / raw)
  To: keescook
  Cc: tglx, cmetcalf, netdev, akpm, arnd, benh, geert, gregkh, linux,
	harish.patil, heiko.carstens, jejb, john.stultz, jwi, kvalo,
	jiangshanlai, len.brown, manish.chopra, mark.gross,
	martin.petersen, schwidefsky, mpe, mdr, oleg, paulus, pavel,
	pmladek, rjw, ralf, sre, stefanr, sboyd, sudipm.mukherjee, tj,
	ubraun, viresh.kum

From: Kees Cook <keescook@chromium.org>
Date: Wed,  4 Oct 2017 16:26:58 -0700

> This refactors the only users of init_timer_pinned() to use
> the new timer_setup() and from_timer(). Drops the definition of
> init_timer_pinned().
> 
> Cc: Chris Metcalf <cmetcalf@mellanox.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: netdev@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

For networking:

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 05/13] timer: Remove init_timer_deferrable() in favor of timer_setup()
  2017-10-04 23:26   ` Kees Cook
@ 2017-10-05  1:02     ` Sebastian Reichel
  -1 siblings, 0 replies; 98+ messages in thread
From: Sebastian Reichel @ 2017-10-05  1:02 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Benjamin Herrenschmidt, Michael Ellerman,
	Harish Patil, Manish Chopra, Kalle Valo, linuxppc-dev, netdev,
	linux-wireless, Andrew Morton, Arnd Bergmann, Chris Metcalf,
	Geert Uytterhoeven, Greg Kroah-Hartman, Guenter Roeck,
	Heiko Carstens, James E.J. Bottomley, John Stultz,
	Julian Wiedmann, Lai Jiangshan, Len Brown, Mark Gross,
	Martin K. Petersen, Martin Schwidefsky, Michael Reed,
	Oleg Nesterov, Paul Mackerras, Pavel Machek, Petr Mladek,
	Rafael J. Wysocki, Ralf Baechle, Stefan Richter, Stephen Boyd,
	Sudip Mukherjee, Tejun Heo, Ursula Braun, Viresh Kumar,
	Wim Van Sebroeck, linux1394-devel, linux-mips, linux-pm,
	linux-s390, linux-scsi, linux-watchdog, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 371 bytes --]

Hi,

On Wed, Oct 04, 2017 at 04:26:59PM -0700, Kees Cook wrote:
> This refactors the only users of init_timer_deferrable() to use
> the new timer_setup() and from_timer(). Removes definition of
> init_timer_deferrable().

[...]

>  drivers/hsi/clients/ssi_protocol.c           | 32 ++++++++++++++++------------

Acked-by: Sebastian Reichel <sre@kernel.org>

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 05/13] timer: Remove init_timer_deferrable() in favor of timer_setup()
@ 2017-10-05  1:02     ` Sebastian Reichel
  0 siblings, 0 replies; 98+ messages in thread
From: Sebastian Reichel @ 2017-10-05  1:02 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Benjamin Herrenschmidt, Michael Ellerman,
	Harish Patil, Manish Chopra, Kalle Valo, linuxppc-dev, netdev,
	linux-wireless, Andrew Morton, Arnd Bergmann, Chris Metcalf,
	Geert Uytterhoeven, Greg Kroah-Hartman, Guenter Roeck,
	Heiko Carstens, James E.J. Bottomley, John Stultz,
	Julian Wiedmann, Lai

[-- Attachment #1: Type: text/plain, Size: 371 bytes --]

Hi,

On Wed, Oct 04, 2017 at 04:26:59PM -0700, Kees Cook wrote:
> This refactors the only users of init_timer_deferrable() to use
> the new timer_setup() and from_timer(). Removes definition of
> init_timer_deferrable().

[...]

>  drivers/hsi/clients/ssi_protocol.c           | 32 ++++++++++++++++------------

Acked-by: Sebastian Reichel <sre@kernel.org>

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  5:28     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 98+ messages in thread
From: Greg Kroah-Hartman @ 2017-10-05  5:28 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	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 Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Petr Mladek, Rafael J. Wysocki, Ralf Baechle,
	Sebastian Reichel, Stefan Richter, Stephen Boyd, Sudip Mukherjee,
	Tejun Heo, Ursula Braun, Viresh Kumar, Wim Van Sebroeck,
	linux1394-devel, linux-mips, linux-pm, linuxppc-dev, linux-s390,
	linux-scsi, linux-watchdog, linux-wireless, linux-kernel

On Wed, Oct 04, 2017 at 04:27:04PM -0700, Kees Cook wrote:
> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts
> ---
>  arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
>  arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
>  arch/m68k/amiga/amisound.c                | 2 +-
>  arch/m68k/mac/macboing.c                  | 2 +-
>  arch/mips/mti-malta/malta-display.c       | 2 +-
>  arch/parisc/kernel/pdc_cons.c             | 2 +-
>  arch/s390/mm/cmm.c                        | 2 +-
>  drivers/atm/idt77105.c                    | 4 ++--
>  drivers/atm/iphase.c                      | 2 +-
>  drivers/block/ataflop.c                   | 8 ++++----
>  drivers/char/dtlk.c                       | 2 +-
>  drivers/char/hangcheck-timer.c            | 2 +-
>  drivers/char/nwbutton.c                   | 2 +-
>  drivers/char/rtc.c                        | 2 +-
>  drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
>  drivers/net/cris/eth_v10.c                | 6 +++---
>  drivers/net/hamradio/yam.c                | 2 +-
>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
>  drivers/staging/speakup/main.c            | 2 +-
>  drivers/staging/speakup/synth.c           | 2 +-
>  drivers/tty/cyclades.c                    | 2 +-
>  drivers/tty/isicom.c                      | 2 +-
>  drivers/tty/moxa.c                        | 2 +-
>  drivers/tty/rocket.c                      | 2 +-
>  drivers/tty/vt/keyboard.c                 | 2 +-
>  drivers/tty/vt/vt.c                       | 2 +-
>  drivers/watchdog/alim7101_wdt.c           | 2 +-
>  drivers/watchdog/machzwd.c                | 2 +-
>  drivers/watchdog/mixcomwd.c               | 2 +-
>  drivers/watchdog/sbc60xxwdt.c             | 2 +-
>  drivers/watchdog/sc520_wdt.c              | 2 +-
>  drivers/watchdog/via_wdt.c                | 2 +-
>  drivers/watchdog/w83877f_wdt.c            | 2 +-
>  drivers/xen/grant-table.c                 | 2 +-
>  fs/pstore/platform.c                      | 2 +-
>  include/linux/timer.h                     | 4 ++--
>  kernel/irq/spurious.c                     | 2 +-
>  lib/random32.c                            | 2 +-
>  net/atm/mpc.c                             | 2 +-
>  net/decnet/dn_route.c                     | 2 +-
>  net/ipv6/ip6_flowlabel.c                  | 2 +-
>  net/netrom/nr_loopback.c                  | 2 +-
>  security/keys/gc.c                        | 2 +-
>  sound/oss/midibuf.c                       | 2 +-
>  sound/oss/soundcard.c                     | 2 +-
>  sound/oss/sys_timer.c                     | 2 +-
>  sound/oss/uart6850.c                      | 2 +-
>  47 files changed, 54 insertions(+), 54 deletions(-)

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  5:28     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 98+ messages in thread
From: Greg Kroah-Hartman @ 2017-10-05  5:28 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	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

On Wed, Oct 04, 2017 at 04:27:04PM -0700, Kees Cook wrote:
> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Acked-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> # for m68k parts
> ---
>  arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
>  arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
>  arch/m68k/amiga/amisound.c                | 2 +-
>  arch/m68k/mac/macboing.c                  | 2 +-
>  arch/mips/mti-malta/malta-display.c       | 2 +-
>  arch/parisc/kernel/pdc_cons.c             | 2 +-
>  arch/s390/mm/cmm.c                        | 2 +-
>  drivers/atm/idt77105.c                    | 4 ++--
>  drivers/atm/iphase.c                      | 2 +-
>  drivers/block/ataflop.c                   | 8 ++++----
>  drivers/char/dtlk.c                       | 2 +-
>  drivers/char/hangcheck-timer.c            | 2 +-
>  drivers/char/nwbutton.c                   | 2 +-
>  drivers/char/rtc.c                        | 2 +-
>  drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
>  drivers/net/cris/eth_v10.c                | 6 +++---
>  drivers/net/hamradio/yam.c                | 2 +-
>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
>  drivers/staging/speakup/main.c            | 2 +-
>  drivers/staging/speakup/synth.c           | 2 +-
>  drivers/tty/cyclades.c                    | 2 +-
>  drivers/tty/isicom.c                      | 2 +-
>  drivers/tty/moxa.c                        | 2 +-
>  drivers/tty/rocket.c                      | 2 +-
>  drivers/tty/vt/keyboard.c                 | 2 +-
>  drivers/tty/vt/vt.c                       | 2 +-
>  drivers/watchdog/alim7101_wdt.c           | 2 +-
>  drivers/watchdog/machzwd.c                | 2 +-
>  drivers/watchdog/mixcomwd.c               | 2 +-
>  drivers/watchdog/sbc60xxwdt.c             | 2 +-
>  drivers/watchdog/sc520_wdt.c              | 2 +-
>  drivers/watchdog/via_wdt.c                | 2 +-
>  drivers/watchdog/w83877f_wdt.c            | 2 +-
>  drivers/xen/grant-table.c                 | 2 +-
>  fs/pstore/platform.c                      | 2 +-
>  include/linux/timer.h                     | 4 ++--
>  kernel/irq/spurious.c                     | 2 +-
>  lib/random32.c                            | 2 +-
>  net/atm/mpc.c                             | 2 +-
>  net/decnet/dn_route.c                     | 2 +-
>  net/ipv6/ip6_flowlabel.c                  | 2 +-
>  net/netrom/nr_loopback.c                  | 2 +-
>  security/keys/gc.c                        | 2 +-
>  sound/oss/midibuf.c                       | 2 +-
>  sound/oss/soundcard.c                     | 2 +-
>  sound/oss/sys_timer.c                     | 2 +-
>  sound/oss/uart6850.c                      | 2 +-
>  47 files changed, 54 insertions(+), 54 deletions(-)

Acked-by: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  5:28     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 98+ messages in thread
From: Greg Kroah-Hartman @ 2017-10-05  5:28 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	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

On Wed, Oct 04, 2017 at 04:27:04PM -0700, Kees Cook wrote:
> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> Acked-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org> # for m68k parts
> ---
>  arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
>  arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
>  arch/m68k/amiga/amisound.c                | 2 +-
>  arch/m68k/mac/macboing.c                  | 2 +-
>  arch/mips/mti-malta/malta-display.c       | 2 +-
>  arch/parisc/kernel/pdc_cons.c             | 2 +-
>  arch/s390/mm/cmm.c                        | 2 +-
>  drivers/atm/idt77105.c                    | 4 ++--
>  drivers/atm/iphase.c                      | 2 +-
>  drivers/block/ataflop.c                   | 8 ++++----
>  drivers/char/dtlk.c                       | 2 +-
>  drivers/char/hangcheck-timer.c            | 2 +-
>  drivers/char/nwbutton.c                   | 2 +-
>  drivers/char/rtc.c                        | 2 +-
>  drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
>  drivers/net/cris/eth_v10.c                | 6 +++---
>  drivers/net/hamradio/yam.c                | 2 +-
>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
>  drivers/staging/speakup/main.c            | 2 +-
>  drivers/staging/speakup/synth.c           | 2 +-
>  drivers/tty/cyclades.c                    | 2 +-
>  drivers/tty/isicom.c                      | 2 +-
>  drivers/tty/moxa.c                        | 2 +-
>  drivers/tty/rocket.c                      | 2 +-
>  drivers/tty/vt/keyboard.c                 | 2 +-
>  drivers/tty/vt/vt.c                       | 2 +-
>  drivers/watchdog/alim7101_wdt.c           | 2 +-
>  drivers/watchdog/machzwd.c                | 2 +-
>  drivers/watchdog/mixcomwd.c               | 2 +-
>  drivers/watchdog/sbc60xxwdt.c             | 2 +-
>  drivers/watchdog/sc520_wdt.c              | 2 +-
>  drivers/watchdog/via_wdt.c                | 2 +-
>  drivers/watchdog/w83877f_wdt.c            | 2 +-
>  drivers/xen/grant-table.c                 | 2 +-
>  fs/pstore/platform.c                      | 2 +-
>  include/linux/timer.h                     | 4 ++--
>  kernel/irq/spurious.c                     | 2 +-
>  lib/random32.c                            | 2 +-
>  net/atm/mpc.c                             | 2 +-
>  net/decnet/dn_route.c                     | 2 +-
>  net/ipv6/ip6_flowlabel.c                  | 2 +-
>  net/netrom/nr_loopback.c                  | 2 +-
>  security/keys/gc.c                        | 2 +-
>  sound/oss/midibuf.c                       | 2 +-
>  sound/oss/soundcard.c                     | 2 +-
>  sound/oss/sys_timer.c                     | 2 +-
>  sound/oss/uart6850.c                      | 2 +-
>  47 files changed, 54 insertions(+), 54 deletions(-)

Acked-by: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
  2017-10-04 23:27   ` Kees Cook
                       ` (2 preceding siblings ...)
  (?)
@ 2017-10-05  6:54     ` Kalle Valo
  -1 siblings, 0 replies; 98+ messages in thread
From: Kalle Valo @ 2017-10-05  6:54 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Greg Kroah-Hartman, Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann,
	Lai Jiangshan, Len Brown, Manish Chopra, Mark Gross,
	Martin K. Petersen, Martin Schwidefsky

Kees Cook <keescook@chromium.org> writes:

> Drop the arguments from the macro and adjust all callers with the
> following script:
>
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

[...]

>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-

For wireless:

Acked-by: Kalle Valo <kvalo@codeaurora.org>

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  6:54     ` Kalle Valo
  0 siblings, 0 replies; 98+ messages in thread
From: Kalle Valo @ 2017-10-05  6:54 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Greg Kroah-Hartman, Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann,
	Lai Jiangshan, Len Brown, Manish Chopra, Mark Gross,
	Martin K. Petersen, Martin Schwidefsky, Michael Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, cw.cz, Petr Mladek, Rafael J. Wysocki,
	Ralf Baechle, Sebastian Reichel, Stefan Richter, Stephen Boyd,
	Sudip Mukherjee, Tejun Heo, Ursula Braun, Viresh Kumar,
	Wim Van Sebroeck, linux1394-devel, linux-mips, linux-pm,
	linuxppc-dev, linux-s390, linux-scsi, linux-watchdog,
	linux-wireless, linux-kernel

Kees Cook <keescook@chromium.org> writes:

> Drop the arguments from the macro and adjust all callers with the
> following script:
>
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

[...]

>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-

For wireless:

Acked-by: Kalle Valo <kvalo@codeaurora.org>

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  6:54     ` Kalle Valo
  0 siblings, 0 replies; 98+ messages in thread
From: Kalle Valo @ 2017-10-05  6:54 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Greg Kroah-Hartman, Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann,
	Lai Jiangshan, Len Brown, Manish Chopra, Mark Gross,
	Martin K. Petersen, Martin Schwidefsky

Kees Cook <keescook@chromium.org> writes:

> Drop the arguments from the macro and adjust all callers with the
> following script:
>
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

[...]

>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-

For wireless:

Acked-by: Kalle Valo <kvalo@codeaurora.org>

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  6:54     ` Kalle Valo
  0 siblings, 0 replies; 98+ messages in thread
From: Kalle Valo @ 2017-10-05  6:54 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Greg Kroah-Hartman, Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann,
	Lai Jiangshan, Len Brown, Manish Chopra, Mark Gross,
	Martin K. Petersen, Martin Schwidefsky, Michael Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek

Kees Cook <keescook@chromium.org> writes:

> Drop the arguments from the macro and adjust all callers with the
> following script:
>
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

[...]

>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-

For wireless:

Acked-by: Kalle Valo <kvalo@codeaurora.org>

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  6:54     ` Kalle Valo
  0 siblings, 0 replies; 98+ messages in thread
From: Kalle Valo @ 2017-10-05  6:54 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Greg Kroah-Hartman, Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann,
	Lai Jiangshan, Len Brown, Manish Chopra, Mark Gross,
	Martin K. Petersen, Martin Schwidefsky, Michael Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek

Kees Cook <keescook@chromium.org> writes:

> Drop the arguments from the macro and adjust all callers with the
> following script:
>
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

[...]

>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-

For wireless:

Acked-by: Kalle Valo <kvalo@codeaurora.org>

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
  2017-10-04 23:27   ` Kees Cook
  (?)
@ 2017-10-05  8:59     ` Arnd Bergmann
  -1 siblings, 0 replies; 98+ messages in thread
From: Arnd Bergmann @ 2017-10-05  8:59 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Benjamin Herrenschmidt,
	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, M

On Thu, Oct 5, 2017 at 1:27 AM, Kees Cook <keescook@chromium.org> wrote:
> Drop the arguments from the macro and adjust all callers with the
> following script:
>
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

I was slightly worried about this large-scale rework, since it might conflict
with new users of DEFINE_TIMER(), causing bisection problems.

However, a little research showed that we have only added two users
in the past five years, so this is not a real concern.

for arch/arm, drivers/char and overall:

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  8:59     ` Arnd Bergmann
  0 siblings, 0 replies; 98+ messages in thread
From: Arnd Bergmann @ 2017-10-05  8:59 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Benjamin Herrenschmidt,
	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 Ellerman,
	Michael Reed, Networking, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Petr Mladek, Rafael J. Wysocki, Ralf Baechle,
	Sebastian Reichel, Stefan Richter, Stephen Boyd, Sudip Mukherjee,
	Tejun Heo, Ursula Braun, Viresh Kumar, Wim Van Sebroeck,
	linux1394-devel, open list:RALINK MIPS ARCHITECTURE, linux-pm,
	linuxppc-dev, linux-s390, linux-scsi, linux-watchdog,
	linux-wireless, Linux Kernel Mailing List

On Thu, Oct 5, 2017 at 1:27 AM, Kees Cook <keescook@chromium.org> wrote:
> Drop the arguments from the macro and adjust all callers with the
> following script:
>
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

I was slightly worried about this large-scale rework, since it might conflict
with new users of DEFINE_TIMER(), causing bisection problems.

However, a little research showed that we have only added two users
in the past five years, so this is not a real concern.

for arch/arm, drivers/char and overall:

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-05  8:59     ` Arnd Bergmann
  0 siblings, 0 replies; 98+ messages in thread
From: Arnd Bergmann @ 2017-10-05  8:59 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Benjamin Herrenschmidt,
	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

On Thu, Oct 5, 2017 at 1:27 AM, Kees Cook <keescook@chromium.org> wrote:
> Drop the arguments from the macro and adjust all callers with the
> following script:
>
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts

I was slightly worried about this large-scale rework, since it might conflict
with new users of DEFINE_TIMER(), causing bisection problems.

However, a little research showed that we have only added two users
in the past five years, so this is not a real concern.

for arch/arm, drivers/char and overall:

Acked-by: Arnd Bergmann <arnd@arndb.de>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Convert schedule_timeout() to use from_timer()
  2017-10-04 23:26   ` Kees Cook
  (?)
  (?)
@ 2017-10-05 13:03   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux, pmladek, cmetcalf, manish.chopra, oleg, hpa, harish.patil,
	paulus, gregkh, benh, tj, kvalo, ubraun, schwidefsky, stefanr,
	john.stultz, akpm, rjw, tglx, mingo, ralf, jwi, sre,
	viresh.kumar, linux-kernel, jiangshanlai, martin.petersen, pavel,
	sudipm.mukherjee, sboyd, arnd, mark.gross, jejb, keescook, geert,
	heiko.carstens, wim, len.brown, mdr, mpe

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

timer: Convert schedule_timeout() to use from_timer()

In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new from_timer() helper and passing
the timer pointer explicitly. Since this special timer is on the stack, it
needs to have a wrapper structure to carry state once .data is eliminated.

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: 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: "Rafael J. Wysocki" <rjw@rjwysocki.net>
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: Stephen Boyd <sboyd@codeaurora.org>
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-2-git-send-email-keescook@chromium.org

---
 include/linux/timer.h |  8 ++++++++
 kernel/time/timer.c   | 26 +++++++++++++++++++-------
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/include/linux/timer.h b/include/linux/timer.h
index 6383c52..5ef5c9e 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -179,6 +179,14 @@ static inline void timer_setup(struct timer_list *timer,
 		      (TIMER_DATA_TYPE)timer, flags);
 }
 
+static inline void timer_setup_on_stack(struct timer_list *timer,
+			       void (*callback)(struct timer_list *),
+			       unsigned int flags)
+{
+	__setup_timer_on_stack(timer, (TIMER_FUNC_TYPE)callback,
+			       (TIMER_DATA_TYPE)timer, flags);
+}
+
 #define from_timer(var, callback_timer, timer_fieldname) \
 	container_of(callback_timer, typeof(*var), timer_fieldname)
 
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index f2674a0..38613ce 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1668,9 +1668,20 @@ void run_local_timers(void)
 	raise_softirq(TIMER_SOFTIRQ);
 }
 
-static void process_timeout(unsigned long __data)
+/*
+ * Since schedule_timeout()'s timer is defined on the stack, it must store
+ * the target task on the stack as well.
+ */
+struct process_timer {
+	struct timer_list timer;
+	struct task_struct *task;
+};
+
+static void process_timeout(struct timer_list *t)
 {
-	wake_up_process((struct task_struct *)__data);
+	struct process_timer *timeout = from_timer(timeout, t, timer);
+
+	wake_up_process(timeout->task);
 }
 
 /**
@@ -1704,7 +1715,7 @@ static void process_timeout(unsigned long __data)
  */
 signed long __sched schedule_timeout(signed long timeout)
 {
-	struct timer_list timer;
+	struct process_timer timer;
 	unsigned long expire;
 
 	switch (timeout)
@@ -1738,13 +1749,14 @@ signed long __sched schedule_timeout(signed long timeout)
 
 	expire = timeout + jiffies;
 
-	setup_timer_on_stack(&timer, process_timeout, (unsigned long)current);
-	__mod_timer(&timer, expire, false);
+	timer.task = current;
+	timer_setup_on_stack(&timer.timer, process_timeout, 0);
+	__mod_timer(&timer.timer, expire, false);
 	schedule();
-	del_singleshot_timer_sync(&timer);
+	del_singleshot_timer_sync(&timer.timer);
 
 	/* Remove the timer from the object tracker */
-	destroy_timer_on_stack(&timer);
+	destroy_timer_on_stack(&timer.timer);
 
 	timeout = expire - jiffies;
 

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Remove init_timer_pinned_deferrable() in favor of timer_setup()
  2017-10-04 23:26   ` Kees Cook
  (?)
  (?)
@ 2017-10-05 13:04   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: arnd, heiko.carstens, stefanr, kvalo, geert, jwi, linux-kernel,
	linux, viresh.kumar, schwidefsky, sboyd, mpe, mingo, paulus,
	john.stultz, cmetcalf, ralf, harish.patil, akpm, benh, tj,
	sudipm.mukherjee, wim, pmladek, pavel, manish.chopra, tglx, sre,
	jejb, keescook, gregkh, jiangshanlai, ubraun, hpa, mdr, rjw,
	martin.petersen, len.brown, mark.gross, oleg

Commit-ID:  1d1fe902afb380571105d05d0be3de61b81bc9a8
Gitweb:     https://git.kernel.org/tip/1d1fe902afb380571105d05d0be3de61b81bc9a8
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:26:56 -0700
Committer:  Thomas Gleixner <tglx@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 <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 | 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)
 

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()
  2017-10-04 23:26   ` Kees Cook
  (?)
  (?)
@ 2017-10-05 13:04   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mdr, cmetcalf, geert, john.stultz, stefanr, paulus, linux-kernel,
	ubraun, tj, mark.gross, kvalo, viresh.kumar, harish.patil, wim,
	mpe, gregkh, hpa, sudipm.mukherjee, pavel, rjw, mingo, linux,
	benh, oleg, jejb, sboyd, heiko.carstens, akpm, manish.chopra,
	ralf, schwidefsky, pmladek, arnd, jiangshanlai, tglx, sre,
	len.brown, keescook, martin.petersen, jwi

Commit-ID:  9c6c273aa4248c60569de6ef7e7e9c7bed3cd32e
Gitweb:     https://git.kernel.org/tip/9c6c273aa4248c60569de6ef7e7e9c7bed3cd32e
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:26:57 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 5 Oct 2017 15:01:17 +0200

timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()

Remove uses of init_timer_on_stack() with open-coded function and data
assignments that could be expressed using timer_setup_on_stack(). Several
were removed from the stack entirely since there was a one-to-one mapping
of parent structure to timer, those are switched to using timer_setup()
instead. All related callbacks were adjusted to use from_timer().

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: Heiko Carstens <heiko.carstens@de.ibm.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: Wim Van Sebroeck <wim@iguana.be>
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: linux-scsi@vger.kernel.org
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: Michael Reed <mdr@sgi.com>
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: Lai Jiangshan <jiangshanlai@gmail.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: "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: Guenter Roeck <linux@roeck-us.net>
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-4-git-send-email-keescook@chromium.org

---
 drivers/base/power/main.c           |  8 +++-----
 drivers/firewire/core-transaction.c | 10 +++++-----
 drivers/parport/ieee1284.c          | 21 +++++++--------------
 drivers/s390/char/tape.h            |  1 +
 drivers/s390/char/tape_std.c        | 18 ++++++------------
 drivers/s390/net/lcs.c              | 16 ++++++----------
 drivers/s390/net/lcs.h              |  1 +
 drivers/scsi/qla1280.c              | 14 +++++---------
 drivers/scsi/qla1280.h              |  1 +
 include/linux/parport.h             |  1 +
 include/linux/timer.h               |  2 --
 11 files changed, 36 insertions(+), 57 deletions(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 770b153..ae47b2e 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -478,9 +478,9 @@ struct dpm_watchdog {
  * There's not much we can do here to recover so panic() to
  * capture a crash-dump in pstore.
  */
-static void dpm_watchdog_handler(unsigned long data)
+static void dpm_watchdog_handler(struct timer_list *t)
 {
-	struct dpm_watchdog *wd = (void *)data;
+	struct dpm_watchdog *wd = from_timer(wd, t, timer);
 
 	dev_emerg(wd->dev, "**** DPM device timeout ****\n");
 	show_stack(wd->tsk, NULL);
@@ -500,11 +500,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
 	wd->dev = dev;
 	wd->tsk = current;
 
-	init_timer_on_stack(timer);
+	timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
 	/* use same timeout value for both suspend and resume */
 	timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT;
-	timer->function = dpm_watchdog_handler;
-	timer->data = (unsigned long)wd;
 	add_timer(timer);
 }
 
diff --git a/drivers/firewire/core-transaction.c b/drivers/firewire/core-transaction.c
index d6a09b9..4372f9e4 100644
--- a/drivers/firewire/core-transaction.c
+++ b/drivers/firewire/core-transaction.c
@@ -137,9 +137,9 @@ int fw_cancel_transaction(struct fw_card *card,
 }
 EXPORT_SYMBOL(fw_cancel_transaction);
 
-static void split_transaction_timeout_callback(unsigned long data)
+static void split_transaction_timeout_callback(struct timer_list *timer)
 {
-	struct fw_transaction *t = (struct fw_transaction *)data;
+	struct fw_transaction *t = from_timer(t, timer, split_timeout_timer);
 	struct fw_card *card = t->card;
 	unsigned long flags;
 
@@ -373,8 +373,8 @@ void fw_send_request(struct fw_card *card, struct fw_transaction *t, int tcode,
 	t->tlabel = tlabel;
 	t->card = card;
 	t->is_split_transaction = false;
-	setup_timer(&t->split_timeout_timer,
-		    split_transaction_timeout_callback, (unsigned long)t);
+	timer_setup(&t->split_timeout_timer,
+		    split_transaction_timeout_callback, 0);
 	t->callback = callback;
 	t->callback_data = callback_data;
 
@@ -423,7 +423,7 @@ int fw_run_transaction(struct fw_card *card, int tcode, int destination_id,
 	struct transaction_callback_data d;
 	struct fw_transaction t;
 
-	init_timer_on_stack(&t.split_timeout_timer);
+	timer_setup_on_stack(&t.split_timeout_timer, NULL, 0);
 	init_completion(&d.done);
 	d.payload = payload;
 	fw_send_request(card, &t, tcode, destination_id, generation, speed,
diff --git a/drivers/parport/ieee1284.c b/drivers/parport/ieee1284.c
index 74cc6dd..2d1a5c7 100644
--- a/drivers/parport/ieee1284.c
+++ b/drivers/parport/ieee1284.c
@@ -44,10 +44,11 @@ static void parport_ieee1284_wakeup (struct parport *port)
 	up (&port->physport->ieee1284.irq);
 }
 
-static struct parport *port_from_cookie[PARPORT_MAX];
-static void timeout_waiting_on_port (unsigned long cookie)
+static void timeout_waiting_on_port (struct timer_list *t)
 {
-	parport_ieee1284_wakeup (port_from_cookie[cookie % PARPORT_MAX]);
+	struct parport *port = from_timer(port, t, timer);
+
+	parport_ieee1284_wakeup (port);
 }
 
 /**
@@ -69,27 +70,19 @@ static void timeout_waiting_on_port (unsigned long cookie)
 int parport_wait_event (struct parport *port, signed long timeout)
 {
 	int ret;
-	struct timer_list timer;
 
 	if (!port->physport->cad->timeout)
 		/* Zero timeout is special, and we can't down() the
 		   semaphore. */
 		return 1;
 
-	init_timer_on_stack(&timer);
-	timer.expires = jiffies + timeout;
-	timer.function = timeout_waiting_on_port;
-	port_from_cookie[port->number % PARPORT_MAX] = port;
-	timer.data = port->number;
-
-	add_timer (&timer);
+	timer_setup(&port->timer, timeout_waiting_on_port, 0);
+	mod_timer(&port->timer, jiffies + timeout);
 	ret = down_interruptible (&port->physport->ieee1284.irq);
-	if (!del_timer_sync(&timer) && !ret)
+	if (!del_timer_sync(&port->timer) && !ret)
 		/* Timed out. */
 		ret = 1;
 
-	destroy_timer_on_stack(&timer);
-
 	return ret;
 }
 
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h
index ea664dd..52fbcd9 100644
--- a/drivers/s390/char/tape.h
+++ b/drivers/s390/char/tape.h
@@ -128,6 +128,7 @@ struct tape_request {
 	int options;			/* options for execution. */
 	int retries;			/* retry counter for error recovery. */
 	int rescnt;			/* residual count from devstat. */
+	struct timer_list timer;	/* timer for std_assign_timeout(). */
 
 	/* Callback for delivering final status. */
 	void (*callback)(struct tape_request *, void *);
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c
index 3478e19..cd204ab 100644
--- a/drivers/s390/char/tape_std.c
+++ b/drivers/s390/char/tape_std.c
@@ -32,14 +32,12 @@
  * tape_std_assign
  */
 static void
-tape_std_assign_timeout(unsigned long data)
+tape_std_assign_timeout(struct timer_list *t)
 {
-	struct tape_request *	request;
-	struct tape_device *	device;
+	struct tape_request *	request = from_timer(request, t, timer);
+	struct tape_device *	device = request->device;
 	int rc;
 
-	request = (struct tape_request *) data;
-	device = request->device;
 	BUG_ON(!device);
 
 	DBF_EVENT(3, "%08x: Assignment timeout. Device busy.\n",
@@ -70,16 +68,12 @@ tape_std_assign(struct tape_device *device)
 	 * to another host (actually this shouldn't happen but it does).
 	 * So we set up a timeout for this call.
 	 */
-	init_timer_on_stack(&timeout);
-	timeout.function = tape_std_assign_timeout;
-	timeout.data     = (unsigned long) request;
-	timeout.expires  = jiffies + 2 * HZ;
-	add_timer(&timeout);
+	timer_setup(&request->timer, tape_std_assign_timeout, 0);
+	mod_timer(&timeout, jiffies + 2 * HZ);
 
 	rc = tape_do_io_interruptible(device, request);
 
-	del_timer_sync(&timeout);
-	destroy_timer_on_stack(&timeout);
+	del_timer_sync(&request->timer);
 
 	if (rc != 0) {
 		DBF_EVENT(3, "%08x: assign failed - device might be busy\n",
diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c
index d01b5c2..21bba40 100644
--- a/drivers/s390/net/lcs.c
+++ b/drivers/s390/net/lcs.c
@@ -834,9 +834,10 @@ lcs_notify_lancmd_waiters(struct lcs_card *card, struct lcs_cmd *cmd)
  * Emit buffer of a lan command.
  */
 static void
-lcs_lancmd_timeout(unsigned long data)
+lcs_lancmd_timeout(struct timer_list *t)
 {
-	struct lcs_reply *reply, *list_reply, *r;
+	struct lcs_reply *reply = from_timer(reply, t, timer);
+	struct lcs_reply *list_reply, *r;
 	unsigned long flags;
 
 	LCS_DBF_TEXT(4, trace, "timeout");
@@ -864,7 +865,6 @@ lcs_send_lancmd(struct lcs_card *card, struct lcs_buffer *buffer,
 {
 	struct lcs_reply *reply;
 	struct lcs_cmd *cmd;
-	struct timer_list timer;
 	unsigned long flags;
 	int rc;
 
@@ -885,14 +885,10 @@ lcs_send_lancmd(struct lcs_card *card, struct lcs_buffer *buffer,
 	rc = lcs_ready_buffer(&card->write, buffer);
 	if (rc)
 		return rc;
-	init_timer_on_stack(&timer);
-	timer.function = lcs_lancmd_timeout;
-	timer.data = (unsigned long) reply;
-	timer.expires = jiffies + HZ*card->lancmd_timeout;
-	add_timer(&timer);
+	timer_setup(&reply->timer, lcs_lancmd_timeout, 0);
+	mod_timer(&reply->timer, jiffies + HZ * card->lancmd_timeout);
 	wait_event(reply->wait_q, reply->received);
-	del_timer_sync(&timer);
-	destroy_timer_on_stack(&timer);
+	del_timer_sync(&reply->timer);
 	LCS_DBF_TEXT_(4, trace, "rc:%d",reply->rc);
 	rc = reply->rc;
 	lcs_put_reply(reply);
diff --git a/drivers/s390/net/lcs.h b/drivers/s390/net/lcs.h
index 150fcb4..d44fb8d 100644
--- a/drivers/s390/net/lcs.h
+++ b/drivers/s390/net/lcs.h
@@ -275,6 +275,7 @@ struct lcs_reply {
 	void (*callback)(struct lcs_card *, struct lcs_cmd *);
 	wait_queue_head_t wait_q;
 	struct lcs_card *card;
+	struct timer_list timer;
 	int received;
 	int rc;
 };
diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c
index 8a29fb0..390775d 100644
--- a/drivers/scsi/qla1280.c
+++ b/drivers/scsi/qla1280.c
@@ -758,9 +758,9 @@ enum action {
 };
 
 
-static void qla1280_mailbox_timeout(unsigned long __data)
+static void qla1280_mailbox_timeout(struct timer_list *t)
 {
-	struct scsi_qla_host *ha = (struct scsi_qla_host *)__data;
+	struct scsi_qla_host *ha = from_timer(ha, t, mailbox_timer);
 	struct device_reg __iomem *reg;
 	reg = ha->iobase;
 
@@ -2465,7 +2465,6 @@ qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
 	uint16_t __iomem *mptr;
 	uint16_t data;
 	DECLARE_COMPLETION_ONSTACK(wait);
-	struct timer_list timer;
 
 	ENTER("qla1280_mailbox_command");
 
@@ -2494,18 +2493,15 @@ qla1280_mailbox_command(struct scsi_qla_host *ha, uint8_t mr, uint16_t *mb)
 	/* Issue set host interrupt command. */
 
 	/* set up a timer just in case we're really jammed */
-	init_timer_on_stack(&timer);
-	timer.expires = jiffies + 20*HZ;
-	timer.data = (unsigned long)ha;
-	timer.function = qla1280_mailbox_timeout;
-	add_timer(&timer);
+	timer_setup(&ha->mailbox_timer, qla1280_mailbox_timeout, 0);
+	mod_timer(&ha->mailbox_timer, jiffies + 20 * HZ);
 
 	spin_unlock_irq(ha->host->host_lock);
 	WRT_REG_WORD(&reg->host_cmd, HC_SET_HOST_INT);
 	data = qla1280_debounce_register(&reg->istatus);
 
 	wait_for_completion(&wait);
-	del_timer_sync(&timer);
+	del_timer_sync(&ha->mailbox_timer);
 
 	spin_lock_irq(ha->host->host_lock);
 
diff --git a/drivers/scsi/qla1280.h b/drivers/scsi/qla1280.h
index 834884b..1522aca 100644
--- a/drivers/scsi/qla1280.h
+++ b/drivers/scsi/qla1280.h
@@ -1055,6 +1055,7 @@ struct scsi_qla_host {
 	struct list_head done_q;	/* Done queue */
 
 	struct completion *mailbox_wait;
+	struct timer_list mailbox_timer;
 
 	volatile struct {
 		uint32_t online:1;			/* 0 */
diff --git a/include/linux/parport.h b/include/linux/parport.h
index 58e3c64..397607a 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -225,6 +225,7 @@ struct parport {
 	struct pardevice *waittail;
 
 	struct list_head list;
+	struct timer_list timer;
 	unsigned int flags;
 
 	void *sysctl_table;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index d11e819..b10c4bd 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_on_stack(timer)					\
-	__init_timer_on_stack((timer), 0)
 
 #define __setup_timer(_timer, _fn, _data, _flags)			\
 	do {								\

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Remove init_timer_pinned() in favor of timer_setup()
  2017-10-04 23:26   ` Kees Cook
                     ` (2 preceding siblings ...)
  (?)
@ 2017-10-05 13:05   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: keescook, benh, wim, jiangshanlai, viresh.kumar, sboyd, cmetcalf,
	hpa, len.brown, martin.petersen, sudipm.mukherjee, schwidefsky,
	pmladek, mingo, geert, manish.chopra, sre, tj, jwi, arnd, ralf,
	linux-kernel, pavel, gregkh, mpe, stefanr, john.stultz, jejb,
	heiko.carstens, linux, kvalo, akpm, tglx, ubraun, mdr, paulus,
	rjw, oleg, mark.gross, harish.patil

Commit-ID:  185981d54a60ae90942c6ba9006b250f3348cef2
Gitweb:     https://git.kernel.org/tip/185981d54a60ae90942c6ba9006b250f3348cef2
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:26:58 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 5 Oct 2017 15:01:17 +0200

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

This refactors the only users of init_timer_pinned() to use
the new timer_setup() and from_timer(). Drops the definition of
init_timer_pinned().

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: David S. Miller <davem@davemloft.net> # for networking parts
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-5-git-send-email-keescook@chromium.org

---
 drivers/net/ethernet/tile/tilepro.c | 9 ++++-----
 include/linux/timer.h               | 2 --
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c
index 49ccee4..56d0628 100644
--- a/drivers/net/ethernet/tile/tilepro.c
+++ b/drivers/net/ethernet/tile/tilepro.c
@@ -608,9 +608,9 @@ static void tile_net_schedule_egress_timer(struct tile_net_cpu *info)
  * ISSUE: Maybe instead track number of expected completions, and free
  * only that many, resetting to zero if "pending" is ever false.
  */
-static void tile_net_handle_egress_timer(unsigned long arg)
+static void tile_net_handle_egress_timer(struct timer_list *t)
 {
-	struct tile_net_cpu *info = (struct tile_net_cpu *)arg;
+	struct tile_net_cpu *info = from_timer(info, t, egress_timer);
 	struct net_device *dev = info->napi.dev;
 
 	/* The timer is no longer scheduled. */
@@ -1004,9 +1004,8 @@ static void tile_net_register(void *dev_ptr)
 		BUG();
 
 	/* Initialize the egress timer. */
-	init_timer_pinned(&info->egress_timer);
-	info->egress_timer.data = (long)info;
-	info->egress_timer.function = tile_net_handle_egress_timer;
+	timer_setup(&info->egress_timer, tile_net_handle_egress_timer,
+		    TIMER_PINNED);
 
 	u64_stats_init(&info->stats.syncp);
 
diff --git a/include/linux/timer.h b/include/linux/timer.h
index b10c4bd..9da9035 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -128,8 +128,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
 
 #define init_timer(timer)						\
 	__init_timer((timer), 0)
-#define init_timer_pinned(timer)					\
-	__init_timer((timer), TIMER_PINNED)
 #define init_timer_deferrable(timer)					\
 	__init_timer((timer), TIMER_DEFERRABLE)
 

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Remove init_timer_deferrable() in favor of timer_setup()
  2017-10-04 23:26   ` Kees Cook
                     ` (3 preceding siblings ...)
  (?)
@ 2017-10-05 13:05   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: ralf, hpa, kvalo, mingo, linux, mpe, stefanr, geert, john.stultz,
	len.brown, harish.patil, keescook, sudipm.mukherjee,
	linux-kernel, pavel, arnd, oleg, pmladek, sboyd, viresh.kumar,
	jejb, mark.gross, tglx, mdr, ubraun, sre, heiko.carstens, rjw,
	schwidefsky, jiangshanlai, cmetcalf, martin.petersen, paulus,
	wim, manish.chopra, jwi, tj, akpm, gregkh, benh

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

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

This refactors the only users of init_timer_deferrable() to use
the new timer_setup() and from_timer(). Removes definition of
init_timer_deferrable().

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: David S. Miller <davem@davemloft.net> # for networking parts
Acked-by: Sebastian Reichel <sre@kernel.org> # for drivers/hsi parts
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: Oleg Nesterov <oleg@redhat.com>
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: "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: "Rafael J. Wysocki" <rjw@rjwysocki.net>
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: linux-wireless@vger.kernel.org
Cc: Sebastian Reichel <sre@kernel.org>
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-6-git-send-email-keescook@chromium.org

---
 arch/powerpc/mm/numa.c                       | 12 +++++------
 drivers/hsi/clients/ssi_protocol.c           | 32 ++++++++++++++++------------
 drivers/net/ethernet/qlogic/qlge/qlge_main.c | 11 ++++------
 drivers/net/vxlan.c                          |  8 +++----
 drivers/net/wireless/ath/ath6kl/recovery.c   |  9 ++++----
 include/linux/timer.h                        |  2 --
 6 files changed, 34 insertions(+), 40 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index b95c584..f9b6107 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -1453,7 +1453,7 @@ static void topology_schedule_update(void)
 	schedule_work(&topology_work);
 }
 
-static void topology_timer_fn(unsigned long ignored)
+static void topology_timer_fn(struct timer_list *unused)
 {
 	if (prrn_enabled && cpumask_weight(&cpu_associativity_changes_mask))
 		topology_schedule_update();
@@ -1463,14 +1463,11 @@ static void topology_timer_fn(unsigned long ignored)
 		reset_topology_timer();
 	}
 }
-static struct timer_list topology_timer =
-	TIMER_INITIALIZER(topology_timer_fn, 0, 0);
+static struct timer_list topology_timer;
 
 static void reset_topology_timer(void)
 {
-	topology_timer.data = 0;
-	topology_timer.expires = jiffies + 60 * HZ;
-	mod_timer(&topology_timer, topology_timer.expires);
+	mod_timer(&topology_timer, jiffies + 60 * HZ);
 }
 
 #ifdef CONFIG_SMP
@@ -1530,7 +1527,8 @@ int start_topology_update(void)
 			prrn_enabled = 0;
 			vphn_enabled = 1;
 			setup_cpu_associativity_change_counters();
-			init_timer_deferrable(&topology_timer);
+			timer_setup(&topology_timer, topology_timer_fn,
+				    TIMER_DEFERRABLE);
 			reset_topology_timer();
 		}
 	}
diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 93d28c0..67af03d 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -464,10 +464,10 @@ static void ssip_error(struct hsi_client *cl)
 	hsi_async_read(cl, msg);
 }
 
-static void ssip_keep_alive(unsigned long data)
+static void ssip_keep_alive(struct timer_list *t)
 {
-	struct hsi_client *cl = (struct hsi_client *)data;
-	struct ssi_protocol *ssi = hsi_client_drvdata(cl);
+	struct ssi_protocol *ssi = from_timer(ssi, t, keep_alive);
+	struct hsi_client *cl = ssi->cl;
 
 	dev_dbg(&cl->device, "Keep alive kick in: m(%d) r(%d) s(%d)\n",
 		ssi->main_state, ssi->recv_state, ssi->send_state);
@@ -490,9 +490,19 @@ static void ssip_keep_alive(unsigned long data)
 	spin_unlock(&ssi->lock);
 }
 
-static void ssip_wd(unsigned long data)
+static void ssip_rx_wd(struct timer_list *t)
+{
+	struct ssi_protocol *ssi = from_timer(ssi, t, rx_wd);
+	struct hsi_client *cl = ssi->cl;
+
+	dev_err(&cl->device, "Watchdog trigerred\n");
+	ssip_error(cl);
+}
+
+static void ssip_tx_wd(unsigned long data)
 {
-	struct hsi_client *cl = (struct hsi_client *)data;
+	struct ssi_protocol *ssi = from_timer(ssi, t, tx_wd);
+	struct hsi_client *cl = ssi->cl;
 
 	dev_err(&cl->device, "Watchdog trigerred\n");
 	ssip_error(cl);
@@ -1084,15 +1094,9 @@ static int ssi_protocol_probe(struct device *dev)
 	}
 
 	spin_lock_init(&ssi->lock);
-	init_timer_deferrable(&ssi->rx_wd);
-	init_timer_deferrable(&ssi->tx_wd);
-	init_timer(&ssi->keep_alive);
-	ssi->rx_wd.data = (unsigned long)cl;
-	ssi->rx_wd.function = ssip_wd;
-	ssi->tx_wd.data = (unsigned long)cl;
-	ssi->tx_wd.function = ssip_wd;
-	ssi->keep_alive.data = (unsigned long)cl;
-	ssi->keep_alive.function = ssip_keep_alive;
+	timer_setup(&ssi->rx_wd, ssip_rx_wd, TIMER_DEFERRABLE);
+	timer_setup(&ssi->tx_wd, ssip_tx_wd, TIMER_DEFERRABLE);
+	timer_setup(&ssi->keep_alive, ssip_keep_alive, 0);
 	INIT_LIST_HEAD(&ssi->txqueue);
 	INIT_LIST_HEAD(&ssi->cmdqueue);
 	atomic_set(&ssi->tx_usecnt, 0);
diff --git a/drivers/net/ethernet/qlogic/qlge/qlge_main.c b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
index 9feec70..29fea74 100644
--- a/drivers/net/ethernet/qlogic/qlge/qlge_main.c
+++ b/drivers/net/ethernet/qlogic/qlge/qlge_main.c
@@ -4725,9 +4725,9 @@ static const struct net_device_ops qlge_netdev_ops = {
 	.ndo_vlan_rx_kill_vid	= qlge_vlan_rx_kill_vid,
 };
 
-static void ql_timer(unsigned long data)
+static void ql_timer(struct timer_list *t)
 {
-	struct ql_adapter *qdev = (struct ql_adapter *)data;
+	struct ql_adapter *qdev = from_timer(qdev, t, timer);
 	u32 var = 0;
 
 	var = ql_read32(qdev, STS);
@@ -4806,11 +4806,8 @@ static int qlge_probe(struct pci_dev *pdev,
 	/* Start up the timer to trigger EEH if
 	 * the bus goes dead
 	 */
-	init_timer_deferrable(&qdev->timer);
-	qdev->timer.data = (unsigned long)qdev;
-	qdev->timer.function = ql_timer;
-	qdev->timer.expires = jiffies + (5*HZ);
-	add_timer(&qdev->timer);
+	timer_setup(&qdev->timer, ql_timer, TIMER_DEFERRABLE);
+	mod_timer(&qdev->timer, jiffies + (5*HZ));
 	ql_link_off(qdev);
 	ql_display_dev_info(ndev);
 	atomic_set(&qdev->lb_count, 0);
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d7c49cf..3247d2f 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2325,9 +2325,9 @@ static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 }
 
 /* Walk the forwarding table and purge stale entries */
-static void vxlan_cleanup(unsigned long arg)
+static void vxlan_cleanup(struct timer_list *t)
 {
-	struct vxlan_dev *vxlan = (struct vxlan_dev *) arg;
+	struct vxlan_dev *vxlan = from_timer(vxlan, t, age_timer);
 	unsigned long next_timer = jiffies + FDB_AGE_INTERVAL;
 	unsigned int h;
 
@@ -2647,9 +2647,7 @@ static void vxlan_setup(struct net_device *dev)
 	INIT_LIST_HEAD(&vxlan->next);
 	spin_lock_init(&vxlan->hash_lock);
 
-	init_timer_deferrable(&vxlan->age_timer);
-	vxlan->age_timer.function = vxlan_cleanup;
-	vxlan->age_timer.data = (unsigned long) vxlan;
+	timer_setup(&vxlan->age_timer, vxlan_cleanup, TIMER_DEFERRABLE);
 
 	vxlan->dev = dev;
 
diff --git a/drivers/net/wireless/ath/ath6kl/recovery.c b/drivers/net/wireless/ath/ath6kl/recovery.c
index 3a8d5e9..c09e40c 100644
--- a/drivers/net/wireless/ath/ath6kl/recovery.c
+++ b/drivers/net/wireless/ath/ath6kl/recovery.c
@@ -60,9 +60,9 @@ void ath6kl_recovery_hb_event(struct ath6kl *ar, u32 cookie)
 		ar->fw_recovery.hb_pending = false;
 }
 
-static void ath6kl_recovery_hb_timer(unsigned long data)
+static void ath6kl_recovery_hb_timer(struct timer_list *t)
 {
-	struct ath6kl *ar = (struct ath6kl *) data;
+	struct ath6kl *ar = from_timer(ar, t, fw_recovery.hb_timer);
 	int err;
 
 	if (test_bit(RECOVERY_CLEANUP, &ar->flag) ||
@@ -104,9 +104,8 @@ void ath6kl_recovery_init(struct ath6kl *ar)
 	recovery->seq_num = 0;
 	recovery->hb_misscnt = 0;
 	ar->fw_recovery.hb_pending = false;
-	ar->fw_recovery.hb_timer.function = ath6kl_recovery_hb_timer;
-	ar->fw_recovery.hb_timer.data = (unsigned long) ar;
-	init_timer_deferrable(&ar->fw_recovery.hb_timer);
+	timer_setup(&ar->fw_recovery.hb_timer, ath6kl_recovery_hb_timer,
+		    TIMER_DEFERRABLE);
 
 	if (ar->fw_recovery.hb_poll)
 		mod_timer(&ar->fw_recovery.hb_timer, jiffies +
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 9da9035..10cc45c 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -128,8 +128,6 @@ static inline void init_timer_on_stack_key(struct timer_list *timer,
 
 #define init_timer(timer)						\
 	__init_timer((timer), 0)
-#define init_timer_deferrable(timer)					\
-	__init_timer((timer), TIMER_DEFERRABLE)
 
 #define __setup_timer(_timer, _fn, _data, _flags)			\
 	do {								\

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Remove users of TIMER_DEFERRED_INITIALIZER
  2017-10-04 23:27   ` Kees Cook
  (?)
  (?)
@ 2017-10-05 13:05   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:05 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: akpm, jejb, kvalo, sudipm.mukherjee, arnd, manish.chopra, sre,
	jwi, sboyd, stefanr, len.brown, linux, mingo, schwidefsky,
	gregkh, mpe, pmladek, geert, oleg, rjw, mdr, pavel, paulus,
	harish.patil, mark.gross, john.stultz, ralf, heiko.carstens, wim,
	cmetcalf, linux-kernel, benh, ubraun, viresh.kumar, tj,
	martin.petersen, keescook, jiangshanlai, tglx, hpa

Commit-ID:  5cd79d6abd2c142352dead0e3df04e86ee32f5d3
Gitweb:     https://git.kernel.org/tip/5cd79d6abd2c142352dead0e3df04e86ee32f5d3
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:27:00 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 5 Oct 2017 15:01:18 +0200

timer: Remove users of TIMER_DEFERRED_INITIALIZER

This removes uses of TIMER_DEFERRED_INITIALIZER and chooses a location
to call timer_setup() from before add_timer() or mod_timer() is called.
Adjusts callbacks to use from_timer() as needed.

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: Martin Schwidefsky <schwidefsky@de.ibm.com>
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: Tejun Heo <tj@kernel.org>
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-7-git-send-email-keescook@chromium.org

---
 arch/s390/kernel/lgr.c      | 6 +++---
 arch/s390/kernel/topology.c | 6 +++---
 kernel/workqueue.c          | 8 +++-----
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/arch/s390/kernel/lgr.c b/arch/s390/kernel/lgr.c
index ae7dff1..bf9622f 100644
--- a/arch/s390/kernel/lgr.c
+++ b/arch/s390/kernel/lgr.c
@@ -153,14 +153,13 @@ static void lgr_timer_set(void);
 /*
  * LGR timer callback
  */
-static void lgr_timer_fn(unsigned long ignored)
+static void lgr_timer_fn(struct timer_list *unused)
 {
 	lgr_info_log();
 	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));
+	timer_setup(&lgr_timer, lgr_timer_fn, TIMER_DEFERRABLE);
 	lgr_timer_set();
 	return 0;
 }
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index ed0bdd2..d7ece98 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -320,15 +320,14 @@ static void topology_flush_work(void)
 	flush_work(&topology_work);
 }
 
-static void topology_timer_fn(unsigned long ignored)
+static void topology_timer_fn(struct timer_list *unused)
 {
 	if (ptf(PTF_CHECK))
 		topology_schedule_update();
 	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);
 
@@ -597,6 +596,7 @@ static struct ctl_table topology_dir_table[] = {
 
 static int __init topology_init(void)
 {
+	timer_setup(&topology_timer, topology_timer_fn, TIMER_DEFERRABLE);
 	if (MACHINE_HAS_TOPOLOGY)
 		set_topology_timer();
 	else
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 64d0edf..a5361fc 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5390,11 +5390,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;
@@ -5408,7 +5405,7 @@ static void wq_watchdog_reset_touched(void)
 		per_cpu(wq_watchdog_touched_cpu, cpu) = jiffies;
 }
 
-static void wq_watchdog_timer_fn(unsigned long data)
+static void wq_watchdog_timer_fn(struct timer_list *unused)
 {
 	unsigned long thresh = READ_ONCE(wq_watchdog_thresh) * HZ;
 	bool lockup_detected = false;
@@ -5510,6 +5507,7 @@ module_param_cb(watchdog_thresh, &wq_watchdog_thresh_ops, &wq_watchdog_thresh,
 
 static void wq_watchdog_init(void)
 {
+	timer_setup(&wq_watchdog_timer, wq_watchdog_timer_fn, TIMER_DEFERRABLE);
 	wq_watchdog_set_thresh(wq_watchdog_thresh);
 }
 

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Remove last user of TIMER_INITIALIZER
  2017-10-04 23:27   ` Kees Cook
  (?)
  (?)
@ 2017-10-05 13:06   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: len.brown, pmladek, oleg, heiko.carstens, hpa, tj, manish.chopra,
	harish.patil, cmetcalf, ralf, jiangshanlai, geert, gregkh,
	keescook, rjw, tglx, paulus, mpe, kvalo, sboyd, mingo, stefanr,
	linux-kernel, martin.petersen, jejb, arnd, wim, jwi, schwidefsky,
	benh, mdr, mark.gross, linux, sre, viresh.kumar, akpm,
	sudipm.mukherjee, ubraun, john.stultz, pavel

Commit-ID:  51487d9ed1e386f9f0863bbf385e5da8a586bff8
Gitweb:     https://git.kernel.org/tip/51487d9ed1e386f9f0863bbf385e5da8a586bff8
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:27:01 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 5 Oct 2017 15:01:18 +0200

timer: Remove last user of TIMER_INITIALIZER

Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the
internal version.

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: Mark Gross <mark.gross@intel.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: Michael Reed <mdr@sgi.com>
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: "James E.J. Bottomley" <jejb@linux.vnet.ibm.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: Guenter Roeck <linux@roeck-us.net>
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-8-git-send-email-keescook@chromium.org

---
 drivers/char/tlclk.c  | 12 +++++-------
 include/linux/timer.h |  2 +-
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 6210bff..8eeb419 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -184,9 +184,8 @@ static unsigned int telclk_interrupt;
 static int int_events;		/* Event that generate a interrupt */
 static int got_event;		/* if events processing have been done */
 
-static void switchover_timeout(unsigned long data);
-static struct timer_list switchover_timer =
-	TIMER_INITIALIZER(switchover_timeout , 0, 0);
+static void switchover_timeout(struct timer_list *t);
+static struct timer_list switchover_timer;
 static unsigned long tlclk_timer_data;
 
 static struct tlclk_alarms *alarm_events;
@@ -805,7 +804,7 @@ static int __init tlclk_init(void)
 		goto out3;
 	}
 
-	init_timer(&switchover_timer);
+	timer_setup(&switchover_timer, switchover_timeout, 0);
 
 	ret = misc_register(&tlclk_miscdev);
 	if (ret < 0) {
@@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void)
 
 }
 
-static void switchover_timeout(unsigned long data)
+static void switchover_timeout(struct timer_list *unused)
 {
-	unsigned long flags = *(unsigned long *) data;
+	unsigned long flags = tlclk_timer_data;
 
 	if ((flags & 1)) {
 		if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08))
@@ -922,7 +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
 		/* TIMEOUT in ~10ms */
 		switchover_timer.expires = jiffies + msecs_to_jiffies(10);
 		tlclk_timer_data = inb(TLCLK_REG1);
-		switchover_timer.data = (unsigned long) &tlclk_timer_data;
 		mod_timer(&switchover_timer, switchover_timer.expires);
 	} else {
 		got_event = 1;
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 10cc45c..4f7476e 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -87,7 +87,7 @@ struct timer_list {
 
 #define DEFINE_TIMER(_name, _function, _expires, _data)		\
 	struct timer_list _name =				\
-		TIMER_INITIALIZER(_function, _expires, _data)
+		__TIMER_INITIALIZER(_function, _expires, _data, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Remove unused static initializer macros
  2017-10-04 23:27   ` Kees Cook
  (?)
  (?)
@ 2017-10-05 13:06   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: cmetcalf, john.stultz, oleg, heiko.carstens, akpm, wim, kvalo,
	pmladek, mingo, jiangshanlai, manish.chopra, mark.gross,
	martin.petersen, geert, benh, paulus, sudipm.mukherjee, mpe,
	harish.patil, len.brown, viresh.kumar, rjw, hpa, schwidefsky,
	linux-kernel, pavel, mdr, linux, jwi, sre, ralf, keescook,
	stefanr, tglx, jejb, gregkh, sboyd, arnd, tj, ubraun

Commit-ID:  fca7ce5b7c6d3eda8c2e011cff98d22e0fbd5097
Gitweb:     https://git.kernel.org/tip/fca7ce5b7c6d3eda8c2e011cff98d22e0fbd5097
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:27:02 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 5 Oct 2017 15:01:19 +0200

timer: Remove unused static initializer macros

This removes the now unused TIMER_*INITIALIZER macros:

TIMER_INITIALIZER
TIMER_PINNED_INITIALIZER
TIMER_DEFERRED_INITIALIZER
TIMER_PINNED_DEFERRED_INITIALIZER

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: Michael Reed <mdr@sgi.com>
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: Guenter Roeck <linux@roeck-us.net>
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-9-git-send-email-keescook@chromium.org

---
 include/linux/timer.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/include/linux/timer.h b/include/linux/timer.h
index 4f7476e..a332203 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -73,18 +73,6 @@ struct timer_list {
 			__FILE__ ":" __stringify(__LINE__))	\
 	}
 
-#define TIMER_INITIALIZER(_function, _expires, _data)		\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), 0)
-
-#define TIMER_PINNED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_PINNED)
-
-#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE)
-
-#define TIMER_PINNED_DEFERRED_INITIALIZER(_function, _expires, _data)	\
-	__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE | TIMER_PINNED)
-
 #define DEFINE_TIMER(_name, _function, _expires, _data)		\
 	struct timer_list _name =				\
 		__TIMER_INITIALIZER(_function, _expires, _data, 0)

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Remove users of expire and data arguments to DEFINE_TIMER
  2017-10-04 23:27   ` Kees Cook
                     ` (2 preceding siblings ...)
  (?)
@ 2017-10-05 13:07   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, stefanr, ubraun, akpm, mdr, benh, manish.chopra,
	john.stultz, rjw, wim, sboyd, viresh.kumar, jwi, keescook,
	pmladek, linux, sudipm.mukherjee, heiko.carstens, jiangshanlai,
	hpa, martin.petersen, len.brown, cmetcalf, tj, gregkh, tglx, mpe,
	oleg, sre, jejb, arnd, paulus, kvalo, ralf, harish.patil,
	schwidefsky, geert, pavel, mark.gross, mingo

Commit-ID:  1ff97897454b9a59edc7cf2cf2d95586b1e7a2cf
Gitweb:     https://git.kernel.org/tip/1ff97897454b9a59edc7cf2cf2d95586b1e7a2cf
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:27:03 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 5 Oct 2017 15:01:20 +0200

timer: Remove users of expire and data arguments to DEFINE_TIMER

The expire and data arguments of DEFINE_TIMER are only used in two places
and are ignored by the code (malta-display.c only uses mod_timer(),
never add_timer(), so the preset expires value is ignored). Set both
sets of arguments to zero.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Guenter Roeck <linux@roeck-us.net> # for watchdog parts
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: Oleg Nesterov <oleg@redhat.com>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: linux1394-devel@lists.sourceforge.net
Cc: linux-s390@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: linux-scsi@vger.kernel.org
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: Chris Metcalf <cmetcalf@mellanox.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: Sebastian Reichel <sre@kernel.org>
Cc: Mark Gross <mark.gross@intel.com>
Cc: linux-watchdog@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: Kalle Valo <kvalo@qca.qualcomm.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-10-git-send-email-keescook@chromium.org

---
 arch/mips/mti-malta/malta-display.c | 6 +++---
 drivers/watchdog/alim7101_wdt.c     | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
index d4f8071..ac81315 100644
--- a/arch/mips/mti-malta/malta-display.c
+++ b/arch/mips/mti-malta/malta-display.c
@@ -36,10 +36,10 @@ void mips_display_message(const char *str)
 	}
 }
 
-static void scroll_display_message(unsigned long data);
-static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, HZ, 0);
+static void scroll_display_message(unsigned long unused);
+static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
 
-static void scroll_display_message(unsigned long data)
+static void scroll_display_message(unsigned long unused)
 {
 	mips_display_message(&display_string[display_count++]);
 	if (display_count == max_display_count)
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 665e0e7..3c1f6ac 100644
--- a/drivers/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
@@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
 		"Use the gpio watchdog (required by old cobalt boards).");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1);
+static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
@@ -87,7 +87,7 @@ MODULE_PARM_DESC(nowayout,
  *	Whack the dog
  */
 
-static void wdt_timer_ping(unsigned long data)
+static void wdt_timer_ping(unsigned long unused)
 {
 	/* If we got a heartbeat pulse within the WDT_US_INTERVAL
 	 * we agree to ping the WDT

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Remove expires and data arguments from DEFINE_TIMER
  2017-10-04 23:27   ` Kees Cook
                     ` (6 preceding siblings ...)
  (?)
@ 2017-10-05 13:07   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mark.gross, akpm, schwidefsky, kvalo, jwi, len.brown, sboyd,
	mingo, harish.patil, linux, mpe, stefanr, martin.petersen,
	cmetcalf, mdr, tj, hpa, keescook, benh, sre, sudipm.mukherjee,
	john.stultz, jiangshanlai, oleg, jejb, ralf, manish.chopra,
	viresh.kumar, arnd, ubraun, rjw, wim, paulus, pavel, pmladek,
	tglx, gregkh, heiko.carstens, linux-kernel

Commit-ID:  1d27e3e2252ba9d949ca82fbdb73cde102cb2067
Gitweb:     https://git.kernel.org/tip/1d27e3e2252ba9d949ca82fbdb73cde102cb2067
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:27:04 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 5 Oct 2017 15:01:20 +0200

timer: Remove expires and data arguments from DEFINE_TIMER

Drop the arguments from the macro and adjust all callers with the
following script:

  perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
    $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts
Acked-by: Guenter Roeck <linux@roeck-us.net> # for watchdog parts
Acked-by: David S. Miller <davem@davemloft.net> # for networking parts
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Kalle Valo <kvalo@codeaurora.org> # for wireless parts
Acked-by: Arnd Bergmann <arnd@arndb.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: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Harish Patil <harish.patil@cavium.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: Michael Reed <mdr@sgi.com>
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: Guenter Roeck <linux@roeck-us.net>
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-11-git-send-email-keescook@chromium.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
 arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
 arch/m68k/amiga/amisound.c                | 2 +-
 arch/m68k/mac/macboing.c                  | 2 +-
 arch/mips/mti-malta/malta-display.c       | 2 +-
 arch/parisc/kernel/pdc_cons.c             | 2 +-
 arch/s390/mm/cmm.c                        | 2 +-
 drivers/atm/idt77105.c                    | 4 ++--
 drivers/atm/iphase.c                      | 2 +-
 drivers/block/ataflop.c                   | 8 ++++----
 drivers/char/dtlk.c                       | 2 +-
 drivers/char/hangcheck-timer.c            | 2 +-
 drivers/char/nwbutton.c                   | 2 +-
 drivers/char/rtc.c                        | 2 +-
 drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
 drivers/net/cris/eth_v10.c                | 6 +++---
 drivers/net/hamradio/yam.c                | 2 +-
 drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
 drivers/staging/speakup/main.c            | 2 +-
 drivers/staging/speakup/synth.c           | 2 +-
 drivers/tty/cyclades.c                    | 2 +-
 drivers/tty/isicom.c                      | 2 +-
 drivers/tty/moxa.c                        | 2 +-
 drivers/tty/rocket.c                      | 2 +-
 drivers/tty/vt/keyboard.c                 | 2 +-
 drivers/tty/vt/vt.c                       | 2 +-
 drivers/watchdog/alim7101_wdt.c           | 2 +-
 drivers/watchdog/machzwd.c                | 2 +-
 drivers/watchdog/mixcomwd.c               | 2 +-
 drivers/watchdog/sbc60xxwdt.c             | 2 +-
 drivers/watchdog/sc520_wdt.c              | 2 +-
 drivers/watchdog/via_wdt.c                | 2 +-
 drivers/watchdog/w83877f_wdt.c            | 2 +-
 drivers/xen/grant-table.c                 | 2 +-
 fs/pstore/platform.c                      | 2 +-
 include/linux/timer.h                     | 4 ++--
 kernel/irq/spurious.c                     | 2 +-
 lib/random32.c                            | 2 +-
 net/atm/mpc.c                             | 2 +-
 net/decnet/dn_route.c                     | 2 +-
 net/ipv6/ip6_flowlabel.c                  | 2 +-
 net/netrom/nr_loopback.c                  | 2 +-
 security/keys/gc.c                        | 2 +-
 sound/oss/midibuf.c                       | 2 +-
 sound/oss/soundcard.c                     | 2 +-
 sound/oss/sys_timer.c                     | 2 +-
 sound/oss/uart6850.c                      | 2 +-
 47 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index b3bd0e1..b3689a1 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -174,7 +174,7 @@ static int power_button_countdown;
 #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
 
 static void dsmg600_power_handler(unsigned long data);
-static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler, 0, 0);
+static DEFINE_TIMER(dsmg600_power_timer, dsmg600_power_handler);
 
 static void dsmg600_power_handler(unsigned long data)
 {
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 4e0f762..562d05f 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -197,7 +197,7 @@ static int power_button_countdown;
 #define PBUTTON_HOLDDOWN_COUNT 4 /* 2 secs */
 
 static void nas100d_power_handler(unsigned long data);
-static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler, 0, 0);
+static DEFINE_TIMER(nas100d_power_timer, nas100d_power_handler);
 
 static void nas100d_power_handler(unsigned long data)
 {
diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
index 90a60d7..a23f481 100644
--- a/arch/m68k/amiga/amisound.c
+++ b/arch/m68k/amiga/amisound.c
@@ -66,7 +66,7 @@ void __init amiga_init_sound(void)
 }
 
 static void nosound( unsigned long ignored );
-static DEFINE_TIMER(sound_timer, nosound, 0, 0);
+static DEFINE_TIMER(sound_timer, nosound);
 
 void amiga_mksound( unsigned int hz, unsigned int ticks )
 {
diff --git a/arch/m68k/mac/macboing.c b/arch/m68k/mac/macboing.c
index ffaa1f6..9a52aff 100644
--- a/arch/m68k/mac/macboing.c
+++ b/arch/m68k/mac/macboing.c
@@ -56,7 +56,7 @@ static void ( *mac_special_bell )( unsigned int, unsigned int, unsigned int );
 /*
  * our timer to start/continue/stop the bell
  */
-static DEFINE_TIMER(mac_sound_timer, mac_nosound, 0, 0);
+static DEFINE_TIMER(mac_sound_timer, mac_nosound);
 
 /*
  * Sort of initialize the sound chip (called from mac_mksound on the first
diff --git a/arch/mips/mti-malta/malta-display.c b/arch/mips/mti-malta/malta-display.c
index ac81315..063de44 100644
--- a/arch/mips/mti-malta/malta-display.c
+++ b/arch/mips/mti-malta/malta-display.c
@@ -37,7 +37,7 @@ void mips_display_message(const char *str)
 }
 
 static void scroll_display_message(unsigned long unused);
-static DEFINE_TIMER(mips_scroll_timer, scroll_display_message, 0, 0);
+static DEFINE_TIMER(mips_scroll_timer, scroll_display_message);
 
 static void scroll_display_message(unsigned long unused)
 {
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
index 10a5ae9..27a2dd6 100644
--- a/arch/parisc/kernel/pdc_cons.c
+++ b/arch/parisc/kernel/pdc_cons.c
@@ -92,7 +92,7 @@ static int pdc_console_setup(struct console *co, char *options)
 #define PDC_CONS_POLL_DELAY (30 * HZ / 1000)
 
 static void pdc_console_poll(unsigned long unused);
-static DEFINE_TIMER(pdc_console_timer, pdc_console_poll, 0, 0);
+static DEFINE_TIMER(pdc_console_timer, pdc_console_poll);
 static struct tty_port tty_port;
 
 static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c
index 829c63d..2dbdcd8 100644
--- a/arch/s390/mm/cmm.c
+++ b/arch/s390/mm/cmm.c
@@ -56,7 +56,7 @@ static DEFINE_SPINLOCK(cmm_lock);
 
 static struct task_struct *cmm_thread_ptr;
 static DECLARE_WAIT_QUEUE_HEAD(cmm_thread_wait);
-static DEFINE_TIMER(cmm_timer, NULL, 0, 0);
+static DEFINE_TIMER(cmm_timer, NULL);
 
 static void cmm_timer_fn(unsigned long);
 static void cmm_set_timer(void);
diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 082aa02..57af9fd 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -49,8 +49,8 @@ static void idt77105_stats_timer_func(unsigned long);
 static void idt77105_restart_timer_func(unsigned long);
 
 
-static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func, 0, 0);
-static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func, 0, 0);
+static DEFINE_TIMER(stats_timer, idt77105_stats_timer_func);
+static DEFINE_TIMER(restart_timer, idt77105_restart_timer_func);
 static int start_timer = 1;
 static struct idt77105_priv *idt77105_all = NULL;
 
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index fc72b763..ad6b582 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -76,7 +76,7 @@ static IADEV *ia_dev[8];
 static struct atm_dev *_ia_dev[8];
 static int iadev_count;
 static void ia_led_timer(unsigned long arg);
-static DEFINE_TIMER(ia_timer, ia_led_timer, 0, 0);
+static DEFINE_TIMER(ia_timer, ia_led_timer);
 static int IA_TX_BUF = DFL_TX_BUFFERS, IA_TX_BUF_SZ = DFL_TX_BUF_SZ;
 static int IA_RX_BUF = DFL_RX_BUFFERS, IA_RX_BUF_SZ = DFL_RX_BUF_SZ;
 static uint IADebugFlag = /* IF_IADBG_ERR | IF_IADBG_CBR| IF_IADBG_INIT_ADAPTER
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c
index 92da886..ae596e5 100644
--- a/drivers/block/ataflop.c
+++ b/drivers/block/ataflop.c
@@ -373,10 +373,10 @@ static void floppy_release(struct gendisk *disk, fmode_t mode);
 
 /************************* End of Prototypes **************************/
 
-static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer, 0, 0);
-static DEFINE_TIMER(readtrack_timer, fd_readtrack_check, 0, 0);
-static DEFINE_TIMER(timeout_timer, fd_times_out, 0, 0);
-static DEFINE_TIMER(fd_timer, check_change, 0, 0);
+static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer);
+static DEFINE_TIMER(readtrack_timer, fd_readtrack_check);
+static DEFINE_TIMER(timeout_timer, fd_times_out);
+static DEFINE_TIMER(fd_timer, check_change);
 	
 static void fd_end_request_cur(blk_status_t err)
 {
diff --git a/drivers/char/dtlk.c b/drivers/char/dtlk.c
index 5847139..1a0385e 100644
--- a/drivers/char/dtlk.c
+++ b/drivers/char/dtlk.c
@@ -84,7 +84,7 @@ static int dtlk_has_indexing;
 static unsigned int dtlk_portlist[] =
 {0x25e, 0x29e, 0x2de, 0x31e, 0x35e, 0x39e, 0};
 static wait_queue_head_t dtlk_process_list;
-static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick, 0, 0);
+static DEFINE_TIMER(dtlk_timer, dtlk_timer_tick);
 
 /* prototypes for file_operations struct */
 static ssize_t dtlk_read(struct file *, char __user *,
diff --git a/drivers/char/hangcheck-timer.c b/drivers/char/hangcheck-timer.c
index 5406b90..5b8db2e 100644
--- a/drivers/char/hangcheck-timer.c
+++ b/drivers/char/hangcheck-timer.c
@@ -124,7 +124,7 @@ static unsigned long long hangcheck_tsc, hangcheck_tsc_margin;
 
 static void hangcheck_fire(unsigned long);
 
-static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire, 0, 0);
+static DEFINE_TIMER(hangcheck_ticktock, hangcheck_fire);
 
 static void hangcheck_fire(unsigned long data)
 {
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
index e6d0d27..44006ed 100644
--- a/drivers/char/nwbutton.c
+++ b/drivers/char/nwbutton.c
@@ -27,7 +27,7 @@ static void button_sequence_finished (unsigned long parameters);
 
 static int button_press_count;		/* The count of button presses */
 /* Times for the end of a sequence */
-static DEFINE_TIMER(button_timer, button_sequence_finished, 0, 0);
+static DEFINE_TIMER(button_timer, button_sequence_finished);
 static DECLARE_WAIT_QUEUE_HEAD(button_wait_queue); /* Used for blocking read */
 static char button_output_buffer[32];	/* Stores data to write out of device */
 static int bcount;			/* The number of bytes in the buffer */
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 974d489..616871e 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -137,7 +137,7 @@ static DECLARE_WAIT_QUEUE_HEAD(rtc_wait);
 #ifdef RTC_IRQ
 static void rtc_dropped_irq(unsigned long data);
 
-static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq, 0, 0);
+static DEFINE_TIMER(rtc_irq_timer, rtc_dropped_irq);
 #endif
 
 static ssize_t rtc_read(struct file *file, char __user *buf,
diff --git a/drivers/input/touchscreen/s3c2410_ts.c b/drivers/input/touchscreen/s3c2410_ts.c
index 3b3db8c..d3265b6 100644
--- a/drivers/input/touchscreen/s3c2410_ts.c
+++ b/drivers/input/touchscreen/s3c2410_ts.c
@@ -145,7 +145,7 @@ static void touch_timer_fire(unsigned long data)
 	}
 }
 
-static DEFINE_TIMER(touch_timer, touch_timer_fire, 0, 0);
+static DEFINE_TIMER(touch_timer, touch_timer_fire);
 
 /**
  * stylus_irq - touchscreen stylus event interrupt
diff --git a/drivers/net/cris/eth_v10.c b/drivers/net/cris/eth_v10.c
index 017f48c..1fcc86f 100644
--- a/drivers/net/cris/eth_v10.c
+++ b/drivers/net/cris/eth_v10.c
@@ -165,8 +165,8 @@ static unsigned int network_rec_config_shadow = 0;
 static unsigned int network_tr_ctrl_shadow = 0;
 
 /* Network speed indication. */
-static DEFINE_TIMER(speed_timer, NULL, 0, 0);
-static DEFINE_TIMER(clear_led_timer, NULL, 0, 0);
+static DEFINE_TIMER(speed_timer, NULL);
+static DEFINE_TIMER(clear_led_timer, NULL);
 static int current_speed; /* Speed read from transceiver */
 static int current_speed_selection; /* Speed selected by user */
 static unsigned long led_next_time;
@@ -174,7 +174,7 @@ static int led_active;
 static int rx_queue_len;
 
 /* Duplex */
-static DEFINE_TIMER(duplex_timer, NULL, 0, 0);
+static DEFINE_TIMER(duplex_timer, NULL);
 static int full_duplex;
 static enum duplex current_duplex;
 
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c
index 7a7c522..104f71f 100644
--- a/drivers/net/hamradio/yam.c
+++ b/drivers/net/hamradio/yam.c
@@ -157,7 +157,7 @@ static struct net_device *yam_devs[NR_PORTS];
 
 static struct yam_mcs *yam_data;
 
-static DEFINE_TIMER(yam_timer, NULL, 0, 0);
+static DEFINE_TIMER(yam_timer, NULL);
 
 /* --------------------------------------------------------------------- */
 
diff --git a/drivers/net/wireless/atmel/at76c50x-usb.c b/drivers/net/wireless/atmel/at76c50x-usb.c
index 94bf01f..ede89d4 100644
--- a/drivers/net/wireless/atmel/at76c50x-usb.c
+++ b/drivers/net/wireless/atmel/at76c50x-usb.c
@@ -519,7 +519,7 @@ exit:
 /* LED trigger */
 static int tx_activity;
 static void at76_ledtrig_tx_timerfunc(unsigned long data);
-static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc, 0, 0);
+static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc);
 DEFINE_LED_TRIGGER(ledtrig_tx);
 
 static void at76_ledtrig_tx_timerfunc(unsigned long data)
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 56f7be6..585925b 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1165,7 +1165,7 @@ static const int NUM_CTL_LABELS = (MSG_CTL_END - MSG_CTL_START + 1);
 
 static void read_all_doc(struct vc_data *vc);
 static void cursor_done(u_long data);
-static DEFINE_TIMER(cursor_timer, cursor_done, 0, 0);
+static DEFINE_TIMER(cursor_timer, cursor_done);
 
 static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
 {
diff --git a/drivers/staging/speakup/synth.c b/drivers/staging/speakup/synth.c
index a1ca68c..6ddd3fc 100644
--- a/drivers/staging/speakup/synth.c
+++ b/drivers/staging/speakup/synth.c
@@ -158,7 +158,7 @@ static void thread_wake_up(u_long data)
 	wake_up_interruptible_all(&speakup_event);
 }
 
-static DEFINE_TIMER(thread_timer, thread_wake_up, 0, 0);
+static DEFINE_TIMER(thread_timer, thread_wake_up);
 
 void synth_start(void)
 {
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index d272bc4..dac8a1a 100644
--- a/drivers/tty/cyclades.c
+++ b/drivers/tty/cyclades.c
@@ -283,7 +283,7 @@ static void cyz_poll(unsigned long);
 /* The Cyclades-Z polling cycle is defined by this variable */
 static long cyz_polling_cycle = CZ_DEF_POLL;
 
-static DEFINE_TIMER(cyz_timerlist, cyz_poll, 0, 0);
+static DEFINE_TIMER(cyz_timerlist, cyz_poll);
 
 #else				/* CONFIG_CYZ_INTR */
 static void cyz_rx_restart(unsigned long);
diff --git a/drivers/tty/isicom.c b/drivers/tty/isicom.c
index 61ecdd6..40af321 100644
--- a/drivers/tty/isicom.c
+++ b/drivers/tty/isicom.c
@@ -177,7 +177,7 @@ static struct tty_driver *isicom_normal;
 static void isicom_tx(unsigned long _data);
 static void isicom_start(struct tty_struct *tty);
 
-static DEFINE_TIMER(tx, isicom_tx, 0, 0);
+static DEFINE_TIMER(tx, isicom_tx);
 
 /*   baud index mappings from linux defns to isi */
 
diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c
index 7f3d4cb..93d3765 100644
--- a/drivers/tty/moxa.c
+++ b/drivers/tty/moxa.c
@@ -428,7 +428,7 @@ static const struct tty_port_operations moxa_port_ops = {
 };
 
 static struct tty_driver *moxaDriver;
-static DEFINE_TIMER(moxaTimer, moxa_poll, 0, 0);
+static DEFINE_TIMER(moxaTimer, moxa_poll);
 
 /*
  * HW init
diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c
index 20d79a6..aa695fd 100644
--- a/drivers/tty/rocket.c
+++ b/drivers/tty/rocket.c
@@ -111,7 +111,7 @@ static struct r_port *rp_table[MAX_RP_PORTS];	       /*  The main repository of
 static unsigned int xmit_flags[NUM_BOARDS];	       /*  Bit significant, indicates port had data to transmit. */
 						       /*  eg.  Bit 0 indicates port 0 has xmit data, ...        */
 static atomic_t rp_num_ports_open;	               /*  Number of serial ports open                           */
-static DEFINE_TIMER(rocket_timer, rp_do_poll, 0, 0);
+static DEFINE_TIMER(rocket_timer, rp_do_poll);
 
 static unsigned long board1;	                       /* ISA addresses, retrieved from rocketport.conf          */
 static unsigned long board2;
diff --git a/drivers/tty/vt/keyboard.c b/drivers/tty/vt/keyboard.c
index f416626..f974d63 100644
--- a/drivers/tty/vt/keyboard.c
+++ b/drivers/tty/vt/keyboard.c
@@ -250,7 +250,7 @@ static void kd_nosound(unsigned long ignored)
 	input_handler_for_each_handle(&kbd_handler, &zero, kd_sound_helper);
 }
 
-static DEFINE_TIMER(kd_mksound_timer, kd_nosound, 0, 0);
+static DEFINE_TIMER(kd_mksound_timer, kd_nosound);
 
 void kd_mksound(unsigned int hz, unsigned int ticks)
 {
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 2ebaba1..602d716 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -228,7 +228,7 @@ static int scrollback_delta;
  */
 int (*console_blank_hook)(int);
 
-static DEFINE_TIMER(console_timer, blank_screen_t, 0, 0);
+static DEFINE_TIMER(console_timer, blank_screen_t);
 static int blank_state;
 static int blank_timer_expired;
 enum {
diff --git a/drivers/watchdog/alim7101_wdt.c b/drivers/watchdog/alim7101_wdt.c
index 3c1f6ac..18e896e 100644
--- a/drivers/watchdog/alim7101_wdt.c
+++ b/drivers/watchdog/alim7101_wdt.c
@@ -71,7 +71,7 @@ MODULE_PARM_DESC(use_gpio,
 		"Use the gpio watchdog (required by old cobalt boards).");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/machzwd.c b/drivers/watchdog/machzwd.c
index 9826b59..8a616a5 100644
--- a/drivers/watchdog/machzwd.c
+++ b/drivers/watchdog/machzwd.c
@@ -127,7 +127,7 @@ static int zf_action = GEN_RESET;
 static unsigned long zf_is_open;
 static char zf_expect_close;
 static DEFINE_SPINLOCK(zf_port_lock);
-static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
+static DEFINE_TIMER(zf_timer, zf_ping);
 static unsigned long next_heartbeat;
 
 
diff --git a/drivers/watchdog/mixcomwd.c b/drivers/watchdog/mixcomwd.c
index be86ea3..c9e3809 100644
--- a/drivers/watchdog/mixcomwd.c
+++ b/drivers/watchdog/mixcomwd.c
@@ -105,7 +105,7 @@ static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */
 
 static int watchdog_port;
 static int mixcomwd_timer_alive;
-static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0);
+static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun);
 static char expect_close;
 
 static bool nowayout = WATCHDOG_NOWAYOUT;
diff --git a/drivers/watchdog/sbc60xxwdt.c b/drivers/watchdog/sbc60xxwdt.c
index 2eef58a..8d58993 100644
--- a/drivers/watchdog/sbc60xxwdt.c
+++ b/drivers/watchdog/sbc60xxwdt.c
@@ -113,7 +113,7 @@ MODULE_PARM_DESC(nowayout,
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/sc520_wdt.c b/drivers/watchdog/sc520_wdt.c
index 1cfd3f6..3e9bbaa 100644
--- a/drivers/watchdog/sc520_wdt.c
+++ b/drivers/watchdog/sc520_wdt.c
@@ -124,7 +124,7 @@ MODULE_PARM_DESC(nowayout,
 static __u16 __iomem *wdtmrctl;
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/watchdog/via_wdt.c b/drivers/watchdog/via_wdt.c
index 5f9cbc3..ad3c3be1 100644
--- a/drivers/watchdog/via_wdt.c
+++ b/drivers/watchdog/via_wdt.c
@@ -68,7 +68,7 @@ static struct resource wdt_res;
 static void __iomem *wdt_mem;
 static unsigned int mmio;
 static void wdt_timer_tick(unsigned long data);
-static DEFINE_TIMER(timer, wdt_timer_tick, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_tick);
 					/* The timer that pings the watchdog */
 static unsigned long next_heartbeat;	/* the next_heartbeat for the timer */
 
diff --git a/drivers/watchdog/w83877f_wdt.c b/drivers/watchdog/w83877f_wdt.c
index f0483c7..ba6b680 100644
--- a/drivers/watchdog/w83877f_wdt.c
+++ b/drivers/watchdog/w83877f_wdt.c
@@ -98,7 +98,7 @@ MODULE_PARM_DESC(nowayout,
 				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
 static void wdt_timer_ping(unsigned long);
-static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0);
+static DEFINE_TIMER(timer, wdt_timer_ping);
 static unsigned long next_heartbeat;
 static unsigned long wdt_is_open;
 static char wdt_expect_close;
diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
index 2c6a911..a8721d7 100644
--- a/drivers/xen/grant-table.c
+++ b/drivers/xen/grant-table.c
@@ -305,7 +305,7 @@ struct deferred_entry {
 };
 static LIST_HEAD(deferred_list);
 static void gnttab_handle_deferred(unsigned long);
-static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred, 0, 0);
+static DEFINE_TIMER(deferred_timer, gnttab_handle_deferred);
 
 static void gnttab_handle_deferred(unsigned long unused)
 {
diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
index 2b21d18..ec7199e 100644
--- a/fs/pstore/platform.c
+++ b/fs/pstore/platform.c
@@ -62,7 +62,7 @@ MODULE_PARM_DESC(update_ms, "milliseconds before pstore updates its content "
 static int pstore_new_entry;
 
 static void pstore_timefunc(unsigned long);
-static DEFINE_TIMER(pstore_timer, pstore_timefunc, 0, 0);
+static DEFINE_TIMER(pstore_timer, pstore_timefunc);
 
 static void pstore_dowork(struct work_struct *);
 static DECLARE_WORK(pstore_work, pstore_dowork);
diff --git a/include/linux/timer.h b/include/linux/timer.h
index a332203..91e5a2c 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -73,9 +73,9 @@ struct timer_list {
 			__FILE__ ":" __stringify(__LINE__))	\
 	}
 
-#define DEFINE_TIMER(_name, _function, _expires, _data)		\
+#define DEFINE_TIMER(_name, _function)				\
 	struct timer_list _name =				\
-		__TIMER_INITIALIZER(_function, _expires, _data, 0)
+		__TIMER_INITIALIZER(_function, 0, 0, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 061ba7e..c805e86 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -20,7 +20,7 @@ static int irqfixup __read_mostly;
 
 #define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
 static void poll_spurious_irqs(unsigned long dummy);
-static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0);
+static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs);
 static int irq_poll_cpu;
 static atomic_t irq_poll_active;
 
diff --git a/lib/random32.c b/lib/random32.c
index fa594b1..6e91b75 100644
--- a/lib/random32.c
+++ b/lib/random32.c
@@ -214,7 +214,7 @@ core_initcall(prandom_init);
 
 static void __prandom_timer(unsigned long dontcare);
 
-static DEFINE_TIMER(seed_timer, __prandom_timer, 0, 0);
+static DEFINE_TIMER(seed_timer, __prandom_timer);
 
 static void __prandom_timer(unsigned long dontcare)
 {
diff --git a/net/atm/mpc.c b/net/atm/mpc.c
index 5677147..63138c8 100644
--- a/net/atm/mpc.c
+++ b/net/atm/mpc.c
@@ -121,7 +121,7 @@ static struct notifier_block mpoa_notifier = {
 
 struct mpoa_client *mpcs = NULL; /* FIXME */
 static struct atm_mpoa_qos *qos_head = NULL;
-static DEFINE_TIMER(mpc_timer, NULL, 0, 0);
+static DEFINE_TIMER(mpc_timer, NULL);
 
 
 static struct mpoa_client *find_mpc_by_itfnum(int itf)
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index 0bd3afd..6538632 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -131,7 +131,7 @@ static struct dn_rt_hash_bucket *dn_rt_hash_table;
 static unsigned int dn_rt_hash_mask;
 
 static struct timer_list dn_route_timer;
-static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush, 0, 0);
+static DEFINE_TIMER(dn_rt_flush_timer, dn_run_flush);
 int decnet_dst_gc_interval = 2;
 
 static struct dst_ops dn_dst_ops = {
diff --git a/net/ipv6/ip6_flowlabel.c b/net/ipv6/ip6_flowlabel.c
index 8081baf..b39d090 100644
--- a/net/ipv6/ip6_flowlabel.c
+++ b/net/ipv6/ip6_flowlabel.c
@@ -47,7 +47,7 @@ static atomic_t fl_size = ATOMIC_INIT(0);
 static struct ip6_flowlabel __rcu *fl_ht[FL_HASH_MASK+1];
 
 static void ip6_fl_gc(unsigned long dummy);
-static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc, 0, 0);
+static DEFINE_TIMER(ip6_fl_gc_timer, ip6_fl_gc);
 
 /* FL hash table lock: it protects only of GC */
 
diff --git a/net/netrom/nr_loopback.c b/net/netrom/nr_loopback.c
index 94d4e92..989ae64 100644
--- a/net/netrom/nr_loopback.c
+++ b/net/netrom/nr_loopback.c
@@ -18,7 +18,7 @@
 static void nr_loopback_timer(unsigned long);
 
 static struct sk_buff_head loopback_queue;
-static DEFINE_TIMER(loopback_timer, nr_loopback_timer, 0, 0);
+static DEFINE_TIMER(loopback_timer, nr_loopback_timer);
 
 void __init nr_loopback_init(void)
 {
diff --git a/security/keys/gc.c b/security/keys/gc.c
index 87cb260..8673f7f 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -30,7 +30,7 @@ DECLARE_WORK(key_gc_work, key_garbage_collector);
  * Reaper for links from keyrings to dead keys.
  */
 static void key_gc_timer_func(unsigned long);
-static DEFINE_TIMER(key_gc_timer, key_gc_timer_func, 0, 0);
+static DEFINE_TIMER(key_gc_timer, key_gc_timer_func);
 
 static time_t key_gc_next_run = LONG_MAX;
 static struct key_type *key_gc_dead_keytype;
diff --git a/sound/oss/midibuf.c b/sound/oss/midibuf.c
index 701c762..1277df8 100644
--- a/sound/oss/midibuf.c
+++ b/sound/oss/midibuf.c
@@ -52,7 +52,7 @@ static struct midi_parms parms[MAX_MIDI_DEV];
 static void midi_poll(unsigned long dummy);
 
 
-static DEFINE_TIMER(poll_timer, midi_poll, 0, 0);
+static DEFINE_TIMER(poll_timer, midi_poll);
 
 static volatile int open_devs;
 static DEFINE_SPINLOCK(lock);
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index b70c7c8..4391062 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -662,7 +662,7 @@ static void do_sequencer_timer(unsigned long dummy)
 }
 
 
-static DEFINE_TIMER(seq_timer, do_sequencer_timer, 0, 0);
+static DEFINE_TIMER(seq_timer, do_sequencer_timer);
 
 void request_sound_timer(int count)
 {
diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c
index d17019d..8a4b562 100644
--- a/sound/oss/sys_timer.c
+++ b/sound/oss/sys_timer.c
@@ -28,7 +28,7 @@ static unsigned long prev_event_time;
 
 static void     poll_def_tmr(unsigned long dummy);
 static DEFINE_SPINLOCK(lock);
-static DEFINE_TIMER(def_tmr, poll_def_tmr, 0, 0);
+static DEFINE_TIMER(def_tmr, poll_def_tmr);
 
 static unsigned long
 tmr2ticks(int tmr_value)
diff --git a/sound/oss/uart6850.c b/sound/oss/uart6850.c
index eda32d7..a9d3f75 100644
--- a/sound/oss/uart6850.c
+++ b/sound/oss/uart6850.c
@@ -78,7 +78,7 @@ static void (*midi_input_intr) (int dev, unsigned char data);
 static void poll_uart6850(unsigned long dummy);
 
 
-static DEFINE_TIMER(uart6850_timer, poll_uart6850, 0, 0);
+static DEFINE_TIMER(uart6850_timer, poll_uart6850);
 
 static void uart6850_input_loop(void)
 {

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] timer: Remove expires argument from __TIMER_INITIALIZER()
  2017-10-04 23:27   ` Kees Cook
  (?)
  (?)
@ 2017-10-05 13:07   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:07 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jwi, ubraun, sre, pmladek, jejb, gregkh, stefanr, tglx, akpm,
	sudipm.mukherjee, ralf, rjw, kvalo, oleg, heiko.carstens, geert,
	martin.petersen, john.stultz, viresh.kumar, arnd, paulus, sboyd,
	mpe, jiangshanlai, harish.patil, linux-kernel, tj, mdr,
	manish.chopra, mingo, mark.gross, cmetcalf, wim, keescook, benh,
	pavel, hpa, schwidefsky, len.brown, linux

Commit-ID:  8ede369b2cccfa585e2969bbed18edc0e2a18c50
Gitweb:     https://git.kernel.org/tip/8ede369b2cccfa585e2969bbed18edc0e2a18c50
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:27:05 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 5 Oct 2017 15:01:21 +0200

timer: Remove expires argument from __TIMER_INITIALIZER()

The expires field is normally initialized during the first mod_timer()
call. It was unused by all callers, so remove it from the macro.

Signed-off-by: Kees Cook <keescook@chromium.org>
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: Michael Reed <mdr@sgi.com>
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: Guenter Roeck <linux@roeck-us.net>
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-12-git-send-email-keescook@chromium.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 include/linux/kthread.h   | 2 +-
 include/linux/timer.h     | 5 ++---
 include/linux/workqueue.h | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/include/linux/kthread.h b/include/linux/kthread.h
index 82e197e..0d622b3 100644
--- a/include/linux/kthread.h
+++ b/include/linux/kthread.h
@@ -117,7 +117,7 @@ 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,	\
-				     0, (unsigned long)&(dwork),	\
+				     (unsigned long)&(dwork),		\
 				     TIMER_IRQSAFE),			\
 	}
 
diff --git a/include/linux/timer.h b/include/linux/timer.h
index 91e5a2c..10685c3 100644
--- a/include/linux/timer.h
+++ b/include/linux/timer.h
@@ -63,10 +63,9 @@ struct timer_list {
 
 #define TIMER_TRACE_FLAGMASK	(TIMER_MIGRATING | TIMER_DEFERRABLE | TIMER_PINNED | TIMER_IRQSAFE)
 
-#define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \
+#define __TIMER_INITIALIZER(_function, _data, _flags) {		\
 		.entry = { .next = TIMER_ENTRY_STATIC },	\
 		.function = (_function),			\
-		.expires = (_expires),				\
 		.data = (_data),				\
 		.flags = (_flags),				\
 		__TIMER_LOCKDEP_MAP_INITIALIZER(		\
@@ -75,7 +74,7 @@ struct timer_list {
 
 #define DEFINE_TIMER(_name, _function)				\
 	struct timer_list _name =				\
-		__TIMER_INITIALIZER(_function, 0, 0, 0)
+		__TIMER_INITIALIZER(_function, 0, 0)
 
 void init_timer_key(struct timer_list *timer, unsigned int flags,
 		    const char *name, struct lock_class_key *key);
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 1c49431..f496026 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -176,7 +176,7 @@ struct execute_work {
 #define __DELAYED_WORK_INITIALIZER(n, f, tflags) {			\
 	.work = __WORK_INITIALIZER((n).work, (f)),			\
 	.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,		\
-				     0, (unsigned long)&(n),		\
+				     (unsigned long)&(n),		\
 				     (tflags) | TIMER_IRQSAFE),		\
 	}
 

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] kthread: Convert callback to use from_timer()
  2017-10-04 23:27   ` Kees Cook
  (?)
  (?)
@ 2017-10-05 13:08   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tj, arnd, geert, harish.patil, cmetcalf, benh, viresh.kumar,
	pavel, schwidefsky, stefanr, linux, paulus, jiangshanlai,
	sudipm.mukherjee, jejb, john.stultz, mdr, mark.gross, hpa, sboyd,
	akpm, martin.petersen, pmladek, tglx, ralf, mpe, ubraun,
	manish.chopra, len.brown, linux-kernel, heiko.carstens, keescook,
	gregkh, rjw, wim, jwi, oleg, sre, mingo, kvalo

Commit-ID:  fe5c3b69b540e3387223a696f327c1bb8880d1ac
Gitweb:     https://git.kernel.org/tip/fe5c3b69b540e3387223a696f327c1bb8880d1ac
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:27:06 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
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 <keescook@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-mips@linux-mips.org
Cc: Len Brown <len.brown@intel.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: Petr Mladek <pmladek@suse.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-pm@vger.kernel.org
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
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: Tejun Heo <tj@kernel.org>
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-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

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* [tip:timers/core] workqueue: Convert callback to use from_timer()
  2017-10-04 23:27   ` Kees Cook
  (?)
  (?)
@ 2017-10-05 13:08   ` tip-bot for Kees Cook
  -1 siblings, 0 replies; 98+ messages in thread
From: tip-bot for Kees Cook @ 2017-10-05 13:08 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: kvalo, heiko.carstens, jejb, mdr, schwidefsky, geert, ubraun,
	jiangshanlai, sudipm.mukherjee, tj, martin.petersen, sboyd,
	paulus, mark.gross, hpa, linux-kernel, john.stultz, benh,
	keescook, oleg, wim, akpm, ralf, gregkh, viresh.kumar, sre,
	mingo, mpe, cmetcalf, jwi, manish.chopra, pavel, tglx, stefanr,
	pmladek, arnd, len.brown, rjw, harish.patil, linux

Commit-ID:  8c20feb60604d91a29cd7fef8ac758bd92d9fd2c
Gitweb:     https://git.kernel.org/tip/8c20feb60604d91a29cd7fef8ac758bd92d9fd2c
Author:     Kees Cook <keescook@chromium.org>
AuthorDate: Wed, 4 Oct 2017 16:27:07 -0700
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 5 Oct 2017 15:01:22 +0200

workqueue: Convert callback to use from_timer()

In preparation for unconditionally passing the struct timer_list pointer
to all timer callbacks, switch workqueue to use from_timer() and pass the
timer pointer explicitly.

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: Martin Schwidefsky <schwidefsky@de.ibm.com>
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: Tejun Heo <tj@kernel.org>
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-14-git-send-email-keescook@chromium.org

---
 include/linux/workqueue.h | 15 ++++++++-------
 kernel/workqueue.c        |  7 +++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index f496026..f3c47a0 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -17,7 +17,7 @@ struct workqueue_struct;
 
 struct work_struct;
 typedef void (*work_func_t)(struct work_struct *work);
-void delayed_work_timer_fn(unsigned long __data);
+void delayed_work_timer_fn(struct timer_list *t);
 
 /*
  * The first word is the work queue pointer and the flags rolled into
@@ -175,8 +175,8 @@ struct execute_work {
 
 #define __DELAYED_WORK_INITIALIZER(n, f, tflags) {			\
 	.work = __WORK_INITIALIZER((n).work, (f)),			\
-	.timer = __TIMER_INITIALIZER(delayed_work_timer_fn,		\
-				     (unsigned long)&(n),		\
+	.timer = __TIMER_INITIALIZER((TIMER_FUNC_TYPE)delayed_work_timer_fn,\
+				     (TIMER_DATA_TYPE)&(n.timer),	\
 				     (tflags) | TIMER_IRQSAFE),		\
 	}
 
@@ -241,8 +241,9 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
 #define __INIT_DELAYED_WORK(_work, _func, _tflags)			\
 	do {								\
 		INIT_WORK(&(_work)->work, (_func));			\
-		__setup_timer(&(_work)->timer, delayed_work_timer_fn,	\
-			      (unsigned long)(_work),			\
+		__setup_timer(&(_work)->timer,				\
+			      (TIMER_FUNC_TYPE)delayed_work_timer_fn,	\
+			      (TIMER_DATA_TYPE)&(_work)->timer,		\
 			      (_tflags) | TIMER_IRQSAFE);		\
 	} while (0)
 
@@ -250,8 +251,8 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; }
 	do {								\
 		INIT_WORK_ONSTACK(&(_work)->work, (_func));		\
 		__setup_timer_on_stack(&(_work)->timer,			\
-				       delayed_work_timer_fn,		\
-				       (unsigned long)(_work),		\
+				       (TIMER_FUNC_TYPE)delayed_work_timer_fn,\
+				       (TIMER_DATA_TYPE)&(_work)->timer,\
 				       (_tflags) | TIMER_IRQSAFE);	\
 	} while (0)
 
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index a5361fc..c77fdf6 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1492,9 +1492,9 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq,
 }
 EXPORT_SYMBOL(queue_work_on);
 
-void delayed_work_timer_fn(unsigned long __data)
+void delayed_work_timer_fn(struct timer_list *t)
 {
-	struct delayed_work *dwork = (struct delayed_work *)__data;
+	struct delayed_work *dwork = from_timer(dwork, t, timer);
 
 	/* should have been called from irqsafe timer with irq already off */
 	__queue_work(dwork->cpu, dwork->wq, &dwork->work);
@@ -1508,8 +1508,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
 	struct work_struct *work = &dwork->work;
 
 	WARN_ON_ONCE(!wq);
-	WARN_ON_ONCE(timer->function != delayed_work_timer_fn ||
-		     timer->data != (unsigned long)dwork);
+	WARN_ON_ONCE(timer->function != (TIMER_FUNC_TYPE)delayed_work_timer_fn);
 	WARN_ON_ONCE(timer_pending(timer));
 	WARN_ON_ONCE(!list_empty(&work->entry));
 

^ permalink raw reply related	[flat|nested] 98+ messages in thread

* Re: [PATCH 03/13] timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()
  2017-10-04 23:26   ` Kees Cook
  (?)
  (?)
@ 2017-10-05 13:18     ` Rafael J. Wysocki
  -1 siblings, 0 replies; 98+ messages in thread
From: Rafael J. Wysocki @ 2017-10-05 13:18 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Rafael J. Wysocki, Pavel Machek, Len Brown,
	Greg Kroah-Hartman, Stefan Richter, Sudip Mukherjee,
	Martin Schwidefsky, Heiko Carstens, Julian Wiedmann,
	Ursula Braun, Michael Reed, James E.J. Bottomley,
	Martin K. Petersen, Linux PM, linux1394-devel, linux-s390,
	open list:TARGET SUBSYSTEM, Andrew Morton

On Thu, Oct 5, 2017 at 1:26 AM, Kees Cook <keescook@chromium.org> wrote:
> Remove uses of init_timer_on_stack() with open-coded function and data
> assignments that could be expressed using timer_setup_on_stack(). Several
> were removed from the stack entirely since there was a one-to-one mapping
> of parent structure to timer, those are switched to using timer_setup()
> instead. All related callbacks were adjusted to use from_timer().
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
> Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Julian Wiedmann <jwi@linux.vnet.ibm.com>
> Cc: Ursula Braun <ubraun@linux.vnet.ibm.com>
> Cc: Michael Reed <mdr@sgi.com>
> Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-pm@vger.kernel.org
> Cc: linux1394-devel@lists.sourceforge.net
> Cc: linux-s390@vger.kernel.org
> Cc: linux-scsi@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/base/power/main.c           |  8 +++-----
>  drivers/firewire/core-transaction.c | 10 +++++-----
>  drivers/parport/ieee1284.c          | 21 +++++++--------------
>  drivers/s390/char/tape.h            |  1 +
>  drivers/s390/char/tape_std.c        | 18 ++++++------------
>  drivers/s390/net/lcs.c              | 16 ++++++----------
>  drivers/s390/net/lcs.h              |  1 +
>  drivers/scsi/qla1280.c              | 14 +++++---------
>  drivers/scsi/qla1280.h              |  1 +
>  include/linux/parport.h             |  1 +
>  include/linux/timer.h               |  2 --
>  11 files changed, 36 insertions(+), 57 deletions(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 770b1539a083..ae47b2ec84b4 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -478,9 +478,9 @@ struct dpm_watchdog {
>   * There's not much we can do here to recover so panic() to
>   * capture a crash-dump in pstore.
>   */
> -static void dpm_watchdog_handler(unsigned long data)
> +static void dpm_watchdog_handler(struct timer_list *t)
>  {
> -       struct dpm_watchdog *wd = (void *)data;
> +       struct dpm_watchdog *wd = from_timer(wd, t, timer);
>
>         dev_emerg(wd->dev, "**** DPM device timeout ****\n");
>         show_stack(wd->tsk, NULL);
> @@ -500,11 +500,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
>         wd->dev = dev;
>         wd->tsk = current;
>
> -       init_timer_on_stack(timer);
> +       timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
>         /* use same timeout value for both suspend and resume */
>         timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT;
> -       timer->function = dpm_watchdog_handler;
> -       timer->data = (unsigned long)wd;
>         add_timer(timer);
>  }

For the above:

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 03/13] timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()
@ 2017-10-05 13:18     ` Rafael J. Wysocki
  0 siblings, 0 replies; 98+ messages in thread
From: Rafael J. Wysocki @ 2017-10-05 13:18 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Rafael J. Wysocki, Pavel Machek, Len Brown,
	Greg Kroah-Hartman, Stefan Richter, Sudip Mukherjee,
	Martin Schwidefsky, Heiko Carstens, Julian Wiedmann,
	Ursula Braun, Michael Reed, James E.J. Bottomley,
	Martin K. Petersen, Linux PM, linux1394-devel, linux-s390,
	open list:TARGET SUBSYSTEM, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Guenter Roeck, Harish Patil, John Stultz, Kalle Valo,
	Lai Jiangshan, Manish Chopra, Mark Gross, Michael Ellerman,
	netdev, Oleg Nesterov, Paul Mackerras, Petr Mladek, Ralf Baechle,
	Sebastian Reichel, Stephen Boyd, Tejun Heo, Viresh Kumar,
	Wim Van Sebroeck, MIPS Linux Kernel List, linuxppc-dev,
	linux-watchdog, open list:NETWORKING DRIVERS (WIRELESS),
	Linux Kernel Mailing List

On Thu, Oct 5, 2017 at 1:26 AM, Kees Cook <keescook@chromium.org> wrote:
> Remove uses of init_timer_on_stack() with open-coded function and data
> assignments that could be expressed using timer_setup_on_stack(). Several
> were removed from the stack entirely since there was a one-to-one mapping
> of parent structure to timer, those are switched to using timer_setup()
> instead. All related callbacks were adjusted to use from_timer().
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
> Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Julian Wiedmann <jwi@linux.vnet.ibm.com>
> Cc: Ursula Braun <ubraun@linux.vnet.ibm.com>
> Cc: Michael Reed <mdr@sgi.com>
> Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-pm@vger.kernel.org
> Cc: linux1394-devel@lists.sourceforge.net
> Cc: linux-s390@vger.kernel.org
> Cc: linux-scsi@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/base/power/main.c           |  8 +++-----
>  drivers/firewire/core-transaction.c | 10 +++++-----
>  drivers/parport/ieee1284.c          | 21 +++++++--------------
>  drivers/s390/char/tape.h            |  1 +
>  drivers/s390/char/tape_std.c        | 18 ++++++------------
>  drivers/s390/net/lcs.c              | 16 ++++++----------
>  drivers/s390/net/lcs.h              |  1 +
>  drivers/scsi/qla1280.c              | 14 +++++---------
>  drivers/scsi/qla1280.h              |  1 +
>  include/linux/parport.h             |  1 +
>  include/linux/timer.h               |  2 --
>  11 files changed, 36 insertions(+), 57 deletions(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 770b1539a083..ae47b2ec84b4 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -478,9 +478,9 @@ struct dpm_watchdog {
>   * There's not much we can do here to recover so panic() to
>   * capture a crash-dump in pstore.
>   */
> -static void dpm_watchdog_handler(unsigned long data)
> +static void dpm_watchdog_handler(struct timer_list *t)
>  {
> -       struct dpm_watchdog *wd = (void *)data;
> +       struct dpm_watchdog *wd = from_timer(wd, t, timer);
>
>         dev_emerg(wd->dev, "**** DPM device timeout ****\n");
>         show_stack(wd->tsk, NULL);
> @@ -500,11 +500,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
>         wd->dev = dev;
>         wd->tsk = current;
>
> -       init_timer_on_stack(timer);
> +       timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
>         /* use same timeout value for both suspend and resume */
>         timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT;
> -       timer->function = dpm_watchdog_handler;
> -       timer->data = (unsigned long)wd;
>         add_timer(timer);
>  }

For the above:

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 03/13] timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()
@ 2017-10-05 13:18     ` Rafael J. Wysocki
  0 siblings, 0 replies; 98+ messages in thread
From: Rafael J. Wysocki @ 2017-10-05 13:18 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Rafael J. Wysocki, Pavel Machek, Len Brown,
	Greg Kroah-Hartman, Stefan Richter, Sudip Mukherjee,
	Martin Schwidefsky, Heiko Carstens, Julian Wiedmann,
	Ursula Braun, Michael Reed, James E.J. Bottomley,
	Martin K. Petersen, Linux PM, linux1394-devel, linux-s390,
	open list:TARGET SUBSYSTEM, Andrew Morton

On Thu, Oct 5, 2017 at 1:26 AM, Kees Cook <keescook@chromium.org> wrote:
> Remove uses of init_timer_on_stack() with open-coded function and data
> assignments that could be expressed using timer_setup_on_stack(). Several
> were removed from the stack entirely since there was a one-to-one mapping
> of parent structure to timer, those are switched to using timer_setup()
> instead. All related callbacks were adjusted to use from_timer().
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
> Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Julian Wiedmann <jwi@linux.vnet.ibm.com>
> Cc: Ursula Braun <ubraun@linux.vnet.ibm.com>
> Cc: Michael Reed <mdr@sgi.com>
> Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-pm@vger.kernel.org
> Cc: linux1394-devel@lists.sourceforge.net
> Cc: linux-s390@vger.kernel.org
> Cc: linux-scsi@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/base/power/main.c           |  8 +++-----
>  drivers/firewire/core-transaction.c | 10 +++++-----
>  drivers/parport/ieee1284.c          | 21 +++++++--------------
>  drivers/s390/char/tape.h            |  1 +
>  drivers/s390/char/tape_std.c        | 18 ++++++------------
>  drivers/s390/net/lcs.c              | 16 ++++++----------
>  drivers/s390/net/lcs.h              |  1 +
>  drivers/scsi/qla1280.c              | 14 +++++---------
>  drivers/scsi/qla1280.h              |  1 +
>  include/linux/parport.h             |  1 +
>  include/linux/timer.h               |  2 --
>  11 files changed, 36 insertions(+), 57 deletions(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 770b1539a083..ae47b2ec84b4 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -478,9 +478,9 @@ struct dpm_watchdog {
>   * There's not much we can do here to recover so panic() to
>   * capture a crash-dump in pstore.
>   */
> -static void dpm_watchdog_handler(unsigned long data)
> +static void dpm_watchdog_handler(struct timer_list *t)
>  {
> -       struct dpm_watchdog *wd = (void *)data;
> +       struct dpm_watchdog *wd = from_timer(wd, t, timer);
>
>         dev_emerg(wd->dev, "**** DPM device timeout ****\n");
>         show_stack(wd->tsk, NULL);
> @@ -500,11 +500,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
>         wd->dev = dev;
>         wd->tsk = current;
>
> -       init_timer_on_stack(timer);
> +       timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
>         /* use same timeout value for both suspend and resume */
>         timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT;
> -       timer->function = dpm_watchdog_handler;
> -       timer->data = (unsigned long)wd;
>         add_timer(timer);
>  }

For the above:

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 03/13] timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack()
@ 2017-10-05 13:18     ` Rafael J. Wysocki
  0 siblings, 0 replies; 98+ messages in thread
From: Rafael J. Wysocki @ 2017-10-05 13:18 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Rafael J. Wysocki, Pavel Machek, Len Brown,
	Greg Kroah-Hartman, Stefan Richter, Sudip Mukherjee,
	Martin Schwidefsky, Heiko Carstens, Julian Wiedmann,
	Ursula Braun, Michael Reed, James E.J. Bottomley,
	Martin K. Petersen, Linux PM, linux1394-devel, linux-s390,
	open list:TARGET SUBSYSTEM, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Guenter Roeck, Harish Patil, John Stultz, Kalle Valo,
	Lai Jiangshan, Manish Chopra, Mark Gross, Michael Ellerman,
	netdev, Oleg Nesterov, Paul Mackerras, Petr Mladek, Ralf Baechle,
	Sebastian Reichel, Stephen Boyd, Tejun Heo, Viresh Kumar,
	Wim Van Sebroeck, MIPS Linux Kernel List, linuxppc-dev,
	linux-watchdog, open list:NETWORKING DRIVERS (WIRELESS),
	Linux Kernel Mailing List

On Thu, Oct 5, 2017 at 1:26 AM, Kees Cook <keescook@chromium.org> wrote:
> Remove uses of init_timer_on_stack() with open-coded function and data
> assignments that could be expressed using timer_setup_on_stack(). Several
> were removed from the stack entirely since there was a one-to-one mapping
> of parent structure to timer, those are switched to using timer_setup()
> instead. All related callbacks were adjusted to use from_timer().
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Pavel Machek <pavel@ucw.cz>
> Cc: Len Brown <len.brown@intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
> Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
> Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
> Cc: Julian Wiedmann <jwi@linux.vnet.ibm.com>
> Cc: Ursula Braun <ubraun@linux.vnet.ibm.com>
> Cc: Michael Reed <mdr@sgi.com>
> Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
> Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: linux-pm@vger.kernel.org
> Cc: linux1394-devel@lists.sourceforge.net
> Cc: linux-s390@vger.kernel.org
> Cc: linux-scsi@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/base/power/main.c           |  8 +++-----
>  drivers/firewire/core-transaction.c | 10 +++++-----
>  drivers/parport/ieee1284.c          | 21 +++++++--------------
>  drivers/s390/char/tape.h            |  1 +
>  drivers/s390/char/tape_std.c        | 18 ++++++------------
>  drivers/s390/net/lcs.c              | 16 ++++++----------
>  drivers/s390/net/lcs.h              |  1 +
>  drivers/scsi/qla1280.c              | 14 +++++---------
>  drivers/scsi/qla1280.h              |  1 +
>  include/linux/parport.h             |  1 +
>  include/linux/timer.h               |  2 --
>  11 files changed, 36 insertions(+), 57 deletions(-)
>
> diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
> index 770b1539a083..ae47b2ec84b4 100644
> --- a/drivers/base/power/main.c
> +++ b/drivers/base/power/main.c
> @@ -478,9 +478,9 @@ struct dpm_watchdog {
>   * There's not much we can do here to recover so panic() to
>   * capture a crash-dump in pstore.
>   */
> -static void dpm_watchdog_handler(unsigned long data)
> +static void dpm_watchdog_handler(struct timer_list *t)
>  {
> -       struct dpm_watchdog *wd = (void *)data;
> +       struct dpm_watchdog *wd = from_timer(wd, t, timer);
>
>         dev_emerg(wd->dev, "**** DPM device timeout ****\n");
>         show_stack(wd->tsk, NULL);
> @@ -500,11 +500,9 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
>         wd->dev = dev;
>         wd->tsk = current;
>
> -       init_timer_on_stack(timer);
> +       timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
>         /* use same timeout value for both suspend and resume */
>         timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT;
> -       timer->function = dpm_watchdog_handler;
> -       timer->data = (unsigned long)wd;
>         add_timer(timer);
>  }

For the above:

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

^ permalink raw reply	[flat|nested] 98+ messages in thread

* RE: [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER
  2017-10-04 23:27   ` Kees Cook
                       ` (2 preceding siblings ...)
  (?)
@ 2017-10-05 22:39     ` Gross, Mark
  -1 siblings, 0 replies; 98+ messages in thread
From: Gross, Mark @ 2017-10-05 22:39 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Andrew Morton,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Brown, Len, Manish Chopra, Martin K. Petersen,
	Martin Schwidefsky

Acked-by: mark gross <mark.gross@intel.com>

--mark

> -----Original Message-----
> From: Kees Cook [mailto:keescook@chromium.org]
> Sent: Wednesday, October 4, 2017 4:27 PM
> To: Thomas Gleixner <tglx@linutronix.de>
> Cc: Kees Cook <keescook@chromium.org>; Arnd Bergmann <arnd@arndb.de>;
> Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Gross, Mark
> <mark.gross@intel.com>; Andrew Morton <akpm@linux-foundation.org>;
> Benjamin Herrenschmidt <benh@kernel.crashing.org>; Chris Metcalf
> <cmetcalf@mellanox.com>; Geert Uytterhoeven <geert@linux-m68k.org>;
> Guenter Roeck <linux@roeck-us.net>; Harish Patil <harish.patil@cavium.com>;
> Heiko Carstens <heiko.carstens@de.ibm.com>; James E.J. Bottomley
> <jejb@linux.vnet.ibm.com>; John Stultz <john.stultz@linaro.org>; Julian
> Wiedmann <jwi@linux.vnet.ibm.com>; Kalle Valo <kvalo@qca.qualcomm.com>;
> Lai Jiangshan <jiangshanlai@gmail.com>; Brown, Len <len.brown@intel.com>;
> Manish Chopra <manish.chopra@cavium.com>; Martin K. Petersen
> <martin.petersen@oracle.com>; Martin Schwidefsky
> <schwidefsky@de.ibm.com>; Michael Ellerman <mpe@ellerman.id.au>; Michael
> Reed <mdr@sgi.com>; netdev@vger.kernel.org; Oleg Nesterov
> <oleg@redhat.com>; Paul Mackerras <paulus@samba.org>; Pavel Machek
> <pavel@ucw.cz>; Petr Mladek <pmladek@suse.com>; Rafael J. Wysocki
> <rjw@rjwysocki.net>; Ralf Baechle <ralf@linux-mips.org>; Sebastian Reichel
> <sre@kernel.org>; Stefan Richter <stefanr@s5r6.in-berlin.de>; Stephen Boyd
> <sboyd@codeaurora.org>; Sudip Mukherjee <sudipm.mukherjee@gmail.com>;
> Tejun Heo <tj@kernel.org>; Ursula Braun <ubraun@linux.vnet.ibm.com>; Viresh
> Kumar <viresh.kumar@linaro.org>; Wim Van Sebroeck <wim@iguana.be>;
> linux1394-devel@lists.sourceforge.net; linux-mips@linux-mips.org; linux-
> pm@vger.kernel.org; linuxppc-dev@lists.ozlabs.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 07/13] timer: Remove last user of TIMER_INITIALIZER
> 
> Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the internal
> version.
> 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Mark Gross <mark.gross@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/char/tlclk.c  | 12 +++++-------  include/linux/timer.h |  2 +-
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index
> 6210bff46341..8eeb4190207d 100644
> --- a/drivers/char/tlclk.c
> +++ b/drivers/char/tlclk.c
> @@ -184,9 +184,8 @@ static unsigned int telclk_interrupt;
>  static int int_events;		/* Event that generate a interrupt */
>  static int got_event;		/* if events processing have been done */
> 
> -static void switchover_timeout(unsigned long data); -static struct timer_list
> switchover_timer =
> -	TIMER_INITIALIZER(switchover_timeout , 0, 0);
> +static void switchover_timeout(struct timer_list *t); static struct
> +timer_list switchover_timer;
>  static unsigned long tlclk_timer_data;
> 
>  static struct tlclk_alarms *alarm_events; @@ -805,7 +804,7 @@ static int
> __init tlclk_init(void)
>  		goto out3;
>  	}
> 
> -	init_timer(&switchover_timer);
> +	timer_setup(&switchover_timer, switchover_timeout, 0);
> 
>  	ret = misc_register(&tlclk_miscdev);
>  	if (ret < 0) {
> @@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void)
> 
>  }
> 
> -static void switchover_timeout(unsigned long data)
> +static void switchover_timeout(struct timer_list *unused)
>  {
> -	unsigned long flags = *(unsigned long *) data;
> +	unsigned long flags = tlclk_timer_data;
> 
>  	if ((flags & 1)) {
>  		if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08)) @@ -922,7
> +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
>  		/* TIMEOUT in ~10ms */
>  		switchover_timer.expires = jiffies + msecs_to_jiffies(10);
>  		tlclk_timer_data = inb(TLCLK_REG1);
> -		switchover_timer.data = (unsigned long) &tlclk_timer_data;
>  		mod_timer(&switchover_timer, switchover_timer.expires);
>  	} else {
>  		got_event = 1;
> diff --git a/include/linux/timer.h b/include/linux/timer.h index
> 10cc45ca5803..4f7476e4a727 100644
> --- a/include/linux/timer.h
> +++ b/include/linux/timer.h
> @@ -87,7 +87,7 @@ struct timer_list {
> 
>  #define DEFINE_TIMER(_name, _function, _expires, _data)		\
>  	struct timer_list _name =				\
> -		TIMER_INITIALIZER(_function, _expires, _data)
> +		__TIMER_INITIALIZER(_function, _expires, _data, 0)
> 
>  void init_timer_key(struct timer_list *timer, unsigned int flags,
>  		    const char *name, struct lock_class_key *key);
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 98+ messages in thread

* RE: [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER
@ 2017-10-05 22:39     ` Gross, Mark
  0 siblings, 0 replies; 98+ messages in thread
From: Gross, Mark @ 2017-10-05 22:39 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Andrew Morton,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Brown, Len, Manish Chopra, Martin K. Petersen,
	Martin Schwidefsky, Michael Ellerman, Michael Reed, netdev,
	Oleg Nesterov, Paul Mackerras, Pavel Machek, Petr Mladek,
	Rafael J. Wysocki, Ralf Baechle, Sebastian Reichel,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linuxppc-dev, linux-s390, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

Acked-by: mark gross <mark.gross@intel.com>

--mark

> -----Original Message-----
> From: Kees Cook [mailto:keescook@chromium.org]
> Sent: Wednesday, October 4, 2017 4:27 PM
> To: Thomas Gleixner <tglx@linutronix.de>
> Cc: Kees Cook <keescook@chromium.org>; Arnd Bergmann <arnd@arndb.de>;
> Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Gross, Mark
> <mark.gross@intel.com>; Andrew Morton <akpm@linux-foundation.org>;
> Benjamin Herrenschmidt <benh@kernel.crashing.org>; Chris Metcalf
> <cmetcalf@mellanox.com>; Geert Uytterhoeven <geert@linux-m68k.org>;
> Guenter Roeck <linux@roeck-us.net>; Harish Patil <harish.patil@cavium.com>;
> Heiko Carstens <heiko.carstens@de.ibm.com>; James E.J. Bottomley
> <jejb@linux.vnet.ibm.com>; John Stultz <john.stultz@linaro.org>; Julian
> Wiedmann <jwi@linux.vnet.ibm.com>; Kalle Valo <kvalo@qca.qualcomm.com>;
> Lai Jiangshan <jiangshanlai@gmail.com>; Brown, Len <len.brown@intel.com>;
> Manish Chopra <manish.chopra@cavium.com>; Martin K. Petersen
> <martin.petersen@oracle.com>; Martin Schwidefsky
> <schwidefsky@de.ibm.com>; Michael Ellerman <mpe@ellerman.id.au>; Michael
> Reed <mdr@sgi.com>; netdev@vger.kernel.org; Oleg Nesterov
> <oleg@redhat.com>; Paul Mackerras <paulus@samba.org>; Pavel Machek
> <pavel@ucw.cz>; Petr Mladek <pmladek@suse.com>; Rafael J. Wysocki
> <rjw@rjwysocki.net>; Ralf Baechle <ralf@linux-mips.org>; Sebastian Reichel
> <sre@kernel.org>; Stefan Richter <stefanr@s5r6.in-berlin.de>; Stephen Boyd
> <sboyd@codeaurora.org>; Sudip Mukherjee <sudipm.mukherjee@gmail.com>;
> Tejun Heo <tj@kernel.org>; Ursula Braun <ubraun@linux.vnet.ibm.com>; Viresh
> Kumar <viresh.kumar@linaro.org>; Wim Van Sebroeck <wim@iguana.be>;
> linux1394-devel@lists.sourceforge.net; linux-mips@linux-mips.org; linux-
> pm@vger.kernel.org; linuxppc-dev@lists.ozlabs.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 07/13] timer: Remove last user of TIMER_INITIALIZER
> 
> Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the internal
> version.
> 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Mark Gross <mark.gross@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/char/tlclk.c  | 12 +++++-------  include/linux/timer.h |  2 +-
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index
> 6210bff46341..8eeb4190207d 100644
> --- a/drivers/char/tlclk.c
> +++ b/drivers/char/tlclk.c
> @@ -184,9 +184,8 @@ static unsigned int telclk_interrupt;
>  static int int_events;		/* Event that generate a interrupt */
>  static int got_event;		/* if events processing have been done */
> 
> -static void switchover_timeout(unsigned long data); -static struct timer_list
> switchover_timer =
> -	TIMER_INITIALIZER(switchover_timeout , 0, 0);
> +static void switchover_timeout(struct timer_list *t); static struct
> +timer_list switchover_timer;
>  static unsigned long tlclk_timer_data;
> 
>  static struct tlclk_alarms *alarm_events; @@ -805,7 +804,7 @@ static int
> __init tlclk_init(void)
>  		goto out3;
>  	}
> 
> -	init_timer(&switchover_timer);
> +	timer_setup(&switchover_timer, switchover_timeout, 0);
> 
>  	ret = misc_register(&tlclk_miscdev);
>  	if (ret < 0) {
> @@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void)
> 
>  }
> 
> -static void switchover_timeout(unsigned long data)
> +static void switchover_timeout(struct timer_list *unused)
>  {
> -	unsigned long flags = *(unsigned long *) data;
> +	unsigned long flags = tlclk_timer_data;
> 
>  	if ((flags & 1)) {
>  		if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08)) @@ -922,7
> +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
>  		/* TIMEOUT in ~10ms */
>  		switchover_timer.expires = jiffies + msecs_to_jiffies(10);
>  		tlclk_timer_data = inb(TLCLK_REG1);
> -		switchover_timer.data = (unsigned long) &tlclk_timer_data;
>  		mod_timer(&switchover_timer, switchover_timer.expires);
>  	} else {
>  		got_event = 1;
> diff --git a/include/linux/timer.h b/include/linux/timer.h index
> 10cc45ca5803..4f7476e4a727 100644
> --- a/include/linux/timer.h
> +++ b/include/linux/timer.h
> @@ -87,7 +87,7 @@ struct timer_list {
> 
>  #define DEFINE_TIMER(_name, _function, _expires, _data)		\
>  	struct timer_list _name =				\
> -		TIMER_INITIALIZER(_function, _expires, _data)
> +		__TIMER_INITIALIZER(_function, _expires, _data, 0)
> 
>  void init_timer_key(struct timer_list *timer, unsigned int flags,
>  		    const char *name, struct lock_class_key *key);
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 98+ messages in thread

* RE: [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER
@ 2017-10-05 22:39     ` Gross, Mark
  0 siblings, 0 replies; 98+ messages in thread
From: Gross, Mark @ 2017-10-05 22:39 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Andrew Morton,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Brown, Len, Manish Chopra, Martin K. Petersen,
	Martin Schwidefsky

Acked-by: mark gross <mark.gross@intel.com>

--mark

> -----Original Message-----
> From: Kees Cook [mailto:keescook@chromium.org]
> Sent: Wednesday, October 4, 2017 4:27 PM
> To: Thomas Gleixner <tglx@linutronix.de>
> Cc: Kees Cook <keescook@chromium.org>; Arnd Bergmann <arnd@arndb.de>;
> Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Gross, Mark
> <mark.gross@intel.com>; Andrew Morton <akpm@linux-foundation.org>;
> Benjamin Herrenschmidt <benh@kernel.crashing.org>; Chris Metcalf
> <cmetcalf@mellanox.com>; Geert Uytterhoeven <geert@linux-m68k.org>;
> Guenter Roeck <linux@roeck-us.net>; Harish Patil <harish.patil@cavium.com>;
> Heiko Carstens <heiko.carstens@de.ibm.com>; James E.J. Bottomley
> <jejb@linux.vnet.ibm.com>; John Stultz <john.stultz@linaro.org>; Julian
> Wiedmann <jwi@linux.vnet.ibm.com>; Kalle Valo <kvalo@qca.qualcomm.com>;
> Lai Jiangshan <jiangshanlai@gmail.com>; Brown, Len <len.brown@intel.com>;
> Manish Chopra <manish.chopra@cavium.com>; Martin K. Petersen
> <martin.petersen@oracle.com>; Martin Schwidefsky
> <schwidefsky@de.ibm.com>; Michael Ellerman <mpe@ellerman.id.au>; Michael
> Reed <mdr@sgi.com>; netdev@vger.kernel.org; Oleg Nesterov
> <oleg@redhat.com>; Paul Mackerras <paulus@samba.org>; Pavel Machek
> <pavel@ucw.cz>; Petr Mladek <pmladek@suse.com>; Rafael J. Wysocki
> <rjw@rjwysocki.net>; Ralf Baechle <ralf@linux-mips.org>; Sebastian Reichel
> <sre@kernel.org>; Stefan Richter <stefanr@s5r6.in-berlin.de>; Stephen Boyd
> <sboyd@codeaurora.org>; Sudip Mukherjee <sudipm.mukherjee@gmail.com>;
> Tejun Heo <tj@kernel.org>; Ursula Braun <ubraun@linux.vnet.ibm.com>; Viresh
> Kumar <viresh.kumar@linaro.org>; Wim Van Sebroeck <wim@iguana.be>;
> linux1394-devel@lists.sourceforge.net; linux-mips@linux-mips.org; linux-
> pm@vger.kernel.org; linuxppc-dev@lists.ozlabs.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 07/13] timer: Remove last user of TIMER_INITIALIZER
> 
> Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the internal
> version.
> 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Mark Gross <mark.gross@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/char/tlclk.c  | 12 +++++-------  include/linux/timer.h |  2 +-
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index
> 6210bff46341..8eeb4190207d 100644
> --- a/drivers/char/tlclk.c
> +++ b/drivers/char/tlclk.c
> @@ -184,9 +184,8 @@ static unsigned int telclk_interrupt;
>  static int int_events;		/* Event that generate a interrupt */
>  static int got_event;		/* if events processing have been done */
> 
> -static void switchover_timeout(unsigned long data); -static struct timer_list
> switchover_timer =
> -	TIMER_INITIALIZER(switchover_timeout , 0, 0);
> +static void switchover_timeout(struct timer_list *t); static struct
> +timer_list switchover_timer;
>  static unsigned long tlclk_timer_data;
> 
>  static struct tlclk_alarms *alarm_events; @@ -805,7 +804,7 @@ static int
> __init tlclk_init(void)
>  		goto out3;
>  	}
> 
> -	init_timer(&switchover_timer);
> +	timer_setup(&switchover_timer, switchover_timeout, 0);
> 
>  	ret = misc_register(&tlclk_miscdev);
>  	if (ret < 0) {
> @@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void)
> 
>  }
> 
> -static void switchover_timeout(unsigned long data)
> +static void switchover_timeout(struct timer_list *unused)
>  {
> -	unsigned long flags = *(unsigned long *) data;
> +	unsigned long flags = tlclk_timer_data;
> 
>  	if ((flags & 1)) {
>  		if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08)) @@ -922,7
> +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
>  		/* TIMEOUT in ~10ms */
>  		switchover_timer.expires = jiffies + msecs_to_jiffies(10);
>  		tlclk_timer_data = inb(TLCLK_REG1);
> -		switchover_timer.data = (unsigned long) &tlclk_timer_data;
>  		mod_timer(&switchover_timer, switchover_timer.expires);
>  	} else {
>  		got_event = 1;
> diff --git a/include/linux/timer.h b/include/linux/timer.h index
> 10cc45ca5803..4f7476e4a727 100644
> --- a/include/linux/timer.h
> +++ b/include/linux/timer.h
> @@ -87,7 +87,7 @@ struct timer_list {
> 
>  #define DEFINE_TIMER(_name, _function, _expires, _data)		\
>  	struct timer_list _name =				\
> -		TIMER_INITIALIZER(_function, _expires, _data)
> +		__TIMER_INITIALIZER(_function, _expires, _data, 0)
> 
>  void init_timer_key(struct timer_list *timer, unsigned int flags,
>  		    const char *name, struct lock_class_key *key);
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 98+ messages in thread

* RE: [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER
@ 2017-10-05 22:39     ` Gross, Mark
  0 siblings, 0 replies; 98+ messages in thread
From: Gross, Mark @ 2017-10-05 22:39 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Andrew Morton,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Brown, Len, Manish Chopra, Martin K. Petersen,
	Martin Schwidefsky, Michael Ellerman, Michael Reed, netdev,
	Oleg Nesterov, Paul Mackerras, Pavel Machek, Petr Mladek,
	Rafael J. Wysocki, Ralf Baechle, Sebastian Reichel,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linuxppc-dev, linux-s390, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

Acked-by: mark gross <mark.gross@intel.com>

--mark

> -----Original Message-----
> From: Kees Cook [mailto:keescook@chromium.org]
> Sent: Wednesday, October 4, 2017 4:27 PM
> To: Thomas Gleixner <tglx@linutronix.de>
> Cc: Kees Cook <keescook@chromium.org>; Arnd Bergmann <arnd@arndb.de>;
> Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Gross, Mark
> <mark.gross@intel.com>; Andrew Morton <akpm@linux-foundation.org>;
> Benjamin Herrenschmidt <benh@kernel.crashing.org>; Chris Metcalf
> <cmetcalf@mellanox.com>; Geert Uytterhoeven <geert@linux-m68k.org>;
> Guenter Roeck <linux@roeck-us.net>; Harish Patil <harish.patil@cavium.com>;
> Heiko Carstens <heiko.carstens@de.ibm.com>; James E.J. Bottomley
> <jejb@linux.vnet.ibm.com>; John Stultz <john.stultz@linaro.org>; Julian
> Wiedmann <jwi@linux.vnet.ibm.com>; Kalle Valo <kvalo@qca.qualcomm.com>;
> Lai Jiangshan <jiangshanlai@gmail.com>; Brown, Len <len.brown@intel.com>;
> Manish Chopra <manish.chopra@cavium.com>; Martin K. Petersen
> <martin.petersen@oracle.com>; Martin Schwidefsky
> <schwidefsky@de.ibm.com>; Michael Ellerman <mpe@ellerman.id.au>; Michael
> Reed <mdr@sgi.com>; netdev@vger.kernel.org; Oleg Nesterov
> <oleg@redhat.com>; Paul Mackerras <paulus@samba.org>; Pavel Machek
> <pavel@ucw.cz>; Petr Mladek <pmladek@suse.com>; Rafael J. Wysocki
> <rjw@rjwysocki.net>; Ralf Baechle <ralf@linux-mips.org>; Sebastian Reichel
> <sre@kernel.org>; Stefan Richter <stefanr@s5r6.in-berlin.de>; Stephen Boyd
> <sboyd@codeaurora.org>; Sudip Mukherjee <sudipm.mukherjee@gmail.com>;
> Tejun Heo <tj@kernel.org>; Ursula Braun <ubraun@linux.vnet.ibm.com>; Viresh
> Kumar <viresh.kumar@linaro.org>; Wim Van Sebroeck <wim@iguana.be>;
> linux1394-devel@lists.sourceforge.net; linux-mips@linux-mips.org; linux-
> pm@vger.kernel.org; linuxppc-dev@lists.ozlabs.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 07/13] timer: Remove last user of TIMER_INITIALIZER
> 
> Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the internal
> version.
> 
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Mark Gross <mark.gross@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/char/tlclk.c  | 12 +++++-------  include/linux/timer.h |  2 +-
>  2 files changed, 6 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index
> 6210bff46341..8eeb4190207d 100644
> --- a/drivers/char/tlclk.c
> +++ b/drivers/char/tlclk.c
> @@ -184,9 +184,8 @@ static unsigned int telclk_interrupt;
>  static int int_events;		/* Event that generate a interrupt */
>  static int got_event;		/* if events processing have been done */
> 
> -static void switchover_timeout(unsigned long data); -static struct timer_list
> switchover_timer =
> -	TIMER_INITIALIZER(switchover_timeout , 0, 0);
> +static void switchover_timeout(struct timer_list *t); static struct
> +timer_list switchover_timer;
>  static unsigned long tlclk_timer_data;
> 
>  static struct tlclk_alarms *alarm_events; @@ -805,7 +804,7 @@ static int
> __init tlclk_init(void)
>  		goto out3;
>  	}
> 
> -	init_timer(&switchover_timer);
> +	timer_setup(&switchover_timer, switchover_timeout, 0);
> 
>  	ret = misc_register(&tlclk_miscdev);
>  	if (ret < 0) {
> @@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void)
> 
>  }
> 
> -static void switchover_timeout(unsigned long data)
> +static void switchover_timeout(struct timer_list *unused)
>  {
> -	unsigned long flags = *(unsigned long *) data;
> +	unsigned long flags = tlclk_timer_data;
> 
>  	if ((flags & 1)) {
>  		if ((inb(TLCLK_REG1) & 0x08) != (flags & 0x08)) @@ -922,7
> +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
>  		/* TIMEOUT in ~10ms */
>  		switchover_timer.expires = jiffies + msecs_to_jiffies(10);
>  		tlclk_timer_data = inb(TLCLK_REG1);
> -		switchover_timer.data = (unsigned long) &tlclk_timer_data;
>  		mod_timer(&switchover_timer, switchover_timer.expires);
>  	} else {
>  		got_event = 1;
> diff --git a/include/linux/timer.h b/include/linux/timer.h index
> 10cc45ca5803..4f7476e4a727 100644
> --- a/include/linux/timer.h
> +++ b/include/linux/timer.h
> @@ -87,7 +87,7 @@ struct timer_list {
> 
>  #define DEFINE_TIMER(_name, _function, _expires, _data)		\
>  	struct timer_list _name =				\
> -		TIMER_INITIALIZER(_function, _expires, _data)
> +		__TIMER_INITIALIZER(_function, _expires, _data, 0)
> 
>  void init_timer_key(struct timer_list *timer, unsigned int flags,
>  		    const char *name, struct lock_class_key *key);
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 98+ messages in thread

* RE: [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER
@ 2017-10-05 22:39     ` Gross, Mark
  0 siblings, 0 replies; 98+ messages in thread
From: Gross, Mark @ 2017-10-05 22:39 UTC (permalink / raw)
  To: Kees Cook, Thomas Gleixner
  Cc: Arnd Bergmann, Greg Kroah-Hartman, Andrew Morton,
	Benjamin Herrenschmidt, Chris Metcalf, Geert Uytterhoeven,
	Guenter Roeck, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Brown, Len, Manish Chopra, Martin K. Petersen,
	Martin Schwidefsky, Michael Ellerman, Michael Reed, netdev,
	Oleg Nesterov, Paul Mackerras, Pavel Machek, Petr Mladek,
	Rafael J. Wysocki, Ralf Baechle, Sebastian Reichel,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linuxppc-dev, linux-s390, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

Acked-by: mark gross <mark.gross@intel.com>

--mark

> -----Original Message-----
> From: Kees Cook [mailto:keescook@chromium.org]
> Sent: Wednesday, October 4, 2017 4:27 PM
> To: Thomas Gleixner <tglx@linutronix.de>
> Cc: Kees Cook <keescook@chromium.org>; Arnd Bergmann <arnd@arndb.de>;
> Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Gross, Mark
> <mark.gross@intel.com>; Andrew Morton <akpm@linux-foundation.org>;
> Benjamin Herrenschmidt <benh@kernel.crashing.org>; Chris Metcalf
> <cmetcalf@mellanox.com>; Geert Uytterhoeven <geert@linux-m68k.org>;
> Guenter Roeck <linux@roeck-us.net>; Harish Patil <harish.patil@cavium.com=
>;
> Heiko Carstens <heiko.carstens@de.ibm.com>; James E.J. Bottomley
> <jejb@linux.vnet.ibm.com>; John Stultz <john.stultz@linaro.org>; Julian
> Wiedmann <jwi@linux.vnet.ibm.com>; Kalle Valo <kvalo@qca.qualcomm.com>;
> Lai Jiangshan <jiangshanlai@gmail.com>; Brown, Len <len.brown@intel.com>;
> Manish Chopra <manish.chopra@cavium.com>; Martin K. Petersen
> <martin.petersen@oracle.com>; Martin Schwidefsky
> <schwidefsky@de.ibm.com>; Michael Ellerman <mpe@ellerman.id.au>; Michael
> Reed <mdr@sgi.com>; netdev@vger.kernel.org; Oleg Nesterov
> <oleg@redhat.com>; Paul Mackerras <paulus@samba.org>; Pavel Machek
> <pavel@ucw.cz>; Petr Mladek <pmladek@suse.com>; Rafael J. Wysocki
> <rjw@rjwysocki.net>; Ralf Baechle <ralf@linux-mips.org>; Sebastian Reiche=
l
> <sre@kernel.org>; Stefan Richter <stefanr@s5r6.in-berlin.de>; Stephen Boy=
d
> <sboyd@codeaurora.org>; Sudip Mukherjee <sudipm.mukherjee@gmail.com>;
> Tejun Heo <tj@kernel.org>; Ursula Braun <ubraun@linux.vnet.ibm.com>; Vire=
sh
> Kumar <viresh.kumar@linaro.org>; Wim Van Sebroeck <wim@iguana.be>;
> linux1394-devel@lists.sourceforge.net; linux-mips@linux-mips.org; linux-
> pm@vger.kernel.org; linuxppc-dev@lists.ozlabs.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 07/13] timer: Remove last user of TIMER_INITIALIZER
>=20
> Drops the last user of TIMER_INITIALIZER and adapts timer.h to use the in=
ternal
> version.
>=20
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Mark Gross <mark.gross@intel.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  drivers/char/tlclk.c  | 12 +++++-------  include/linux/timer.h |  2 +-
>  2 files changed, 6 insertions(+), 8 deletions(-)
>=20
> diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index
> 6210bff46341..8eeb4190207d 100644
> --- a/drivers/char/tlclk.c
> +++ b/drivers/char/tlclk.c
> @@ -184,9 +184,8 @@ static unsigned int telclk_interrupt;
>  static int int_events;		/* Event that generate a interrupt */
>  static int got_event;		/* if events processing have been done */
>=20
> -static void switchover_timeout(unsigned long data); -static struct timer=
_list
> switchover_timer =3D
> -	TIMER_INITIALIZER(switchover_timeout , 0, 0);
> +static void switchover_timeout(struct timer_list *t); static struct
> +timer_list switchover_timer;
>  static unsigned long tlclk_timer_data;
>=20
>  static struct tlclk_alarms *alarm_events; @@ -805,7 +804,7 @@ static int
> __init tlclk_init(void)
>  		goto out3;
>  	}
>=20
> -	init_timer(&switchover_timer);
> +	timer_setup(&switchover_timer, switchover_timeout, 0);
>=20
>  	ret =3D misc_register(&tlclk_miscdev);
>  	if (ret < 0) {
> @@ -855,9 +854,9 @@ static void __exit tlclk_cleanup(void)
>=20
>  }
>=20
> -static void switchover_timeout(unsigned long data)
> +static void switchover_timeout(struct timer_list *unused)
>  {
> -	unsigned long flags =3D *(unsigned long *) data;
> +	unsigned long flags =3D tlclk_timer_data;
>=20
>  	if ((flags & 1)) {
>  		if ((inb(TLCLK_REG1) & 0x08) !=3D (flags & 0x08)) @@ -922,7
> +921,6 @@ static irqreturn_t tlclk_interrupt(int irq, void *dev_id)
>  		/* TIMEOUT in ~10ms */
>  		switchover_timer.expires =3D jiffies + msecs_to_jiffies(10);
>  		tlclk_timer_data =3D inb(TLCLK_REG1);
> -		switchover_timer.data =3D (unsigned long) &tlclk_timer_data;
>  		mod_timer(&switchover_timer, switchover_timer.expires);
>  	} else {
>  		got_event =3D 1;
> diff --git a/include/linux/timer.h b/include/linux/timer.h index
> 10cc45ca5803..4f7476e4a727 100644
> --- a/include/linux/timer.h
> +++ b/include/linux/timer.h
> @@ -87,7 +87,7 @@ struct timer_list {
>=20
>  #define DEFINE_TIMER(_name, _function, _expires, _data)		\
>  	struct timer_list _name =3D				\
> -		TIMER_INITIALIZER(_function, _expires, _data)
> +		__TIMER_INITIALIZER(_function, _expires, _data, 0)
>=20
>  void init_timer_key(struct timer_list *timer, unsigned int flags,
>  		    const char *name, struct lock_class_key *key);
> --
> 2.7.4

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER
  2017-10-04 23:27   ` Kees Cook
@ 2017-10-09 13:23     ` Ralf Baechle
  -1 siblings, 0 replies; 98+ messages in thread
From: Ralf Baechle @ 2017-10-09 13:23 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Wim Van Sebroeck, Guenter Roeck,
	Geert Uytterhoeven, linux-mips, linux-watchdog, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Greg Kroah-Hartman, 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 Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Petr Mladek, Rafael J. Wysocki, Sebastian Reichel,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, linux1394-devel, linux-pm,
	linuxppc-dev, linux-s390, linux-scsi, linux-wireless,
	linux-kernel

On Wed, Oct 04, 2017 at 04:27:03PM -0700, Kees Cook wrote:

> Subject: [PATCH 09/13] timer: Remove users of expire and data arguments to
>  DEFINE_TIMER
> 
> The expire and data arguments of DEFINE_TIMER are only used in two places
> and are ignored by the code (malta-display.c only uses mod_timer(),
> never add_timer(), so the preset expires value is ignored). Set both
> sets of arguments to zero.
> 
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: linux-mips@linux-mips.org
> Cc: linux-watchdog@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  arch/mips/mti-malta/malta-display.c | 6 +++---
>  drivers/watchdog/alim7101_wdt.c     | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)

For malta-display:

Acked-by: Ralf Baechle <ralf@linux-mips.org>

  Ralf

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER
@ 2017-10-09 13:23     ` Ralf Baechle
  0 siblings, 0 replies; 98+ messages in thread
From: Ralf Baechle @ 2017-10-09 13:23 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Wim Van Sebroeck, Guenter Roeck,
	Geert Uytterhoeven, linux-mips, linux-watchdog, Andrew Morton,
	Arnd Bergmann, Benjamin Herrenschmidt, Chris Metcalf,
	Greg Kroah-Hartman, Harish Patil, Heiko Carstens,
	James E.J. Bottomley, John Stultz, Julian Wiedmann, Kalle Valo,
	Lai Jiangshan, Len Brown, Manis

On Wed, Oct 04, 2017 at 04:27:03PM -0700, Kees Cook wrote:

> Subject: [PATCH 09/13] timer: Remove users of expire and data arguments to
>  DEFINE_TIMER
> 
> The expire and data arguments of DEFINE_TIMER are only used in two places
> and are ignored by the code (malta-display.c only uses mod_timer(),
> never add_timer(), so the preset expires value is ignored). Set both
> sets of arguments to zero.
> 
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Wim Van Sebroeck <wim@iguana.be>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: linux-mips@linux-mips.org
> Cc: linux-watchdog@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  arch/mips/mti-malta/malta-display.c | 6 +++---
>  drivers/watchdog/alim7101_wdt.c     | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)

For malta-display:

Acked-by: Ralf Baechle <ralf@linux-mips.org>

  Ralf

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
  2017-10-04 23:27   ` Kees Cook
@ 2017-10-09 13:27     ` Ralf Baechle
  -1 siblings, 0 replies; 98+ messages in thread
From: Ralf Baechle @ 2017-10-09 13:27 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, 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 Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Petr Mladek, Rafael J. Wysocki, Sebastian Reichel,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linuxppc-dev, linux-s390, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

On Wed, Oct 04, 2017 at 04:27:04PM -0700, Kees Cook wrote:

> Subject: [PATCH 10/13] timer: Remove expires and data arguments from
>  DEFINE_TIMER
> 
> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts
> ---
>  arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
>  arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
>  arch/m68k/amiga/amisound.c                | 2 +-
>  arch/m68k/mac/macboing.c                  | 2 +-
>  arch/mips/mti-malta/malta-display.c       | 2 +-
>  arch/parisc/kernel/pdc_cons.c             | 2 +-
>  arch/s390/mm/cmm.c                        | 2 +-
>  drivers/atm/idt77105.c                    | 4 ++--
>  drivers/atm/iphase.c                      | 2 +-
>  drivers/block/ataflop.c                   | 8 ++++----
>  drivers/char/dtlk.c                       | 2 +-
>  drivers/char/hangcheck-timer.c            | 2 +-
>  drivers/char/nwbutton.c                   | 2 +-
>  drivers/char/rtc.c                        | 2 +-
>  drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
>  drivers/net/cris/eth_v10.c                | 6 +++---
>  drivers/net/hamradio/yam.c                | 2 +-
>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
>  drivers/staging/speakup/main.c            | 2 +-
>  drivers/staging/speakup/synth.c           | 2 +-
>  drivers/tty/cyclades.c                    | 2 +-
>  drivers/tty/isicom.c                      | 2 +-
>  drivers/tty/moxa.c                        | 2 +-
>  drivers/tty/rocket.c                      | 2 +-
>  drivers/tty/vt/keyboard.c                 | 2 +-
>  drivers/tty/vt/vt.c                       | 2 +-
>  drivers/watchdog/alim7101_wdt.c           | 2 +-
>  drivers/watchdog/machzwd.c                | 2 +-
>  drivers/watchdog/mixcomwd.c               | 2 +-
>  drivers/watchdog/sbc60xxwdt.c             | 2 +-
>  drivers/watchdog/sc520_wdt.c              | 2 +-
>  drivers/watchdog/via_wdt.c                | 2 +-
>  drivers/watchdog/w83877f_wdt.c            | 2 +-
>  drivers/xen/grant-table.c                 | 2 +-
>  fs/pstore/platform.c                      | 2 +-
>  include/linux/timer.h                     | 4 ++--
>  kernel/irq/spurious.c                     | 2 +-
>  lib/random32.c                            | 2 +-
>  net/atm/mpc.c                             | 2 +-
>  net/decnet/dn_route.c                     | 2 +-
>  net/ipv6/ip6_flowlabel.c                  | 2 +-
>  net/netrom/nr_loopback.c                  | 2 +-
>  security/keys/gc.c                        | 2 +-
>  sound/oss/midibuf.c                       | 2 +-
>  sound/oss/soundcard.c                     | 2 +-
>  sound/oss/sys_timer.c                     | 2 +-
>  sound/oss/uart6850.c                      | 2 +-
>  47 files changed, 54 insertions(+), 54 deletions(-)

Acked-by: Ralf Baechle <ralf@linux-mips.org>

Thanks,

  Ralf

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER
@ 2017-10-09 13:27     ` Ralf Baechle
  0 siblings, 0 replies; 98+ messages in thread
From: Ralf Baechle @ 2017-10-09 13:27 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, 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

On Wed, Oct 04, 2017 at 04:27:04PM -0700, Kees Cook wrote:

> Subject: [PATCH 10/13] timer: Remove expires and data arguments from
>  DEFINE_TIMER
> 
> Drop the arguments from the macro and adjust all callers with the
> following script:
> 
>   perl -pi -e 's/DEFINE_TIMER\((.*), 0, 0\);/DEFINE_TIMER($1);/g;' \
>     $(git grep DEFINE_TIMER | cut -d: -f1 | sort -u | grep -v timer.h)
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> # for m68k parts
> ---
>  arch/arm/mach-ixp4xx/dsmg600-setup.c      | 2 +-
>  arch/arm/mach-ixp4xx/nas100d-setup.c      | 2 +-
>  arch/m68k/amiga/amisound.c                | 2 +-
>  arch/m68k/mac/macboing.c                  | 2 +-
>  arch/mips/mti-malta/malta-display.c       | 2 +-
>  arch/parisc/kernel/pdc_cons.c             | 2 +-
>  arch/s390/mm/cmm.c                        | 2 +-
>  drivers/atm/idt77105.c                    | 4 ++--
>  drivers/atm/iphase.c                      | 2 +-
>  drivers/block/ataflop.c                   | 8 ++++----
>  drivers/char/dtlk.c                       | 2 +-
>  drivers/char/hangcheck-timer.c            | 2 +-
>  drivers/char/nwbutton.c                   | 2 +-
>  drivers/char/rtc.c                        | 2 +-
>  drivers/input/touchscreen/s3c2410_ts.c    | 2 +-
>  drivers/net/cris/eth_v10.c                | 6 +++---
>  drivers/net/hamradio/yam.c                | 2 +-
>  drivers/net/wireless/atmel/at76c50x-usb.c | 2 +-
>  drivers/staging/speakup/main.c            | 2 +-
>  drivers/staging/speakup/synth.c           | 2 +-
>  drivers/tty/cyclades.c                    | 2 +-
>  drivers/tty/isicom.c                      | 2 +-
>  drivers/tty/moxa.c                        | 2 +-
>  drivers/tty/rocket.c                      | 2 +-
>  drivers/tty/vt/keyboard.c                 | 2 +-
>  drivers/tty/vt/vt.c                       | 2 +-
>  drivers/watchdog/alim7101_wdt.c           | 2 +-
>  drivers/watchdog/machzwd.c                | 2 +-
>  drivers/watchdog/mixcomwd.c               | 2 +-
>  drivers/watchdog/sbc60xxwdt.c             | 2 +-
>  drivers/watchdog/sc520_wdt.c              | 2 +-
>  drivers/watchdog/via_wdt.c                | 2 +-
>  drivers/watchdog/w83877f_wdt.c            | 2 +-
>  drivers/xen/grant-table.c                 | 2 +-
>  fs/pstore/platform.c                      | 2 +-
>  include/linux/timer.h                     | 4 ++--
>  kernel/irq/spurious.c                     | 2 +-
>  lib/random32.c                            | 2 +-
>  net/atm/mpc.c                             | 2 +-
>  net/decnet/dn_route.c                     | 2 +-
>  net/ipv6/ip6_flowlabel.c                  | 2 +-
>  net/netrom/nr_loopback.c                  | 2 +-
>  security/keys/gc.c                        | 2 +-
>  sound/oss/midibuf.c                       | 2 +-
>  sound/oss/soundcard.c                     | 2 +-
>  sound/oss/sys_timer.c                     | 2 +-
>  sound/oss/uart6850.c                      | 2 +-
>  47 files changed, 54 insertions(+), 54 deletions(-)

Acked-by: Ralf Baechle <ralf@linux-mips.org>

Thanks,

  Ralf

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 11/13] timer: Remove expires argument from __TIMER_INITIALIZER()
@ 2017-10-11 10:15     ` Petr Mladek
  0 siblings, 0 replies; 98+ messages in thread
From: Petr Mladek @ 2017-10-11 10:15 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, 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 Ellerman,
	Michael Reed, netdev, Oleg Nesterov, Paul Mackerras,
	Pavel Machek, Rafael J. Wysocki, Ralf Baechle, Sebastian Reichel,
	Stefan Richter, Stephen Boyd, Sudip Mukherjee, Tejun Heo,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linuxppc-dev, linux-s390, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

On Wed 2017-10-04 16:27:05, Kees Cook wrote:
> The expires field is normally initialized during the first mod_timer()
> call. It was unused by all callers, so remove it from the macro.
> 
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
>  include/linux/kthread.h   | 2 +-
>  include/linux/timer.h     | 5 ++---
>  include/linux/workqueue.h | 2 +-
>  3 files changed, 4 insertions(+), 5 deletions(-)

I was primary interested into the change in kthread.h. But the entire
patch is simple and looks fine:

Reviewed-by: Petr Mladek <pmladek@suse.cz>

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 11/13] timer: Remove expires argument from __TIMER_INITIALIZER()
@ 2017-10-11 10:15     ` Petr Mladek
  0 siblings, 0 replies; 98+ messages in thread
From: Petr Mladek @ 2017-10-11 10:15 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Arnd Bergmann,
	Benjamin Herrenschmidt, 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

On Wed 2017-10-04 16:27:05, Kees Cook wrote:
> The expires field is normally initialized during the first mod_timer()
> call. It was unused by all callers, so remove it from the macro.
> 
> Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> ---
>  include/linux/kthread.h   | 2 +-
>  include/linux/timer.h     | 5 ++---
>  include/linux/workqueue.h | 2 +-
>  3 files changed, 4 insertions(+), 5 deletions(-)

I was primary interested into the change in kthread.h. But the entire
patch is simple and looks fine:

Reviewed-by: Petr Mladek <pmladek-AlSwsSmVLrQ@public.gmane.org>

Best Regards,
Petr
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 12/13] kthread: Convert callback to use from_timer()
@ 2017-10-11 10:20     ` Petr Mladek
  0 siblings, 0 replies; 98+ messages in thread
From: Petr Mladek @ 2017-10-11 10:20 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Tejun Heo, Oleg Nesterov,
	Arnd Bergmann, Benjamin Herrenschmidt, 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 Ellerman, Michael Reed, netdev,
	Paul Mackerras, Pavel Machek, Rafael J. Wysocki, Ralf Baechle,
	Sebastian Reichel, Stefan Richter, Stephen Boyd, Sudip Mukherjee,
	Ursula Braun, Viresh Kumar, Wim Van Sebroeck, linux1394-devel,
	linux-mips, linux-pm, linuxppc-dev, linux-s390, linux-scsi,
	linux-watchdog, linux-wireless, linux-kernel

On Wed 2017-10-04 16:27:06, Kees Cook wrote:
> 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.
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Petr Mladek <pmladek@suse.com>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 12/13] kthread: Convert callback to use from_timer()
@ 2017-10-11 10:20     ` Petr Mladek
  0 siblings, 0 replies; 98+ messages in thread
From: Petr Mladek @ 2017-10-11 10:20 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Tejun Heo, Oleg Nesterov,
	Arnd Bergmann, Benjamin Herrenschmidt, 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

On Wed 2017-10-04 16:27:06, Kees Cook wrote:
> 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.
> 
> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Cc: Petr Mladek <pmladek-IBi9RG/b67k@public.gmane.org>
> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
> Cc: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Reviewed-by: Petr Mladek <pmladek-IBi9RG/b67k@public.gmane.org>

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 98+ messages in thread

* Re: [PATCH 12/13] kthread: Convert callback to use from_timer()
@ 2017-10-11 10:20     ` Petr Mladek
  0 siblings, 0 replies; 98+ messages in thread
From: Petr Mladek @ 2017-10-11 10:20 UTC (permalink / raw)
  To: Kees Cook
  Cc: Thomas Gleixner, Andrew Morton, Tejun Heo, Oleg Nesterov,
	Arnd Bergmann, Benjamin Herrenschmidt, 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

On Wed 2017-10-04 16:27:06, Kees Cook wrote:
> 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.
> 
> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> Cc: Petr Mladek <pmladek-IBi9RG/b67k@public.gmane.org>
> Cc: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
> Cc: Oleg Nesterov <oleg-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Kees Cook <keescook-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Reviewed-by: Petr Mladek <pmladek-IBi9RG/b67k@public.gmane.org>

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 98+ messages in thread

end of thread, other threads:[~2017-10-11 10:20 UTC | newest]

Thread overview: 98+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-04 23:26 [PATCH 00/13] timer: Start conversion to timer_setup() Kees Cook
2017-10-04 23:26 ` Kees Cook
2017-10-04 23:26 ` Kees Cook
2017-10-04 23:26 ` [PATCH 01/13] timer: Convert schedule_timeout() to use from_timer() Kees Cook
2017-10-04 23:26   ` Kees Cook
2017-10-04 23:26   ` Kees Cook
2017-10-05 13:03   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-04 23:26 ` [PATCH 02/13] timer: Remove init_timer_pinned_deferrable() in favor of timer_setup() Kees Cook
2017-10-04 23:26   ` Kees Cook
2017-10-04 23:26   ` Kees Cook
2017-10-05 13:04   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-04 23:26 ` [PATCH 03/13] timer: Remove init_timer_on_stack() in favor of timer_setup_on_stack() Kees Cook
2017-10-04 23:26   ` Kees Cook
2017-10-04 23:26   ` Kees Cook
2017-10-05 13:04   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-05 13:18   ` [PATCH 03/13] " Rafael J. Wysocki
2017-10-05 13:18     ` Rafael J. Wysocki
2017-10-05 13:18     ` Rafael J. Wysocki
2017-10-05 13:18     ` Rafael J. Wysocki
2017-10-04 23:26 ` [PATCH 04/13] timer: Remove init_timer_pinned() in favor of timer_setup() Kees Cook
2017-10-04 23:26   ` Kees Cook
2017-10-04 23:26   ` Kees Cook
2017-10-05  0:41   ` David Miller
2017-10-05  0:41     ` David Miller
2017-10-05 13:05   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-04 23:26 ` [PATCH 05/13] timer: Remove init_timer_deferrable() " Kees Cook
2017-10-04 23:26   ` Kees Cook
2017-10-04 23:26   ` Kees Cook
2017-10-05  0:41   ` David Miller
2017-10-05  0:41     ` David Miller
2017-10-05  1:02   ` Sebastian Reichel
2017-10-05  1:02     ` Sebastian Reichel
2017-10-05 13:05   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-04 23:27 ` [PATCH 06/13] timer: Remove users of TIMER_DEFERRED_INITIALIZER Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-05 13:05   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-04 23:27 ` [PATCH 07/13] timer: Remove last user of TIMER_INITIALIZER Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-05 13:06   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-05 22:39   ` [PATCH 07/13] " Gross, Mark
2017-10-05 22:39     ` Gross, Mark
2017-10-05 22:39     ` Gross, Mark
2017-10-05 22:39     ` Gross, Mark
2017-10-05 22:39     ` Gross, Mark
2017-10-04 23:27 ` [PATCH 08/13] timer: Remove unused static initializer macros Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-05 13:06   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-04 23:27 ` [PATCH 09/13] timer: Remove users of expire and data arguments to DEFINE_TIMER Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-05  0:12   ` Guenter Roeck
2017-10-05  0:12     ` Guenter Roeck
2017-10-05  0:12     ` Guenter Roeck
2017-10-05 13:07   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-09 13:23   ` [PATCH 09/13] " Ralf Baechle
2017-10-09 13:23     ` Ralf Baechle
2017-10-04 23:27 ` [PATCH 10/13] timer: Remove expires and data arguments from DEFINE_TIMER Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-05  0:13   ` Guenter Roeck
2017-10-05  0:13     ` Guenter Roeck
2017-10-05  0:13     ` Guenter Roeck
2017-10-05  0:40   ` David Miller
2017-10-05  0:40     ` David Miller
2017-10-05  5:28   ` Greg Kroah-Hartman
2017-10-05  5:28     ` Greg Kroah-Hartman
2017-10-05  5:28     ` Greg Kroah-Hartman
2017-10-05  6:54   ` Kalle Valo
2017-10-05  6:54     ` Kalle Valo
2017-10-05  6:54     ` Kalle Valo
2017-10-05  6:54     ` Kalle Valo
2017-10-05  6:54     ` Kalle Valo
2017-10-05  8:59   ` Arnd Bergmann
2017-10-05  8:59     ` Arnd Bergmann
2017-10-05  8:59     ` Arnd Bergmann
2017-10-05 13:07   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-09 13:27   ` [PATCH 10/13] " Ralf Baechle
2017-10-09 13:27     ` Ralf Baechle
2017-10-04 23:27 ` [PATCH 11/13] timer: Remove expires argument from __TIMER_INITIALIZER() Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-05 13:07   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-11 10:15   ` [PATCH 11/13] " Petr Mladek
2017-10-11 10:15     ` Petr Mladek
2017-10-04 23:27 ` [PATCH 12/13] kthread: Convert callback to use from_timer() Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-05 13:08   ` [tip:timers/core] " tip-bot for Kees Cook
2017-10-11 10:20   ` [PATCH 12/13] " Petr Mladek
2017-10-11 10:20     ` Petr Mladek
2017-10-11 10:20     ` Petr Mladek
2017-10-04 23:27 ` [PATCH 13/13] workqueue: " Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-04 23:27   ` Kees Cook
2017-10-05 13:08   ` [tip:timers/core] " tip-bot for Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.