aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/hpwdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/hpwdt.c')
-rw-r--r--drivers/watchdog/hpwdt.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 77ca72c0c6d5..a5d36ae350dd 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -35,6 +35,7 @@
35#include <asm/cacheflush.h> 35#include <asm/cacheflush.h>
36 36
37#define HPWDT_VERSION "1.1.1" 37#define HPWDT_VERSION "1.1.1"
38#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128)
38#define DEFAULT_MARGIN 30 39#define DEFAULT_MARGIN 30
39 40
40static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */ 41static unsigned int soft_margin = DEFAULT_MARGIN; /* in seconds */
@@ -410,7 +411,7 @@ static int __devinit detect_cru_service(void)
410 */ 411 */
411static void hpwdt_start(void) 412static void hpwdt_start(void)
412{ 413{
413 reload = (soft_margin * 1000) / 128; 414 reload = SECS_TO_TICKS(soft_margin);
414 iowrite16(reload, hpwdt_timer_reg); 415 iowrite16(reload, hpwdt_timer_reg);
415 iowrite16(0x85, hpwdt_timer_con); 416 iowrite16(0x85, hpwdt_timer_con);
416} 417}
@@ -443,7 +444,7 @@ static int hpwdt_change_timer(int new_margin)
443 printk(KERN_DEBUG 444 printk(KERN_DEBUG
444 "hpwdt: New timer passed in is %d seconds.\n", 445 "hpwdt: New timer passed in is %d seconds.\n",
445 new_margin); 446 new_margin);
446 reload = (soft_margin * 1000) / 128; 447 reload = SECS_TO_TICKS(soft_margin);
447 448
448 return 0; 449 return 0;
449} 450}