linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] hpwdt: Introduce SECS_TO_TICKS() macro
@ 2010-06-02 22:23 dann frazier
  2010-06-02 22:23 ` [PATCH 2/3] hpwdt: allow full range of timer values supported by hardware dann frazier
  2010-06-02 22:23 ` [PATCH 3/3] hpwdt: implement WDIOC_GETTIMELEFT dann frazier
  0 siblings, 2 replies; 3+ messages in thread
From: dann frazier @ 2010-06-02 22:23 UTC (permalink / raw)
  To: Wim Van Sebroeck; +Cc: linux-kernel, Thomas Mingarelli, dann frazier

Define a macro to convert from seconds to timer ticks.

Signed-off-by: dann frazier <dannf@hp.com>
---
 drivers/watchdog/hpwdt.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 809e716..af61fb6 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -49,6 +49,8 @@
 #define ROM_SIZE			0x10000
 #define HPWDT_VERSION			"1.1.1"
 
+#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128)
+
 struct bios32_service_dir {
 	u32 signature;
 	u32 entry_point;
@@ -420,7 +422,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);
 }
@@ -453,7 +455,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;
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-06-02 22:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-02 22:23 [PATCH 1/3] hpwdt: Introduce SECS_TO_TICKS() macro dann frazier
2010-06-02 22:23 ` [PATCH 2/3] hpwdt: allow full range of timer values supported by hardware dann frazier
2010-06-02 22:23 ` [PATCH 3/3] hpwdt: implement WDIOC_GETTIMELEFT dann frazier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).