mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Srinivas Neeli <srinivas.neeli@amd.com>,
	shubhrajyoti.datta@amd.com, michal.simek@amd.com,
	wim@linux-watchdog.org, linux@roeck-us.ne,
	christophe.jaillet@wanadoo.fr
Cc: linux-watchdog@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, git@amd.com,
	neelisrinivas18@gmail.com
Subject: Re: [PATCH] watchdog: of_xilinx_wdt: Remove unnecessary clock disable call in the remove path
Date: Mon, 28 Aug 2023 02:37:36 -0700	[thread overview]
Message-ID: <09d7be2d-c3ee-286c-7035-5a253d033278@roeck-us.net> (raw)
In-Reply-To: <20230828092044.3597916-1-srinivas.neeli@amd.com>

On 8/28/23 02:20, Srinivas Neeli wrote:
> There is a mismatch in axi clock enable and disable calls.
> The axi clock is enabled and disabled by the probe function,
> then it is again disabled in the remove path.
> So observed the call trace while removing the module.
> Use the clk_enable() and devm_clk_get_prepared() functions
> instead of devm_clk_get_enable() to avoid an extra clock disable
> call from the remove path.
> 
>   Call trace:
>    clk_core_disable+0xb0/0xc0
>    clk_disable+0x30/0x4c
>    clk_disable_unprepare+0x18/0x30
>    devm_clk_release+0x24/0x40
>    devres_release_all+0xc8/0x190
>    device_unbind_cleanup+0x18/0x6c
>    device_release_driver_internal+0x20c/0x250
>    device_release_driver+0x18/0x24
>    bus_remove_device+0x124/0x130
>    device_del+0x174/0x440
> 
> Fixes: 4de0224c6fbe ("watchdog: of_xilinx_wdt: Use devm_clk_get_enabled() helper")
> Signed-off-by: Srinivas Neeli <srinivas.neeli@amd.com>
> ---
>   drivers/watchdog/of_xilinx_wdt.c | 12 +++++++++---
>   1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c
> index 05657dc1d36a..777272f7d326 100644
> --- a/drivers/watchdog/of_xilinx_wdt.c
> +++ b/drivers/watchdog/of_xilinx_wdt.c
> @@ -187,7 +187,7 @@ static int xwdt_probe(struct platform_device *pdev)
>   
>   	watchdog_set_nowayout(xilinx_wdt_wdd, enable_once);
>   
> -	xdev->clk = devm_clk_get_enabled(dev, NULL);
> +	xdev->clk = devm_clk_get_prepared(dev, NULL);
>   	if (IS_ERR(xdev->clk)) {
>   		if (PTR_ERR(xdev->clk) != -ENOENT)
>   			return PTR_ERR(xdev->clk);
> @@ -218,18 +218,24 @@ static int xwdt_probe(struct platform_device *pdev)
>   	spin_lock_init(&xdev->spinlock);
>   	watchdog_set_drvdata(xilinx_wdt_wdd, xdev);
>   
> +	rc = clk_enable(xdev->clk);
> +	if (rc) {
> +		dev_err(dev, "unable to enable clock\n");
> +		return rc;
> +	}
> +
>   	rc = xwdt_selftest(xdev);
>   	if (rc == XWT_TIMER_FAILED) {
>   		dev_err(dev, "SelfTest routine error\n");

Needs clk_disable() here as well.

Guenter

>   		return rc;
>   	}
>   
> +	clk_disable(xdev->clk);
> +
>   	rc = devm_watchdog_register_device(dev, xilinx_wdt_wdd);
>   	if (rc)
>   		return rc;
>   
> -	clk_disable(xdev->clk);
> -
>   	dev_info(dev, "Xilinx Watchdog Timer with timeout %ds\n",
>   		 xilinx_wdt_wdd->timeout);
>   


      reply	other threads:[~2023-08-28  9:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-28  9:20 Srinivas Neeli
2023-08-28  9:37 ` Guenter Roeck [this message]

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=09d7be2d-c3ee-286c-7035-5a253d033278@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=git@amd.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.ne \
    --cc=michal.simek@amd.com \
    --cc=neelisrinivas18@gmail.com \
    --cc=shubhrajyoti.datta@amd.com \
    --cc=srinivas.neeli@amd.com \
    --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

all inboxes | Powered by JetHome®