.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Driver for watchdog device controlled through GPIO-line |
---|
3 | 4 | * |
---|
4 | 5 | * Author: 2013, Alexander Shiyan <shc_work@mail.ru> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
9 | | - * (at your option) any later version. |
---|
10 | 6 | */ |
---|
11 | 7 | |
---|
12 | 8 | #include <linux/err.h> |
---|
.. | .. |
---|
16 | 12 | #include <linux/of.h> |
---|
17 | 13 | #include <linux/platform_device.h> |
---|
18 | 14 | #include <linux/watchdog.h> |
---|
| 15 | + |
---|
| 16 | +static bool nowayout = WATCHDOG_NOWAYOUT; |
---|
| 17 | +module_param(nowayout, bool, 0); |
---|
| 18 | +MODULE_PARM_DESC(nowayout, |
---|
| 19 | + "Watchdog cannot be stopped once started (default=" |
---|
| 20 | + __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); |
---|
19 | 21 | |
---|
20 | 22 | #define SOFT_TIMEOUT_MIN 1 |
---|
21 | 23 | #define SOFT_TIMEOUT_DEF 60 |
---|
.. | .. |
---|
154 | 156 | priv->wdd.parent = dev; |
---|
155 | 157 | priv->wdd.timeout = SOFT_TIMEOUT_DEF; |
---|
156 | 158 | |
---|
157 | | - watchdog_init_timeout(&priv->wdd, 0, &pdev->dev); |
---|
| 159 | + watchdog_init_timeout(&priv->wdd, 0, dev); |
---|
| 160 | + watchdog_set_nowayout(&priv->wdd, nowayout); |
---|
158 | 161 | |
---|
159 | 162 | watchdog_stop_on_reboot(&priv->wdd); |
---|
160 | 163 | |
---|
161 | 164 | if (priv->always_running) |
---|
162 | 165 | gpio_wdt_start(&priv->wdd); |
---|
163 | 166 | |
---|
164 | | - ret = watchdog_register_device(&priv->wdd); |
---|
165 | | - |
---|
166 | | - return ret; |
---|
167 | | -} |
---|
168 | | - |
---|
169 | | -static int gpio_wdt_remove(struct platform_device *pdev) |
---|
170 | | -{ |
---|
171 | | - struct gpio_wdt_priv *priv = platform_get_drvdata(pdev); |
---|
172 | | - |
---|
173 | | - watchdog_unregister_device(&priv->wdd); |
---|
174 | | - |
---|
175 | | - return 0; |
---|
| 167 | + return devm_watchdog_register_device(dev, &priv->wdd); |
---|
176 | 168 | } |
---|
177 | 169 | |
---|
178 | 170 | static const struct of_device_id gpio_wdt_dt_ids[] = { |
---|
.. | .. |
---|
187 | 179 | .of_match_table = gpio_wdt_dt_ids, |
---|
188 | 180 | }, |
---|
189 | 181 | .probe = gpio_wdt_probe, |
---|
190 | | - .remove = gpio_wdt_remove, |
---|
191 | 182 | }; |
---|
192 | 183 | |
---|
193 | 184 | #ifdef CONFIG_GPIO_WATCHDOG_ARCH_INITCALL |
---|