From: Guenter Roeck <linux@roeck-us.net> To: Ken Sloat <KSloat@aampglobal.com> Cc: "nicolas.ferre@microchip.com" <nicolas.ferre@microchip.com>, "alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>, "ludovic.desroches@microchip.com" <ludovic.desroches@microchip.com>, "wim@linux-watchdog.org" <wim@linux-watchdog.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org>, "linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> Subject: Re: [PATCH v2 1/1] watchdog: atmel: atmel-sama5d4-wdt: Disable watchdog on system suspend Date: Tue, 2 Jul 2019 06:40:37 -0700 [thread overview] Message-ID: <20190702134037.GA23223@roeck-us.net> (raw) In-Reply-To: <20190614125310.29458-1-ksloat@aampglobal.com> On Fri, Jun 14, 2019 at 12:53:22PM +0000, Ken Sloat wrote: > From: Ken Sloat <ksloat@aampglobal.com> > > Currently, the atmel-sama5d4-wdt continues to run after system suspend. > Unless the system resumes within the watchdog timeout period so the > userspace can kick it, the system will be reset. This change disables > the watchdog on suspend if it is active and re-enables on resume. These > actions occur during the late and early phases of suspend and resume > respectively to minimize chances where a lock could occur while the > watchdog is disabled. > > Signed-off-by: Ken Sloat <ksloat@aampglobal.com> > Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> > --- > Changes in v2: > -Consolidate resume and resume early statements. > > drivers/watchdog/sama5d4_wdt.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c > index 111695223aae..0d123f8cbcc6 100644 > --- a/drivers/watchdog/sama5d4_wdt.c > +++ b/drivers/watchdog/sama5d4_wdt.c > @@ -280,7 +280,17 @@ static const struct of_device_id sama5d4_wdt_of_match[] = { > MODULE_DEVICE_TABLE(of, sama5d4_wdt_of_match); > > #ifdef CONFIG_PM_SLEEP > -static int sama5d4_wdt_resume(struct device *dev) > +static int sama5d4_wdt_suspend_late(struct device *dev) > +{ > + struct sama5d4_wdt *wdt = dev_get_drvdata(dev); > + > + if (watchdog_active(&wdt->wdd)) > + sama5d4_wdt_stop(&wdt->wdd); > + > + return 0; > +} > + > +static int sama5d4_wdt_resume_early(struct device *dev) > { > struct sama5d4_wdt *wdt = dev_get_drvdata(dev); > > @@ -291,12 +301,17 @@ static int sama5d4_wdt_resume(struct device *dev) > */ > sama5d4_wdt_init(wdt); > > + if (watchdog_active(&wdt->wdd)) > + sama5d4_wdt_start(&wdt->wdd); > + > return 0; > } > #endif > > -static SIMPLE_DEV_PM_OPS(sama5d4_wdt_pm_ops, NULL, > - sama5d4_wdt_resume); > +static const struct dev_pm_ops sama5d4_wdt_pm_ops = { > + SET_LATE_SYSTEM_SLEEP_PM_OPS(sama5d4_wdt_suspend_late, > + sama5d4_wdt_resume_early) > +}; > > static struct platform_driver sama5d4_wdt_driver = { > .probe = sama5d4_wdt_probe,
WARNING: multiple messages have this Message-ID (diff)
From: Guenter Roeck <linux@roeck-us.net> To: Ken Sloat <KSloat@aampglobal.com> Cc: "alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>, "linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "ludovic.desroches@microchip.com" <ludovic.desroches@microchip.com>, "wim@linux-watchdog.org" <wim@linux-watchdog.org>, "linux-arm-kernel@lists.infradead.org" <linux-arm-kernel@lists.infradead.org> Subject: Re: [PATCH v2 1/1] watchdog: atmel: atmel-sama5d4-wdt: Disable watchdog on system suspend Date: Tue, 2 Jul 2019 06:40:37 -0700 [thread overview] Message-ID: <20190702134037.GA23223@roeck-us.net> (raw) In-Reply-To: <20190614125310.29458-1-ksloat@aampglobal.com> On Fri, Jun 14, 2019 at 12:53:22PM +0000, Ken Sloat wrote: > From: Ken Sloat <ksloat@aampglobal.com> > > Currently, the atmel-sama5d4-wdt continues to run after system suspend. > Unless the system resumes within the watchdog timeout period so the > userspace can kick it, the system will be reset. This change disables > the watchdog on suspend if it is active and re-enables on resume. These > actions occur during the late and early phases of suspend and resume > respectively to minimize chances where a lock could occur while the > watchdog is disabled. > > Signed-off-by: Ken Sloat <ksloat@aampglobal.com> > Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> > --- > Changes in v2: > -Consolidate resume and resume early statements. > > drivers/watchdog/sama5d4_wdt.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c > index 111695223aae..0d123f8cbcc6 100644 > --- a/drivers/watchdog/sama5d4_wdt.c > +++ b/drivers/watchdog/sama5d4_wdt.c > @@ -280,7 +280,17 @@ static const struct of_device_id sama5d4_wdt_of_match[] = { > MODULE_DEVICE_TABLE(of, sama5d4_wdt_of_match); > > #ifdef CONFIG_PM_SLEEP > -static int sama5d4_wdt_resume(struct device *dev) > +static int sama5d4_wdt_suspend_late(struct device *dev) > +{ > + struct sama5d4_wdt *wdt = dev_get_drvdata(dev); > + > + if (watchdog_active(&wdt->wdd)) > + sama5d4_wdt_stop(&wdt->wdd); > + > + return 0; > +} > + > +static int sama5d4_wdt_resume_early(struct device *dev) > { > struct sama5d4_wdt *wdt = dev_get_drvdata(dev); > > @@ -291,12 +301,17 @@ static int sama5d4_wdt_resume(struct device *dev) > */ > sama5d4_wdt_init(wdt); > > + if (watchdog_active(&wdt->wdd)) > + sama5d4_wdt_start(&wdt->wdd); > + > return 0; > } > #endif > > -static SIMPLE_DEV_PM_OPS(sama5d4_wdt_pm_ops, NULL, > - sama5d4_wdt_resume); > +static const struct dev_pm_ops sama5d4_wdt_pm_ops = { > + SET_LATE_SYSTEM_SLEEP_PM_OPS(sama5d4_wdt_suspend_late, > + sama5d4_wdt_resume_early) > +}; > > static struct platform_driver sama5d4_wdt_driver = { > .probe = sama5d4_wdt_probe, _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-07-02 13:40 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-06-14 12:53 [PATCH v2 1/1] watchdog: atmel: atmel-sama5d4-wdt: Disable watchdog on system suspend Ken Sloat 2019-06-14 12:53 ` Ken Sloat 2019-06-14 16:46 ` Guenter Roeck 2019-06-14 16:46 ` Guenter Roeck 2019-06-14 17:53 ` Ken Sloat 2019-06-14 17:53 ` Ken Sloat 2019-06-14 18:08 ` Alexandre Belloni 2019-06-14 18:08 ` Alexandre Belloni 2019-06-14 18:43 ` Ken Sloat 2019-06-14 18:43 ` Ken Sloat 2019-06-14 20:33 ` Alexandre Belloni 2019-06-14 20:33 ` Alexandre Belloni 2019-06-14 20:45 ` Ken Sloat 2019-06-14 20:45 ` Ken Sloat 2019-06-15 14:22 ` Guenter Roeck 2019-06-15 14:22 ` Guenter Roeck 2019-06-20 8:33 ` Alexandre Belloni 2019-06-20 8:33 ` Alexandre Belloni 2019-07-02 13:40 ` Guenter Roeck [this message] 2019-07-02 13:40 ` 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=20190702134037.GA23223@roeck-us.net \ --to=linux@roeck-us.net \ --cc=KSloat@aampglobal.com \ --cc=alexandre.belloni@bootlin.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-watchdog@vger.kernel.org \ --cc=ludovic.desroches@microchip.com \ --cc=nicolas.ferre@microchip.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: linkBe 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.