Skip to content

Commit

Permalink
watchdog: hpwdt (7/12): allow full range of timer values supported by…
Browse files Browse the repository at this point in the history
… hardware

The hpwdt timer is a 16 bit value with 128ms resolution.
Let applications use this entire range.

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 e802e32 commit 6f681c2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/watchdog/hpwdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@

#define HPWDT_VERSION "1.1.1"
#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128)
#define TICKS_TO_SECS(ticks) ((ticks) * 128 / 1000)
#define HPWDT_MAX_TIMER TICKS_TO_SECS(65535)
#define DEFAULT_MARGIN 30

static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */
Expand Down Expand Up @@ -432,8 +434,7 @@ static void hpwdt_ping(void)

static int hpwdt_change_timer(int new_margin)
{
/* Arbitrary, can't find the card's limits */
if (new_margin < 5 || new_margin > 600) {
if (new_margin < 1 || new_margin > HPWDT_MAX_TIMER) {
printk(KERN_WARNING
"hpwdt: New value passed in is invalid: %d seconds.\n",
new_margin);
Expand Down

0 comments on commit 6f681c2

Please sign in to comment.