diff options
author | dann frazier <dannf@hp.com> | 2010-06-02 18:23:41 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2010-08-13 16:54:46 -0400 |
commit | aae67f3602d8869c8ab1b34b6ba9206e9fff4b16 (patch) | |
tree | e85f5ff3c9620ecb0501c403551b11254ad8ba6f /drivers/watchdog/hpwdt.c | |
parent | 6f681c2eabbd8df062963c52abaa0c7c3b2c5a7d (diff) |
watchdog: hpwdt (8/12): implement WDIOC_GETTIMELEFT
Let applications check the amount of time left before the watchdog will fire.
Signed-off-by: dann frazier <dannf@hp.com>
Acked-by: Thomas Mingarelli <Thomas.Mingarelli@hp.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/hpwdt.c')
-rw-r--r-- | drivers/watchdog/hpwdt.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 00299919df39..554526cf3233 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -450,6 +450,11 @@ static int hpwdt_change_timer(int new_margin) | |||
450 | return 0; | 450 | return 0; |
451 | } | 451 | } |
452 | 452 | ||
453 | static int hpwdt_time_left(void) | ||
454 | { | ||
455 | return TICKS_TO_SECS(ioread16(hpwdt_timer_reg)); | ||
456 | } | ||
457 | |||
453 | /* | 458 | /* |
454 | * NMI Handler | 459 | * NMI Handler |
455 | */ | 460 | */ |
@@ -591,6 +596,10 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd, | |||
591 | case WDIOC_GETTIMEOUT: | 596 | case WDIOC_GETTIMEOUT: |
592 | ret = put_user(soft_margin, p); | 597 | ret = put_user(soft_margin, p); |
593 | break; | 598 | break; |
599 | |||
600 | case WDIOC_GETTIMELEFT: | ||
601 | ret = put_user(hpwdt_time_left(), p); | ||
602 | break; | ||
594 | } | 603 | } |
595 | return ret; | 604 | return ret; |
596 | } | 605 | } |