summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordann frazier <dannf@hp.com>2010-06-02 16:23:41 -0600
committerWim Van Sebroeck <wim@iguana.be>2010-08-13 20:54:46 +0000
commitaae67f3602d8869c8ab1b34b6ba9206e9fff4b16 (patch)
treee85f5ff3c9620ecb0501c403551b11254ad8ba6f
parent6f681c2eabbd8df062963c52abaa0c7c3b2c5a7d (diff)
downloadlinux-aae67f3602d8869c8ab1b34b6ba9206e9fff4b16.tar.bz2
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>
-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;
}