[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6ED8E3B22081A4459DAC7699F3695FB7014B223DE8@SW-EX-MBX02.diasemi.com>
Date: Thu, 7 May 2015 19:02:29 +0000
From: "Opensource [Steve Twiss]" <stwiss.opensource@...semi.com>
To: Guenter Roeck <linux@...ck-us.net>
CC: LINUXKERNEL <linux-kernel@...r.kernel.org>,
LINUXWATCHDOG <linux-watchdog@...r.kernel.org>,
Wim Van Sebroeck <wim@...ana.be>,
Alessandro Zummo <a.zummo@...ertech.it>,
DEVICETREE <devicetree@...r.kernel.org>,
David Dajun Chen <david.chen@...semi.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
LINUXINPUT <linux-input@...r.kernel.org>,
Lee Jones <lee.jones@...aro.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
"Mark Rutland" <mark.rutland@....com>,
Pawel Moll <pawel.moll@....com>,
RTCLINUX <rtc-linux@...glegroups.com>,
Rob Herring <robh+dt@...nel.org>,
Samuel Ortiz <sameo@...ux.intel.com>,
Support Opensource <Support.Opensource@...semi.com>
Subject: RE: [PATCH V1 5/6] watchdog: da9062: DA9062 watchdog driver
On 07 May 2015 18:58 Guenter Roeck wrote:
Hi Guenter,
> > +static void da9062_apply_window_protection(struct da9062_watchdog *wdt)
> > +{
> > + unsigned long delay = msecs_to_jiffies(DA9062_RESET_PROTECTION_MS);
> > + unsigned long timeout = wdt->j_time_stamp + delay;
> > + unsigned long now = jiffies;
> > + unsigned int diff_ms;
> > +
> > + /* if time-limit has not elapsed then wait for remainder */
> > + if (time_before(now, timeout)) {
> > + diff_ms = jiffies_to_msecs(timeout-now);
> > + dev_dbg(wdt->hw->dev,
> > + "Delaying watchdog ping by %u msecs\n", diff_ms);
>
> I would not bother about the dev_dbg, but that is your call.
>
.. easily removed ... I only have it in because I am worried about the case when the
watchdog gets kicked too often & quickly. If it is okay, I will leave that in because the
edge-case should be made known somewhere. Perhaps I will make it a better
debug description like "Watchdog kicked too quickly. Delaying %d ms"
> > + mdelay(diff_ms);
>
> Can you use usleep_range() ?
>
I put mdelay() ?? I meant to put msleep(). That's probably what I need to do now.
I did take a look at usleep_range() as I trawled for the best delay call, but usleep_range()
requires a lower and upper bound and I only have a lower bound in my case -- also, the
kernel docs "Documentation/timers/timers-howto.txt" suggest:
SLEEPING FOR ~USECS OR SMALL MSECS ( 10us - 20ms):
* Use usleep_range
SLEEPING FOR LARGER MSECS ( 10ms+ )
* Use msleep [...]
I guess the majority of the time there would be zero delay-time and the code branch
wouldn't be triggered anyway, but when it is triggered the time can be anything up to
300 msecs. So I was intending to use msleep().
> Othewise looks good. BTW, I had to do something similar in
> drivers/hwmon/pmbus/zl6100.c; this is where the idea comes from.
Ah, I see, thanks.
Regards,
Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists