.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * sunxi Watchdog Driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (c) 2013 Carlo Caione |
---|
5 | 6 | * 2012 Henrik Nordstrom |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or |
---|
8 | | - * modify it under the terms of the GNU General Public License |
---|
9 | | - * as published by the Free Software Foundation; either version |
---|
10 | | - * 2 of the License, or (at your option) any later version. |
---|
11 | 7 | * |
---|
12 | 8 | * Based on xen_wdt.c |
---|
13 | 9 | * (c) Copyright 2010 Novell, Inc. |
---|
.. | .. |
---|
233 | 229 | |
---|
234 | 230 | static int sunxi_wdt_probe(struct platform_device *pdev) |
---|
235 | 231 | { |
---|
| 232 | + struct device *dev = &pdev->dev; |
---|
236 | 233 | struct sunxi_wdt_dev *sunxi_wdt; |
---|
237 | | - struct resource *res; |
---|
238 | 234 | int err; |
---|
239 | 235 | |
---|
240 | | - sunxi_wdt = devm_kzalloc(&pdev->dev, sizeof(*sunxi_wdt), GFP_KERNEL); |
---|
| 236 | + sunxi_wdt = devm_kzalloc(dev, sizeof(*sunxi_wdt), GFP_KERNEL); |
---|
241 | 237 | if (!sunxi_wdt) |
---|
242 | | - return -EINVAL; |
---|
| 238 | + return -ENOMEM; |
---|
243 | 239 | |
---|
244 | | - sunxi_wdt->wdt_regs = of_device_get_match_data(&pdev->dev); |
---|
| 240 | + sunxi_wdt->wdt_regs = of_device_get_match_data(dev); |
---|
245 | 241 | if (!sunxi_wdt->wdt_regs) |
---|
246 | 242 | return -ENODEV; |
---|
247 | 243 | |
---|
248 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
249 | | - sunxi_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res); |
---|
| 244 | + sunxi_wdt->wdt_base = devm_platform_ioremap_resource(pdev, 0); |
---|
250 | 245 | if (IS_ERR(sunxi_wdt->wdt_base)) |
---|
251 | 246 | return PTR_ERR(sunxi_wdt->wdt_base); |
---|
252 | 247 | |
---|
.. | .. |
---|
255 | 250 | sunxi_wdt->wdt_dev.timeout = WDT_MAX_TIMEOUT; |
---|
256 | 251 | sunxi_wdt->wdt_dev.max_timeout = WDT_MAX_TIMEOUT; |
---|
257 | 252 | sunxi_wdt->wdt_dev.min_timeout = WDT_MIN_TIMEOUT; |
---|
258 | | - sunxi_wdt->wdt_dev.parent = &pdev->dev; |
---|
| 253 | + sunxi_wdt->wdt_dev.parent = dev; |
---|
259 | 254 | |
---|
260 | | - watchdog_init_timeout(&sunxi_wdt->wdt_dev, timeout, &pdev->dev); |
---|
| 255 | + watchdog_init_timeout(&sunxi_wdt->wdt_dev, timeout, dev); |
---|
261 | 256 | watchdog_set_nowayout(&sunxi_wdt->wdt_dev, nowayout); |
---|
262 | 257 | watchdog_set_restart_priority(&sunxi_wdt->wdt_dev, 128); |
---|
263 | 258 | |
---|
.. | .. |
---|
266 | 261 | sunxi_wdt_stop(&sunxi_wdt->wdt_dev); |
---|
267 | 262 | |
---|
268 | 263 | watchdog_stop_on_reboot(&sunxi_wdt->wdt_dev); |
---|
269 | | - err = devm_watchdog_register_device(&pdev->dev, &sunxi_wdt->wdt_dev); |
---|
| 264 | + err = devm_watchdog_register_device(dev, &sunxi_wdt->wdt_dev); |
---|
270 | 265 | if (unlikely(err)) |
---|
271 | 266 | return err; |
---|
272 | 267 | |
---|
273 | | - dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)", |
---|
274 | | - sunxi_wdt->wdt_dev.timeout, nowayout); |
---|
| 268 | + dev_info(dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)", |
---|
| 269 | + sunxi_wdt->wdt_dev.timeout, nowayout); |
---|
275 | 270 | |
---|
276 | 271 | return 0; |
---|
277 | 272 | } |
---|