diff options
author | Doug Anderson <dianders@chromium.org> | 2013-11-26 13:22:52 -0500 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2014-01-28 13:07:56 -0500 |
commit | 2c34d59916bd82efe6544f39ec162e8c9236009d (patch) | |
tree | 47418cfcb1c3642921f777ca9893df2ce9e46e91 /drivers/watchdog | |
parent | bc17f9dcb11dfe7a5f02103da51f580d62a6df2c (diff) |
watchdog: core: Make dt "timeout-sec" property work on drivers w/out min/max
It is valid for a watchdog driver to have 0 for a "min" and "max"
timeout if the driver doesn't need the core to enforce the concepts of
min and max. The s3c2410_wdt driver is one such driver. Specifically
it can be hard for that driver to come up with a static "max" on all
platforms without a lot more information since the input clock on
S3C2410 and S3C2440 can change with DVFS.
As written, watchdog_init_timeout() will not ever read "timeout-sec"
on these drivers since watchdog_timeout_invalid() will _never_ return
true. Change to not consider a timeout_parm of 0 as valid even if
min/max aren't specified by the driver. Also handle the case when
there is no min/max and no "timeout-sec" property.
Signed-off-by: Doug Anderson <dianders@chromium.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/watchdog_core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index 461336c4519f..cec9b559647d 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c | |||
@@ -78,7 +78,7 @@ int watchdog_init_timeout(struct watchdog_device *wdd, | |||
78 | watchdog_check_min_max_timeout(wdd); | 78 | watchdog_check_min_max_timeout(wdd); |
79 | 79 | ||
80 | /* try to get the timeout module parameter first */ | 80 | /* try to get the timeout module parameter first */ |
81 | if (!watchdog_timeout_invalid(wdd, timeout_parm)) { | 81 | if (!watchdog_timeout_invalid(wdd, timeout_parm) && timeout_parm) { |
82 | wdd->timeout = timeout_parm; | 82 | wdd->timeout = timeout_parm; |
83 | return ret; | 83 | return ret; |
84 | } | 84 | } |
@@ -89,7 +89,7 @@ int watchdog_init_timeout(struct watchdog_device *wdd, | |||
89 | if (dev == NULL || dev->of_node == NULL) | 89 | if (dev == NULL || dev->of_node == NULL) |
90 | return ret; | 90 | return ret; |
91 | of_property_read_u32(dev->of_node, "timeout-sec", &t); | 91 | of_property_read_u32(dev->of_node, "timeout-sec", &t); |
92 | if (!watchdog_timeout_invalid(wdd, t)) | 92 | if (!watchdog_timeout_invalid(wdd, t) && t) |
93 | wdd->timeout = t; | 93 | wdd->timeout = t; |
94 | else | 94 | else |
95 | ret = -EINVAL; | 95 | ret = -EINVAL; |