From: Frank Li <Frank.Li@nxp.com>
To: vkoul@kernel.org, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, dmaengine@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
peng.fan@nxp.com, joy.zou@nxp.com, shenwei.wang@nxp.com,
imx@lists.linux.dev
Subject: [PATCH v6 07/12] dmaengine: fsl-edma: refactor using devm_clk_get_enabled
Date: Wed, 14 Jun 2023 15:35:39 -0400 [thread overview]
Message-ID: <20230614193544.2114603-8-Frank.Li@nxp.com> (raw)
In-Reply-To: <20230614193544.2114603-1-Frank.Li@nxp.com>
Use devm_clk_get_enabled in probe code to reduce error checks,
thereby enhancing readability
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
drivers/dma/fsl-edma-main.c | 19 ++-----------------
1 file changed, 2 insertions(+), 17 deletions(-)
diff --git a/drivers/dma/fsl-edma-main.c b/drivers/dma/fsl-edma-main.c
index a0e54ca4893c..503e5ad5a8dd 100644
--- a/drivers/dma/fsl-edma-main.c
+++ b/drivers/dma/fsl-edma-main.c
@@ -266,17 +266,11 @@ static int fsl_edma_probe(struct platform_device *pdev)
regs = &fsl_edma->regs;
if (drvdata->flags & FSL_EDMA_DRV_HAS_DMACLK) {
- fsl_edma->dmaclk = devm_clk_get(&pdev->dev, "dma");
+ fsl_edma->dmaclk = devm_clk_get_enabled(&pdev->dev, "dma");
if (IS_ERR(fsl_edma->dmaclk)) {
dev_err(&pdev->dev, "Missing DMA block clock.\n");
return PTR_ERR(fsl_edma->dmaclk);
}
-
- ret = clk_prepare_enable(fsl_edma->dmaclk);
- if (ret) {
- dev_err(&pdev->dev, "DMA clk block failed.\n");
- return ret;
- }
}
for (i = 0; i < fsl_edma->drvdata->dmamuxs; i++) {
@@ -291,19 +285,12 @@ static int fsl_edma_probe(struct platform_device *pdev)
}
sprintf(clkname, "dmamux%d", i);
- fsl_edma->muxclk[i] = devm_clk_get(&pdev->dev, clkname);
+ fsl_edma->muxclk[i] = devm_clk_get_enabled(&pdev->dev, clkname);
if (IS_ERR(fsl_edma->muxclk[i])) {
dev_err(&pdev->dev, "Missing DMAMUX block clock.\n");
/* on error: disable all previously enabled clks */
- fsl_disable_clocks(fsl_edma, i);
return PTR_ERR(fsl_edma->muxclk[i]);
}
-
- ret = clk_prepare_enable(fsl_edma->muxclk[i]);
- if (ret)
- /* on error: disable all previously enabled clks */
- fsl_disable_clocks(fsl_edma, i);
-
}
fsl_edma->big_endian = of_property_read_bool(np, "big-endian");
@@ -364,7 +351,6 @@ static int fsl_edma_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev,
"Can't register Freescale eDMA engine. (%d)\n", ret);
- fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs);
return ret;
}
@@ -373,7 +359,6 @@ static int fsl_edma_probe(struct platform_device *pdev)
dev_err(&pdev->dev,
"Can't register Freescale eDMA of_dma. (%d)\n", ret);
dma_async_device_unregister(&fsl_edma->dma_dev);
- fsl_disable_clocks(fsl_edma, fsl_edma->drvdata->dmamuxs);
return ret;
}
--
2.34.1
next prev parent reply other threads:[~2023-06-14 19:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-14 19:35 [PATCH v6 00/12] dmaengine: edma: add freescale edma v3 support Frank Li
2023-06-14 19:35 ` [PATCH v6 01/12] dmaengine: fsl-edma: clean up EXPORT_SYMBOL_GPL in fsl-edma-common.c Frank Li
2023-06-14 19:35 ` [PATCH v6 02/12] dmaengine: fsl-edma: clean up fsl_edma_irq_exit() Frank Li
2023-06-14 19:35 ` [PATCH v6 03/12] dmaengine: fsl-edma: transition from bool fields to bitmask flags in drvdata Frank Li
2023-06-14 19:35 ` [PATCH v6 04/12] dmaengine: fsl-edma: Remove enum edma_version Frank Li
2023-06-14 19:35 ` [PATCH v6 05/12] dmaengine: fsl-edma: move common IRQ handler to common.c Frank Li
2023-06-14 19:35 ` [PATCH v6 06/12] dmaengine: fsl-edma: simply ATTR_DSIZE and ATTR_SSIZE by using ffs() Frank Li
2023-06-14 19:35 ` Frank Li [this message]
2023-06-14 19:35 ` [PATCH v6 08/12] dmaengine: fsl-edma: move clearing of register interrupt into setup_irq function Frank Li
2023-06-14 19:35 ` [PATCH v6 09/12] dmaengine: fsl-edma: refactor chan_name setup and safety Frank Li
2023-06-14 19:35 ` [PATCH v6 10/12] dmaengine: fsl-edma: move tcd into struct fsl_dma_chan Frank Li
2023-06-14 19:35 ` [PATCH v6 11/12] dmaengine: fsl-edma: integrate v3 support Frank Li
2023-06-14 19:35 ` [PATCH v6 12/12] dt-bindings: fsl-dma: fsl-edma: add edma3 compatible string Frank Li
2023-06-15 10:52 ` Krzysztof Kozlowski
2023-06-15 14:37 ` Frank Li
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=20230614193544.2114603-8-Frank.Li@nxp.com \
--to=frank.li@nxp.com \
--cc=devicetree@vger.kernel.org \
--cc=dmaengine@vger.kernel.org \
--cc=imx@lists.linux.dev \
--cc=joy.zou@nxp.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=robh+dt@kernel.org \
--cc=shenwei.wang@nxp.com \
--cc=vkoul@kernel.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).