aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/pcwd_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/pcwd_pci.c')
-rw-r--r--drivers/watchdog/pcwd_pci.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c
index 2617129a7ccc..90eb1d4271d7 100644
--- a/drivers/watchdog/pcwd_pci.c
+++ b/drivers/watchdog/pcwd_pci.c
@@ -96,7 +96,7 @@
96#define CMD_GET_CLEAR_RESET_COUNT 0x84 96#define CMD_GET_CLEAR_RESET_COUNT 0x84
97 97
98/* Watchdog's Dip Switch heartbeat values */ 98/* Watchdog's Dip Switch heartbeat values */
99static const int heartbeat_tbl [] = { 99static const int heartbeat_tbl[] = {
100 5, /* OFF-OFF-OFF = 5 Sec */ 100 5, /* OFF-OFF-OFF = 5 Sec */
101 10, /* OFF-OFF-ON = 10 Sec */ 101 10, /* OFF-OFF-ON = 10 Sec */
102 30, /* OFF-ON-OFF = 30 Sec */ 102 30, /* OFF-ON-OFF = 30 Sec */
@@ -219,11 +219,10 @@ static void pcipcwd_show_card_info(void)
219 int option_switches; 219 int option_switches;
220 220
221 got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor); 221 got_fw_rev = send_command(CMD_GET_FIRMWARE_VERSION, &fw_rev_major, &fw_rev_minor);
222 if (got_fw_rev) { 222 if (got_fw_rev)
223 sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor); 223 sprintf(fw_ver_str, "%u.%02u", fw_rev_major, fw_rev_minor);
224 } else { 224 else
225 sprintf(fw_ver_str, "<card no answer>"); 225 sprintf(fw_ver_str, "<card no answer>");
226 }
227 226
228 /* Get switch settings */ 227 /* Get switch settings */
229 option_switches = pcipcwd_get_option_switches(); 228 option_switches = pcipcwd_get_option_switches();
@@ -330,7 +329,7 @@ static int pcipcwd_get_status(int *status)
330{ 329{
331 int control_status; 330 int control_status;
332 331
333 *status=0; 332 *status = 0;
334 control_status = inb_p(pcipcwd_private.io_addr + 1); 333 control_status = inb_p(pcipcwd_private.io_addr + 1);
335 if (control_status & WD_PCI_WTRP) 334 if (control_status & WD_PCI_WTRP)
336 *status |= WDIOF_CARDRESET; 335 *status |= WDIOF_CARDRESET;
@@ -368,8 +367,8 @@ static int pcipcwd_clear_status(void)
368 outb_p((control_status & WD_PCI_R2DS) | WD_PCI_WTRP, pcipcwd_private.io_addr + 1); 367 outb_p((control_status & WD_PCI_R2DS) | WD_PCI_WTRP, pcipcwd_private.io_addr + 1);
369 368
370 /* clear reset counter */ 369 /* clear reset counter */
371 msb=0; 370 msb = 0;
372 reset_counter=0xff; 371 reset_counter = 0xff;
373 send_command(CMD_GET_CLEAR_RESET_COUNT, &msb, &reset_counter); 372 send_command(CMD_GET_CLEAR_RESET_COUNT, &msb, &reset_counter);
374 373
375 if (debug >= DEBUG) { 374 if (debug >= DEBUG) {
@@ -441,7 +440,7 @@ static ssize_t pcipcwd_write(struct file *file, const char __user *data,
441 /* scan to see whether or not we got the magic character */ 440 /* scan to see whether or not we got the magic character */
442 for (i = 0; i != len; i++) { 441 for (i = 0; i != len; i++) {
443 char c; 442 char c;
444 if(get_user(c, data+i)) 443 if (get_user(c, data + i))
445 return -EFAULT; 444 return -EFAULT;
446 if (c == 'V') 445 if (c == 'V')
447 expect_release = 42; 446 expect_release = 42;
@@ -471,8 +470,7 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd,
471 470
472 switch (cmd) { 471 switch (cmd) {
473 case WDIOC_GETSUPPORT: 472 case WDIOC_GETSUPPORT:
474 return copy_to_user(argp, &ident, 473 return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
475 sizeof (ident)) ? -EFAULT : 0;
476 474
477 case WDIOC_GETSTATUS: 475 case WDIOC_GETSTATUS:
478 { 476 {
@@ -498,7 +496,7 @@ static long pcipcwd_ioctl(struct file *file, unsigned int cmd,
498 { 496 {
499 int new_options, retval = -EINVAL; 497 int new_options, retval = -EINVAL;
500 498
501 if (get_user (new_options, p)) 499 if (get_user(new_options, p))
502 return -EFAULT; 500 return -EFAULT;
503 501
504 if (new_options & WDIOS_DISABLECARD) { 502 if (new_options & WDIOS_DISABLECARD) {
@@ -600,7 +598,7 @@ static ssize_t pcipcwd_temp_read(struct file *file, char __user *data,
600 if (pcipcwd_get_temperature(&temperature)) 598 if (pcipcwd_get_temperature(&temperature))
601 return -EFAULT; 599 return -EFAULT;
602 600
603 if (copy_to_user (data, &temperature, 1)) 601 if (copy_to_user(data, &temperature, 1))
604 return -EFAULT; 602 return -EFAULT;
605 603
606 return 1; 604 return 1;
@@ -625,10 +623,8 @@ static int pcipcwd_temp_release(struct inode *inode, struct file *file)
625 623
626static int pcipcwd_notify_sys(struct notifier_block *this, unsigned long code, void *unused) 624static int pcipcwd_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
627{ 625{
628 if (code==SYS_DOWN || code==SYS_HALT) { 626 if (code == SYS_DOWN || code == SYS_HALT)
629 /* Turn the WDT off */ 627 pcipcwd_stop(); /* Turn the WDT off */
630 pcipcwd_stop();
631 }
632 628
633 return NOTIFY_DONE; 629 return NOTIFY_DONE;
634} 630}