Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1447541
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] watchdog: bcm2835_wdt: set WDOG_HW_RUNNING bit when appropriate |
| Date | 2016-07-21 01:50 +0200 |
| Message-ID | <rX9pv-81V-7@gated-at.bofh.it> (permalink) |
| References | <rV6vM-4wu-23@gated-at.bofh.it> <rV6vN-4wu-43@gated-at.bofh.it> <rVbF8-7wy-15@gated-at.bofh.it> <rX7nH-6Oz-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, Jul 20, 2016 at 11:37:55PM +0200, Rasmus Villemoes wrote:
> On 2016-07-15 15:46, Guenter Roeck wrote:
> >On 07/15/2016 01:15 AM, Rasmus Villemoes wrote:
> >>
> >>+static bool bcm2835_wdt_is_running(struct bcm2835_wdt *wdt)
> >>+{
> >>+ uint32_t cur;
> >>+
> >>+ cur = readl(wdt->base + PM_RSTC);
> >>+
> >>+ return !!(cur & PM_RSTC_WRCFG_FULL_RESET);
> >>+}
> >>+
> >> static int bcm2835_wdt_start(struct watchdog_device *wdog)
> >> {
> >> struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
> >>@@ -70,6 +79,7 @@ static int bcm2835_wdt_start(struct watchdog_device
> >>*wdog)
> >> PM_RSTC_WRCFG_FULL_RESET, wdt->base + PM_RSTC);
> >>
> >> spin_unlock_irqrestore(&wdt->lock, flags);
> >>+ set_bit(WDOG_HW_RUNNING, &wdog->status);
> >>
> >You don't need to set this bit here unless the watchdog can not be stopped.
> >
> >> return 0;
> >> }
> >>@@ -79,6 +89,7 @@ static int bcm2835_wdt_stop(struct watchdog_device
> >>*wdog)
> >> struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
> >>
> >> writel_relaxed(PM_PASSWORD | PM_RSTC_RESET, wdt->base + PM_RSTC);
> >>+ clear_bit(WDOG_HW_RUNNING, &wdog->status);
> >
> >... and since you clear the bit, it can be stopped. Both setting and
> >resetting the bit
> >is therefore not necessary.
>
> Well, if the bit isn't cleared here, but it was set during probe(), the
> framework will (re)start this watchdog (and keep it fed) since there's no
> separate ping method. I suppose that's reasonable semantics if the watchdog
> was running at boot (and I like how that ends up interacting with my
> open_deadline proposal), but probably a little too subtle. This would also
> change if the ->start method was broken up into separate ping and start
> methods, which it seems that it could be.
>
> If we do clear the bit here, I think it's neater to set it in start as well,
> even if that doesn't really have any effect.
>
The problem is different. The core should clear the bit on close if there is a
stop function, and if calling the stop function does not return an error.
Guenter
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/3] watchdog: bcm2835_wdt: constify _ops and _info structures Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2016-07-15 10:20 +0200
[PATCH 3/3] watchdog: bcm2835_wdt: set WDOG_HW_RUNNING bit when appropriate Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2016-07-15 10:20 +0200
Re: [PATCH 3/3] watchdog: bcm2835_wdt: set WDOG_HW_RUNNING bit when appropriate Guenter Roeck <linux@roeck-us.net> - 2016-07-15 15:50 +0200
Re: [PATCH 3/3] watchdog: bcm2835_wdt: set WDOG_HW_RUNNING bit when appropriate Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2016-07-20 23:40 +0200
Re: [PATCH 3/3] watchdog: bcm2835_wdt: set WDOG_HW_RUNNING bit when appropriate Guenter Roeck <linux@roeck-us.net> - 2016-07-21 01:50 +0200
[PATCH 2/3] watchdog: bcm2835_wdt: remove redundant ->set_timeout callback Rasmus Villemoes <rasmus.villemoes@prevas.dk> - 2016-07-15 10:20 +0200
Re: [PATCH 2/3] watchdog: bcm2835_wdt: remove redundant ->set_timeout callback Guenter Roeck <linux@roeck-us.net> - 2016-07-15 15:50 +0200
Re: [PATCH 2/3] watchdog: bcm2835_wdt: remove redundant ->set_timeout callback Eric Anholt <eric@anholt.net> - 2016-07-15 21:00 +0200
Re: [PATCH 2/3] watchdog: bcm2835_wdt: remove redundant ->set_timeout callback Wim Van Sebroeck <wim@iguana.be> - 2016-07-17 22:30 +0200
Re: [PATCH 1/3] watchdog: bcm2835_wdt: constify _ops and _info structures Guenter Roeck <linux@roeck-us.net> - 2016-07-15 15:50 +0200
Re: [PATCH 1/3] watchdog: bcm2835_wdt: constify _ops and _info structures Wim Van Sebroeck <wim@iguana.be> - 2016-07-17 22:30 +0200
csiph-web