diff options
author | Wim Van Sebroeck <wim@iguana.be> | 2009-03-23 09:50:38 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2009-03-25 05:11:02 -0400 |
commit | 3b9d49eea1c32e529fa932670a53358e1c8cd67e (patch) | |
tree | 3fdd6b9a6b118642954a544cb1094b42594d8212 /drivers | |
parent | 0426fd0d88a595a8ab18e0cd69bdfe82a4d15115 (diff) |
[WATCHDOG] i6300esb.c: start locking
Change the start function in preparation of the generic watchdog code.
Also make sure that locking of the start function is OK.
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/watchdog/i6300esb.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c index fbe852853248..2dbe83570d65 100644 --- a/drivers/watchdog/i6300esb.c +++ b/drivers/watchdog/i6300esb.c | |||
@@ -83,7 +83,6 @@ static unsigned short triggered; /* The status of the watchdog upon boot */ | |||
83 | static char esb_expect_close; | 83 | static char esb_expect_close; |
84 | static struct platform_device *esb_platform_device; | 84 | static struct platform_device *esb_platform_device; |
85 | 85 | ||
86 | |||
87 | /* module parameters */ | 86 | /* module parameters */ |
88 | /* 30 sec default heartbeat (1 < heartbeat < 2*1023) */ | 87 | /* 30 sec default heartbeat (1 < heartbeat < 2*1023) */ |
89 | #define WATCHDOG_HEARTBEAT 30 | 88 | #define WATCHDOG_HEARTBEAT 30 |
@@ -116,13 +115,18 @@ static inline void esb_unlock_registers(void) | |||
116 | writeb(ESB_UNLOCK2, ESB_RELOAD_REG); | 115 | writeb(ESB_UNLOCK2, ESB_RELOAD_REG); |
117 | } | 116 | } |
118 | 117 | ||
119 | static void esb_timer_start(void) | 118 | static int esb_timer_start(void) |
120 | { | 119 | { |
121 | u8 val; | 120 | u8 val; |
122 | 121 | ||
122 | spin_lock(&esb_lock); | ||
123 | esb_unlock_registers(); | ||
124 | writew(ESB_WDT_RELOAD, ESB_RELOAD_REG); | ||
123 | /* Enable or Enable + Lock? */ | 125 | /* Enable or Enable + Lock? */ |
124 | val = 0x02 | (nowayout ? 0x01 : 0x00); | 126 | val = 0x02 | (nowayout ? 0x01 : 0x00); |
125 | pci_write_config_byte(esb_pci, ESB_LOCK_REG, val); | 127 | pci_write_config_byte(esb_pci, ESB_LOCK_REG, val); |
128 | spin_unlock(&esb_lock); | ||
129 | return 0; | ||
126 | } | 130 | } |
127 | 131 | ||
128 | static int esb_timer_stop(void) | 132 | static int esb_timer_stop(void) |
@@ -209,7 +213,6 @@ static int esb_open(struct inode *inode, struct file *file) | |||
209 | return -EBUSY; | 213 | return -EBUSY; |
210 | 214 | ||
211 | /* Reload and activate timer */ | 215 | /* Reload and activate timer */ |
212 | esb_timer_keepalive(); | ||
213 | esb_timer_start(); | 216 | esb_timer_start(); |
214 | 217 | ||
215 | return nonseekable_open(inode, file); | 218 | return nonseekable_open(inode, file); |
@@ -295,7 +298,6 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
295 | } | 298 | } |
296 | 299 | ||
297 | if (new_options & WDIOS_ENABLECARD) { | 300 | if (new_options & WDIOS_ENABLECARD) { |
298 | esb_timer_keepalive(); | ||
299 | esb_timer_start(); | 301 | esb_timer_start(); |
300 | retval = 0; | 302 | retval = 0; |
301 | } | 303 | } |