Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752429AbbDARvb (ORCPT ); Wed, 1 Apr 2015 13:51:31 -0400 Received: from mail-yh0-f74.google.com ([209.85.213.74]:33760 "EHLO mail-yh0-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751210AbbDARv2 (ORCPT ); Wed, 1 Apr 2015 13:51:28 -0400 From: Andrew Bresticker To: Wim Van Sebroeck , Guenter Roeck Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Bresticker , Ezequiel Garcia , James Hogan Subject: [PATCH V2 1/3] watchdog: imgpdc: Allow timeout to be set in device-tree Date: Wed, 1 Apr 2015 10:43:14 -0700 Message-Id: <1427910196-28568-1-git-send-email-abrestic@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1758 Lines: 48 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 Cc: Ezequiel Garcia Cc: James Hogan --- New for v2. --- drivers/watchdog/imgpdc_wdt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/watchdog/imgpdc_wdt.c b/drivers/watchdog/imgpdc_wdt.c index 0deaa4f..89b2abc 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) ")"); @@ -195,9 +195,9 @@ static int pdc_wdt_probe(struct platform_device *pdev) 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; + pdc_wdt->wdt_dev.timeout = PDC_WDT_DEF_TIMEOUT; dev_warn(&pdev->dev, - "Initial timeout out of range! setting max timeout\n"); + "Initial timeout out of range! setting default timeout\n"); } pdc_wdt_stop(&pdc_wdt->wdt_dev); -- 2.2.0.rc0.207.ga3a616c -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/