Commit 12b7a152 authored by Wim Van Sebroeck's avatar Wim Van Sebroeck

[WATCHDOG] sbc8360.c - move stop code into a function

Move the sbc8360.c watchdog stop code into a seperate function.
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 0c06090c
...@@ -231,6 +231,13 @@ static void sbc8360_ping(void) ...@@ -231,6 +231,13 @@ static void sbc8360_ping(void)
outb(wd_margin, SBC8360_BASETIME); outb(wd_margin, SBC8360_BASETIME);
} }
/* stop watchdog */
static void sbc8360_stop(void)
{
/* De-activate the watchdog */
outb(0, SBC8360_ENABLE);
}
/* Userspace pings kernel driver, or requests clean close */ /* Userspace pings kernel driver, or requests clean close */
static ssize_t sbc8360_write(struct file *file, const char __user *buf, static ssize_t sbc8360_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
...@@ -271,7 +278,7 @@ static int sbc8360_open(struct inode *inode, struct file *file) ...@@ -271,7 +278,7 @@ static int sbc8360_open(struct inode *inode, struct file *file)
static int sbc8360_close(struct inode *inode, struct file *file) static int sbc8360_close(struct inode *inode, struct file *file)
{ {
if (expect_close == 42) if (expect_close == 42)
outb(0, SBC8360_ENABLE); sbc8360_stop();
else else
printk(KERN_CRIT PFX printk(KERN_CRIT PFX
"SBC8360 device closed unexpectedly. SBC8360 will not stop!\n"); "SBC8360 device closed unexpectedly. SBC8360 will not stop!\n");
...@@ -288,10 +295,9 @@ static int sbc8360_close(struct inode *inode, struct file *file) ...@@ -288,10 +295,9 @@ static int sbc8360_close(struct inode *inode, struct file *file)
static int sbc8360_notify_sys(struct notifier_block *this, unsigned long code, static int sbc8360_notify_sys(struct notifier_block *this, unsigned long code,
void *unused) void *unused)
{ {
if (code == SYS_DOWN || code == SYS_HALT) { if (code == SYS_DOWN || code == SYS_HALT)
/* Disable the SBC8360 Watchdog */ sbc8360_stop(); /* Disable the SBC8360 Watchdog */
outb(0, SBC8360_ENABLE);
}
return NOTIFY_DONE; return NOTIFY_DONE;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment