Commit 854478a3 authored by Stefan Eichenberger's avatar Stefan Eichenberger Committed by Wim Van Sebroeck

watchdog: imx_sc_wdt: fix pretimeout

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: default avatarStefan Eichenberger <eichest@gmail.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Reviewed-by: default avatarDong Aisheng <aisheng.dong@nxp.com>
Link: https://lore.kernel.org/r/20210519080311.142928-1-eichest@gmail.comSigned-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@linux-watchdog.org>
parent 266b2e33
...@@ -183,16 +183,12 @@ static int imx_sc_wdt_probe(struct platform_device *pdev) ...@@ -183,16 +183,12 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
watchdog_stop_on_reboot(wdog); watchdog_stop_on_reboot(wdog);
watchdog_stop_on_unregister(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, ret = imx_scu_irq_group_enable(SC_IRQ_GROUP_WDOG,
SC_IRQ_WDOG, SC_IRQ_WDOG,
true); true);
if (ret) { if (ret) {
dev_warn(dev, "Enable irq failed, pretimeout NOT supported\n"); 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; 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) ...@@ -203,7 +199,7 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
false); false);
dev_warn(dev, dev_warn(dev,
"Register irq notifier failed, pretimeout NOT supported\n"); "Register irq notifier failed, pretimeout NOT supported\n");
return 0; goto register_device;
} }
ret = devm_add_action_or_reset(dev, imx_sc_wdt_action, 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) ...@@ -213,7 +209,8 @@ static int imx_sc_wdt_probe(struct platform_device *pdev)
else else
dev_warn(dev, "Add action failed, pretimeout NOT supported\n"); 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) static int __maybe_unused imx_sc_wdt_suspend(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment