diff options
author | Oleksij Rempel <linux@rempel-privat.de> | 2018-03-13 09:33:24 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-03-23 07:35:24 +0100 |
commit | dc16077260f59df5d22b02c189a4187c27cc3367 (patch) | |
tree | 0434f846c0c14171c6b7fdf9997c6fcb7a425c33 /drivers/watchdog/wd_core.c | |
parent | 65a644388e845bde01215bf378d4df2a6a260a6a (diff) | |
download | barebox-dc16077260f59df5d22b02c189a4187c27cc3367.tar.gz barebox-dc16077260f59df5d22b02c189a4187c27cc3367.tar.xz |
watchdog: move max timeout test in to wd_core
this also will be needed for watchdog poller as well
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/watchdog/wd_core.c')
-rw-r--r-- | drivers/watchdog/wd_core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c index de1f4c7327..6f9c2707a7 100644 --- a/drivers/watchdog/wd_core.c +++ b/drivers/watchdog/wd_core.c @@ -59,6 +59,9 @@ int watchdog_register(struct watchdog *wd) if (!wd->priority) wd->priority = WATCHDOG_DEFAULT_PRIORITY; + dev_add_param_uint32_ro(&wd->dev, "timeout_max", + &wd->timeout_max, "%u"); + list_add_tail(&wd->list, &watchdog_list); pr_debug("registering watchdog %s with priority %d\n", watchdog_name(wd), @@ -105,6 +108,9 @@ int watchdog_set_timeout(unsigned timeout) if (!wd) return -ENODEV; + if (timeout > wd->timeout_max) + return -EINVAL; + pr_debug("setting timeout on %s to %ds\n", watchdog_name(wd), timeout); return wd->set_timeout(wd, timeout); |