Skip to content

Commit

Permalink
watchdog: hpwdt (8/12): implement WDIOC_GETTIMELEFT
Browse files Browse the repository at this point in the history
Let applications check the amount of time left before the watchdog will fire.

Signed-off-by: dann frazier <dannf@hp.com>
Acked-by: Thomas Mingarelli <Thomas.Mingarelli@hp.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
dann frazier authored and Wim Van Sebroeck committed Aug 13, 2010
1 parent 6f681c2 commit aae67f3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions drivers/watchdog/hpwdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit aae67f3

Please sign in to comment.