| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Meson Watchdog Driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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. |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | |
|---|
| 12 | 8 | #include <linux/clk.h> |
|---|
| .. | .. |
|---|
| 164 | 160 | |
|---|
| 165 | 161 | static int meson_wdt_probe(struct platform_device *pdev) |
|---|
| 166 | 162 | { |
|---|
| 167 | | - struct resource *res; |
|---|
| 163 | + struct device *dev = &pdev->dev; |
|---|
| 168 | 164 | struct meson_wdt_dev *meson_wdt; |
|---|
| 169 | 165 | const struct of_device_id *of_id; |
|---|
| 170 | 166 | int err; |
|---|
| 171 | 167 | |
|---|
| 172 | | - meson_wdt = devm_kzalloc(&pdev->dev, sizeof(*meson_wdt), GFP_KERNEL); |
|---|
| 168 | + meson_wdt = devm_kzalloc(dev, sizeof(*meson_wdt), GFP_KERNEL); |
|---|
| 173 | 169 | if (!meson_wdt) |
|---|
| 174 | 170 | return -ENOMEM; |
|---|
| 175 | 171 | |
|---|
| 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); |
|---|
| 178 | 173 | if (IS_ERR(meson_wdt->wdt_base)) |
|---|
| 179 | 174 | return PTR_ERR(meson_wdt->wdt_base); |
|---|
| 180 | 175 | |
|---|
| 181 | | - of_id = of_match_device(meson_wdt_dt_ids, &pdev->dev); |
|---|
| 176 | + of_id = of_match_device(meson_wdt_dt_ids, dev); |
|---|
| 182 | 177 | if (!of_id) { |
|---|
| 183 | | - dev_err(&pdev->dev, "Unable to initialize WDT data\n"); |
|---|
| 178 | + dev_err(dev, "Unable to initialize WDT data\n"); |
|---|
| 184 | 179 | return -ENODEV; |
|---|
| 185 | 180 | } |
|---|
| 186 | 181 | meson_wdt->data = of_id->data; |
|---|
| 187 | 182 | |
|---|
| 188 | | - meson_wdt->wdt_dev.parent = &pdev->dev; |
|---|
| 183 | + meson_wdt->wdt_dev.parent = dev; |
|---|
| 189 | 184 | meson_wdt->wdt_dev.info = &meson_wdt_info; |
|---|
| 190 | 185 | meson_wdt->wdt_dev.ops = &meson_wdt_ops; |
|---|
| 191 | 186 | meson_wdt->wdt_dev.max_timeout = |
|---|
| .. | .. |
|---|
| 197 | 192 | |
|---|
| 198 | 193 | watchdog_set_drvdata(&meson_wdt->wdt_dev, meson_wdt); |
|---|
| 199 | 194 | |
|---|
| 200 | | - watchdog_init_timeout(&meson_wdt->wdt_dev, timeout, &pdev->dev); |
|---|
| 195 | + watchdog_init_timeout(&meson_wdt->wdt_dev, timeout, dev); |
|---|
| 201 | 196 | watchdog_set_nowayout(&meson_wdt->wdt_dev, nowayout); |
|---|
| 202 | 197 | watchdog_set_restart_priority(&meson_wdt->wdt_dev, 128); |
|---|
| 203 | 198 | |
|---|
| 204 | 199 | meson_wdt_stop(&meson_wdt->wdt_dev); |
|---|
| 205 | 200 | |
|---|
| 206 | 201 | 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); |
|---|
| 208 | 203 | if (err) |
|---|
| 209 | 204 | return err; |
|---|
| 210 | 205 | |
|---|
| 211 | | - dev_info(&pdev->dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)", |
|---|
| 206 | + dev_info(dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)", |
|---|
| 212 | 207 | meson_wdt->wdt_dev.timeout, nowayout); |
|---|
| 213 | 208 | |
|---|
| 214 | 209 | return 0; |
|---|