* [PATCH] gpu: host1x: mipi: Benefit from devm_clk_get_prepared()
@ 2024-04-09 16:50 Uwe Kleine-König
2024-04-19 11:30 ` Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2024-04-09 16:50 UTC (permalink / raw)
To: Thierry Reding, Mikko Perttunen, David Airlie, Daniel Vetter
Cc: dri-devel, linux-tegra, kernel
When using devm_clk_get_prepared() instead of devm_clk_get() the clock
is already returned prepared. So probe doesn't need to call
clk_prepare() and at remove time the call to clk_unprepare() can be
dropped. The latter makes the remove callback empty, so it can be
dropped, too.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
the motivation for this patch is that the driver uses struct
platform_driver::remove() which I plan to change the prototype of. Instead
of converting the driver to the temporal .remove_new() and then back to
the new .remove(), drop the remove callback completely.
Best regards
Uwe
drivers/gpu/host1x/mipi.c | 17 +----------------
1 file changed, 1 insertion(+), 16 deletions(-)
diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c
index 4dcec535ec21..e51b43dd15a3 100644
--- a/drivers/gpu/host1x/mipi.c
+++ b/drivers/gpu/host1x/mipi.c
@@ -501,7 +501,6 @@ static int tegra_mipi_probe(struct platform_device *pdev)
{
const struct of_device_id *match;
struct tegra_mipi *mipi;
- int err;
match = of_match_node(tegra_mipi_of_match, pdev->dev.of_node);
if (!match)
@@ -520,35 +519,21 @@ static int tegra_mipi_probe(struct platform_device *pdev)
mutex_init(&mipi->lock);
- mipi->clk = devm_clk_get(&pdev->dev, NULL);
+ mipi->clk = devm_clk_get_prepared(&pdev->dev, NULL);
if (IS_ERR(mipi->clk)) {
dev_err(&pdev->dev, "failed to get clock\n");
return PTR_ERR(mipi->clk);
}
- err = clk_prepare(mipi->clk);
- if (err < 0)
- return err;
-
platform_set_drvdata(pdev, mipi);
return 0;
}
-static int tegra_mipi_remove(struct platform_device *pdev)
-{
- struct tegra_mipi *mipi = platform_get_drvdata(pdev);
-
- clk_unprepare(mipi->clk);
-
- return 0;
-}
-
struct platform_driver tegra_mipi_driver = {
.driver = {
.name = "tegra-mipi",
.of_match_table = tegra_mipi_of_match,
},
.probe = tegra_mipi_probe,
- .remove = tegra_mipi_remove,
};
base-commit: a053fd3ca5d1b927a8655f239c84b0d790218fda
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] gpu: host1x: mipi: Benefit from devm_clk_get_prepared()
2024-04-09 16:50 [PATCH] gpu: host1x: mipi: Benefit from devm_clk_get_prepared() Uwe Kleine-König
@ 2024-04-19 11:30 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2024-04-19 11:30 UTC (permalink / raw)
To: Uwe Kleine-König, Mikko Perttunen, David Airlie, Daniel Vetter
Cc: dri-devel, linux-tegra, kernel
[-- Attachment #1: Type: text/plain, Size: 1002 bytes --]
On Tue Apr 9, 2024 at 6:50 PM CEST, Uwe Kleine-König wrote:
> When using devm_clk_get_prepared() instead of devm_clk_get() the clock
> is already returned prepared. So probe doesn't need to call
> clk_prepare() and at remove time the call to clk_unprepare() can be
> dropped. The latter makes the remove callback empty, so it can be
> dropped, too.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
>
> the motivation for this patch is that the driver uses struct
> platform_driver::remove() which I plan to change the prototype of. Instead
> of converting the driver to the temporal .remove_new() and then back to
> the new .remove(), drop the remove callback completely.
>
> Best regards
> Uwe
>
> drivers/gpu/host1x/mipi.c | 17 +----------------
> 1 file changed, 1 insertion(+), 16 deletions(-)
Feel free to take this in through whatever tree is most appropriate for
this ongoing work:
Acked-by: Thierry Reding <treding@nvidia.com>
[-- 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:[~2024-04-19 11:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-09 16:50 [PATCH] gpu: host1x: mipi: Benefit from devm_clk_get_prepared() Uwe Kleine-König
2024-04-19 11:30 ` 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).