[PATCH v2 08/31] timer: Remove users of TIMER_INITIALIZER

From: Kees Cook
Date: Wed Sep 20 2017 - 19:31:12 EST


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

Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
---
drivers/char/tlclk.c | 7 +++----
include/linux/timer.h | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 6210bff46341..390505d1ecba 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -185,8 +185,7 @@ 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 struct timer_list switchover_timer;
static unsigned long tlclk_timer_data;

static struct tlclk_alarms *alarm_events;
@@ -805,7 +804,8 @@ static int __init tlclk_init(void)
goto out3;
}

- init_timer(&switchover_timer);
+ setup_timer(&switchover_timer, switchover_timeout,
+ (unsigned long)&tlclk_timer_data);

ret = misc_register(&tlclk_miscdev);
if (ret < 0) {
@@ -922,7 +922,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 491dfdda4acf..3f54800962aa 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