summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2019-10-24 17:24:28 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2019-10-29 10:23:43 +0100
commitd0c0d45237fbeda2e2dc96123eb315df544c27ac (patch)
tree8507ad05edb8aa4567d348cd15088632162d3bf8
parente1ef5d828320cec35232126497b1b8dd4c22d540 (diff)
downloadbarebox-d0c0d45237fbeda2e2dc96123eb315df544c27ac.tar.gz
watchdog: add timeout_cur parameter only when poller is enabled
timeout_curr is the timeout programmed into the watchdog hardware every 500 milliseconds. If watchdog poller support is disabled, it still shows up as a configurable device parameter, but has no effect. Improve user experience by having it show up only if watchdog poller support was compiled in. This is already the case for the autoping parameter. The timeout_max parameter is a generic parameter and will remain unchanged. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/watchdog/wd_core.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index 07fe9b0..8b13950 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -158,20 +158,21 @@ int watchdog_register(struct watchdog *wd)
if (!wd->timeout_max)
wd->timeout_max = 60 * 60 * 24;
- if (!wd->poller_timeout_cur || wd->poller_timeout_cur > wd->timeout_max)
- wd->poller_timeout_cur = wd->timeout_max;
-
p = dev_add_param_uint32_ro(&wd->dev, "timeout_max",
&wd->timeout_max, "%u");
if (IS_ERR(p))
return PTR_ERR(p);
- p = dev_add_param_uint32(&wd->dev, "timeout_cur", watchdog_set_cur, NULL,
- &wd->poller_timeout_cur, "%u", wd);
- if (IS_ERR(p))
- return PTR_ERR(p);
-
if (IS_ENABLED(CONFIG_WATCHDOG_POLLER)) {
+ if (!wd->poller_timeout_cur ||
+ wd->poller_timeout_cur > wd->timeout_max)
+ wd->poller_timeout_cur = wd->timeout_max;
+
+ p = dev_add_param_uint32(&wd->dev, "timeout_cur", watchdog_set_cur,
+ NULL, &wd->poller_timeout_cur, "%u", wd);
+ if (IS_ERR(p))
+ return PTR_ERR(p);
+
ret = watchdog_register_poller(wd);
if (ret)
return ret;