Received: by 10.223.185.116 with SMTP id b49csp20328wrg; Sat, 10 Feb 2018 01:20:45 -0800 (PST) X-Google-Smtp-Source: AH8x2263+ZoEOuloq/hb7jfsOnQzJWh9YbQYsRZ/WmzYAEGDJITlSaAsqTNlQPfnVJ/1SvSeX6G9 X-Received: by 2002:a17:902:10b:: with SMTP id 11-v6mr5243638plb.336.1518254445065; Sat, 10 Feb 2018 01:20:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518254445; cv=none; d=google.com; s=arc-20160816; b=Ww9ukO2yRveJItPeQzsqrLHbUKx9V6QT5zYxnscUxTE8D9wVZdpj2TJ6PQXgVLzkZQ fYA1N8HWLTA+UfreNYTj9HGQfYpM0nLIkOQgtmwOpOs5q4g2FFQjoQNBsH5Q7Z3HuNIf qofV5u15AGQQIHKFecRdC7OrppdwFGfTdYQQwVAQwQyRtG+XglSZR56MvIox57MYv5uw wkfOH66rONWmWbzaznLxpHqBQC8Qfvp+ClKqnlCsdvE2fVJOo47JRN82eWULne8gQDQZ YY29jb+h240n7N2XWVZCrAuruNJLUnvxv2P//TB6U5iadqV2cVK3I53HI3pmSZFWtodA UiZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=vUe+2b3pXvAmgfwbMn5AUHXtD5aRF4yDh95LGmjC8ks=; b=PslHpKPC3jf//EIxFUGwORFLctcXK+IqujfO4vtL2EwwZ+BpCpCK8doptqRRt7hJmY oS7PiZhXS8CkV/Tc9qHbxsDLsj7UKcO4SoIFhGCtPTXqgQxeowVkhhyUaJIlHaT5I2ln G1oQOEmG1XXAxxoysEvy0qrIY3nQnVyyNP/pBDflgcAs9Uygx3+L4ZLUtGHXv7gfzbng hZdG3gRwmAWtQCkpJrFqPQnLGsvLu64Nfg4AsmtibPbl4F2v5G9bbQluCYMt1TxSvJ9U vlJBdsXMA3Msk9JtU9hc26FQYJavQyV+bkgSMllsznZOSegCAgzCINkNROYBo1ekzCW6 prUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GVqQeluf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si2540395pge.563.2018.02.10.01.20.31; Sat, 10 Feb 2018 01:20:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GVqQeluf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752208AbeBJJTs (ORCPT + 99 others); Sat, 10 Feb 2018 04:19:48 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:42447 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751859AbeBJJTp (ORCPT ); Sat, 10 Feb 2018 04:19:45 -0500 Received: by mail-lf0-f67.google.com with SMTP id w10so1596409lfc.9; Sat, 10 Feb 2018 01:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vUe+2b3pXvAmgfwbMn5AUHXtD5aRF4yDh95LGmjC8ks=; b=GVqQelufh2jvlG1M0NLl8Q5RwjxGeUlB8RanwyLj+XJzsYVaNSvR/LRRCebx45ASkA 3KcVnRu5nlR8+Rg1EAMUFtK2y2if28QxLwLCtZupH7DJBZ6wAJ7u02hGbu7o1NHTzM5u 6NuWzz1c/CsMBjkZC6Z4qx2Q9HXQ+M9RFgaNIaGVmCE7r+fB2zpov57Z0Pu0TfC1jLh6 1RSFfuvHSJm38dFKFdlS7dSDaw2SCepwxsAQoyWJ2DhOizpTJkZWtvqHIZetVxxL9g8x Ac4djfJd/YbafVceMcXo+eOUjvq7b/A/UAtbHUuRjDO+9jqSyJFYB6ogoBk2ECsziohy xHfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vUe+2b3pXvAmgfwbMn5AUHXtD5aRF4yDh95LGmjC8ks=; b=elrwS3upd5AuqcoTgWRS/8vnBgBknqkd0dGqy9KZ37KBr+66ReSZU4+UvLn5KF3hZ9 9YOrbpaRJREJERc75+RauqHP1kAyqvMRNQ9+hVpvuJMvt9cAHe/xd0K3Sgrrbz0E6W9B GSysUtKyO34N6G1ycXFm9/mPmMJ8yUEmujxvmuKD6LM4fpImZ6e/4x5A91vPXJ4DmaqW 0T7KchNEapCZ24qyy4bFxQgpaiw2wH6bmCQwRjH5fdUxfMOPRsxLb4kMkp779WNUHasf lsToLIGcbSZkN8CnEn70YVdesTvdk5BZtoMaQsTr+QvVVR41RKcxwrScHHGXnsIqh2Zp 6Xhg== X-Gm-Message-State: APf1xPCFUs0IwbC2lvcg4wbop+wS6K38mkzKMrUA0+xFjhkgqr7lDn6V jLEmH4FxN0ZPYZzHxg75Zjpfy0Dh X-Received: by 10.25.83.203 with SMTP id h72mr3836217lfl.135.1518254383865; Sat, 10 Feb 2018 01:19:43 -0800 (PST) Received: from localhost.localdomain ([46.194.112.145]) by smtp.gmail.com with ESMTPSA id s9sm794551lfe.48.2018.02.10.01.19.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Feb 2018 01:19:42 -0800 (PST) From: Marcus Folkesson To: Wim Van Sebroeck , Guenter Roeck , Rob Herring , Mark Rutland , Carlo Caione , Kevin Hilman , Matthias Brugger , Barry Song , Maxime Ripard , Chen-Yu Tsai , Linus Walleij , Vladimir Zapolskiy , Sylvain Lemieux , Nicolas Ferre , Alexandre Belloni Cc: linux-watchdog@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, Marcus Folkesson Subject: [PATCH v2 7/7] watchdog: coh901327: make use of timeout-secs provided in devicetree Date: Sat, 10 Feb 2018 10:19:11 +0100 Message-Id: <20180210091911.3644-7-marcus.folkesson@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180210091911.3644-1-marcus.folkesson@gmail.com> References: <20180210091911.3644-1-marcus.folkesson@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org watchdog_init_timeout() will allways pick timeout_param since it defaults to a valid timeout. Following best practice described in Documentation/watchdog/watchdog-kernel-api.txt to make use of the parameter logic. Signed-off-by: Marcus Folkesson --- v2: - Set .timeout in coh901327_wdt structure declaration. - Set .min_timeout to 1 instead of 0. I could not find a datasheet for coh901327, so I'm not sure if 0 is valid. However, 0 seems wrong to me and most driver has 1 as min value. If it should be 0, please let me know and I have to set another initial value for margin. drivers/watchdog/coh901327_wdt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c index 4410337f4f7f..5d8eb9a30879 100644 --- a/drivers/watchdog/coh901327_wdt.c +++ b/drivers/watchdog/coh901327_wdt.c @@ -67,7 +67,9 @@ #define U300_WDOG_IFR_WILL_BARK_IRQ_FORCE_ENABLE 0x0001U /* Default timeout in seconds = 1 minute */ -static unsigned int margin = 60; +#define U300_WDOG_DEFAULT_TIMEOUT 60 + +static unsigned int margin; static int irq; static void __iomem *virtbase; static struct device *parent; @@ -235,8 +237,9 @@ static struct watchdog_device coh901327_wdt = { * timeout register is max * 0x7FFF = 327670ms ~= 327s. */ - .min_timeout = 0, + .min_timeout = 1, .max_timeout = 327, + .timeout = U300_WDOG_DEFAULT_TIMEOUT, }; static int __exit coh901327_remove(struct platform_device *pdev) @@ -315,9 +318,7 @@ static int __init coh901327_probe(struct platform_device *pdev) goto out_no_irq; } - ret = watchdog_init_timeout(&coh901327_wdt, margin, dev); - if (ret < 0) - coh901327_wdt.timeout = 60; + watchdog_init_timeout(&coh901327_wdt, margin, dev); coh901327_wdt.parent = dev; ret = watchdog_register_device(&coh901327_wdt); -- 2.15.1