linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH v2] watchdog: imx_sc_wdt: fix pretimeout
@ 2021-05-19  8:03 Stefan Eichenberger
  2021-05-19  9:56 ` Aisheng Dong
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Eichenberger @ 2021-05-19  8:03 UTC (permalink / raw)
  To: linux-watchdog
  Cc: Wim Van Sebroeck, Guenter Roeck, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Stefan Eichenberger, Ahmad Fatoum

If the WDIOF_PRETIMEOUT flag is not set when registering the device the
driver will not show the sysfs entries or register the default governor.
By moving the registering after the decision whether pretimeout is
supported this gets fixed.

Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/watchdog/imx_sc_wdt.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c
index e9ee22a7cb45..8ac021748d16 100644
--- a/drivers/watchdog/imx_sc_wdt.c
+++ b/drivers/watchdog/imx_sc_wdt.c
@@ -183,16 +183,12 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
 	watchdog_stop_on_reboot(wdog);
 	watchdog_stop_on_unregister(wdog);
 
-	ret = devm_watchdog_register_device(dev, wdog);
-	if (ret)
-		return ret;
-
 	ret = imx_scu_irq_group_enable(SC_IRQ_GROUP_WDOG,
 				       SC_IRQ_WDOG,
 				       true);
 	if (ret) {
 		dev_warn(dev, "Enable irq failed, pretimeout NOT supported\n");
-		return 0;
+		goto register_device;
 	}
 
 	imx_sc_wdd->wdt_notifier.notifier_call = imx_sc_wdt_notify;
@@ -203,7 +199,7 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
 					 false);
 		dev_warn(dev,
 			 "Register irq notifier failed, pretimeout NOT supported\n");
-		return 0;
+		goto register_device;
 	}
 
 	ret = devm_add_action_or_reset(dev, imx_sc_wdt_action,
@@ -213,7 +209,8 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
 	else
 		dev_warn(dev, "Add action failed, pretimeout NOT supported\n");
 
-	return 0;
+register_device:
+	return devm_watchdog_register_device(dev, wdog);
 }
 
 static int __maybe_unused imx_sc_wdt_suspend(struct device *dev)
-- 
2.27.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [RESEND PATCH v2] watchdog: imx_sc_wdt: fix pretimeout
  2021-05-19  8:03 [RESEND PATCH v2] watchdog: imx_sc_wdt: fix pretimeout Stefan Eichenberger
@ 2021-05-19  9:56 ` Aisheng Dong
  0 siblings, 0 replies; 2+ messages in thread
From: Aisheng Dong @ 2021-05-19  9:56 UTC (permalink / raw)
  To: Stefan Eichenberger, linux-watchdog
  Cc: Wim Van Sebroeck, Guenter Roeck, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, dl-linux-imx,
	Ahmad Fatoum

> From: Stefan Eichenberger <eichest@gmail.com>
> Sent: Wednesday, May 19, 2021 4:03 PM
> 
> If the WDIOF_PRETIMEOUT flag is not set when registering the device the
> driver will not show the sysfs entries or register the default governor.
> By moving the registering after the decision whether pretimeout is supported
> this gets fixed.
> 
> Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>

Regards
Aisheng

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-19  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19  8:03 [RESEND PATCH v2] watchdog: imx_sc_wdt: fix pretimeout Stefan Eichenberger
2021-05-19  9:56 ` Aisheng Dong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).