Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Pandey, Radhey Shyam" <radheys@amd.com>
To: Michal Simek <michal.simek@amd.com>,
	linux-kernel@vger.kernel.org, monstr@monstr.eu, git@amd.com
Cc: Moritz Fischer <mdf@kernel.org>, Tom Rix <trix@redhat.com>,
	Xu Yilun <yilun.xu@intel.com>,
	"moderated list:ARM/ZYNQ ARCHITECTURE"
	<linux-arm-kernel@lists.infradead.org>,
	"open list:FPGA MANAGER FRAMEWORK" <linux-fpga@vger.kernel.org>
Subject: Re: [PATCH] fpga: xilinx-pr-decoupler: Use devm_clk_get_prepared()
Date: Tue, 23 Jun 2026 16:31:28 +0530	[thread overview]
Message-ID: <5bd0f7db-7ec0-4390-b6ea-1edca46e1ca7@amd.com> (raw)
In-Reply-To: <8ca8ee5ba720b608a41f842d2b743302e5500ad0.1782205286.git.michal.simek@amd.com>

> The driver keeps the "aclk" clock prepared but disabled in its idle
> state, toggling only the atomic clk_enable()/clk_disable() around
> register accesses in the bridge enable_set/enable_show callbacks.
> 
> At probe time this was open-coded as clk_prepare_enable() immediately
> followed by clk_disable(), leaving the clock prepared, with a matching
> clk_unprepare() in the error path and in remove().
> 
> devm_clk_get_prepared() expresses exactly this: it gets and prepares the
> clock and unprepares it automatically on driver detach.
> 
> Use it to drop the manual prepare/disable dance, the error-path
> unprepare, and the now-empty clock teardown in remove().
> 
> Signed-off-by: Michal Simek <michal.simek@amd.com>

Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com>
Thanks!

> ---
> 
>   drivers/fpga/xilinx-pr-decoupler.c | 20 ++------------------
>   1 file changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/fpga/xilinx-pr-decoupler.c b/drivers/fpga/xilinx-pr-decoupler.c
> index 6994d68e9036..45b65a3264af 100644
> --- a/drivers/fpga/xilinx-pr-decoupler.c
> +++ b/drivers/fpga/xilinx-pr-decoupler.c
> @@ -118,46 +118,30 @@ static int xlnx_pr_decoupler_probe(struct platform_device *pdev)
>   	if (IS_ERR(priv->io_base))
>   		return PTR_ERR(priv->io_base);
>   
> -	priv->clk = devm_clk_get(&pdev->dev, "aclk");
> +	priv->clk = devm_clk_get_prepared(&pdev->dev, "aclk");
>   	if (IS_ERR(priv->clk))
>   		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk),
>   				     "input clock not found\n");
>   
> -	err = clk_prepare_enable(priv->clk);
> -	if (err) {
> -		dev_err(&pdev->dev, "unable to enable clock\n");
> -		return err;
> -	}
> -
> -	clk_disable(priv->clk);
> -
>   	br = fpga_bridge_register(&pdev->dev, priv->ipconfig->name,
>   				  &xlnx_pr_decoupler_br_ops, priv);
>   	if (IS_ERR(br)) {
>   		err = PTR_ERR(br);
>   		dev_err(&pdev->dev, "unable to register %s",
>   			priv->ipconfig->name);
> -		goto err_clk;
> +		return err;
>   	}
>   
>   	platform_set_drvdata(pdev, br);
>   
>   	return 0;
> -
> -err_clk:
> -	clk_unprepare(priv->clk);
> -
> -	return err;
>   }
>   
>   static void xlnx_pr_decoupler_remove(struct platform_device *pdev)
>   {
>   	struct fpga_bridge *bridge = platform_get_drvdata(pdev);
> -	struct xlnx_pr_decoupler_data *p = bridge->priv;
>   
>   	fpga_bridge_unregister(bridge);
> -
> -	clk_unprepare(p->clk);
>   }
>   
>   static struct platform_driver xlnx_pr_decoupler_driver = {
> ---
> base-commit: 502d801f0ab03e4f32f9a33d203154ce84887921
> branch: xnext/pr-decoupler
> 



      reply	other threads:[~2026-06-23 11:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-23  9:01 [PATCH] fpga: xilinx-pr-decoupler: Use devm_clk_get_prepared() Michal Simek
2026-06-23 11:01 ` Pandey, Radhey Shyam [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=5bd0f7db-7ec0-4390-b6ea-1edca46e1ca7@amd.com \
    --to=radheys@amd.com \
    --cc=git@amd.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=michal.simek@amd.com \
    --cc=monstr@monstr.eu \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /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