Prev: [PATCH 2/3] hpwdt: allow full range of timer values supported by hardware
Next: How to stop kernel rebooting during startup?
From: dann frazier on 2 Jun 2010 18:30 Let applications check the amount of time left before the watchdog will fire. Signed-off-by: dann frazier <dannf(a)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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |