Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpu: host1x: mipi: Benefit from devm_clk_get_prepared()

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.

Acked-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20240409165043.105137-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

+1 -16
+1 -16
drivers/gpu/host1x/mipi.c
··· 501 501 { 502 502 const struct of_device_id *match; 503 503 struct tegra_mipi *mipi; 504 - int err; 505 504 506 505 match = of_match_node(tegra_mipi_of_match, pdev->dev.of_node); 507 506 if (!match) ··· 519 520 520 521 mutex_init(&mipi->lock); 521 522 522 - mipi->clk = devm_clk_get(&pdev->dev, NULL); 523 + mipi->clk = devm_clk_get_prepared(&pdev->dev, NULL); 523 524 if (IS_ERR(mipi->clk)) { 524 525 dev_err(&pdev->dev, "failed to get clock\n"); 525 526 return PTR_ERR(mipi->clk); 526 527 } 527 528 528 - err = clk_prepare(mipi->clk); 529 - if (err < 0) 530 - return err; 531 - 532 529 platform_set_drvdata(pdev, mipi); 533 - 534 - return 0; 535 - } 536 - 537 - static int tegra_mipi_remove(struct platform_device *pdev) 538 - { 539 - struct tegra_mipi *mipi = platform_get_drvdata(pdev); 540 - 541 - clk_unprepare(mipi->clk); 542 530 543 531 return 0; 544 532 } ··· 536 550 .of_match_table = tegra_mipi_of_match, 537 551 }, 538 552 .probe = tegra_mipi_probe, 539 - .remove = tegra_mipi_remove, 540 553 };