summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorAndrew Bresticker <abrestic@chromium.org>2015-04-03 10:05:20 -0700
committerWim Van Sebroeck <wim@iguana.be>2015-06-22 15:54:12 +0200
commit7094e1dd2ba98f1eb534c262deebbc65e34fe132 (patch)
tree676f6c41e114e7ce940ade74b76a1187100f4809 /drivers/watchdog
parent530c11d432727c697629ad5f9d00ee8e2864d453 (diff)
downloadblackbird-op-linux-7094e1dd2ba98f1eb534c262deebbc65e34fe132.tar.gz
blackbird-op-linux-7094e1dd2ba98f1eb534c262deebbc65e34fe132.zip
watchdog: imgpdc: Allow timeout to be set in device-tree
Since the heartbeat is statically initialized to its default value, watchdog_init_timeout() will never look in the device-tree for a timeout-sec value. Instead of statically initializing heartbeat, fall back to the default timeout value if watchdog_init_timeout() fails. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Reviewed-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com> Tested-by: Ezequiel Garcia <ezequiel.garcia@imgtec.com> Cc: James Hogan <james.hogan@imgtec.com> 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/imgpdc_wdt.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/watchdog/imgpdc_wdt.c b/drivers/watchdog/imgpdc_wdt.c
index 0deaa4f971f5..d6826a6dfc81 100644
--- a/drivers/watchdog/imgpdc_wdt.c
+++ b/drivers/watchdog/imgpdc_wdt.c
@@ -42,7 +42,7 @@
#define PDC_WDT_MIN_TIMEOUT 1
#define PDC_WDT_DEF_TIMEOUT 64
-static int heartbeat = PDC_WDT_DEF_TIMEOUT;
+static int heartbeat;
module_param(heartbeat, int, 0);
MODULE_PARM_DESC(heartbeat, "Watchdog heartbeats in seconds "
"(default=" __MODULE_STRING(PDC_WDT_DEF_TIMEOUT) ")");
@@ -190,15 +190,11 @@ static int pdc_wdt_probe(struct platform_device *pdev)
pdc_wdt->wdt_dev.info = &pdc_wdt_info;
pdc_wdt->wdt_dev.ops = &pdc_wdt_ops;
pdc_wdt->wdt_dev.max_timeout = 1 << PDC_WDT_CONFIG_DELAY_MASK;
+ pdc_wdt->wdt_dev.timeout = PDC_WDT_DEF_TIMEOUT;
pdc_wdt->wdt_dev.parent = &pdev->dev;
watchdog_set_drvdata(&pdc_wdt->wdt_dev, pdc_wdt);
- ret = watchdog_init_timeout(&pdc_wdt->wdt_dev, heartbeat, &pdev->dev);
- if (ret < 0) {
- pdc_wdt->wdt_dev.timeout = pdc_wdt->wdt_dev.max_timeout;
- dev_warn(&pdev->dev,
- "Initial timeout out of range! setting max timeout\n");
- }
+ watchdog_init_timeout(&pdc_wdt->wdt_dev, heartbeat, &pdev->dev);
pdc_wdt_stop(&pdc_wdt->wdt_dev);
OpenPOWER on IntegriCloud