summaryrefslogtreecommitdiff
path: root/drivers/watchdog/hpwdt.c
diff options
context:
space:
mode:
authordann frazier <dannf@hp.com>2010-06-03 02:23:41 +0400
committerWim Van Sebroeck <wim@iguana.be>2010-08-14 00:54:46 +0400
commitaae67f3602d8869c8ab1b34b6ba9206e9fff4b16 (patch)
treee85f5ff3c9620ecb0501c403551b11254ad8ba6f /drivers/watchdog/hpwdt.c
parent6f681c2eabbd8df062963c52abaa0c7c3b2c5a7d (diff)
downloadlinux-aae67f3602d8869c8ab1b34b6ba9206e9fff4b16.tar.xz
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.c9
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)
return 0;
}
+static int hpwdt_time_left(void)
+{
+ return TICKS_TO_SECS(ioread16(hpwdt_timer_reg));
+}
+
/*
* NMI Handler
*/
@@ -591,6 +596,10 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETTIMEOUT:
ret = put_user(soft_margin, p);
break;
+
+ case WDIOC_GETTIMELEFT:
+ ret = put_user(hpwdt_time_left(), p);
+ break;
}
return ret;
}