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.fat...@pengutronix.de>
---
 drivers/watchdog/wd_core.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index 5b984db8586a..1ce5a360eb61 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -134,20 +134,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;
-- 
2.23.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to