* [PATCH] PCI: dwc: change to use devm_clk_get_enabled() helpers
@ 2024-08-23 1:25 Wu Bo
2024-08-23 21:56 ` Bjorn Helgaas
0 siblings, 1 reply; 2+ messages in thread
From: Wu Bo @ 2024-08-23 1:25 UTC (permalink / raw)
To: linux-kernel
Cc: Pratyush Anand, Lorenzo Pieralisi, Krzysztof Wilczyński,
Manivannan Sadhasivam, Rob Herring, Bjorn Helgaas, linux-pci,
Wu Bo, Wu Bo
Make the code cleaner and avoid call clk_disable_unprepare()
Signed-off-by: Wu Bo <bo.wu@vivo.com>
---
drivers/pci/controller/dwc/pcie-spear13xx.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-spear13xx.c b/drivers/pci/controller/dwc/pcie-spear13xx.c
index 201dced209f0..37d9ccffc2e6 100644
--- a/drivers/pci/controller/dwc/pcie-spear13xx.c
+++ b/drivers/pci/controller/dwc/pcie-spear13xx.c
@@ -221,32 +221,18 @@ static int spear13xx_pcie_probe(struct platform_device *pdev)
phy_init(spear13xx_pcie->phy);
- spear13xx_pcie->clk = devm_clk_get(dev, NULL);
+ spear13xx_pcie->clk = devm_clk_get_enabled(dev, NULL);
if (IS_ERR(spear13xx_pcie->clk)) {
dev_err(dev, "couldn't get clk for pcie\n");
return PTR_ERR(spear13xx_pcie->clk);
}
- ret = clk_prepare_enable(spear13xx_pcie->clk);
- if (ret) {
- dev_err(dev, "couldn't enable clk for pcie\n");
- return ret;
- }
if (of_property_read_bool(np, "st,pcie-is-gen1"))
pci->link_gen = 1;
platform_set_drvdata(pdev, spear13xx_pcie);
- ret = spear13xx_add_pcie_port(spear13xx_pcie, pdev);
- if (ret < 0)
- goto fail_clk;
-
- return 0;
-
-fail_clk:
- clk_disable_unprepare(spear13xx_pcie->clk);
-
- return ret;
+ return spear13xx_add_pcie_port(spear13xx_pcie, pdev);
}
static const struct of_device_id spear13xx_pcie_of_match[] = {
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] PCI: dwc: change to use devm_clk_get_enabled() helpers
2024-08-23 1:25 [PATCH] PCI: dwc: change to use devm_clk_get_enabled() helpers Wu Bo
@ 2024-08-23 21:56 ` Bjorn Helgaas
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2024-08-23 21:56 UTC (permalink / raw)
To: Wu Bo
Cc: linux-kernel, Pratyush Anand, Lorenzo Pieralisi,
Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, linux-pci, Wu Bo
This is spear13xx-specific, not a generic dwc change, so the subject
should be:
PCI: spear13xx: <Capitalized> ...
On Thu, Aug 22, 2024 at 07:25:16PM -0600, Wu Bo wrote:
Include the fact that you're using devm_clk_get_enabled() here so the
commit log is complete even without the subject line.
> Make the code cleaner and avoid call clk_disable_unprepare()
>
> Signed-off-by: Wu Bo <bo.wu@vivo.com>
> ---
> drivers/pci/controller/dwc/pcie-spear13xx.c | 18 ++----------------
> 1 file changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/pci/controller/dwc/pcie-spear13xx.c b/drivers/pci/controller/dwc/pcie-spear13xx.c
> index 201dced209f0..37d9ccffc2e6 100644
> --- a/drivers/pci/controller/dwc/pcie-spear13xx.c
> +++ b/drivers/pci/controller/dwc/pcie-spear13xx.c
> @@ -221,32 +221,18 @@ static int spear13xx_pcie_probe(struct platform_device *pdev)
>
> phy_init(spear13xx_pcie->phy);
>
> - spear13xx_pcie->clk = devm_clk_get(dev, NULL);
> + spear13xx_pcie->clk = devm_clk_get_enabled(dev, NULL);
> if (IS_ERR(spear13xx_pcie->clk)) {
> dev_err(dev, "couldn't get clk for pcie\n");
> return PTR_ERR(spear13xx_pcie->clk);
> }
> - ret = clk_prepare_enable(spear13xx_pcie->clk);
> - if (ret) {
> - dev_err(dev, "couldn't enable clk for pcie\n");
> - return ret;
> - }
>
> if (of_property_read_bool(np, "st,pcie-is-gen1"))
> pci->link_gen = 1;
>
> platform_set_drvdata(pdev, spear13xx_pcie);
>
> - ret = spear13xx_add_pcie_port(spear13xx_pcie, pdev);
> - if (ret < 0)
> - goto fail_clk;
> -
> - return 0;
> -
> -fail_clk:
> - clk_disable_unprepare(spear13xx_pcie->clk);
> -
> - return ret;
> + return spear13xx_add_pcie_port(spear13xx_pcie, pdev);
Nice cleanup, I like it.
> }
>
> static const struct of_device_id spear13xx_pcie_of_match[] = {
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-08-23 21:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-23 1:25 [PATCH] PCI: dwc: change to use devm_clk_get_enabled() helpers Wu Bo
2024-08-23 21:56 ` Bjorn Helgaas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox