Commit e802e32d authored by dann frazier's avatar dann frazier Committed by Wim Van Sebroeck

watchdog: hpwdt (6/12): Introduce SECS_TO_TICKS() macro

Define a macro to convert from seconds to timer ticks.
Signed-off-by: default avatardann frazier <dannf@hp.com>
Acked-by: default avatarThomas Mingarelli <Thomas.Mingarelli@hp.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 6b7f3d53
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#define HPWDT_VERSION "1.1.1" #define HPWDT_VERSION "1.1.1"
#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128)
#define DEFAULT_MARGIN 30 #define DEFAULT_MARGIN 30
static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */ static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */
...@@ -410,7 +411,7 @@ static int __devinit detect_cru_service(void) ...@@ -410,7 +411,7 @@ static int __devinit detect_cru_service(void)
*/ */
static void hpwdt_start(void) static void hpwdt_start(void)
{ {
reload = (soft_margin * 1000) / 128; reload = SECS_TO_TICKS(soft_margin);
iowrite16(reload, hpwdt_timer_reg); iowrite16(reload, hpwdt_timer_reg);
iowrite16(0x85, hpwdt_timer_con); iowrite16(0x85, hpwdt_timer_con);
} }
...@@ -443,7 +444,7 @@ static int hpwdt_change_timer(int new_margin) ...@@ -443,7 +444,7 @@ static int hpwdt_change_timer(int new_margin)
printk(KERN_DEBUG printk(KERN_DEBUG
"hpwdt: New timer passed in is %d seconds.\n", "hpwdt: New timer passed in is %d seconds.\n",
new_margin); new_margin);
reload = (soft_margin * 1000) / 128; reload = SECS_TO_TICKS(soft_margin);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment