hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/watchdog/meson_wdt.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Meson Watchdog Driver
34 *
45 * Copyright (c) 2014 Carlo Caione
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version
9
- * 2 of the License, or (at your option) any later version.
106 */
117
128 #include <linux/clk.h>
....@@ -164,28 +160,27 @@
164160
165161 static int meson_wdt_probe(struct platform_device *pdev)
166162 {
167
- struct resource *res;
163
+ struct device *dev = &pdev->dev;
168164 struct meson_wdt_dev *meson_wdt;
169165 const struct of_device_id *of_id;
170166 int err;
171167
172
- meson_wdt = devm_kzalloc(&pdev->dev, sizeof(*meson_wdt), GFP_KERNEL);
168
+ meson_wdt = devm_kzalloc(dev, sizeof(*meson_wdt), GFP_KERNEL);
173169 if (!meson_wdt)
174170 return -ENOMEM;
175171
176
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
177
- meson_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res);
172
+ meson_wdt->wdt_base = devm_platform_ioremap_resource(pdev, 0);
178173 if (IS_ERR(meson_wdt->wdt_base))
179174 return PTR_ERR(meson_wdt->wdt_base);
180175
181
- of_id = of_match_device(meson_wdt_dt_ids, &pdev->dev);
176
+ of_id = of_match_device(meson_wdt_dt_ids, dev);
182177 if (!of_id) {
183
- dev_err(&pdev->dev, "Unable to initialize WDT data\n");
178
+ dev_err(dev, "Unable to initialize WDT data\n");
184179 return -ENODEV;
185180 }
186181 meson_wdt->data = of_id->data;
187182
188
- meson_wdt->wdt_dev.parent = &pdev->dev;
183
+ meson_wdt->wdt_dev.parent = dev;
189184 meson_wdt->wdt_dev.info = &meson_wdt_info;
190185 meson_wdt->wdt_dev.ops = &meson_wdt_ops;
191186 meson_wdt->wdt_dev.max_timeout =
....@@ -197,18 +192,18 @@
197192
198193 watchdog_set_drvdata(&meson_wdt->wdt_dev, meson_wdt);
199194
200
- watchdog_init_timeout(&meson_wdt->wdt_dev, timeout, &pdev->dev);
195
+ watchdog_init_timeout(&meson_wdt->wdt_dev, timeout, dev);
201196 watchdog_set_nowayout(&meson_wdt->wdt_dev, nowayout);
202197 watchdog_set_restart_priority(&meson_wdt->wdt_dev, 128);
203198
204199 meson_wdt_stop(&meson_wdt->wdt_dev);
205200
206201 watchdog_stop_on_reboot(&meson_wdt->wdt_dev);
207
- err = devm_watchdog_register_device(&pdev->dev, &meson_wdt->wdt_dev);
202
+ err = devm_watchdog_register_device(dev, &meson_wdt->wdt_dev);
208203 if (err)
209204 return err;
210205
211
- dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)",
206
+ dev_info(dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)",
212207 meson_wdt->wdt_dev.timeout, nowayout);
213208
214209 return 0;