summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/hpwdt.c
diff options
context:
space:
mode:
authorJerry Hoemann <jerry.hoemann@hpe.com>2019-05-17 22:59:39 +0200
committerWim Van Sebroeck <wim@linux-watchdog.org>2019-07-08 16:10:08 +0200
commitc22d8e38e475c3a9fcc5923f98ac8cfdee8b1ad7 (patch)
tree5bcec186c27c4fcd29e1eb783a6b83ae85308f09 /drivers/watchdog/hpwdt.c
parentwatchdog/hpwdt: Stop hpwdt on unregister. (diff)
downloadlinux-c22d8e38e475c3a9fcc5923f98ac8cfdee8b1ad7.tar.xz
linux-c22d8e38e475c3a9fcc5923f98ac8cfdee8b1ad7.zip
watchdog/hpwdt: Advertize max_hw_heartbeat_ms
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> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Diffstat (limited to 'drivers/watchdog/hpwdt.c')
-rw-r--r--drivers/watchdog/hpwdt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index b2cba8851cf2..6ad6ce53ed52 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -58,9 +58,9 @@ static const struct pci_device_id hpwdt_blacklist[] = {
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);
@@ -87,9 +87,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;
@@ -204,9 +204,9 @@ static struct watchdog_device hpwdt_dev = {
.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,
};