From: Guenter Roeck <linux@roeck-us.net>
To: Lubomir Rintel <lkundrak@v3.sk>
Cc: linux-kernel@vger.kernel.org,
Stephen Warren <swarren@wwwdotorg.org>,
Wim Van Sebroeck <wim@iguana.be>,
linux-rpi-kernel@lists.infradead.org,
linux-watchdog@vger.kernel.org
Subject: Re: watchdog: Add Broadcom BCM2708 watchdog timer driver
Date: Sun, 24 Mar 2013 08:36:35 -0700 [thread overview]
Message-ID: <20130324153635.GA15620@roeck-us.net> (raw)
In-Reply-To: <1364134019.2906.2.camel@hobbes.kokotovo>
On Sun, Mar 24, 2013 at 03:06:59PM +0100, Lubomir Rintel wrote:
> On Fri, 2013-03-22 at 06:56 -0700, Guenter Roeck wrote:
>
> Thank you for your response!
>
> On Fri Mar 22 09:56:01 EDT 2013, Guenter Roeck wrote:
> > On Fri, Mar 22, 2013 at 12:55:07PM -0000, Lubomir Rintel wrote:
> ...
> > > + writel_relaxed(PM_PASSWORD | (cur & PM_RSTC_WRCFG_CLR) |
> > > + PM_RSTC_WRCFG_FULL_RESET, wdt_regs + PM_RSTC);
> > > +
> > Nitpick - I prefer people to use the recommended continuation line style,
> > but that is really up to the maintainer to decide.
>
> Well, I intended to comply with Documentation/CodingStyle, are you referring to
> it? I fail to understand what to do to be more compliant and could not really
> identify a style that would be consistently used across the kernel source.
> Should I cut then second line into two smaller parts that would be aligned with
> right line end?
>
I was referring to line continuation aligned with '(', such as
writel_relaxed(PM_PASSWORD | (cur & PM_RSTC_WRCFG_CLR) |
PM_RSTC_WRCFG_FULL_RESET, wdt_regs + PM_RSTC);
I don't recall how deep the indentation was - does that not fit ?
> ...
> > > +static int bcm2835_wdt_set_timeout(struct watchdog_device *wdog, unsigned int t)
> > > +{
> > > + wdog->timeout = t;
> >
> > No need to update the actual chip timeout ?
>
> No need to, watchdog core applies the new timeout by pinging the device (see
> below for what happens when this driver is pinged).
>
> See: WDIOC_SETTIMEOUT in drivers/watchdog/watchdog_dev.c
>
Ok, makes sense.
> ...
> > > +static struct watchdog_ops bcm2835_wdt_ops = {
> > > + .owner = THIS_MODULE,
> > > + .start = bcm2835_wdt_start,
> > > + .stop = bcm2835_wdt_stop,
> > > + .set_timeout = bcm2835_wdt_set_timeout,
> > > + .get_timeleft = bcm2835_wdt_get_timeleft,
> >
> > No separate ping function ?
>
> The watchdog documentation core states:
>
> "Most hardware that does not support this as a separate function uses the
> start function to restart the watchdog timer hardware. And that's also what
> the watchdog timer driver core does."
>
> This indeed applies to this driver.
>
Ok.
> ...
> > > + if (WARN(!wdt_regs, "failed to remap watchdog regs"))
> > > + return -ENODEV;
> >
> > WARN seems to be a bit extreme. Is this necessary ?
>
> Probably not. I'll replace it with dev_err() instead.
>
> > > + dev_info(dev, "Broadcom BCM2835 watchdog timer");
> > > +
> > > + watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev);
> >
> > Since heartbeat is by default set to -1, which is interpreted as unsigned
> > int, I would expect this call to return -EINVAL, leaving the default timeout
> > undefined. Is this really what you want ?
>
> Well, I looked into orion-wdt for an example how to initialize the default
> timeout, but failed to understand it correctly. I thought that watchdog core
> picks a sensible value upon getting -1, which is incorrect. They in fact use
> initialize timeout with maximal value, and use a fall-through vi EINVAL to leave
> it untouched if it was not overridden. I'll do the same thing now.
>
Some user level documentation states that the default timeout for all drivers
would be 60 seconds. Unfortunately, that is not correct, as all drivers do
what they want. I myself use it as a guideline, ie use a 60 seconds default
unless there is a good reason to use another default value (eg if the
chip only supports a lower maximum).
> > > + watchdog_set_nowayout(&bcm2835_wdt_wdd, nowayout);
> > > + return watchdog_register_device(&bcm2835_wdt_wdd);
> >
> > Leaking iomap if this fails.
>
> Oops. Fixing.
>
> > Would be nice to have something like devm_of_iomap ...
>
> That sounds sound to me. Sent out a separate patch implementing it, and I'll
> modify this if it gets merged.
>
Excellent!
Thanks,
Guenter
next prev parent reply other threads:[~2013-03-24 15:36 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 12:55 [PATCH] watchdog: Add Broadcom BCM2708 watchdog timer driver Lubomir Rintel
2013-03-22 13:56 ` Guenter Roeck
2013-03-24 14:06 ` Lubomir Rintel
2013-03-24 15:36 ` Guenter Roeck [this message]
2013-03-22 18:46 ` [PATCH] " Arend van Spriel
2013-03-24 14:08 ` Lubomir Rintel
2013-03-23 2:24 ` Stephen Warren
2013-03-24 14:12 ` Lubomir Rintel
2013-03-27 3:26 ` Stephen Warren
2013-03-27 3:33 ` Stephen Warren
2013-03-24 14:22 ` [PATCH v2] watchdog: Add Broadcom BCM2835 " Lubomir Rintel
2013-03-24 14:25 ` [PATCH v2] arm: Add Broadcom BCM2835 watchdog timer driver to bcm2835_defconfig Lubomir Rintel
2013-03-26 17:48 ` [PATCH v2] bcm2835: Add Broadcom BCM2835 RNG to the device tree Lubomir Rintel
2013-03-26 17:50 ` Lubomir Rintel
2013-03-26 17:50 ` [PATCH v3] watchdog: Add Broadcom BCM2835 watchdog timer driver Lubomir Rintel
2013-03-26 21:03 ` Guenter Roeck
2013-03-27 16:39 ` Lubomir Rintel
2013-03-27 3:40 ` Stephen Warren
2013-03-27 16:36 ` Lubomir Rintel
2013-03-27 3:49 ` Stephen Warren
2013-03-27 16:40 ` [PATCH v4] " Lubomir Rintel
2013-03-27 19:52 ` Guenter Roeck
2013-03-28 3:00 ` Stephen Warren
2013-03-28 3:50 ` Guenter Roeck
2013-05-26 14:22 ` Wim Van Sebroeck
2013-06-18 16:50 ` Lubomir Rintel
2013-06-18 17:10 ` Stephen Warren
2013-06-18 17:44 ` [PATCH v5] " Lubomir Rintel
2013-06-18 18:24 ` Guenter Roeck
2013-06-18 18:24 ` Guenter Roeck
2013-06-27 20:25 ` Wim Van Sebroeck
2013-05-17 2:59 ` [PATCH v4] " Stephen Warren
2013-03-24 16:12 ` [PATCH v2] " Guenter Roeck
2013-03-26 17:47 ` Lubomir Rintel
2013-03-26 19:47 ` Guenter Roeck
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=20130324153635.GA15620@roeck-us.net \
--to=linux@roeck-us.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=lkundrak@v3.sk \
--cc=swarren@wwwdotorg.org \
--cc=wim@iguana.be \
/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.