Received: by 10.223.185.116 with SMTP id b49csp1334450wrg; Sun, 11 Feb 2018 09:36:44 -0800 (PST) X-Google-Smtp-Source: AH8x225oj7tdO+wvirx7c65fp0ZEXj9/S5pQ8nr+WQxthUK8I24JyLQoxldRL4M2F/yLf2hkoU1/ X-Received: by 10.98.25.207 with SMTP id 198mr9290972pfz.83.1518370604136; Sun, 11 Feb 2018 09:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518370604; cv=none; d=google.com; s=arc-20160816; b=D04BCpLCr+VrUJ8uuYHPI/lq1AuC7KkbZ5oI0/0XFiilXK7pfhYu5cEjBOwxLS4mTV TNgDIDtI1sHGqmQW8kArIUjONAvQ9aGAxPNpd5jyEFrT3Fw/Q43MmvThCksEKygb7l+5 yR6d5BqC1AUohOcOL3p6IUeWees1bwPVBcvSrfhKmcMtW4//Zt3cmLCvb63QMuNfWVCt 1M+DAwaj5f5N+UrJ3alUV4Os+4IWmmyLsEIt4xIEXcNtmkMp+dl+mv5skuHnuC4P/5yx Kv2o+4HyiR9FH50w1/Zej/kYBJa8bxOcA63oTuz4Dh5/TtfJFPZ5rY6cp03sx8XWKH5l Azew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=rvWk3V7BeyMPQeFme5t+vVgwAu3OJqffJuOWL7FQkfE=; b=LmxmohtICicaXzLPpi/LmdgWCbKXCZDJrPETAoP4Zws2e2EWOW7a3J/17WqPj3ZBGf Kev1/9QPKVNdV96bufdJP5ybUxLLXB0wECwKFnNKcO9DyFhcolpX+0RL4w8VWbkfIuiv XGqy5+F6qhhXR6gDrfRWF9ItQnLonzSZIkUr2jL89LH+yxQL+2YHR4njKgB3kCrxF7Dq T2g/fCClDHbzXFUyuRhxOSwZiQQuLK0oxmZXpqMd9hXOLqdLsJaTIQph8XLGD3BWbKuT f5iaTR2M91S1b2gVNHNtihzZs19uU/UfC611jWgm2I3R1F27dL0SuMVIAJjEx26qF4RV lMjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=N3OtaNig; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u36si4204052pgn.702.2018.02.11.09.35.51; Sun, 11 Feb 2018 09:36:44 -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=fail header.i=@gmail.com header.s=20161025 header.b=N3OtaNig; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753547AbeBKReC (ORCPT + 99 others); Sun, 11 Feb 2018 12:34:02 -0500 Received: from mail-oi0-f65.google.com ([209.85.218.65]:33818 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752286AbeBKReA (ORCPT ); Sun, 11 Feb 2018 12:34:00 -0500 Received: by mail-oi0-f65.google.com with SMTP id k15so9544200oib.1; Sun, 11 Feb 2018 09:34:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rvWk3V7BeyMPQeFme5t+vVgwAu3OJqffJuOWL7FQkfE=; b=N3OtaNign9+kraSR5wPNRjBoTk++XKyi7k6icPeb9Ie5RTVoAHiRZRL3tMGIp/2B2A RuS5fywDedttcKD04b+5fwVr0Vwhp04jOvevoOob6SwtkI/ht+9FAbMfSztGM9BdB9kh ZEHpncax1Q4kEqP8NPnyDTwfLafef0jcMdQpOzbRkJZN+k7YhoexRMv4L9obVvIs4V9H GjrRhjs/zQDfmtPDfmZShvqG0da2zJbnlUa5JXBmKZAHQ1o2lY83kM/oD9MHiDtW6WHj qSATAAZkA8U6F0iA7M8V9MM3dm9zn8l420kZSchMIZFTDKXOrpZUrnGH0dWCcw+gdJsO xW4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=rvWk3V7BeyMPQeFme5t+vVgwAu3OJqffJuOWL7FQkfE=; b=q1cfWNEKBu4UXgTQGKGZQ8K3izVqO4eJ7kHX+zLIfB7WkWHiWynnC/nJhCZJc0480b GDl6a2ypsKH4YrFJAZb10oPLaFMupmPeRjSJnb3qciv8b5Pj48lNKO5QwHoe+9ROByCo BOmbJ9FDO+bE/Gh9GwJRbgLKEibUxIy0+jOEk7Bw+wcVCAQN672Fmrf95Vx/ApW6YAST yC9TPXfLkTnDCth0haQVCmSVGBtzW5X8BCVClPvdlYR7RlIYZ15/nlHrvS/mNjGpH2xx RgGlsDFXpYF8T0Os7CsYfqPKeQ82cPDqnWCqckx2tNgmLeTUFejYFhSWb2fcjmbVHkiS g7JQ== X-Gm-Message-State: APf1xPBe91/kO5NTV/Pa6kP1GCj7AKvUrgzeQouOmO2MKdLWH3pOlQvf n5PPt98IqXWzZoALBhCpz/c= X-Received: by 10.202.4.65 with SMTP id 62mr6498591oie.136.1518370439719; Sun, 11 Feb 2018 09:33:59 -0800 (PST) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id l15sm3519967otl.54.2018.02.11.09.33.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Feb 2018 09:33:58 -0800 (PST) Date: Sun, 11 Feb 2018 09:33:56 -0800 From: Guenter Roeck To: Marcus Folkesson Cc: Wim Van Sebroeck , 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 , 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 Subject: Re: [v2, 7/7] watchdog: coh901327: make use of timeout-secs provided in devicetree Message-ID: <20180211173356.GA18292@roeck-us.net> References: <20180210091911.3644-7-marcus.folkesson@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180210091911.3644-7-marcus.folkesson@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Feb 10, 2018 at 10:19:11AM +0100, Marcus Folkesson wrote: > 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. Makes sense to me. > > 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; I just realized that 'margin' instead of the actual timeout is used at the end of the probe function to display the selected timeout. This will have to change as well (and I'll have to go back to the other patches to make sure that this doesn't happen there as well). Guenter > 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);