From patchwork Sat Feb 10 09:19:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Folkesson X-Patchwork-Id: 10210451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 25A77602D8 for ; Sat, 10 Feb 2018 09:32:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06F4C288BB for ; Sat, 10 Feb 2018 09:32:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF73428905; Sat, 10 Feb 2018 09:32:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AF3BA288BB for ; Sat, 10 Feb 2018 09:32:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=OTVYNNcFgYMHpiKJla0UdNoLURra3/5XjoQfGgwJ5kk=; b=d2Yc/tvD0Xc/7uM0IEqH4VFMpA gINjj9oeHGkCJ8DZmQTeJzL9XtFEAxhBdwHKbp7DlVq95RzCkLWfYy9S7cg/tOjaSKT8k9KT8gvWK 1gKGMQogXMaqgme9/TkUz49Cb1XlKgKdSGo3OUK889FuBgXInYOV8rF6fAl+2Wp7hYOGhITEbAM+N x2xnIs25fVIZl2gLntnbI5vSaIQ6q0RNpo46fVLHaQ+3LkkkCQNivTSKLXKfrQjQLcfag+FX8auCu JQ/F3ZJl27/bAgvVhMPBQiWOxp22mUdb/1oT65saUpRb9u6T27yFXNRQ0TdzIeIK2ZkMNBAYGulk5 V+qgxvpQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ekRWT-0003sF-Fg; Sat, 10 Feb 2018 09:32:41 +0000 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ekRK7-00059t-HB; Sat, 10 Feb 2018 09:19:58 +0000 Received: by mail-lf0-x242.google.com with SMTP id a25so5100212lfg.10; Sat, 10 Feb 2018 01:19:45 -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=buYmIc8hNjm6eI2fenBK6KPcsVfFnySuf5gFnJ8dv7r8O1VU6Wo12evjWgj/MA3eud xuK2L2rVmoruCOS1U1QbD5MgNu2X4oykMrdA/BNjRbAolFCOJs5TzAOpJ++V+w6XvzCu 26O25tMqUtRY48bnprHrAvwHySD4KTqh9XEaeJU70gG4yPr2jJ6CKcytCEP00mNzi53V XBGIWKnYyl7occEsYhXAxLJp1diLZcxbc6UdauSJ2dEypW3shX8CFZMi839+osuG0BJl fD0ys1vSauQCvySR+6L5BgVlLrd4ukzYAzQQX/sjW7ocBAxpTmky6mcQzu6cFE9l6ZyG vEzQ== X-Gm-Message-State: APf1xPBwbRrFA8Nyrf/gluuRss4Bq3serJP1SDyIT1+WhfAkEk3twLLx 2kVU+kp4EXOn4NGuOVoedWc= X-Google-Smtp-Source: AH8x225LeylKOALqTMQDp1KUuubMd6T0ru/ja6itstECwEl+DTOvxKm40Y7gsFcAtPV1AsCUJPSAlw== 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 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> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Marcus Folkesson , linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Linus Walleij --- 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);