watchdog: meson_wdt: fix register and callback of reboot notfiy

PD#147089: watchdog: meson_wdt: fix register and callback of reboot notify

The function register_reboot_notifier() use the wrong notifier_block
variable. So the container_of in the callback can't get the right pointer
of the struct.

The watchdog is disable in case of system down. If the kernel panic, the
reboot notify should ignore that.

Change-Id: I3fd21590808f4b380ddd54883db576e5c13c04a1
Signed-off-by: Bo Yang <bo.yang@amlogic.com>
This commit is contained in:
Bo Yang
2017-07-07 18:24:50 +08:00
parent 4cc49ffb39
commit 1674fa1ab5

View File

@@ -268,9 +268,10 @@ static int aml_wtd_reboot_notify(struct notifier_block *nb,
{
struct aml_wdt_dev *wdev;
wdev = container_of(nb, struct aml_wdt_dev, reboot_notifier);
disable_watchdog(wdev);
if (event == SYS_DOWN || event == SYS_HALT) {
wdev = container_of(nb, struct aml_wdt_dev, reboot_notifier);
disable_watchdog(wdev);
}
pr_info("disable watchdog\n");
return NOTIFY_OK;
}
@@ -324,10 +325,10 @@ static int aml_wdt_probe(struct platform_device *pdev)
if (ret)
return ret;
wdev->reboot_notifier = aml_wdt_pm_notifier;
wdev->pm_notifier = aml_wdt_pm_notifier;
wdev->reboot_notifier = aml_wdt_reboot_notifier;
register_pm_notifier(&aml_wdt_pm_notifier);
register_reboot_notifier(&aml_wdt_reboot_notifier);
register_pm_notifier(&wdev->pm_notifier);
register_reboot_notifier(&wdev->reboot_notifier);
dev_info(wdev->dev, "AML Watchdog Timer probed done\n");
return 0;