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/machzwd.c | |
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/machzwd.c')
-rw-r--r-- | drivers/char/watchdog/machzwd.c | 16 |
1 files changed, 5 insertions, 11 deletions
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: |