--- zzzz-none-000/linux-3.10.107/drivers/watchdog/stmp3xxx_rtc_wdt.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/watchdog/stmp3xxx_rtc_wdt.c 2021-02-04 17:41:59.000000000 +0000 @@ -1,7 +1,7 @@ /* * Watchdog driver for the RTC based watchdog in STMP3xxx and i.MX23/28 * - * Author: Wolfram Sang + * Author: Wolfram Sang * * Copyright (C) 2011-12 Wolfram Sang, Pengutronix * @@ -9,10 +9,8 @@ * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ -#include #include #include -#include #include #include #include @@ -30,7 +28,7 @@ static int wdt_start(struct watchdog_device *wdd) { struct device *dev = watchdog_get_drvdata(wdd); - struct stmp3xxx_wdt_pdata *pdata = dev->platform_data; + struct stmp3xxx_wdt_pdata *pdata = dev_get_platdata(dev); pdata->wdt_set_timeout(dev->parent, wdd->timeout * WDOG_TICK_RATE); return 0; @@ -39,7 +37,7 @@ static int wdt_stop(struct watchdog_device *wdd) { struct device *dev = watchdog_get_drvdata(wdd); - struct stmp3xxx_wdt_pdata *pdata = dev->platform_data; + struct stmp3xxx_wdt_pdata *pdata = dev_get_platdata(dev); pdata->wdt_set_timeout(dev->parent, 0); return 0; @@ -78,6 +76,7 @@ watchdog_set_drvdata(&stmp3xxx_wdd, &pdev->dev); stmp3xxx_wdd.timeout = clamp_t(unsigned, heartbeat, 1, STMP3XXX_MAX_TIMEOUT); + stmp3xxx_wdd.parent = &pdev->dev; ret = watchdog_register_device(&stmp3xxx_wdd); if (ret < 0) { @@ -96,9 +95,33 @@ return 0; } +static int __maybe_unused stmp3xxx_wdt_suspend(struct device *dev) +{ + struct watchdog_device *wdd = &stmp3xxx_wdd; + + if (watchdog_active(wdd)) + return wdt_stop(wdd); + + return 0; +} + +static int __maybe_unused stmp3xxx_wdt_resume(struct device *dev) +{ + struct watchdog_device *wdd = &stmp3xxx_wdd; + + if (watchdog_active(wdd)) + return wdt_start(wdd); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(stmp3xxx_wdt_pm_ops, + stmp3xxx_wdt_suspend, stmp3xxx_wdt_resume); + static struct platform_driver stmp3xxx_wdt_driver = { .driver = { .name = "stmp3xxx_rtc_wdt", + .pm = &stmp3xxx_wdt_pm_ops, }, .probe = stmp3xxx_wdt_probe, .remove = stmp3xxx_wdt_remove, @@ -107,5 +130,4 @@ MODULE_DESCRIPTION("STMP3XXX RTC Watchdog Driver"); MODULE_LICENSE("GPL v2"); -MODULE_AUTHOR("Wolfram Sang "); -MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); +MODULE_AUTHOR("Wolfram Sang ");