diff options
Diffstat (limited to 'drivers/watchdog/mpc8xxx_wdt.c')
| -rw-r--r-- | drivers/watchdog/mpc8xxx_wdt.c | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c index 069072e6747d..a4b497ecfa20 100644 --- a/drivers/watchdog/mpc8xxx_wdt.c +++ b/drivers/watchdog/mpc8xxx_wdt.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* * mpc8xxx_wdt.c - MPC8xx/MPC83xx/MPC86xx watchdog userspace interface * @@ -10,18 +11,13 @@ * * Note: it appears that you can only actually ENABLE or DISABLE the thing * once after POR. Once enabled, you cannot disable, and vice versa. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. */ #include <linux/fs.h> #include <linux/init.h> #include <linux/kernel.h> -#include <linux/of_address.h> -#include <linux/of_platform.h> +#include <linux/of.h> +#include <linux/platform_device.h> #include <linux/module.h> #include <linux/watchdog.h> #include <linux/io.h> @@ -104,6 +100,8 @@ static int mpc8xxx_wdt_start(struct watchdog_device *w) ddata->swtc = tmp >> 16; set_bit(WDOG_HW_RUNNING, &ddata->wdd.status); + mpc8xxx_wdt_keepalive(ddata); + return 0; } @@ -122,7 +120,7 @@ static struct watchdog_info mpc8xxx_wdt_info = { .identity = "MPC8xxx", }; -static struct watchdog_ops mpc8xxx_wdt_ops = { +static const struct watchdog_ops mpc8xxx_wdt_ops = { .owner = THIS_MODULE, .start = mpc8xxx_wdt_start, .ping = mpc8xxx_wdt_ping, @@ -149,8 +147,7 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev) if (!ddata) return -ENOMEM; - res = platform_get_resource(ofdev, IORESOURCE_MEM, 0); - ddata->base = devm_ioremap_resource(dev, res); + ddata->base = devm_platform_ioremap_resource(ofdev, 0); if (IS_ERR(ddata->base)) return PTR_ERR(ddata->base); @@ -180,8 +177,8 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev) spin_lock_init(&ddata->lock); - ddata->wdd.info = &mpc8xxx_wdt_info, - ddata->wdd.ops = &mpc8xxx_wdt_ops, + ddata->wdd.info = &mpc8xxx_wdt_info; + ddata->wdd.ops = &mpc8xxx_wdt_ops; ddata->wdd.timeout = WATCHDOG_TIMEOUT; watchdog_init_timeout(&ddata->wdd, timeout, dev); @@ -205,11 +202,9 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev) if (ddata->wdd.timeout < ddata->wdd.min_timeout) ddata->wdd.timeout = ddata->wdd.min_timeout; - ret = watchdog_register_device(&ddata->wdd); - if (ret) { - dev_err(dev, "cannot register watchdog device (err=%d)\n", ret); + ret = devm_watchdog_register_device(dev, &ddata->wdd); + if (ret) return ret; - } dev_info(dev, "WDT driver for MPC8xxx initialized. mode:%s timeout=%d sec\n", @@ -219,17 +214,6 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev) return 0; } -static int mpc8xxx_wdt_remove(struct platform_device *ofdev) -{ - struct mpc8xxx_wdt_ddata *ddata = platform_get_drvdata(ofdev); - - dev_crit(&ofdev->dev, "Watchdog removed, expect the %s soon!\n", - reset ? "reset" : "machine check exception"); - watchdog_unregister_device(&ddata->wdd); - - return 0; -} - static const struct of_device_id mpc8xxx_wdt_match[] = { { .compatible = "mpc83xx_wdt", @@ -260,7 +244,6 @@ MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match); static struct platform_driver mpc8xxx_wdt_driver = { .probe = mpc8xxx_wdt_probe, - .remove = mpc8xxx_wdt_remove, .driver = { .name = "mpc8xxx_wdt", .of_match_table = mpc8xxx_wdt_match, |
