diff mbox series

watchdog: stop wdd when watchdog hw running in reboot_notifier

Message ID 20210114082651.17162-1-qiang.zhao@nxp.com (mailing list archive)
State Accepted
Headers show
Series watchdog: stop wdd when watchdog hw running in reboot_notifier | expand

Commit Message

Qiang Zhao Jan. 14, 2021, 8:26 a.m. UTC
From: Zhao Qiang <qiang.zhao@nxp.com>

In watchdog_reboot_notifier, wdd should be stopped when the device
is in hw_running state

Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>
---
 drivers/watchdog/watchdog_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck Jan. 23, 2021, 5:26 p.m. UTC | #1
On Thu, Jan 14, 2021 at 04:26:51PM +0800, Qiang Zhao wrote:
> From: Zhao Qiang <qiang.zhao@nxp.com>
> 
> In watchdog_reboot_notifier, wdd should be stopped when the device
> is in hw_running state
> 
> Signed-off-by: Zhao Qiang <qiang.zhao@nxp.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/watchdog_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
> index 861daf4..ec670cc 100644
> --- a/drivers/watchdog/watchdog_core.c
> +++ b/drivers/watchdog/watchdog_core.c
> @@ -154,7 +154,7 @@ static int watchdog_reboot_notifier(struct notifier_block *nb,
>  
>  	wdd = container_of(nb, struct watchdog_device, reboot_nb);
>  	if (code == SYS_DOWN || code == SYS_HALT) {
> -		if (watchdog_active(wdd)) {
> +		if (watchdog_active(wdd) || watchdog_hw_running(wdd)) {
>  			int ret;
>  
>  			ret = wdd->ops->stop(wdd);
diff mbox series

Patch

diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index 861daf4..ec670cc 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -154,7 +154,7 @@  static int watchdog_reboot_notifier(struct notifier_block *nb,
 
 	wdd = container_of(nb, struct watchdog_device, reboot_nb);
 	if (code == SYS_DOWN || code == SYS_HALT) {
-		if (watchdog_active(wdd)) {
+		if (watchdog_active(wdd) || watchdog_hw_running(wdd)) {
 			int ret;
 
 			ret = wdd->ops->stop(wdd);