All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ayyathurai, Vijayakannan" <vijayakannan.ayyathurai@intel.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: "wim@linux-watchdog.org" <wim@linux-watchdog.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"andriy.shevchenko@linux.intel.com" 
	<andriy.shevchenko@linux.intel.com>,
	"mgross@linux.intel.com" <mgross@linux.intel.com>,
	"Wan Mohamad,
	Wan Ahmad Zainie"  <wan.ahmad.zainie.wan.mohamad@intel.com>,
	"Raja Subramanian,
	Lakshmi Bai"  <lakshmi.bai.raja.subramanian@intel.com>
Subject: RE: [PATCH v3 1/2] watchdog: Add watchdog driver for Intel Keembay Soc
Date: Wed, 2 Dec 2020 17:12:43 +0000	[thread overview]
Message-ID: <DM6PR11MB42508F9E0FACB158A392D322FBF30@DM6PR11MB4250.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20201202163238.GA215023@roeck-us.net>

Hi Guenter,

> From: Guenter Roeck <linux@roeck-us.net>
> 
> On Wed, Dec 02, 2020 at 02:55:32PM +0000, Ayyathurai, Vijayakannan wrote:
> >
> > > From: Guenter Roeck <linux@roeck-us.net>
> > > Sent: Wednesday, 2 December, 2020 12:31 AM
> > >
> > > On Tue, Dec 01, 2020 at 11:10:33PM +0800,
> > > > From: Vijayakannan Ayyathurai <vijayakannan.ayyathurai@intel.com>
> > > >
> > > >
> > > > +static void keembay_wdt_set_timeout_reg(struct watchdog_device
> *wdog,
> > > bool ping)
> > > > +{
> > > > +	struct keembay_wdt *wdt = watchdog_get_drvdata(wdog);
> > > > +	u32 th_val = 0;
> > > > +
> > > > +	if (!ping && wdog->pretimeout) {
> > > > +		th_val = wdog->timeout - wdog->pretimeout;
> > > > +		keembay_wdt_writel(wdt, TIM_WATCHDOG_INT_THRES, th_val
> > > * wdt->rate);
> > >
> > > Sorry for annoying you now, but I may have found another potential
> problem.
> > >
> > > What happens if the user sets a pretimeout, then removes it ?
> > > What should TIM_WATCHDOG_INT_THRES be set to in that case ?
> > > Right now TIM_WATCHDOG_INT_THRES won't be updated anymore
> >
> > It is a good catch. Indeed, I don't have coverage like this.
> >
> > > in that case, which seems wrong. This might get worse with
> > > the following sequence.
> > >
> > > - set pretimeout
> > > - clear pretimeout
> > > - set timeout to some other value
> > >
> >
> > Can the below method resolve this issue?
> >
> >
> > static int keembay_wdt_set_pretimeout(struct watchdog_device *wdog, u32
> t)
> > {
> >         struct keembay_wdt *wdt = watchdog_get_drvdata(wdog);
> >
> >         if(!t)
> >                 keembay_wdt_writel(wdt, TIM_WATCHDOG_INT_THRES, 0);
> >
> 
> Partially, only it makes for awkward code. After all, it is never really
> necessary to set the timeout register after updating the pretimeout.
> The "ping" parameter makes less and less sense with this in mind.

Yes.

> It might be better to split the set_timeout_reg function into
> set_timeout_reg and set_pretimeout_reg and call those functions as needed
> (and handle the if() above in the set_pretimeout_reg function).
> 

Ok. Thanks for your suggestion.
Let me incorporate necessary changes in the next version.

> Thanks,
> Guenter
>

Thanks,
Vijay

  reply	other threads:[~2020-12-02 17:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 15:10 [PATCH v3 0/2] Add drivers for Intel Keem Bay SoC watchdog vijayakannan.ayyathurai
2020-12-01 15:10 ` [PATCH v3 1/2] watchdog: Add watchdog driver for Intel Keembay Soc vijayakannan.ayyathurai
2020-12-01 16:30   ` Guenter Roeck
2020-12-02 14:55     ` Ayyathurai, Vijayakannan
2020-12-02 16:32       ` Guenter Roeck
2020-12-02 17:12         ` Ayyathurai, Vijayakannan [this message]
2020-12-01 15:10 ` [PATCH v3 2/2] dt-bindings: watchdog: Add bindings for Intel Keem Bay SoC vijayakannan.ayyathurai
2020-12-01 15:41   ` Ayyathurai, Vijayakannan
2020-12-07 18:23   ` Rob Herring
2020-12-08  2:21     ` Ayyathurai, Vijayakannan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR11MB42508F9E0FACB158A392D322FBF30@DM6PR11MB4250.namprd11.prod.outlook.com \
    --to=vijayakannan.ayyathurai@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=lakshmi.bai.raja.subramanian@intel.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mgross@linux.intel.com \
    --cc=robh+dt@kernel.org \
    --cc=wan.ahmad.zainie.wan.mohamad@intel.com \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.