summaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/mixcomwd.c
diff options
context:
space:
mode:
authorJiri Slaby2007-02-08 18:39:36 +0100
committerWim Van Sebroeck2007-02-12 22:43:02 +0100
commit82eb7c5059de64bd43f6b3cf3f128470f2b3fb83 (patch)
tree6735317bd9c19574f85fa7e21d0071562e824355 /drivers/char/watchdog/mixcomwd.c
parent[WATCHDOG] ib700wdt.c - convert to platform_device part 2 (diff)
downloadkernel-qcow2-linux-82eb7c5059de64bd43f6b3cf3f128470f2b3fb83.tar.gz
kernel-qcow2-linux-82eb7c5059de64bd43f6b3cf3f128470f2b3fb83.tar.xz
kernel-qcow2-linux-82eb7c5059de64bd43f6b3cf3f128470f2b3fb83.zip
[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 };
#define FLASHCOM_WATCHDOG_OFFSET 0x4
#define FLASHCOM_ID 0x18
+static void mixcomwd_timerfun(unsigned long d);
+
static unsigned long mixcomwd_opened; /* long req'd for setbit --RR */
static int watchdog_port;
static int mixcomwd_timer_alive;
-static DEFINE_TIMER(mixcomwd_timer, NULL, 0, 0);
+static DEFINE_TIMER(mixcomwd_timer, mixcomwd_timerfun, 0, 0);
static char expect_close;
static int nowayout = WATCHDOG_NOWAYOUT;
@@ -77,7 +79,7 @@ static void mixcomwd_timerfun(unsigned long d)
{
mixcomwd_ping();
- mod_timer(&mixcomwd_timer,jiffies+ 5*HZ);
+ mod_timer(&mixcomwd_timer, jiffies + 5 * HZ);
}
/*
@@ -114,12 +116,8 @@ static int mixcomwd_release(struct inode *inode, struct file *file)
printk(KERN_ERR "mixcomwd: release called while internal timer alive");
return -EBUSY;
}
- init_timer(&mixcomwd_timer);
- mixcomwd_timer.expires=jiffies + 5 * HZ;
- mixcomwd_timer.function=mixcomwd_timerfun;
- mixcomwd_timer.data=0;
mixcomwd_timer_alive=1;
- add_timer(&mixcomwd_timer);
+ mod_timer(&mixcomwd_timer, jiffies + 5 * HZ);
} else {
printk(KERN_CRIT "mixcomwd: WDT device closed unexpectedly. WDT will not stop!\n");
}
@@ -285,7 +283,7 @@ static void __exit mixcomwd_exit(void)
if(mixcomwd_timer_alive) {
printk(KERN_WARNING "mixcomwd: I quit now, hardware will"
" probably reboot!\n");
- del_timer(&mixcomwd_timer);
+ del_timer_sync(&mixcomwd_timer);
mixcomwd_timer_alive=0;
}
}