diff options
-rw-r--r-- | drivers/watchdog/mtk_wdt.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c index 113a48d54058..9c3d0033260d 100644 --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c @@ -153,10 +153,11 @@ static const struct watchdog_ops mtk_wdt_ops = { static int mtk_wdt_probe(struct platform_device *pdev) { + struct device *dev = &pdev->dev; struct mtk_wdt_dev *mtk_wdt; int err; - mtk_wdt = devm_kzalloc(&pdev->dev, sizeof(*mtk_wdt), GFP_KERNEL); + mtk_wdt = devm_kzalloc(dev, sizeof(*mtk_wdt), GFP_KERNEL); if (!mtk_wdt) return -ENOMEM; @@ -171,9 +172,9 @@ static int mtk_wdt_probe(struct platform_device *pdev) mtk_wdt->wdt_dev.timeout = WDT_MAX_TIMEOUT; mtk_wdt->wdt_dev.max_timeout = WDT_MAX_TIMEOUT; mtk_wdt->wdt_dev.min_timeout = WDT_MIN_TIMEOUT; - mtk_wdt->wdt_dev.parent = &pdev->dev; + mtk_wdt->wdt_dev.parent = dev; - watchdog_init_timeout(&mtk_wdt->wdt_dev, timeout, &pdev->dev); + watchdog_init_timeout(&mtk_wdt->wdt_dev, timeout, dev); watchdog_set_nowayout(&mtk_wdt->wdt_dev, nowayout); watchdog_set_restart_priority(&mtk_wdt->wdt_dev, 128); @@ -181,29 +182,13 @@ static int mtk_wdt_probe(struct platform_device *pdev) mtk_wdt_stop(&mtk_wdt->wdt_dev); - err = watchdog_register_device(&mtk_wdt->wdt_dev); + watchdog_stop_on_reboot(&mtk_wdt->wdt_dev); + err = devm_watchdog_register_device(dev, &mtk_wdt->wdt_dev); if (unlikely(err)) return err; - dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)\n", - mtk_wdt->wdt_dev.timeout, nowayout); - - return 0; -} - -static void mtk_wdt_shutdown(struct platform_device *pdev) -{ - struct mtk_wdt_dev *mtk_wdt = platform_get_drvdata(pdev); - - if (watchdog_active(&mtk_wdt->wdt_dev)) - mtk_wdt_stop(&mtk_wdt->wdt_dev); -} - -static int mtk_wdt_remove(struct platform_device *pdev) -{ - struct mtk_wdt_dev *mtk_wdt = platform_get_drvdata(pdev); - - watchdog_unregister_device(&mtk_wdt->wdt_dev); + dev_info(dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)\n", + mtk_wdt->wdt_dev.timeout, nowayout); return 0; } @@ -245,8 +230,6 @@ static const struct dev_pm_ops mtk_wdt_pm_ops = { static struct platform_driver mtk_wdt_driver = { .probe = mtk_wdt_probe, - .remove = mtk_wdt_remove, - .shutdown = mtk_wdt_shutdown, .driver = { .name = DRV_NAME, .pm = &mtk_wdt_pm_ops, |