diff options
Diffstat (limited to 'drivers/char/watchdog/pcwd_pci.c')
-rw-r--r-- | drivers/char/watchdog/pcwd_pci.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/drivers/char/watchdog/pcwd_pci.c b/drivers/char/watchdog/pcwd_pci.c index 2451edbefece..1f40ecefbf72 100644 --- a/drivers/char/watchdog/pcwd_pci.c +++ b/drivers/char/watchdog/pcwd_pci.c | |||
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | /* | 23 | /* |
24 | * A bells and whistles driver is available from: | 24 | * A bells and whistles driver is available from: |
25 | * http://www.kernel.org/pub/linux/kernel/people/wim/pcwd/pcwd_pci/ | 25 | * http://www.kernel.org/pub/linux/kernel/people/wim/pcwd/pcwd_pci/ |
26 | * | 26 | * |
27 | * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/ | 27 | * More info available at http://www.berkprod.com/ or http://www.pcwatchdog.com/ |
@@ -390,6 +390,24 @@ static int pcipcwd_get_temperature(int *temperature) | |||
390 | return 0; | 390 | return 0; |
391 | } | 391 | } |
392 | 392 | ||
393 | static int pcipcwd_get_timeleft(int *time_left) | ||
394 | { | ||
395 | int msb; | ||
396 | int lsb; | ||
397 | |||
398 | /* Read the time that's left before rebooting */ | ||
399 | /* Note: if the board is not yet armed then we will read 0xFFFF */ | ||
400 | send_command(CMD_READ_WATCHDOG_TIMEOUT, &msb, &lsb); | ||
401 | |||
402 | *time_left = (msb << 8) + lsb; | ||
403 | |||
404 | if (debug >= VERBOSE) | ||
405 | printk(KERN_DEBUG PFX "Time left before next reboot: %d\n", | ||
406 | *time_left); | ||
407 | |||
408 | return 0; | ||
409 | } | ||
410 | |||
393 | /* | 411 | /* |
394 | * /dev/watchdog handling | 412 | * /dev/watchdog handling |
395 | */ | 413 | */ |
@@ -512,6 +530,16 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file, | |||
512 | case WDIOC_GETTIMEOUT: | 530 | case WDIOC_GETTIMEOUT: |
513 | return put_user(heartbeat, p); | 531 | return put_user(heartbeat, p); |
514 | 532 | ||
533 | case WDIOC_GETTIMELEFT: | ||
534 | { | ||
535 | int time_left; | ||
536 | |||
537 | if (pcipcwd_get_timeleft(&time_left)) | ||
538 | return -EFAULT; | ||
539 | |||
540 | return put_user(time_left, p); | ||
541 | } | ||
542 | |||
515 | default: | 543 | default: |
516 | return -ENOIOCTLCMD; | 544 | return -ENOIOCTLCMD; |
517 | } | 545 | } |