Home Home > GIT Browse > SLE12-SP3
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYadan Fan <ydfan@suse.com>2018-07-11 18:24:01 +0800
committerYadan Fan <ydfan@suse.com>2018-07-11 18:24:12 +0800
commit09be79b7200f24d6526fb3772aa001b75cb46351 (patch)
tree8aff89adb4003de211fc74a79949096b011dab58
parent0387addd2c7ae4194a69117adb6b694b9a753813 (diff)
watchdog: da9063: Fix updating timeout value (bsc#1100843).
-rw-r--r--drivers/watchdog/da9063_wdt.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c
index e531c1c6a3f4..3f1517681705 100644
--- a/drivers/watchdog/da9063_wdt.c
+++ b/drivers/watchdog/da9063_wdt.c
@@ -130,10 +130,23 @@ static int da9063_wdt_set_timeout(struct watchdog_device *wdd,
{
struct da9063_watchdog *wdt = watchdog_get_drvdata(wdd);
unsigned int selector;
- int ret;
+ int ret = 0;
selector = da9063_wdt_timeout_to_sel(timeout);
- ret = _da9063_wdt_set_timeout(wdt->da9063, selector);
+
+ /*
+ * There are two cases when a set_timeout() will be called:
+ * 1. The watchdog is off and someone wants to set the timeout for the
+ * further use.
+ * 2. The watchdog is already running and a new timeout value should be
+ * set.
+ *
+ * The watchdog can't store a timeout value not equal zero without
+ * enabling the watchdog, so the timeout must be buffered by the driver.
+ */
+ if (watchdog_active(wdd))
+ ret = _da9063_wdt_set_timeout(da9063, selector);
+
if (ret)
dev_err(wdt->da9063->dev, "Failed to set watchdog timeout (err = %d)\n",
ret);