hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/watchdog/gpio_wdt.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Driver for watchdog device controlled through GPIO-line
34 *
45 * 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.
106 */
117
128 #include <linux/err.h>
....@@ -16,6 +12,12 @@
1612 #include <linux/of.h>
1713 #include <linux/platform_device.h>
1814 #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) ")");
1921
2022 #define SOFT_TIMEOUT_MIN 1
2123 #define SOFT_TIMEOUT_DEF 60
....@@ -154,25 +156,15 @@
154156 priv->wdd.parent = dev;
155157 priv->wdd.timeout = SOFT_TIMEOUT_DEF;
156158
157
- watchdog_init_timeout(&priv->wdd, 0, &pdev->dev);
159
+ watchdog_init_timeout(&priv->wdd, 0, dev);
160
+ watchdog_set_nowayout(&priv->wdd, nowayout);
158161
159162 watchdog_stop_on_reboot(&priv->wdd);
160163
161164 if (priv->always_running)
162165 gpio_wdt_start(&priv->wdd);
163166
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);
176168 }
177169
178170 static const struct of_device_id gpio_wdt_dt_ids[] = {
....@@ -187,7 +179,6 @@
187179 .of_match_table = gpio_wdt_dt_ids,
188180 },
189181 .probe = gpio_wdt_probe,
190
- .remove = gpio_wdt_remove,
191182 };
192183
193184 #ifdef CONFIG_GPIO_WATCHDOG_ARCH_INITCALL