Skip to content

Commit

Permalink
watchdog: imx_sc_wdt: fix pretimeout
Browse files Browse the repository at this point in the history
[ Upstream commit 854478a ]

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>
Link: https://lore.kernel.org/r/20210519080311.142928-1-eichest@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
eichenberger authored and gregkh committed Jul 20, 2021
1 parent 4c05dac commit 158e5a9
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/watchdog/imx_sc_wdt.c
Expand Up @@ -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;
Expand All @@ -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,
Expand All @@ -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)
Expand Down

0 comments on commit 158e5a9

Please sign in to comment.