linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Jisheng Zhang <Jisheng.Zhang@synaptics.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: "linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] watchdog: dw: use devm_watchdog_register_device()
Date: Fri, 25 Jan 2019 00:04:25 -0800	[thread overview]
Message-ID: <b521625b-ffff-ba49-77d7-018ad363db36@roeck-us.net> (raw)
In-Reply-To: <20190125154604.66801c6a@xhacker.debian>

Hi,

On 1/24/19 11:52 PM, Jisheng Zhang wrote:
> Use devm_watchdog_register_device() to simplify the code.
> 
> Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
> ---
>   drivers/watchdog/dw_wdt.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index 501aebb5b81f..c053c2de5c2f 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -303,7 +303,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
>   
>   	watchdog_set_restart_priority(wdd, 128);
>   
> -	ret = watchdog_register_device(wdd);
> +	ret = devm_watchdog_register_device(wdd);
>   	if (ret)
>   		goto out_disable_clk;
>   
> @@ -318,7 +318,6 @@ static int dw_wdt_drv_remove(struct platform_device *pdev)
>   {
>   	struct dw_wdt *dw_wdt = platform_get_drvdata(pdev);
>   
> -	watchdog_unregister_device(&dw_wdt->wdd);
>   	reset_control_assert(dw_wdt->rst);
>   	clk_disable_unprepare(dw_wdt->clk);
>   
> 
Unfortunately it isn't that easy. The other two calls have to be executed after
unregistering the watchdog, meaning you would have to add devm_add_action()
in the probe function to call them.

Guenter

  reply	other threads:[~2019-01-25  8:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25  7:52 [PATCH] watchdog: dw: use devm_watchdog_register_device() Jisheng Zhang
2019-01-25  8:04 ` Guenter Roeck [this message]
2019-01-25  8:17   ` Jisheng Zhang
2019-01-25  9:01     ` 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=b521625b-ffff-ba49-77d7-018ad363db36@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=Jisheng.Zhang@synaptics.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).