mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] PCI: xilinx-nwl: Use devm_clk_get_enabled() in nwl_pcie_probe()
@ 2026-11-22 19:52 Markus Elfring
  2026-11-23 17:49 ` Frank Li
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2026-11-22 19:52 UTC (permalink / raw)
  To: linux-pci, linux-arm-kernel, Bharat Kumar Gogada, Bjorn Helgaas,
	Hyun Kwon, Lorenzo Pieralisi, Manivannan Sadhasivam,
	Michal Simek, Rob Herring, Sean Anderson
  Cc: LKML, kernel-janitors, Andy Shevchenko, Christophe Jaillet,
	Florian Fainelli, Frank Li

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 22 Nov 2026 20:35:35 +0100

* Reuse existing functionality from devm_clk_get_enabled() instead of
  keeping duplicate source code.

* Omit a clk_disable_unprepare() call on an error handling path
  and in the implementation of the function “nwl_pcie_remove”.

* Delete the label “err_clk”.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pci/controller/pcie-xilinx-nwl.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c
index 0dee19fa24ca..fd134317e9c4 100644
--- a/drivers/pci/controller/pcie-xilinx-nwl.c
+++ b/drivers/pci/controller/pcie-xilinx-nwl.c
@@ -844,20 +844,14 @@ static int nwl_pcie_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	pcie->clk = devm_clk_get(dev, NULL);
+	pcie->clk = devm_clk_get_enabled(dev, NULL);
 	if (IS_ERR(pcie->clk))
 		return PTR_ERR(pcie->clk);
 
-	err = clk_prepare_enable(pcie->clk);
-	if (err) {
-		dev_err(dev, "can't enable PCIe ref clock\n");
-		return err;
-	}
-
 	err = nwl_pcie_phy_enable(pcie);
 	if (err) {
 		dev_err(dev, "could not enable PHYs\n");
-		goto err_clk;
+		return err;
 	}
 
 	err = nwl_pcie_bridge_init(pcie);
@@ -889,8 +883,6 @@ static int nwl_pcie_probe(struct platform_device *pdev)
 
 err_phy:
 	nwl_pcie_phy_disable(pcie);
-err_clk:
-	clk_disable_unprepare(pcie->clk);
 	return err;
 }
 
@@ -899,7 +891,6 @@ static void nwl_pcie_remove(struct platform_device *pdev)
 	struct nwl_pcie *pcie = platform_get_drvdata(pdev);
 
 	nwl_pcie_phy_disable(pcie);
-	clk_disable_unprepare(pcie->clk);
 }
 
 static struct platform_driver nwl_pcie_driver = {
-- 
2.56.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: xilinx-nwl: Use devm_clk_get_enabled() in nwl_pcie_probe()
  2026-11-22 19:52 [PATCH] PCI: xilinx-nwl: Use devm_clk_get_enabled() in nwl_pcie_probe() Markus Elfring
@ 2026-11-23 17:49 ` Frank Li
  2026-11-23 18:28   ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Li @ 2026-11-23 17:49 UTC (permalink / raw)
  To: Markus Elfring
  Cc: linux-pci, linux-arm-kernel, Bharat Kumar Gogada, Bjorn Helgaas,
	Hyun Kwon, Lorenzo Pieralisi, Manivannan Sadhasivam,
	Michal Simek, Rob Herring, Sean Anderson, LKML, kernel-janitors,
	Andy Shevchenko, Christophe Jaillet, Florian Fainelli, Frank Li

On Sun, Nov 22, 2026 at 08:52:11PM +0100, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 22 Nov 2026 20:35:35 +0100
>
> * Reuse existing functionality from devm_clk_get_enabled() instead of
>   keeping duplicate source code.
>
> * Omit a clk_disable_unprepare() call on an error handling path
>   and in the implementation of the function “nwl_pcie_remove”.
>
> * Delete the label “err_clk”.

Needn't * in this case. Not title ahead of a list at body.

Frank

>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/pci/controller/pcie-xilinx-nwl.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-xilinx-nwl.c b/drivers/pci/controller/pcie-xilinx-nwl.c
> index 0dee19fa24ca..fd134317e9c4 100644
> --- a/drivers/pci/controller/pcie-xilinx-nwl.c
> +++ b/drivers/pci/controller/pcie-xilinx-nwl.c
> @@ -844,20 +844,14 @@ static int nwl_pcie_probe(struct platform_device *pdev)
>  		return err;
>  	}
>
> -	pcie->clk = devm_clk_get(dev, NULL);
> +	pcie->clk = devm_clk_get_enabled(dev, NULL);
>  	if (IS_ERR(pcie->clk))
>  		return PTR_ERR(pcie->clk);
>
> -	err = clk_prepare_enable(pcie->clk);
> -	if (err) {
> -		dev_err(dev, "can't enable PCIe ref clock\n");
> -		return err;
> -	}
> -
>  	err = nwl_pcie_phy_enable(pcie);
>  	if (err) {
>  		dev_err(dev, "could not enable PHYs\n");
> -		goto err_clk;
> +		return err;
>  	}
>
>  	err = nwl_pcie_bridge_init(pcie);
> @@ -889,8 +883,6 @@ static int nwl_pcie_probe(struct platform_device *pdev)
>
>  err_phy:
>  	nwl_pcie_phy_disable(pcie);
> -err_clk:
> -	clk_disable_unprepare(pcie->clk);
>  	return err;
>  }
>
> @@ -899,7 +891,6 @@ static void nwl_pcie_remove(struct platform_device *pdev)
>  	struct nwl_pcie *pcie = platform_get_drvdata(pdev);
>
>  	nwl_pcie_phy_disable(pcie);
> -	clk_disable_unprepare(pcie->clk);
>  }
>
>  static struct platform_driver nwl_pcie_driver = {
> --
> 2.56.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PCI: xilinx-nwl: Use devm_clk_get_enabled() in nwl_pcie_probe()
  2026-11-23 17:49 ` Frank Li
@ 2026-11-23 18:28   ` Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-11-23 18:28 UTC (permalink / raw)
  To: Frank Li, linux-pci, linux-arm-kernel
  Cc: Bharat Kumar Gogada, Bjorn Helgaas, Hyun Kwon, Lorenzo Pieralisi,
	Manivannan Sadhasivam, Michal Simek, Rob Herring, Sean Anderson,
	LKML, kernel-janitors, Andy Shevchenko, Christophe Jaillet,
	Florian Fainelli, Frank Li

>> * Reuse existing functionality from devm_clk_get_enabled() instead of
>>   keeping duplicate source code.
>>
>> * Omit a clk_disable_unprepare() call on an error handling path
>>   and in the implementation of the function “nwl_pcie_remove”.
>>
>> * Delete the label “err_clk”.
> 
> Needn't * in this case. Not title ahead of a list at body.
Which wording variation would you prefer finally?

Regards,
Markus

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-23 18:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-22 19:52 [PATCH] PCI: xilinx-nwl: Use devm_clk_get_enabled() in nwl_pcie_probe() Markus Elfring
2026-11-23 17:49 ` Frank Li
2026-11-23 18:28   ` Markus Elfring

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®