From: Guenter Roeck <linux@roeck-us.net>
To: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Wim Van Sebroeck" <wim@iguana.be>
Cc: kernel@pengutronix.de, linux-watchdog@vger.kernel.org
Subject: Re: [PATCH v2 4/7] watchdog: mpc8xxx: use devm_ioremap_resource to map memory
Date: Wed, 12 Aug 2015 03:18:52 -0700 [thread overview]
Message-ID: <55CB1D8C.3080803@roeck-us.net> (raw)
In-Reply-To: <1439367358-5338-5-git-send-email-u.kleine-koenig@pengutronix.de>
On 08/12/2015 01:15 AM, Uwe Kleine-König wrote:
> This simplifies the error paths and device unbinding.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/mpc8xxx_wdt.c | 19 +++++++------------
> 1 file changed, 7 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
> index fb1fe967cf57..a6790fcfa69b 100644
> --- a/drivers/watchdog/mpc8xxx_wdt.c
> +++ b/drivers/watchdog/mpc8xxx_wdt.c
> @@ -142,8 +142,7 @@ static struct watchdog_device mpc8xxx_wdt_dev = {
> static int mpc8xxx_wdt_probe(struct platform_device *ofdev)
> {
> int ret;
> - const struct of_device_id *match;
> - struct device_node *np = ofdev->dev.of_node;
> + struct resource *res;
> const struct mpc8xxx_wdt_type *wdt_type;
> u32 freq = fsl_get_sys_freq();
> bool enabled;
> @@ -156,15 +155,15 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev)
> if (!freq || freq == -1)
> return -EINVAL;
>
> - wd_base = of_iomap(np, 0);
> - if (!wd_base)
> - return -ENOMEM;
> + res = platform_get_resource(ofdev, IORESOURCE_MEM, 0);
> + wd_base = devm_ioremap_resource(&ofdev->dev, res);
> + if (IS_ERR(wd_base))
> + return PTR_ERR(wd_base);
>
> enabled = in_be32(&wd_base->swcrr) & SWCRR_SWEN;
> if (!enabled && wdt_type->hw_enabled) {
> pr_info("could not be enabled in software\n");
> - ret = -ENOSYS;
> - goto err_unmap;
> + return -ENOSYS;
> }
>
> /* Calculate the timeout in seconds */
> @@ -177,7 +176,7 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev)
> ret = watchdog_register_device(&mpc8xxx_wdt_dev);
> if (ret) {
> pr_err("cannot register watchdog device (err=%d)\n", ret);
> - goto err_unmap;
> + return ret;
> }
>
> pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d (%d seconds)\n",
> @@ -191,9 +190,6 @@ static int mpc8xxx_wdt_probe(struct platform_device *ofdev)
> if (enabled)
> mod_timer(&wdt_timer, jiffies);
> return 0;
> -err_unmap:
> - iounmap(wd_base);
> - return ret;
> }
>
> static int mpc8xxx_wdt_remove(struct platform_device *ofdev)
> @@ -202,7 +198,6 @@ static int mpc8xxx_wdt_remove(struct platform_device *ofdev)
> reset ? "reset" : "machine check exception");
> del_timer_sync(&wdt_timer);
> watchdog_unregister_device(&mpc8xxx_wdt_dev);
> - iounmap(wd_base);
>
> return 0;
> }
>
next prev parent reply other threads:[~2015-08-12 10:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 8:15 [PATCH v2 0/7] watchdog: mpc8xxx: several cleanups Uwe Kleine-König
2015-08-12 8:15 ` [PATCH v2 1/7] watchdog: mpc8xxx: remove dead code Uwe Kleine-König
2015-08-12 8:15 ` [PATCH v2 2/7] watchdog: mpc8xxx: simplify registration Uwe Kleine-König
2015-08-12 8:15 ` [PATCH v2 3/7] watchdog: mpc8xxx: make use of of_device_get_match_data Uwe Kleine-König
2015-08-12 10:16 ` Guenter Roeck
2015-08-12 8:15 ` [PATCH v2 4/7] watchdog: mpc8xxx: use devm_ioremap_resource to map memory Uwe Kleine-König
2015-08-12 10:18 ` Guenter Roeck [this message]
2015-08-12 8:15 ` [PATCH v2 5/7] watchdog: mpc8xxx: use dynamic memory for device specific data Uwe Kleine-König
2015-08-12 10:21 ` Guenter Roeck
2015-08-12 8:15 ` [PATCH v2 6/7] watchdog: mpc8xxx: use better error code when watchdog cannot be enabled Uwe Kleine-König
2015-08-12 10:21 ` Guenter Roeck
2015-08-12 8:15 ` [PATCH v2 7/7] watchdog: mpc8xxx: allow to compile for MPC512x Uwe Kleine-König
2015-08-12 10:22 ` Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55CB1D8C.3080803@roeck-us.net \
--to=linux@roeck-us.net \
--cc=kernel@pengutronix.de \
--cc=linux-watchdog@vger.kernel.org \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wim@iguana.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.