Skip to content

Commit

Permalink
watchdog: hpwdt (6/12): Introduce SECS_TO_TICKS() macro
Browse files Browse the repository at this point in the history
Define a macro to convert from seconds to timer ticks.

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 6b7f3d5 commit e802e32
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 @@ -35,6 +35,7 @@
#include <asm/cacheflush.h>

#define HPWDT_VERSION "1.1.1"
#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128)
#define DEFAULT_MARGIN 30

static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */
Expand Down Expand Up @@ -410,7 +411,7 @@ static int __devinit detect_cru_service(void)
*/
static void hpwdt_start(void)
{
reload = (soft_margin * 1000) / 128;
reload = SECS_TO_TICKS(soft_margin);
iowrite16(reload, hpwdt_timer_reg);
iowrite16(0x85, hpwdt_timer_con);
}
Expand Down Expand Up @@ -443,7 +444,7 @@ static int hpwdt_change_timer(int new_margin)
printk(KERN_DEBUG
"hpwdt: New timer passed in is %d seconds.\n",
new_margin);
reload = (soft_margin * 1000) / 128;
reload = SECS_TO_TICKS(soft_margin);

return 0;
}
Expand Down

0 comments on commit e802e32

Please sign in to comment.