[PATCH 6/6] watchdog: sama5d4: try to set timeout from device tree first

From: Sylvain Rochet
Date: Thu Oct 08 2015 - 17:36:00 EST


watchdog_init_timeout function doesn't try to get the "timeout-sec" DT
property if timeout_parm is not zero. This change makes this DT property
working for the sama5d4 watchdog driver.

Signed-off-by: Sylvain Rochet <sylvain.rochet@xxxxxxxxxxxx>
---
drivers/watchdog/sama5d4_wdt.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c
index a49634c..2e2049b 100644
--- a/drivers/watchdog/sama5d4_wdt.c
+++ b/drivers/watchdog/sama5d4_wdt.c
@@ -222,7 +222,10 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
}
}

- ret = watchdog_init_timeout(wdd, wdt_timeout, &pdev->dev);
+ /* Try to set timeout from device tree first */
+ ret = watchdog_init_timeout(wdd, 0, &pdev->dev);
+ if (ret)
+ ret = watchdog_init_timeout(wdd, wdt_timeout, &pdev->dev);
if (ret) {
dev_err(&pdev->dev, "unable to set timeout value\n");
return ret;
@@ -243,7 +246,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, wdt);

dev_info(&pdev->dev, "initialized (timeout = %d sec, nowayout = %d)\n",
- wdt_timeout, nowayout);
+ wdd->timeout, nowayout);

return 0;
}
--
2.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/