* [PATCH] soc/tegra: pmc: Use devm_clk_get_optional()
@ 2022-08-07 20:55 Christophe JAILLET
2022-09-15 11:14 ` Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-08-07 20:55 UTC (permalink / raw)
To: Thierry Reding, Jonathan Hunter
Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-tegra
Use devm_clk_get_optional() instead of hand writing it.
While at it, use dev_err_probe() to further simplify the code. This is also
less verbose if clk_get() returns -EPROBE_DEFER.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
drivers/soc/tegra/pmc.c | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 6a4b8f7e7948..016762f88fff 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -2885,17 +2885,10 @@ static int tegra_pmc_probe(struct platform_device *pdev)
pmc->scratch = base;
}
- pmc->clk = devm_clk_get(&pdev->dev, "pclk");
- if (IS_ERR(pmc->clk)) {
- err = PTR_ERR(pmc->clk);
-
- if (err != -ENOENT) {
- dev_err(&pdev->dev, "failed to get pclk: %d\n", err);
- return err;
- }
-
- pmc->clk = NULL;
- }
+ pmc->clk = devm_clk_get_optional(&pdev->dev, "pclk");
+ if (IS_ERR(pmc->clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(pmc->clk),
+ "failed to get pclk\n");
/*
* PMC should be last resort for restarting since it soft-resets
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] soc/tegra: pmc: Use devm_clk_get_optional()
2022-08-07 20:55 [PATCH] soc/tegra: pmc: Use devm_clk_get_optional() Christophe JAILLET
@ 2022-09-15 11:14 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2022-09-15 11:14 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Jonathan Hunter, linux-kernel, kernel-janitors, linux-tegra
[-- Attachment #1: Type: text/plain, Size: 476 bytes --]
On Sun, Aug 07, 2022 at 10:55:59PM +0200, Christophe JAILLET wrote:
> Use devm_clk_get_optional() instead of hand writing it.
>
> While at it, use dev_err_probe() to further simplify the code. This is also
> less verbose if clk_get() returns -EPROBE_DEFER.
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/soc/tegra/pmc.c | 15 ++++-----------
> 1 file changed, 4 insertions(+), 11 deletions(-)
Applied, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-15 11:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-07 20:55 [PATCH] soc/tegra: pmc: Use devm_clk_get_optional() Christophe JAILLET
2022-09-15 11:14 ` 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).