watchdog: hpwdt (6/12): Introduce SECS_TO_TICKS() macro
authordann frazier <dannf@hp.com>
Wed, 2 Jun 2010 22:23:39 +0000 (16:23 -0600)
committerWim Van Sebroeck <wim@iguana.be>
Fri, 13 Aug 2010 20:54:39 +0000 (20:54 +0000)
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>
drivers/watchdog/hpwdt.c

index 77ca72c0c6d5d4a00cc63a56c3c3870cc2f59047..a5d36ae350ddf8132d6f8d20961b97e32ac12600 100644 (file)
@@ -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 */
@@ -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);
 }
@@ -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;
 }