Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
From: Christophe Leroy <christophe.leroy@c-s.fr>
To: Guenter Roeck <linux@roeck-us.net>,
	Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 21/22] watchdog: mpc8xxx_wdt: Convert to use device managed functions and other improvements
Date: Tue, 23 Apr 2019 15:28:06 +0200
Message-ID: <3631a90f-7c77-d2c2-ef68-01f9daf40ae6@c-s.fr> (raw)
In-Reply-To: <1554913683-25454-22-git-send-email-linux@roeck-us.net>



Le 10/04/2019 à 18:28, Guenter Roeck a écrit :
> Use device managed functions to simplify error handling, reduce
> source code size, improve readability, and reduce the likelyhood of bugs.
> Other improvements as listed below.
> 
> The conversion was done automatically with coccinelle using the
> following semantic patches. The semantic patches and the scripts
> used to generate this commit log are available at
> https://github.com/groeck/coccinelle-patches
> 
> - Drop assignments to otherwise unused variables
> - Drop empty remove function
>    This also drops the inaccurate message on remove; the driver won't be
>    removed if the hardware watchdog is running, no matter if the watchdog
>    device is open or not.
> - Use local variable 'struct device *dev' consistently
> - Use devm_watchdog_register_driver() to register watchdog device
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Reviewed-by: Christophe Leroy <christophe.leroy@c-s.fr>

> ---
>   drivers/watchdog/mpc8xxx_wdt.c | 17 +++--------------
>   1 file changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
> index 3b5b446b690c..9b6d6a5a27ad 100644
> --- a/drivers/watchdog/mpc8xxx_wdt.c
> +++ b/drivers/watchdog/mpc8xxx_wdt.c
> @@ -204,9 +204,10 @@ 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);
> +	ret = devm_watchdog_register_device(dev, &ddata->wdd);
>   	if (ret) {
> -		dev_err(dev, "cannot register watchdog device (err=%d)\n", ret);
> +		dev_err(dev, "cannot register watchdog device (err=%d)\n",
> +			ret);
>   		return ret;
>   	}
>   
> @@ -218,17 +219,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",
> @@ -259,7 +249,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,
> 

  reply index

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10 16:27 [PATCH 00/22] watchdog: Expand use of device managed functions (series 3 of 3) Guenter Roeck
2019-04-10 16:27 ` [PATCH 01/22] watchdog: tegra_wdt: Use watchdog_stop_on_unregister and other improvements Guenter Roeck
2019-04-10 16:27 ` [PATCH 02/22] watchdog: tqmx86_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-10 16:27 ` [PATCH 03/22] watchdog: ts4800_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-10 16:27 ` [PATCH 04/22] watchdog: ts72xx_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-10 16:27 ` [PATCH 05/22] watchdog: twl4030_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-10 16:27 ` [PATCH 06/22] watchdog: uniphier_wdt: drop platform_set_drvdata Guenter Roeck
2019-04-10 16:27 ` [PATCH 07/22] watchdog: wdat_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-10 16:27 ` [PATCH 08/22] watchdog: wm831x_wdt: " Guenter Roeck
2019-04-10 16:27 ` [PATCH 09/22] watchdog: xen_wdt: " Guenter Roeck
2019-04-10 16:27 ` [PATCH 10/22] watchdog: imx_sc_wdt: " Guenter Roeck
2019-04-11  8:48   ` Shawn Guo
2019-04-10 16:27 ` [PATCH 11/22] watchdog: sbsa_gwdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-10 16:27 ` [PATCH 12/22] watchdog: zx2967_wdt: " Guenter Roeck
2019-04-11  8:53   ` Shawn Guo
2019-04-10 16:27 ` [PATCH 13/22] watchdog: stm32_iwdg: " Guenter Roeck
2019-04-10 16:27 ` [PATCH 14/22] watchdog: ux500_wdt: " Guenter Roeck
2019-04-10 16:27 ` [PATCH 15/22] watchdog: pic32-dmt: " Guenter Roeck
2019-04-10 16:27 ` [PATCH 16/22] watchdog: pic32-wdt: " Guenter Roeck
2019-04-10 16:27 ` [PATCH 17/22] watchdog: loongson1_wdt: " Guenter Roeck
2019-04-10 16:27 ` [PATCH 18/22] watchdog: mt7621_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-10 18:46   ` Joe Perches
2019-04-10 19:54     ` Guenter Roeck
2019-04-10 22:10       ` Joe Perches
2019-04-10 22:15         ` Guenter Roeck
2019-04-10 16:28 ` [PATCH 19/22] watchdog: rt2880_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-10 16:28 ` [PATCH 20/22] watchdog: jz4740_wdt: Use 'dev' instead of dereferencing it repeatedly Guenter Roeck
2019-04-10 16:52   ` Joe Perches
2019-04-10 17:47     ` Guenter Roeck
2019-04-10 16:28 ` [PATCH 21/22] watchdog: mpc8xxx_wdt: Convert to use device managed functions and other improvements Guenter Roeck
2019-04-23 13:28   ` Christophe Leroy [this message]
2019-04-10 16:28 ` [PATCH 22/22] watchdog: pnx4008_wdt: " Guenter Roeck

Reply instructions:

You may reply publically 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=3631a90f-7c77-d2c2-ef68-01f9daf40ae6@c-s.fr \
    --to=christophe.leroy@c-s.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=wim@linux-watchdog.org \
    /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

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org
	public-inbox-index linux-watchdog

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git