aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/mixcomwd.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2007-02-08 12:39:36 -0500
committerWim Van Sebroeck <wim@iguana.be>2007-02-12 16:43:02 -0500
commit82eb7c5059de64bd43f6b3cf3f128470f2b3fb83 (patch)
tree6735317bd9c19574f85fa7e21d0071562e824355 /drivers/char/watchdog/mixcomwd.c
parent35fcf53870eaa6cc966604a6e36df1c2c1577540 (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/mixcomwd.c')
-rw-r--r--drivers/char/watchdog/mixcomwd.c14
1 files changed, 6 insertions, 8 deletions
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
59static void mixcomwd_timerfun(unsigned long d);
60
59static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */ 61static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */
60 62
61static int watchdog_port; 63static int watchdog_port;
62static int mixcomwd_timer_alive; 64static int mixcomwd_timer_alive;
63static DEFINE_TIMER(mixcomwd_timer, NULL, 0, 0); 65static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0);
64static char expect_close; 66static char expect_close;
65 67
66static int nowayout = WATCHDOG_NOWAYOUT; 68static 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 }