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/alim7101_wdt.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/alim7101_wdt.c')
-rw-r--r-- | drivers/char/watchdog/alim7101_wdt.c | 13 |
1 files changed, 3 insertions, 10 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", |