diff options
author | Wim Van Sebroeck <wim@iguana.be> | 2009-03-25 15:14:45 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2009-04-08 02:06:41 -0400 |
commit | 31838d9dac17dce6d68d985fd28c10d7a756dc4d (patch) | |
tree | 0a1ad0496f45c4ca4b692f78e3a2bca5f86b2304 | |
parent | bd4e6c18ae02a492094621072e540df02e866f61 (diff) |
[WATCHDOG] i6300esb.c: Fix the GETSTATUS and GETBOOTSTATUS ioctls.
The WDIOC_GETSTATUS and WDIOC_GETBOOTSTATUS should return WDIOF_* flags
(and not counter values, ...)
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/watchdog/i6300esb.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c index cfbb01c43163..8a0ef65a0691 100644 --- a/drivers/watchdog/i6300esb.c +++ b/drivers/watchdog/i6300esb.c | |||
@@ -68,6 +68,7 @@ | |||
68 | #define ESB_WDT_INTTYPE (0x11 << 0) /* Interrupt type on timer1 timeout */ | 68 | #define ESB_WDT_INTTYPE (0x11 << 0) /* Interrupt type on timer1 timeout */ |
69 | 69 | ||
70 | /* Reload register bits */ | 70 | /* Reload register bits */ |
71 | #define ESB_WDT_TIMEOUT (0x01 << 9) /* Watchdog timed out */ | ||
71 | #define ESB_WDT_RELOAD (0x01 << 8) /* prevent timeout */ | 72 | #define ESB_WDT_RELOAD (0x01 << 8) /* prevent timeout */ |
72 | 73 | ||
73 | /* Magic constants */ | 74 | /* Magic constants */ |
@@ -87,7 +88,6 @@ static struct platform_device *esb_platform_device; | |||
87 | /* 30 sec default heartbeat (1 < heartbeat < 2*1023) */ | 88 | /* 30 sec default heartbeat (1 < heartbeat < 2*1023) */ |
88 | #define WATCHDOG_HEARTBEAT 30 | 89 | #define WATCHDOG_HEARTBEAT 30 |
89 | static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */ | 90 | static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */ |
90 | |||
91 | module_param(heartbeat, int, 0); | 91 | module_param(heartbeat, int, 0); |
92 | MODULE_PARM_DESC(heartbeat, | 92 | MODULE_PARM_DESC(heartbeat, |
93 | "Watchdog heartbeat in seconds. (1<heartbeat<2046, default=" | 93 | "Watchdog heartbeat in seconds. (1<heartbeat<2046, default=" |
@@ -190,18 +190,6 @@ static int esb_timer_set_heartbeat(int time) | |||
190 | return 0; | 190 | return 0; |
191 | } | 191 | } |
192 | 192 | ||
193 | static int esb_timer_read(void) | ||
194 | { | ||
195 | u32 count; | ||
196 | |||
197 | /* This isn't documented, and doesn't take into | ||
198 | * acount which stage is running, but it looks | ||
199 | * like a 20 bit count down, so we might as well report it. | ||
200 | */ | ||
201 | pci_read_config_dword(esb_pci, 0x64, &count); | ||
202 | return (int)count; | ||
203 | } | ||
204 | |||
205 | /* | 193 | /* |
206 | * /dev/watchdog handling | 194 | * /dev/watchdog handling |
207 | */ | 195 | */ |
@@ -282,7 +270,7 @@ static long esb_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
282 | sizeof(ident)) ? -EFAULT : 0; | 270 | sizeof(ident)) ? -EFAULT : 0; |
283 | 271 | ||
284 | case WDIOC_GETSTATUS: | 272 | case WDIOC_GETSTATUS: |
285 | return put_user(esb_timer_read(), p); | 273 | return put_user(0, p); |
286 | 274 | ||
287 | case WDIOC_GETBOOTSTATUS: | 275 | case WDIOC_GETBOOTSTATUS: |
288 | return put_user(triggered, p); | 276 | return put_user(triggered, p); |
@@ -412,11 +400,12 @@ static unsigned char __devinit esb_getdevice(void) | |||
412 | /* Check if the watchdog was previously triggered */ | 400 | /* Check if the watchdog was previously triggered */ |
413 | esb_unlock_registers(); | 401 | esb_unlock_registers(); |
414 | val2 = readw(ESB_RELOAD_REG); | 402 | val2 = readw(ESB_RELOAD_REG); |
415 | triggered = (val2 & (0x01 << 9) >> 9); | 403 | if (val2 & ESB_WDT_TIMEOUT) |
404 | triggered = WDIOF_CARDRESET; | ||
416 | 405 | ||
417 | /* Reset trigger flag and timers */ | 406 | /* Reset trigger flag and timers */ |
418 | esb_unlock_registers(); | 407 | esb_unlock_registers(); |
419 | writew((0x11 << 8), ESB_RELOAD_REG); | 408 | writew((ESB_WDT_TIMEOUT | ESB_WDT_RELOAD), ESB_RELOAD_REG); |
420 | 409 | ||
421 | /* Done */ | 410 | /* Done */ |
422 | return 1; | 411 | return 1; |