From: Lei Liu <liulei.rjpt@vivo.com>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH v1 5/5] usb: ux500: Use devm_clk_get_enabled() helpers
Date: Thu, 22 Aug 2024 12:07:30 +0800 [thread overview]
Message-ID: <20240822040734.29412-6-liulei.rjpt@vivo.com> (raw)
In-Reply-To: <20240822040734.29412-1-liulei.rjpt@vivo.com>
The devm_clk_get_enabled() helpers:
- call devm_clk_get()
- call clk_prepare_enable() and register what is needed in order to
call clk_disable_unprepare() when needed, as a managed resource.
This simplifies the code and avoids calls to clk_disable_unprepare().
---
v0 -> v1
Incorrect usage of clk_prepare_enable() should be corrected to
devm_clk_get_enabled().
Signed-off-by: Lei Liu <liulei.rjpt@vivo.com>
---
drivers/usb/musb/ux500.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index c8d9d2a1d2f0..51ce67678c0c 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -246,19 +246,13 @@ static int ux500_probe(struct platform_device *pdev)
goto err0;
}
- clk = devm_clk_get(&pdev->dev, NULL);
+ clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(clk)) {
dev_err(&pdev->dev, "failed to get clock\n");
ret = PTR_ERR(clk);
goto err1;
}
- ret = clk_prepare_enable(clk);
- if (ret) {
- dev_err(&pdev->dev, "failed to enable clock\n");
- goto err1;
- }
-
musb->dev.parent = &pdev->dev;
musb->dev.dma_mask = &pdev->dev.coherent_dma_mask;
musb->dev.coherent_dma_mask = pdev->dev.coherent_dma_mask;
@@ -276,26 +270,23 @@ static int ux500_probe(struct platform_device *pdev)
ret = platform_device_add_resources(musb, pdev->resource, pdev->num_resources);
if (ret) {
dev_err(&pdev->dev, "failed to add resources\n");
- goto err2;
+ goto err1;
}
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(&pdev->dev, "failed to add platform_data\n");
- goto err2;
+ goto err1;
}
ret = platform_device_add(musb);
if (ret) {
dev_err(&pdev->dev, "failed to register musb device\n");
- goto err2;
+ goto err1;
}
return 0;
-err2:
- clk_disable_unprepare(clk);
-
err1:
platform_device_put(musb);
@@ -308,7 +299,6 @@ static void ux500_remove(struct platform_device *pdev)
struct ux500_glue *glue = platform_get_drvdata(pdev);
platform_device_unregister(glue->musb);
- clk_disable_unprepare(glue->clk);
}
#ifdef CONFIG_PM_SLEEP
--
2.34.1
next prev parent reply other threads:[~2024-08-22 4:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 4:07 [PATCH v1 0/5] usb drivers use devm_clk_get_enabled() helpers Lei Liu
2024-08-22 4:07 ` [PATCH v1 1/5] usb: aspeed_udc: Use " Lei Liu
2024-08-22 4:07 ` [PATCH v1 2/5] usb: pxa27x_udc: " Lei Liu
2024-08-22 4:07 ` [PATCH v1 3/5] usb: r8a66597-udc: " Lei Liu
2024-08-22 4:07 ` [PATCH v1 4/5] usb: mpfs: " Lei Liu
2024-08-22 4:07 ` Lei Liu [this message]
2024-08-22 4:27 ` [PATCH v1 0/5] usb drivers use " Greg Kroah-Hartman
2024-08-22 4:46 ` Lei Liu
2024-08-22 5:14 ` Greg Kroah-Hartman
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=20240822040734.29412-6-liulei.rjpt@vivo.com \
--to=liulei.rjpt@vivo.com \
--cc=linux-aspeed@lists.ozlabs.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