Messages in this thread Patch in this message | | | From | dann frazier <> | Subject | [PATCH 3/3] hpwdt: implement WDIOC_GETTIMELEFT | Date | Wed, 2 Jun 2010 16:23:41 -0600 |
| |
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
| |