From patchwork Sun Feb 11 20:08:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Folkesson X-Patchwork-Id: 10211453 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 D9873602CB for ; Sun, 11 Feb 2018 20:16:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C660628AEA for ; Sun, 11 Feb 2018 20:16:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B6DAB28AF5; Sun, 11 Feb 2018 20:16:52 +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 casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4384228AEA for ; Sun, 11 Feb 2018 20:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=kS+zEKDn0g51Y7VPIQO2ixPz5/um6GAXzHzKVM9dUvQ=; b=DepJzxGcZXOuWO4WJljFuFNdea rLqcrKu1IEU6ZvHARKaoD6ZvtptOyVB9bOM3Ky5qFcMNS7zdC54blziLqD+hhVy7XWVFbTHYp6g+O QQ9AB+Fc63E8TTIPFoqoLNxmC98XDmxVPPVj/3v0ztSPijnZMXwGXB4QsU4kZMUDW+HHAGyh2k8UC zKZR18JIo7wfT3lheQf2NjbJrcCiNvCm7P//l2tANSEC4kSdkEju+DZDDzqxGTfOD2/m8a5IQs1vC jtCCzaZ85Lah1jdJU0g6oGA9/erKCzgoZ037Zsw4YuoGkyAE0XH4uMPkMA+F2xiO5b6kj3Bm8EW8z 1+Fs8oZQ==; Received: from [198.137.202.133] (helo=bombadil.infradead.org) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eky3E-0006k5-TY for patchwork-linux-arm@patchwork.kernel.org; Sun, 11 Feb 2018 20:16:41 +0000 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=kS+zEKDn0g51Y7VPIQO2ixPz5/um6GAXzHzKVM9dUvQ=; b=EUmkjIuqncAdq+d543jNCsUBOw VDOnepUIatxWVKRBTEvgY/sPOU39Mg9uwwX7WmitBBLNwR9r/2JO4sH7Zukrc6BnR1BTbcHFUtvSK dGG8PF9RBKZWCjKJS+M2PsMMlRPffs1nX4mGUPD1gS7sTQD8KZdiRX1YiC7xdNvXKBcmBSm+9M1kB CNLlDNgtRNadkKZ+9Od0vMB2Hi94RaWnihLFujOwY7hF1DvuusRpx1yR72QTSROYM+01G4q/eqbln SJq5ZeFCU1uxsSxTA5sbz99kMnbIYkUg1INYxqguKzT9i15Jh8W5nngwHHpNSPwXz8v/63e2VyRjx Z2aMZ94w==; 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 1ekxy1-0006yy-Jm; Sun, 11 Feb 2018 20:11:17 +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 1ekxwU-0003D8-Iv; Sun, 11 Feb 2018 20:09:44 +0000 Received: by mail-lf0-x242.google.com with SMTP id a204so17797840lfa.2; Sun, 11 Feb 2018 12:09:35 -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=wCdL3vQiebr6dGnxI0MvabcHQ7k8UaDSqNJnpxLSfRQ=; b=lJAiA7IW6xeNjIUMPmxUoG/90iWMGFM8+4mx5QFCYBK1O7oJPCkLJ9IbdG6IR3vOIF VTCEFPWsLABIR8pB59mqKyyKZj3HN3b0qrDe5wDawpvgRjGfBx7RymAjo9U94gFFydOY 89Vu2L/XYNyBB4JWUePQl/EZAcQYUg9fUb6p7n9HMaSOcLaMatWnMANGjA/c/6NH0iAu vsP+kx+nm0g/Y4vPH3jbgcgRKijI6VNn53qKrLbh6UrJTm3hIVigjHBPYXvvevL+4M2x up3YyEUncymkF6lskM1qEAOc04/3vPD0BuHnMvvW3+iLWCW337/su3pWnXYZp0faroA7 0Fdg== 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=wCdL3vQiebr6dGnxI0MvabcHQ7k8UaDSqNJnpxLSfRQ=; b=rnD5Rwv2tKYCx1SqRnr1pgTGo0j6SIV/Hz9nH8TqJdFTM/9UtdH9lSt2/7oKorQ2iZ es9DRfa6sW8fQAUdGPgijjE7s0qZoBac82kZIzrBcvGyK+OQQGvPY/SQNHQ0cUXEJaTE BQfrFuId2weAEywQsYn9gbcIaE5rkw4loXPoCrNFJP9OOpeOpN+baKzdaVSCwc8vEvTR XpyYfIefAVnXjorrE80EFJb6KB1t2aa9G4Kwi5V71++yBphaIeK9calOF/a2HfnXAun5 O5TISQELbk+O7TU/88j9R1JvqVcH+3lzFWpE6Rmk3IYlI6zvlpWbyfrgvZwG07dBGqh5 t8Ww== X-Gm-Message-State: APf1xPC6WJnAyeb+A2EtKublmMSFnvGHF+EACAjFrWd27TdfmOGBAu3d dLUXhWoWYxhlqqiICYOXkG8= X-Google-Smtp-Source: AH8x226J4oBmTX1xI2FngD5z6pUm6lLXOiwQP+XdAodcCF+eQ6kjRX1FvP/3AkfBcSImCv5EiLZbEQ== X-Received: by 10.46.7.67 with SMTP id i3mr5836643ljd.79.1518379774151; Sun, 11 Feb 2018 12:09:34 -0800 (PST) Received: from localhost.localdomain (c-2ec27091-74736162.cust.telenor.se. [46.194.112.145]) by smtp.gmail.com with ESMTPSA id c21sm927549lfb.13.2018.02.11.12.09.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Feb 2018 12:09:33 -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 v3 7/7] watchdog: coh901327: make use of timeout-secs provided in devicetree Date: Sun, 11 Feb 2018 21:08:47 +0100 Message-Id: <20180211200847.25000-7-marcus.folkesson@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180211200847.25000-1-marcus.folkesson@gmail.com> References: <20180211200847.25000-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: Guenter Roeck Reviewed-by: Linus Walleij --- Notes: v3: - Reformat and use coh901327_wdt.timeout instead of margin when print out timout in probe function. 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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/watchdog/coh901327_wdt.c b/drivers/watchdog/coh901327_wdt.c index 4410337f4f7f..500af8a7ec5a 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,16 +318,15 @@ 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); if (ret) goto out_no_wdog; - dev_info(dev, "initialized. timer margin=%d sec\n", margin); + dev_info(dev, "initialized. (timeout=%d sec)\n", + coh901327_wdt.timeout); return 0; out_no_wdog: