git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
drivers
/
char
/
watchdog
/
w83627hf_wdt.c
diff --git
a/drivers/char/watchdog/w83627hf_wdt.c
b/drivers/char/watchdog/w83627hf_wdt.c
index
813c970
..
07d4bff
100644
(file)
--- a/
drivers/char/watchdog/w83627hf_wdt.c
+++ b/
drivers/char/watchdog/w83627hf_wdt.c
@@
-33,6
+33,7
@@
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h>
+#include <linux/spinlock.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/uaccess.h>
@@
-44,6
+45,7
@@
static unsigned long wdt_is_open;
static char expect_close;
static unsigned long wdt_is_open;
static char expect_close;
+static spinlock_t io_lock;
/* You must set this - there is no sane way to probe for this board. */
static int wdt_io = 0x2E;
/* You must set this - there is no sane way to probe for this board. */
static int wdt_io = 0x2E;
@@
-54,12
+56,7
@@
static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
module_param(timeout, int, 0);
MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
-#ifdef CONFIG_WATCHDOG_NOWAYOUT
-static int nowayout = 1;
-#else
-static int nowayout = 0;
-#endif
-
+static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
@@
-98,6
+95,12
@@
w83627hf_init(void)
w83627hf_select_wd_register();
w83627hf_select_wd_register();
+ outb_p(0xF6, WDT_EFER); /* Select CRF6 */
+ t=inb_p(WDT_EFDR); /* read CRF6 */
+ if (t != 0) {
+ printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout);
+ outb_p(timeout, WDT_EFDR); /* Write back to CRF6 */
+ }
outb_p(0xF5, WDT_EFER); /* Select CRF5 */
t=inb_p(WDT_EFDR); /* read CRF5 */
t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */
outb_p(0xF5, WDT_EFER); /* Select CRF5 */
t=inb_p(WDT_EFDR); /* read CRF5 */
t&=~0x0C; /* set second mode & disable keyboard turning off watchdog */
@@
-109,12
+112,16
@@
w83627hf_init(void)
static void
wdt_ctrl(int timeout)
{
static void
wdt_ctrl(int timeout)
{
+ spin_lock(&io_lock);
+
w83627hf_select_wd_register();
outb_p(0xF6, WDT_EFER); /* Select CRF6 */
outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF6 */
w83627hf_unselect_wd_register();
w83627hf_select_wd_register();
outb_p(0xF6, WDT_EFER); /* Select CRF6 */
outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF6 */
w83627hf_unselect_wd_register();
+
+ spin_unlock(&io_lock);
}
static int
}
static int
@@
-222,7
+229,7
@@
wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
}
default:
}
default:
- return -ENO
IOCTLCMD
;
+ return -ENO
TTY
;
}
return 0;
}
}
return 0;
}
@@
-273,7
+280,7
@@
wdt_notify_sys(struct notifier_block *this, unsigned long code,
* Kernel Interfaces
*/
* Kernel Interfaces
*/
-static struct file_operations wdt_fops = {
+static
const
struct file_operations wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = wdt_write,
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = wdt_write,
@@
-302,6
+309,8
@@
wdt_init(void)
{
int ret;
{
int ret;
+ spin_lock_init(&io_lock);
+
printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF Super I/O chip initialising.\n");
if (wdt_set_heartbeat(timeout)) {
printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF Super I/O chip initialising.\n");
if (wdt_set_heartbeat(timeout)) {
@@
-358,5
+367,5
@@
module_exit(wdt_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Pádraig Brady <P@draigBrady.com>");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Pádraig Brady <P@draigBrady.com>");
-MODULE_DESCRIPTION("w
38
627hf WDT driver");
+MODULE_DESCRIPTION("w
83
627hf WDT driver");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);