linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerry Hoemann <jerry.hoemann@hpe.com>
To: linux@roeck-us.net, wim@linux-watchdog.org,
	linux-watchdog@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mironov.ivan@gmail.com,
	rasmus.villemoes@prevas.dk, jerry.hoemann@hpe.com
Subject: [PATCH 2/6] watchdog/hpwdt: Advertize max_hw_heartbeat_ms
Date: Fri, 17 May 2019 14:59:39 -0600	[thread overview]
Message-ID: <1558126783-4877-3-git-send-email-jerry.hoemann@hpe.com> (raw)
In-Reply-To: <1558126783-4877-1-git-send-email-jerry.hoemann@hpe.com>

Set max_hw_heartbeat_ms instead of max_timeout so that user client can
set timeout range in excess of what the underlying hardware supports.

Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com>
---
 drivers/watchdog/hpwdt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 8c49f13..9f7a370 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -62,9 +62,9 @@
 static int hpwdt_start(struct watchdog_device *wdd)
 {
 	int control = 0x81 | (pretimeout ? 0x4 : 0);
-	int reload = SECS_TO_TICKS(wdd->timeout);
+	int reload = SECS_TO_TICKS(min(wdd->timeout, wdd->max_hw_heartbeat_ms/1000));
 
-	dev_dbg(wdd->parent, "start watchdog 0x%08x:0x%02x\n", reload, control);
+	dev_dbg(wdd->parent, "start watchdog 0x%08x:0x%08x:0x%02x\n", wdd->timeout, reload, control);
 	iowrite16(reload, hpwdt_timer_reg);
 	iowrite8(control, hpwdt_timer_con);
 
@@ -91,9 +91,9 @@ static int hpwdt_stop_core(struct watchdog_device *wdd)
 
 static int hpwdt_ping(struct watchdog_device *wdd)
 {
-	int reload = SECS_TO_TICKS(wdd->timeout);
+	int reload = SECS_TO_TICKS(min(wdd->timeout, wdd->max_hw_heartbeat_ms/1000));
 
-	dev_dbg(wdd->parent, "ping  watchdog 0x%08x\n", reload);
+	dev_dbg(wdd->parent, "ping  watchdog 0x%08x:0x%08x\n", wdd->timeout, reload);
 	iowrite16(reload, hpwdt_timer_reg);
 
 	return 0;
@@ -208,9 +208,9 @@ static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs)
 	.info		= &ident,
 	.ops		= &hpwdt_ops,
 	.min_timeout	= 1,
-	.max_timeout	= HPWDT_MAX_TIMER,
 	.timeout	= DEFAULT_MARGIN,
 	.pretimeout	= PRETIMEOUT_SEC,
+	.max_hw_heartbeat_ms	= HPWDT_MAX_TIMER * 1000,
 };
 
 
-- 
1.8.3.1


  parent reply	other threads:[~2019-05-17 21:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 20:59 [PATCH 0/6] watchdog/hpwdt: cleanups and kdump accommodations Jerry Hoemann
2019-05-17 20:59 ` [PATCH 1/6] watchdog/hpwdt: Stop hpwdt on unregister Jerry Hoemann
2019-06-06 21:14   ` Guenter Roeck
2019-05-17 20:59 ` Jerry Hoemann [this message]
2019-06-06 21:17   ` [PATCH 2/6] watchdog/hpwdt: Advertize max_hw_heartbeat_ms Guenter Roeck
2019-05-17 20:59 ` [PATCH 3/6] watchdog/hpwdt: Have core ping watchdog Jerry Hoemann
2019-06-06 21:18   ` Guenter Roeck
2019-05-17 20:59 ` [PATCH 4/6] watchdog/hpwdt: Add module parameter kdumptimeout Jerry Hoemann
2019-06-06 21:19   ` Guenter Roeck
2019-05-17 20:59 ` [PATCH 5/6] watchdog/hpwdt: Update documentation Jerry Hoemann
2019-06-06 21:19   ` Guenter Roeck
2019-05-17 20:59 ` [PATCH 6/6] watchdog/hpwdt: Reflect changes Jerry Hoemann
2019-06-06 21:20   ` Guenter Roeck
2019-06-05 22:31 ` [PATCH 0/6] watchdog/hpwdt: cleanups and kdump accommodations Jerry Hoemann
2019-06-05 22:51   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1558126783-4877-3-git-send-email-jerry.hoemann@hpe.com \
    --to=jerry.hoemann@hpe.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mironov.ivan@gmail.com \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).