mirror of
https://github.com/torvalds/linux.git
synced 2026-09-11 20:13:02 +02:00
watchdog: msc313e: Sync timeout value if WDT was running at boot
If WDT was running at boot, the hardware timeout might be set to values
other than the final software timeout.
To be consistent, set the hardware timeout to match the final software
timeout (i.e., after watchdog_init_timeout()) if WDT was running.
Fixes: ffd264bd15 ("watchdog: msc313e: Check if the WDT was running at boot")
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://patch.msgid.link/20260828161348.13212-8-tzungbi@kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
ab390021b2
commit
01504d14e4
|
|
@ -144,12 +144,21 @@ static int msc313e_wdt_probe(struct platform_device *pdev)
|
|||
priv->wdev.max_timeout = U32_MAX / rate;
|
||||
priv->wdev.timeout = MSC313E_WDT_DEFAULT_TIMEOUT;
|
||||
|
||||
watchdog_set_drvdata(&priv->wdev, priv);
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
watchdog_init_timeout(&priv->wdev, timeout, dev);
|
||||
watchdog_stop_on_reboot(&priv->wdev);
|
||||
watchdog_stop_on_unregister(&priv->wdev);
|
||||
watchdog_stop_ping_on_suspend(&priv->wdev);
|
||||
|
||||
ret = clk_prepare_enable(priv->clk);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* If the period is non-zero the WDT is running */
|
||||
if (msc313e_wdt_get_hw_timeout(priv)) {
|
||||
msc313e_wdt_set_hw_timeout(priv, priv->wdev.timeout);
|
||||
set_bit(WDOG_HW_RUNNING, &priv->wdev.status);
|
||||
/*
|
||||
* Keep the clock enabled. The watchdog core will skip the next
|
||||
|
|
@ -160,14 +169,6 @@ static int msc313e_wdt_probe(struct platform_device *pdev)
|
|||
clk_disable_unprepare(priv->clk);
|
||||
}
|
||||
|
||||
watchdog_set_drvdata(&priv->wdev, priv);
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
watchdog_init_timeout(&priv->wdev, timeout, dev);
|
||||
watchdog_stop_on_reboot(&priv->wdev);
|
||||
watchdog_stop_on_unregister(&priv->wdev);
|
||||
watchdog_stop_ping_on_suspend(&priv->wdev);
|
||||
|
||||
ret = devm_watchdog_register_device(dev, &priv->wdev);
|
||||
|
||||
/* If the WDT is running and anything goes wrong, disable the clock. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user