* [PATCH] pwm: clk: Use the devm_clk_get_prepared() helper function
@ 2023-04-16 9:02 Christophe JAILLET
2023-04-16 17:05 ` Uwe Kleine-König
2023-06-23 14:51 ` Thierry Reding
0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2023-04-16 9:02 UTC (permalink / raw)
To: Thierry Reding, Uwe Kleine-König
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-pwm
Use the devm_clk_get_prepared() helper function instead of hand-writing it.
It saves some line of codes.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/pwm/pwm-clk.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/pwm/pwm-clk.c b/drivers/pwm/pwm-clk.c
index f1da99881adf..0ee4d2aee4df 100644
--- a/drivers/pwm/pwm-clk.c
+++ b/drivers/pwm/pwm-clk.c
@@ -89,7 +89,7 @@ static int pwm_clk_probe(struct platform_device *pdev)
if (!pcchip)
return -ENOMEM;
- pcchip->clk = devm_clk_get(&pdev->dev, NULL);
+ pcchip->clk = devm_clk_get_prepared(&pdev->dev, NULL);
if (IS_ERR(pcchip->clk))
return dev_err_probe(&pdev->dev, PTR_ERR(pcchip->clk),
"Failed to get clock\n");
@@ -98,15 +98,9 @@ static int pwm_clk_probe(struct platform_device *pdev)
pcchip->chip.ops = &pwm_clk_ops;
pcchip->chip.npwm = 1;
- ret = clk_prepare(pcchip->clk);
- if (ret < 0)
- return dev_err_probe(&pdev->dev, ret, "Failed to prepare clock\n");
-
ret = pwmchip_add(&pcchip->chip);
- if (ret < 0) {
- clk_unprepare(pcchip->clk);
+ if (ret < 0)
return dev_err_probe(&pdev->dev, ret, "Failed to add pwm chip\n");
- }
platform_set_drvdata(pdev, pcchip);
return 0;
@@ -120,8 +114,6 @@ static void pwm_clk_remove(struct platform_device *pdev)
if (pcchip->clk_enabled)
clk_disable(pcchip->clk);
-
- clk_unprepare(pcchip->clk);
}
static const struct of_device_id pwm_clk_dt_ids[] = {
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pwm: clk: Use the devm_clk_get_prepared() helper function
2023-04-16 9:02 [PATCH] pwm: clk: Use the devm_clk_get_prepared() helper function Christophe JAILLET
@ 2023-04-16 17:05 ` Uwe Kleine-König
2023-06-23 14:51 ` Thierry Reding
1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2023-04-16 17:05 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Thierry Reding, linux-kernel, kernel-janitors, linux-pwm
[-- Attachment #1: Type: text/plain, Size: 500 bytes --]
Hello,
On Sun, Apr 16, 2023 at 11:02:13AM +0200, Christophe JAILLET wrote:
> Use the devm_clk_get_prepared() helper function instead of hand-writing it.
> It saves some line of codes.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Thanks
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pwm: clk: Use the devm_clk_get_prepared() helper function
2023-04-16 9:02 [PATCH] pwm: clk: Use the devm_clk_get_prepared() helper function Christophe JAILLET
2023-04-16 17:05 ` Uwe Kleine-König
@ 2023-06-23 14:51 ` Thierry Reding
1 sibling, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2023-06-23 14:51 UTC (permalink / raw)
To: Uwe Kleine-König, Christophe JAILLET
Cc: linux-kernel, kernel-janitors, linux-pwm
On Sun, 16 Apr 2023 11:02:13 +0200, Christophe JAILLET wrote:
> Use the devm_clk_get_prepared() helper function instead of hand-writing it.
> It saves some line of codes.
>
>
Applied, thanks!
[1/1] pwm: clk: Use the devm_clk_get_prepared() helper function
commit: 2b8e30b1bd500df67554f1c183caf333de82f8d2
Best regards,
--
Thierry Reding <thierry.reding@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-23 14:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-16 9:02 [PATCH] pwm: clk: Use the devm_clk_get_prepared() helper function Christophe JAILLET
2023-04-16 17:05 ` Uwe Kleine-König
2023-06-23 14:51 ` Thierry Reding
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).