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: 10211443 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 885D560467 for ; Sun, 11 Feb 2018 20:12:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 783D928AEA for ; Sun, 11 Feb 2018 20:12:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C0F928AF5; Sun, 11 Feb 2018 20:12:07 +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 12B8B28AEA for ; Sun, 11 Feb 2018 20:12:06 +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=X1gT6eNT46fXXa0RIOI4fybM71UzLLwsiy7UhdU6Wmg=; b=JtvYPG6X/t75hliQNEM5QbTrXV suInvAUZwMxPhHRYVI0xsUi3PRLG+iTqogUIaGIun+0V7z0BmZPS2IkROzhAPfjwS4R1bbs86kxFz N1Fof4sMe5XrEQqPh8mmd7KNbv57bg5jYx57ZK8/YWRlRylp6LN6Si/YdKxYTSrYC6dYn7Wwp9ilu EwC00Dt6fv5WuT2M8Vnmv5y9NTtw9qjXyFC2Ot4zraK0uCrlRx2G+QOBok17HEZ4XuFybWxIAggkd bOtConVFO74exiNWe2ewZj6bNmblybXKpINC98g2DkT/jogQOejLAraAZQhwmNsqKveKhvk61jqTY 5fj/S2hA==; Received: from [198.137.202.133] (helo=bombadil.infradead.org) by casper.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ekxyh-0004ec-CE for patchwork-linux-amlogic@patchwork.kernel.org; Sun, 11 Feb 2018 20:11:59 +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=X1gT6eNT46fXXa0RIOI4fybM71UzLLwsiy7UhdU6Wmg=; b=U/lVB7QVVN9KrUYuZpR8JcBqT4 X6FRiC6eXQ/9bXcNU/jsc1Rxv3C5WdWIF7Bexcu6UqUr1mG1OoecGQdR6DyczYevhEmXF6TjF+BEM J5zFepk2lYpS+Xghx1ubYmdi0apd0mgKxEBulh2bTVFmM/wD1k+lUxC/gWm4OW20jluMXUFKRDTmQ OL6napAZ7wH36buzFVOg+KiXrIJpFETPUNFRXYqLGGHvJ9SN6EjJrWWfv3pn9brnoXB6NIkPcA1Uc 1BscHCzX9gd0vV7I5QHwnLiFRKHtlYyzjucJmDLjJywi7KoUird+fHlO6pBYaVXcNykycqFOJPPGz a9Q212HA==; 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 1ekxya-00084x-J6; Sun, 11 Feb 2018 20:11:52 +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-amlogic@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-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=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: