Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3269790imm; Fri, 10 Aug 2018 06:39:15 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwXPpY9v8pCL+oRd098SlxOesg5aOx4MAETTsfz+W+ejyoO/JMdsIBtaC6ylXHBHbt1p+Dp X-Received: by 2002:a17:902:3204:: with SMTP id y4-v6mr6224102plb.195.1533908354990; Fri, 10 Aug 2018 06:39:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533908354; cv=none; d=google.com; s=arc-20160816; b=LkjO03fo/3Ti+hWscjN8PcBewor1xsfbRJVjBgJNkLEgmzrOsg1NL0MUmakXGJiovu dhXPM3EeQqJhm6Hk1YR9uDFCQ6tXcUw49DucY0y7nNUsddT0qK6iCfOi4+n86LmesjmX b2cPzpVn89Wp+mk6YeeJycpQeF38Co9zVKI4C8eVdBooNGzMpHqhX6WVk63IKcvrEAkA fAuj6VAYfbty1ODO3OaGdxtbqS0YnpIzB4VQUEhrZuCLhomLxH5f7KpilYpSb4F5m99S wThcZA9VC+0/rGxWJa0F756gchk8OAekxfYgupI4zQAtOQnVBsX0+saxAWVQXLQUT/y7 Q3rg== 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=WtxEI4l3KMgN+mKQ13uzMgZlocJDJEpYaCFOClNnnEU=; b=GNf1mR1wVP9BIhgPqiwZZV2i6ppvQxuHgEHGCbJerAycsihQMHw+StcPDedbqWFdt4 mfRBORHUK3r2mov0wMI0Ml7YgdXTmsWo/Hb3+fcbKzCmz6JpyvJUJpf11E7IITnzjMsY Ap+ys+rvF5nFXO2F7g/vVcwR+2r9RcLnkSRh1a56E7k1SLVdtJLGNMc4bY+WDmuXQyky jwrSOy2FXnVQdJ27xaCXRMuohYdJQAXLVa+wkB/Z8fY46SxB/lsUcyVeuGf98k2VH55o /xjeyWWdpU3Es042rQ3oxcfR5VCPuauK2G0aFRhVdV2WiB4WV0Jig1KMj0W73M8w1LoI amuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=fHdEWPGq; 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 1-v6si7553188plj.411.2018.08.10.06.38.59; Fri, 10 Aug 2018 06:39:14 -0700 (PDT) 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=fHdEWPGq; 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 S1728610AbeHJQHe (ORCPT + 99 others); Fri, 10 Aug 2018 12:07:34 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39258 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728104AbeHJQHe (ORCPT ); Fri, 10 Aug 2018 12:07:34 -0400 Received: by mail-pg1-f193.google.com with SMTP id a11-v6so4424531pgw.6; Fri, 10 Aug 2018 06:37:37 -0700 (PDT) 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=WtxEI4l3KMgN+mKQ13uzMgZlocJDJEpYaCFOClNnnEU=; b=fHdEWPGqISYB+gPXIuF9SGHcP6XZfCvxW6OiyCSDIPTEEYcfA3cXNegMFb4KTDw2Ah tzS1xpzyO3r4r4Vzjn5qoO9xf7n5zFx5pwrc8h2dAteNPl9f1wJOKAMTUYdFDXUVkedR iIAxxfbPRrqXZOQqwvH2GUbTFi76AXiIc3XXc1ojfqx0/aVoBLzziwHHusOnJnC7XNjh /KZoYPVTbdV73LrpjWB6Sh8u30ZD1LhlA4QxeREaLJRpXoiPh18HAlBQ2qb1YFi+0WAz XS74FSaNCKPMWbBdB33Uoder6Wb1rLbEU0CP4VwivWFLMI7Oj1JKboB7bDAK4f/1zozk LJGQ== 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=WtxEI4l3KMgN+mKQ13uzMgZlocJDJEpYaCFOClNnnEU=; b=FoZQAbrN7xwGo91MP2L1ceHWb00rxe2qY2NO/eSR8lGCFlWYYvE8UM8dyGQ6zp3gEL y9IUMR9VO3YAsOoOPqJ/4PVs8+zk1VuVRk90IMAjQD5HngGyqefIAS6mjBfBLdV/X+e0 rBEW8acNlHQsuPYC124q568QhR2DZkecpzEeEZOrvNhuCKQ/ELanVG4pGtNYcZRYd7l7 lZPRTGsKYJ1UWDOdfmak7sVMfEv8ZZBSPfe/uI+HajWpkBVgtM+Ne0+DZwu0+XetLFho Rsq6Mdj3bOBlPCcmMh+giPWyIqJaMuR+e/VazmYUyqBZ3n9aNCPqkymddYmIZKwoeC73 IkiQ== X-Gm-Message-State: AOUpUlEkDK2BdOR/WswNc5SpU2xfVl7+2YnXe5YgEdktLQTrKWZYRZEJ CBgAUcpSX6JCd3tTATN/cFI= X-Received: by 2002:a63:a042:: with SMTP id u2-v6mr6429924pgn.80.1533908257018; Fri, 10 Aug 2018 06:37:37 -0700 (PDT) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id j15-v6sm12160378pfn.52.2018.08.10.06.37.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 06:37:36 -0700 (PDT) Date: Fri, 10 Aug 2018 06:37:35 -0700 From: Guenter Roeck To: Paul Cercueil Cc: Rob Herring , Mark Rutland , Thierry Reding , Daniel Lezcano , Thomas Gleixner , Wim Van Sebroeck , Ralf Baechle , Paul Burton , James Hogan , Jonathan Corbet , Lee Jones , Mathieu Malaterre , Ezequiel Garcia , linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-mips@linux-mips.org, linux-doc@vger.kernel.org, linux-clk@vger.kernel.org Subject: Re: [PATCH v6 10/24] watchdog: jz4740: Avoid starting watchdog in set_timeout Message-ID: <20180810133735.GC29028@roeck-us.net> References: <20180809214414.20905-1-paul@crapouillou.net> <20180809214414.20905-11-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180809214414.20905-11-paul@crapouillou.net> 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 Thu, Aug 09, 2018 at 11:44:00PM +0200, Paul Cercueil wrote: > Previously the jz4740_wdt_set_timeout() function was starting the timer > unconditionally, even if it was stopped when that function was entered. > > Now, the timer will be restarted only if it was already running before > this function is called. > > Signed-off-by: Paul Cercueil Reviewed-by: Guenter Roeck > --- > drivers/watchdog/jz4740_wdt.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > v6: New patch > > diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c > index 0f54306aee25..45d9495170e5 100644 > --- a/drivers/watchdog/jz4740_wdt.c > +++ b/drivers/watchdog/jz4740_wdt.c > @@ -64,13 +64,15 @@ static int jz4740_wdt_set_timeout(struct watchdog_device *wdt_dev, > { > struct jz4740_wdt_drvdata *drvdata = watchdog_get_drvdata(wdt_dev); > u16 timeout_value = (u16)(drvdata->clk_rate * new_timeout); > + u32 tcer; > > + regmap_read(drvdata->map, TCU_REG_WDT_TCER, &tcer); > regmap_write(drvdata->map, TCU_REG_WDT_TCER, 0); > > regmap_write(drvdata->map, TCU_REG_WDT_TDR, timeout_value); > regmap_write(drvdata->map, TCU_REG_WDT_TCNT, 0); > > - regmap_write(drvdata->map, TCU_REG_WDT_TCER, TCU_WDT_TCER_TCEN); > + regmap_write(drvdata->map, TCU_REG_WDT_TCER, tcer & TCU_WDT_TCER_TCEN); > > wdt_dev->timeout = new_timeout; > return 0; > @@ -86,6 +88,7 @@ static int jz4740_wdt_start(struct watchdog_device *wdt_dev) > return ret; > > jz4740_wdt_set_timeout(wdt_dev, wdt_dev->timeout); > + regmap_write(drvdata->map, TCU_REG_WDT_TCER, TCU_WDT_TCER_TCEN); > > return 0; > } > -- > 2.11.0 >