Instead of (partly) open coding watchdog_init_timeout to determine the
inital timeout use the core function that exists for exactly this
purpose.

As a side effect the "timeout-sec" device-tree property is recognized now
(though currently unused in the omap device trees).

Reviewed-by: Guenter Roeck <[email protected]>
Signed-off-by: Uwe Kleine-König <[email protected]>
---
Notes:
    Changes since (implicit) v1, sent with
    Message-Id: 
[email protected]:
    
     - reword commit log
     - add Guenter's Reviewed-by tag

 Documentation/devicetree/bindings/watchdog/omap-wdt.txt | 3 +++
 drivers/watchdog/omap_wdt.c                             | 5 +----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/watchdog/omap-wdt.txt 
b/Documentation/devicetree/bindings/watchdog/omap-wdt.txt
index 597e19d18dca..1fa20e453a2d 100644
--- a/Documentation/devicetree/bindings/watchdog/omap-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/omap-wdt.txt
@@ -4,6 +4,9 @@ Required properties:
 - compatible : "ti,omap3-wdt" for OMAP3 or "ti,omap4-wdt" for OMAP4
 - ti,hwmods : Name of the hwmod associated to the WDT
 
+Optional properties:
+- timeout-sec : default watchdog timeout in seconds
+
 Examples:
 
 wdt2: wdt@4a314000 {
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 39a6cfcba016..0eb9ca04e672 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -234,10 +234,7 @@ static int omap_wdt_probe(struct platform_device *pdev)
        omap_wdt->min_timeout = TIMER_MARGIN_MIN;
        omap_wdt->max_timeout = TIMER_MARGIN_MAX;
 
-       if (timer_margin >= TIMER_MARGIN_MIN &&
-           timer_margin <= TIMER_MARGIN_MAX)
-               omap_wdt->timeout = timer_margin;
-       else
+       if (watchdog_init_timeout(omap_wdt, timer_margin, &pdev->dev) < 0)
                omap_wdt->timeout = TIMER_MARGIN_DEFAULT;
 
        watchdog_set_drvdata(omap_wdt, wdev);
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to