From aae67f3602d8869c8ab1b34b6ba9206e9fff4b16 Mon Sep 17 00:00:00 2001 From: dann frazier Date: Wed, 2 Jun 2010 16:23:41 -0600 Subject: [PATCH] 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 Acked-by: Thomas Mingarelli Signed-off-by: Wim Van Sebroeck --- drivers/watchdog/hpwdt.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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; }