OSDN Git Service

watchdog: omap: use watchdog_init_timeout instead of open coding it
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 27 Apr 2015 09:22:59 +0000 (11:22 +0200)
committerWim Van Sebroeck <wim@iguana.be>
Mon, 22 Jun 2015 13:54:04 +0000 (15:54 +0200)
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).

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Documentation/devicetree/bindings/watchdog/omap-wdt.txt
drivers/watchdog/omap_wdt.c

index 597e19d..1fa20e4 100644 (file)
@@ -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 {
index 1e6be9e..88ca2ea 100644 (file)
@@ -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);