lkml.org 
[lkml]   [2010]   [Jun]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/3] hpwdt: implement WDIOC_GETTIMELEFT
Date
Let applications check the amount of time left before the watchdog will fire.

Signed-off-by: dann frazier <dannf@hp.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


\
 
 \ /
  Last update: 2010-06-03 00:27    [W:0.128 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site