diff options
author | Jiri Slaby <jirislaby@gmail.com> | 2007-02-08 12:39:36 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2007-02-12 16:43:02 -0500 |
commit | 82eb7c5059de64bd43f6b3cf3f128470f2b3fb83 (patch) | |
tree | 6735317bd9c19574f85fa7e21d0071562e824355 /drivers/char/watchdog | |
parent | 35fcf53870eaa6cc966604a6e36df1c2c1577540 (diff) |
[WATCHDOG] timers cleanup
- Use timer macros to set function and data members and to modify
expiration time.
- Use DEFINE_TIMER for single (platform dependent) watchdog timers and
do not init them at run-time in these cases.
- del_timer_sync is common in most cases -- we want to wait for timer
function if it's still running.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Steve Hill <steve@navaho.co.uk>
Cc: Heiko Ronsdorf <hero@ihg.uni-duisburg.de>
Cc: Fernando Fuganti <fuganti@conectiva.com.br>
Cc: Gergely Madarasz <gorgo@itc.hu>
Cc: Ken Hollis <khollis@bitgate.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'drivers/char/watchdog')
-rw-r--r-- | drivers/char/watchdog/alim7101_wdt.c | 13 | ||||
-rw-r--r-- | drivers/char/watchdog/cpu5wdt.c | 13 | ||||
-rw-r--r-- | drivers/char/watchdog/machzwd.c | 16 | ||||
-rw-r--r-- | drivers/char/watchdog/mixcomwd.c | 14 | ||||
-rw-r--r-- | drivers/char/watchdog/pcwd.c | 4 | ||||
-rw-r--r-- | drivers/char/watchdog/sbc60xxwdt.c | 12 | ||||
-rw-r--r-- | drivers/char/watchdog/sc520_wdt.c | 12 | ||||
-rw-r--r-- | drivers/char/watchdog/shwdt.c | 8 | ||||
-rw-r--r-- | drivers/char/watchdog/w83877f_wdt.c | 12 |
9 files changed, 31 insertions, 73 deletions
diff --git a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c index 1dacec5c9637..c195078688de 100644 --- a/drivers/char/watchdog/alim7101_wdt.c +++ b/drivers/char/watchdog/alim7101_wdt.c | |||
@@ -69,7 +69,7 @@ module_param(use_gpio, int, 0); | |||
69 | MODULE_PARM_DESC(use_gpio, "Use the gpio watchdog. (required by old cobalt boards)"); | 69 | MODULE_PARM_DESC(use_gpio, "Use the gpio watchdog. (required by old cobalt boards)"); |
70 | 70 | ||
71 | static void wdt_timer_ping(unsigned long); | 71 | static void wdt_timer_ping(unsigned long); |
72 | static struct timer_list timer; | 72 | static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1); |
73 | static unsigned long next_heartbeat; | 73 | static unsigned long next_heartbeat; |
74 | static unsigned long wdt_is_open; | 74 | static unsigned long wdt_is_open; |
75 | static char wdt_expect_close; | 75 | static char wdt_expect_close; |
@@ -108,8 +108,7 @@ static void wdt_timer_ping(unsigned long data) | |||
108 | printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); | 108 | printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); |
109 | } | 109 | } |
110 | /* Re-set the timer interval */ | 110 | /* Re-set the timer interval */ |
111 | timer.expires = jiffies + WDT_INTERVAL; | 111 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
112 | add_timer(&timer); | ||
113 | } | 112 | } |
114 | 113 | ||
115 | /* | 114 | /* |
@@ -147,9 +146,7 @@ static void wdt_startup(void) | |||
147 | wdt_change(WDT_ENABLE); | 146 | wdt_change(WDT_ENABLE); |
148 | 147 | ||
149 | /* Start the timer */ | 148 | /* Start the timer */ |
150 | timer.expires = jiffies + WDT_INTERVAL; | 149 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
151 | add_timer(&timer); | ||
152 | |||
153 | 150 | ||
154 | printk(KERN_INFO PFX "Watchdog timer is now enabled.\n"); | 151 | printk(KERN_INFO PFX "Watchdog timer is now enabled.\n"); |
155 | } | 152 | } |
@@ -380,10 +377,6 @@ static int __init alim7101_wdt_init(void) | |||
380 | timeout); | 377 | timeout); |
381 | } | 378 | } |
382 | 379 | ||
383 | init_timer(&timer); | ||
384 | timer.function = wdt_timer_ping; | ||
385 | timer.data = 1; | ||
386 | |||
387 | rc = misc_register(&wdt_miscdev); | 380 | rc = misc_register(&wdt_miscdev); |
388 | if (rc) { | 381 | if (rc) { |
389 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", | 382 | printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", |
diff --git a/drivers/char/watchdog/cpu5wdt.c b/drivers/char/watchdog/cpu5wdt.c index 00bdabb90f27..bcd7e36ca0aa 100644 --- a/drivers/char/watchdog/cpu5wdt.c +++ b/drivers/char/watchdog/cpu5wdt.c | |||
@@ -80,10 +80,8 @@ static void cpu5wdt_trigger(unsigned long unused) | |||
80 | outb(1, port + CPU5WDT_TRIGGER_REG); | 80 | outb(1, port + CPU5WDT_TRIGGER_REG); |
81 | 81 | ||
82 | /* requeue?? */ | 82 | /* requeue?? */ |
83 | if( cpu5wdt_device.queue && ticks ) { | 83 | if (cpu5wdt_device.queue && ticks) |
84 | cpu5wdt_device.timer.expires = jiffies + CPU5WDT_INTERVAL; | 84 | mod_timer(&cpu5wdt_device.timer, jiffies + CPU5WDT_INTERVAL); |
85 | add_timer(&cpu5wdt_device.timer); | ||
86 | } | ||
87 | else { | 85 | else { |
88 | /* ticks doesn't matter anyway */ | 86 | /* ticks doesn't matter anyway */ |
89 | complete(&cpu5wdt_device.stop); | 87 | complete(&cpu5wdt_device.stop); |
@@ -109,8 +107,7 @@ static void cpu5wdt_start(void) | |||
109 | outb(1, port + CPU5WDT_MODE_REG); | 107 | outb(1, port + CPU5WDT_MODE_REG); |
110 | outb(0, port + CPU5WDT_RESET_REG); | 108 | outb(0, port + CPU5WDT_RESET_REG); |
111 | outb(0, port + CPU5WDT_ENABLE_REG); | 109 | outb(0, port + CPU5WDT_ENABLE_REG); |
112 | cpu5wdt_device.timer.expires = jiffies + CPU5WDT_INTERVAL; | 110 | mod_timer(&cpu5wdt_device.timer, jiffies + CPU5WDT_INTERVAL); |
113 | add_timer(&cpu5wdt_device.timer); | ||
114 | } | 111 | } |
115 | /* if process dies, counter is not decremented */ | 112 | /* if process dies, counter is not decremented */ |
116 | cpu5wdt_device.running++; | 113 | cpu5wdt_device.running++; |
@@ -245,9 +242,7 @@ static int __devinit cpu5wdt_init(void) | |||
245 | 242 | ||
246 | clear_bit(0, &cpu5wdt_device.inuse); | 243 | clear_bit(0, &cpu5wdt_device.inuse); |
247 | 244 | ||
248 | init_timer(&cpu5wdt_device.timer); | 245 | setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0); |
249 | cpu5wdt_device.timer.function = cpu5wdt_trigger; | ||
250 | cpu5wdt_device.timer.data = 0; | ||
251 | 246 | ||
252 | cpu5wdt_device.default_ticks = ticks; | 247 | cpu5wdt_device.default_ticks = ticks; |
253 | 248 | ||
diff --git a/drivers/char/watchdog/machzwd.c b/drivers/char/watchdog/machzwd.c index 391998d260c2..4a328ba0d262 100644 --- a/drivers/char/watchdog/machzwd.c +++ b/drivers/char/watchdog/machzwd.c | |||
@@ -118,12 +118,14 @@ static int action = 0; | |||
118 | module_param(action, int, 0); | 118 | module_param(action, int, 0); |
119 | MODULE_PARM_DESC(action, "after watchdog resets, generate: 0 = RESET(*) 1 = SMI 2 = NMI 3 = SCI"); | 119 | MODULE_PARM_DESC(action, "after watchdog resets, generate: 0 = RESET(*) 1 = SMI 2 = NMI 3 = SCI"); |
120 | 120 | ||
121 | static void zf_ping(unsigned long data); | ||
122 | |||
121 | static int zf_action = GEN_RESET; | 123 | static int zf_action = GEN_RESET; |
122 | static unsigned long zf_is_open; | 124 | static unsigned long zf_is_open; |
123 | static char zf_expect_close; | 125 | static char zf_expect_close; |
124 | static spinlock_t zf_lock; | 126 | static spinlock_t zf_lock; |
125 | static spinlock_t zf_port_lock; | 127 | static spinlock_t zf_port_lock; |
126 | static struct timer_list zf_timer; | 128 | static DEFINE_TIMER(zf_timer, zf_ping, 0, 0); |
127 | static unsigned long next_heartbeat = 0; | 129 | static unsigned long next_heartbeat = 0; |
128 | 130 | ||
129 | 131 | ||
@@ -220,9 +222,7 @@ static void zf_timer_on(void) | |||
220 | next_heartbeat = jiffies + ZF_USER_TIMEO; | 222 | next_heartbeat = jiffies + ZF_USER_TIMEO; |
221 | 223 | ||
222 | /* start the timer for internal ping */ | 224 | /* start the timer for internal ping */ |
223 | zf_timer.expires = jiffies + ZF_HW_TIMEO; | 225 | mod_timer(&zf_timer, jiffies + ZF_HW_TIMEO); |
224 | |||
225 | add_timer(&zf_timer); | ||
226 | 226 | ||
227 | /* start watchdog timer */ | 227 | /* start watchdog timer */ |
228 | ctrl_reg = zf_get_control(); | 228 | ctrl_reg = zf_get_control(); |
@@ -260,8 +260,7 @@ static void zf_ping(unsigned long data) | |||
260 | zf_set_control(ctrl_reg); | 260 | zf_set_control(ctrl_reg); |
261 | spin_unlock_irqrestore(&zf_port_lock, flags); | 261 | spin_unlock_irqrestore(&zf_port_lock, flags); |
262 | 262 | ||
263 | zf_timer.expires = jiffies + ZF_HW_TIMEO; | 263 | mod_timer(&zf_timer, jiffies + ZF_HW_TIMEO); |
264 | add_timer(&zf_timer); | ||
265 | }else{ | 264 | }else{ |
266 | printk(KERN_CRIT PFX ": I will reset your machine\n"); | 265 | printk(KERN_CRIT PFX ": I will reset your machine\n"); |
267 | } | 266 | } |
@@ -465,11 +464,6 @@ static int __init zf_init(void) | |||
465 | zf_set_status(0); | 464 | zf_set_status(0); |
466 | zf_set_control(0); | 465 | zf_set_control(0); |
467 | 466 | ||
468 | /* this is the timer that will do the hard work */ | ||
469 | init_timer(&zf_timer); | ||
470 | zf_timer.function = zf_ping; | ||
471 | zf_timer.data = 0; | ||
472 | |||
473 | return 0; | 467 | return 0; |
474 | 468 | ||
475 | no_reboot: | 469 | no_reboot: |
diff --git a/drivers/char/watchdog/mixcomwd.c b/drivers/char/watchdog/mixcomwd.c index 7e3308a60afb..f35e2848aa3e 100644 --- a/drivers/char/watchdog/mixcomwd.c +++ b/drivers/char/watchdog/mixcomwd.c | |||
@@ -56,11 +56,13 @@ static int mixcomwd_ioports[] = { 0x180, 0x280, 0x380, 0x000 }; | |||
56 | #define FLASHCOM_WATCHDOG_OFFSET 0x4 | 56 | #define FLASHCOM_WATCHDOG_OFFSET 0x4 |
57 | #define FLASHCOM_ID 0x18 | 57 | #define FLASHCOM_ID 0x18 |
58 | 58 | ||
59 | static void mixcomwd_timerfun(unsigned long d); | ||
60 | |||
59 | static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */ | 61 | static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */ |
60 | 62 | ||
61 | static int watchdog_port; | 63 | static int watchdog_port; |
62 | static int mixcomwd_timer_alive; | 64 | static int mixcomwd_timer_alive; |
63 | static DEFINE_TIMER(mixcomwd_timer, NULL, 0, 0); | 65 | static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0); |
64 | static char expect_close; | 66 | static char expect_close; |
65 | 67 | ||
66 | static int nowayout = WATCHDOG_NOWAYOUT; | 68 | static int nowayout = WATCHDOG_NOWAYOUT; |
@@ -77,7 +79,7 @@ static void mixcomwd_timerfun(unsigned long d) | |||
77 | { | 79 | { |
78 | mixcomwd_ping(); | 80 | mixcomwd_ping(); |
79 | 81 | ||
80 | mod_timer(&mixcomwd_timer,jiffies+ 5*HZ); | 82 | mod_timer(&mixcomwd_timer, jiffies + 5 * HZ); |
81 | } | 83 | } |
82 | 84 | ||
83 | /* | 85 | /* |
@@ -114,12 +116,8 @@ static int mixcomwd_release(struct inode *inode, struct file *file) | |||
114 | printk(KERN_ERR "mixcomwd: release called while internal timer alive"); | 116 | printk(KERN_ERR "mixcomwd: release called while internal timer alive"); |
115 | return -EBUSY; | 117 | return -EBUSY; |
116 | } | 118 | } |
117 | init_timer(&mixcomwd_timer); | ||
118 | mixcomwd_timer.expires=jiffies + 5 * HZ; | ||
119 | mixcomwd_timer.function=mixcomwd_timerfun; | ||
120 | mixcomwd_timer.data=0; | ||
121 | mixcomwd_timer_alive=1; | 119 | mixcomwd_timer_alive=1; |
122 | add_timer(&mixcomwd_timer); | 120 | mod_timer(&mixcomwd_timer, jiffies + 5 * HZ); |
123 | } else { | 121 | } else { |
124 | printk(KERN_CRIT "mixcomwd: WDT device closed unexpectedly. WDT will not stop!\n"); | 122 | printk(KERN_CRIT "mixcomwd: WDT device closed unexpectedly. WDT will not stop!\n"); |
125 | } | 123 | } |
@@ -285,7 +283,7 @@ static void __exit mixcomwd_exit(void) | |||
285 | if(mixcomwd_timer_alive) { | 283 | if(mixcomwd_timer_alive) { |
286 | printk(KERN_WARNING "mixcomwd: I quit now, hardware will" | 284 | printk(KERN_WARNING "mixcomwd: I quit now, hardware will" |
287 | " probably reboot!\n"); | 285 | " probably reboot!\n"); |
288 | del_timer(&mixcomwd_timer); | 286 | del_timer_sync(&mixcomwd_timer); |
289 | mixcomwd_timer_alive=0; | 287 | mixcomwd_timer_alive=0; |
290 | } | 288 | } |
291 | } | 289 | } |
diff --git a/drivers/char/watchdog/pcwd.c b/drivers/char/watchdog/pcwd.c index b056c3c18aa7..6e8b5705b5b7 100644 --- a/drivers/char/watchdog/pcwd.c +++ b/drivers/char/watchdog/pcwd.c | |||
@@ -843,9 +843,7 @@ static int __devinit pcwatchdog_init(int base_addr) | |||
843 | /* clear the "card caused reboot" flag */ | 843 | /* clear the "card caused reboot" flag */ |
844 | pcwd_clear_status(); | 844 | pcwd_clear_status(); |
845 | 845 | ||
846 | init_timer(&pcwd_private.timer); | 846 | setup_timer(&pcwd_private.timer, pcwd_timer_ping, 0); |
847 | pcwd_private.timer.function = pcwd_timer_ping; | ||
848 | pcwd_private.timer.data = 0; | ||
849 | 847 | ||
850 | /* Disable the board */ | 848 | /* Disable the board */ |
851 | pcwd_stop(); | 849 | pcwd_stop(); |
diff --git a/drivers/char/watchdog/sbc60xxwdt.c b/drivers/char/watchdog/sbc60xxwdt.c index f5fb8cc23d52..b6282039198c 100644 --- a/drivers/char/watchdog/sbc60xxwdt.c +++ b/drivers/char/watchdog/sbc60xxwdt.c | |||
@@ -103,7 +103,7 @@ module_param(nowayout, int, 0); | |||
103 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 103 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
104 | 104 | ||
105 | static void wdt_timer_ping(unsigned long); | 105 | static void wdt_timer_ping(unsigned long); |
106 | static struct timer_list timer; | 106 | static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0); |
107 | static unsigned long next_heartbeat; | 107 | static unsigned long next_heartbeat; |
108 | static unsigned long wdt_is_open; | 108 | static unsigned long wdt_is_open; |
109 | static char wdt_expect_close; | 109 | static char wdt_expect_close; |
@@ -122,8 +122,7 @@ static void wdt_timer_ping(unsigned long data) | |||
122 | /* Ping the WDT by reading from wdt_start */ | 122 | /* Ping the WDT by reading from wdt_start */ |
123 | inb_p(wdt_start); | 123 | inb_p(wdt_start); |
124 | /* Re-set the timer interval */ | 124 | /* Re-set the timer interval */ |
125 | timer.expires = jiffies + WDT_INTERVAL; | 125 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
126 | add_timer(&timer); | ||
127 | } else { | 126 | } else { |
128 | printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); | 127 | printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); |
129 | } | 128 | } |
@@ -138,8 +137,7 @@ static void wdt_startup(void) | |||
138 | next_heartbeat = jiffies + (timeout * HZ); | 137 | next_heartbeat = jiffies + (timeout * HZ); |
139 | 138 | ||
140 | /* Start the timer */ | 139 | /* Start the timer */ |
141 | timer.expires = jiffies + WDT_INTERVAL; | 140 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
142 | add_timer(&timer); | ||
143 | printk(KERN_INFO PFX "Watchdog timer is now enabled.\n"); | 141 | printk(KERN_INFO PFX "Watchdog timer is now enabled.\n"); |
144 | } | 142 | } |
145 | 143 | ||
@@ -363,10 +361,6 @@ static int __init sbc60xxwdt_init(void) | |||
363 | } | 361 | } |
364 | } | 362 | } |
365 | 363 | ||
366 | init_timer(&timer); | ||
367 | timer.function = wdt_timer_ping; | ||
368 | timer.data = 0; | ||
369 | |||
370 | rc = misc_register(&wdt_miscdev); | 364 | rc = misc_register(&wdt_miscdev); |
371 | if (rc) | 365 | if (rc) |
372 | { | 366 | { |
diff --git a/drivers/char/watchdog/sc520_wdt.c b/drivers/char/watchdog/sc520_wdt.c index ecc73051a3b0..2676a43895a7 100644 --- a/drivers/char/watchdog/sc520_wdt.c +++ b/drivers/char/watchdog/sc520_wdt.c | |||
@@ -121,7 +121,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" _ | |||
121 | static __u16 __iomem *wdtmrctl; | 121 | static __u16 __iomem *wdtmrctl; |
122 | 122 | ||
123 | static void wdt_timer_ping(unsigned long); | 123 | static void wdt_timer_ping(unsigned long); |
124 | static struct timer_list timer; | 124 | static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0); |
125 | static unsigned long next_heartbeat; | 125 | static unsigned long next_heartbeat; |
126 | static unsigned long wdt_is_open; | 126 | static unsigned long wdt_is_open; |
127 | static char wdt_expect_close; | 127 | static char wdt_expect_close; |
@@ -145,8 +145,7 @@ static void wdt_timer_ping(unsigned long data) | |||
145 | spin_unlock(&wdt_spinlock); | 145 | spin_unlock(&wdt_spinlock); |
146 | 146 | ||
147 | /* Re-set the timer interval */ | 147 | /* Re-set the timer interval */ |
148 | timer.expires = jiffies + WDT_INTERVAL; | 148 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
149 | add_timer(&timer); | ||
150 | } else { | 149 | } else { |
151 | printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); | 150 | printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); |
152 | } | 151 | } |
@@ -179,8 +178,7 @@ static int wdt_startup(void) | |||
179 | next_heartbeat = jiffies + (timeout * HZ); | 178 | next_heartbeat = jiffies + (timeout * HZ); |
180 | 179 | ||
181 | /* Start the timer */ | 180 | /* Start the timer */ |
182 | timer.expires = jiffies + WDT_INTERVAL; | 181 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
183 | add_timer(&timer); | ||
184 | 182 | ||
185 | /* Start the watchdog */ | 183 | /* Start the watchdog */ |
186 | wdt_config(WDT_ENB | WDT_WRST_ENB | WDT_EXP_SEL_04); | 184 | wdt_config(WDT_ENB | WDT_WRST_ENB | WDT_EXP_SEL_04); |
@@ -389,10 +387,6 @@ static int __init sc520_wdt_init(void) | |||
389 | 387 | ||
390 | spin_lock_init(&wdt_spinlock); | 388 | spin_lock_init(&wdt_spinlock); |
391 | 389 | ||
392 | init_timer(&timer); | ||
393 | timer.function = wdt_timer_ping; | ||
394 | timer.data = 0; | ||
395 | |||
396 | /* Check that the timeout value is within it's range ; if not reset to the default */ | 390 | /* Check that the timeout value is within it's range ; if not reset to the default */ |
397 | if (wdt_set_heartbeat(timeout)) { | 391 | if (wdt_set_heartbeat(timeout)) { |
398 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); | 392 | wdt_set_heartbeat(WATCHDOG_TIMEOUT); |
diff --git a/drivers/char/watchdog/shwdt.c b/drivers/char/watchdog/shwdt.c index dc403629aeb3..cecbedd473a4 100644 --- a/drivers/char/watchdog/shwdt.c +++ b/drivers/char/watchdog/shwdt.c | |||
@@ -65,10 +65,12 @@ static int clock_division_ratio = WTCSR_CKS_4096; | |||
65 | 65 | ||
66 | #define next_ping_period(cks) msecs_to_jiffies(cks - 4) | 66 | #define next_ping_period(cks) msecs_to_jiffies(cks - 4) |
67 | 67 | ||
68 | static void sh_wdt_ping(unsigned long data); | ||
69 | |||
68 | static unsigned long shwdt_is_open; | 70 | static unsigned long shwdt_is_open; |
69 | static struct watchdog_info sh_wdt_info; | 71 | static struct watchdog_info sh_wdt_info; |
70 | static char shwdt_expect_close; | 72 | static char shwdt_expect_close; |
71 | static struct timer_list timer; | 73 | static DEFINE_TIMER(timer, sh_wdt_ping, 0, 0); |
72 | static unsigned long next_heartbeat; | 74 | static unsigned long next_heartbeat; |
73 | 75 | ||
74 | #define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */ | 76 | #define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */ |
@@ -433,10 +435,6 @@ static int __init sh_wdt_init(void) | |||
433 | "be 1<=x<=3600, using %d\n", heartbeat); | 435 | "be 1<=x<=3600, using %d\n", heartbeat); |
434 | } | 436 | } |
435 | 437 | ||
436 | init_timer(&timer); | ||
437 | timer.function = sh_wdt_ping; | ||
438 | timer.data = 0; | ||
439 | |||
440 | rc = register_reboot_notifier(&sh_wdt_notifier); | 438 | rc = register_reboot_notifier(&sh_wdt_notifier); |
441 | if (unlikely(rc)) { | 439 | if (unlikely(rc)) { |
442 | printk(KERN_ERR PFX "Can't register reboot notifier (err=%d)\n", | 440 | printk(KERN_ERR PFX "Can't register reboot notifier (err=%d)\n", |
diff --git a/drivers/char/watchdog/w83877f_wdt.c b/drivers/char/watchdog/w83877f_wdt.c index 7dcd80aa7373..3c88fe18f4f4 100644 --- a/drivers/char/watchdog/w83877f_wdt.c +++ b/drivers/char/watchdog/w83877f_wdt.c | |||
@@ -90,7 +90,7 @@ module_param(nowayout, int, 0); | |||
90 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | 90 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
91 | 91 | ||
92 | static void wdt_timer_ping(unsigned long); | 92 | static void wdt_timer_ping(unsigned long); |
93 | static struct timer_list timer; | 93 | static DEFINE_TIMER(timer, wdt_timer_ping, 0, 0); |
94 | static unsigned long next_heartbeat; | 94 | static unsigned long next_heartbeat; |
95 | static unsigned long wdt_is_open; | 95 | static unsigned long wdt_is_open; |
96 | static char wdt_expect_close; | 96 | static char wdt_expect_close; |
@@ -114,8 +114,7 @@ static void wdt_timer_ping(unsigned long data) | |||
114 | inb_p(WDT_PING); | 114 | inb_p(WDT_PING); |
115 | 115 | ||
116 | /* Re-set the timer interval */ | 116 | /* Re-set the timer interval */ |
117 | timer.expires = jiffies + WDT_INTERVAL; | 117 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
118 | add_timer(&timer); | ||
119 | 118 | ||
120 | spin_unlock(&wdt_spinlock); | 119 | spin_unlock(&wdt_spinlock); |
121 | 120 | ||
@@ -155,8 +154,7 @@ static void wdt_startup(void) | |||
155 | next_heartbeat = jiffies + (timeout * HZ); | 154 | next_heartbeat = jiffies + (timeout * HZ); |
156 | 155 | ||
157 | /* Start the timer */ | 156 | /* Start the timer */ |
158 | timer.expires = jiffies + WDT_INTERVAL; | 157 | mod_timer(&timer, jiffies + WDT_INTERVAL); |
159 | add_timer(&timer); | ||
160 | 158 | ||
161 | wdt_change(WDT_ENABLE); | 159 | wdt_change(WDT_ENABLE); |
162 | 160 | ||
@@ -377,10 +375,6 @@ static int __init w83877f_wdt_init(void) | |||
377 | goto err_out_region1; | 375 | goto err_out_region1; |
378 | } | 376 | } |
379 | 377 | ||
380 | init_timer(&timer); | ||
381 | timer.function = wdt_timer_ping; | ||
382 | timer.data = 0; | ||
383 | |||
384 | rc = misc_register(&wdt_miscdev); | 378 | rc = misc_register(&wdt_miscdev); |
385 | if (rc) | 379 | if (rc) |
386 | { | 380 | { |