hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/watchdog/max77620_wdt.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Maxim MAX77620 Watchdog Driver
34 *
45 * Copyright (C) 2016 NVIDIA CORPORATION. All rights reserved.
56 *
67 * Author: Laxman Dewangan <ldewangan@nvidia.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #include <linux/err.h>
....@@ -112,17 +109,18 @@
112109
113110 static int max77620_wdt_probe(struct platform_device *pdev)
114111 {
112
+ struct device *dev = &pdev->dev;
115113 struct max77620_wdt *wdt;
116114 struct watchdog_device *wdt_dev;
117115 unsigned int regval;
118116 int ret;
119117
120
- wdt = devm_kzalloc(&pdev->dev, sizeof(*wdt), GFP_KERNEL);
118
+ wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
121119 if (!wdt)
122120 return -ENOMEM;
123121
124
- wdt->dev = &pdev->dev;
125
- wdt->rmap = dev_get_regmap(pdev->dev.parent, NULL);
122
+ wdt->dev = dev;
123
+ wdt->rmap = dev_get_regmap(dev->parent, NULL);
126124 if (!wdt->rmap) {
127125 dev_err(wdt->dev, "Failed to get parent regmap\n");
128126 return -ENODEV;
....@@ -183,23 +181,8 @@
183181 watchdog_set_nowayout(wdt_dev, nowayout);
184182 watchdog_set_drvdata(wdt_dev, wdt);
185183
186
- ret = watchdog_register_device(wdt_dev);
187
- if (ret < 0) {
188
- dev_err(&pdev->dev, "watchdog registration failed: %d\n", ret);
189
- return ret;
190
- }
191
-
192
- return 0;
193
-}
194
-
195
-static int max77620_wdt_remove(struct platform_device *pdev)
196
-{
197
- struct max77620_wdt *wdt = platform_get_drvdata(pdev);
198
-
199
- max77620_wdt_stop(&wdt->wdt_dev);
200
- watchdog_unregister_device(&wdt->wdt_dev);
201
-
202
- return 0;
184
+ watchdog_stop_on_unregister(wdt_dev);
185
+ return devm_watchdog_register_device(dev, wdt_dev);
203186 }
204187
205188 static const struct platform_device_id max77620_wdt_devtype[] = {
....@@ -213,7 +196,6 @@
213196 .name = "max77620-watchdog",
214197 },
215198 .probe = max77620_wdt_probe,
216
- .remove = max77620_wdt_remove,
217199 .id_table = max77620_wdt_devtype,
218200 };
219201