[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1275517421-10544-3-git-send-email-dannf@hp.com>
Date: Wed, 2 Jun 2010 16:23:41 -0600
From: dann frazier <dannf@...com>
To: Wim Van Sebroeck <wim@...ana.be>
Cc: linux-kernel@...r.kernel.org,
Thomas Mingarelli <thomas.mingarelli@...com>,
dann frazier <dannf@...com>
Subject: [PATCH 3/3] hpwdt: implement WDIOC_GETTIMELEFT
Let applications check the amount of time left before the watchdog will fire.
Signed-off-by: dann frazier <dannf@...com>
---
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 e3bf645..dbe650e 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -443,6 +443,11 @@ static void hpwdt_ping(void)
iowrite16(reload, hpwdt_timer_reg);
}
+static int hpwdt_time_left(void)
+{
+ return TICKS_TO_SECS(ioread16(hpwdt_timer_reg));
+}
+
static int hpwdt_change_timer(int new_margin)
{
if (new_margin < 1 || new_margin > HPWDT_MAX_TIMER) {
@@ -583,6 +588,10 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd,
ret = put_user(0, p);
break;
+ case WDIOC_GETTIMELEFT:
+ ret = put_user(hpwdt_time_left(), p);
+ break;
+
case WDIOC_KEEPALIVE:
hpwdt_ping();
ret = 0;
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists