diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2019-10-24 17:24:28 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-10-29 10:23:43 +0100 |
commit | d0c0d45237fbeda2e2dc96123eb315df544c27ac (patch) | |
tree | 8507ad05edb8aa4567d348cd15088632162d3bf8 | |
parent | e1ef5d828320cec35232126497b1b8dd4c22d540 (diff) | |
download | barebox-d0c0d45237fbeda2e2dc96123eb315df544c27ac.tar.gz barebox-d0c0d45237fbeda2e2dc96123eb315df544c27ac.tar.xz |
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.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c index 07fe9b030e..8b13950238 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; |