drm/tegra: Allocate resources at probe time

Since the .init() and .exit() functions are executed whenever the DRM
driver is loaded or unloaded, care must be taken not to use them for
resource allocation. Otherwise deferred probing cannot be used, since
the .init() and .exit() are not run at probe time. Similarly the code
that frees resources must be run at .remove() time. If it is run from
the .exit() function, it can release resources multiple times.

To handle this more consistently, rename the tegra_output_parse_dt()
function to tegra_output_probe() and introduce tegra_output_remove()
which can be used to free output-related resources.

Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
Thierry Reding
2013-10-14 14:26:42 +02:00
parent f002abc19a
commit 59d29c0ec9
5 changed files with 56 additions and 27 deletions
+7 -1
View File
@@ -1226,7 +1226,7 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
hdmi->output.dev = &pdev->dev;
err = tegra_output_parse_dt(&hdmi->output);
err = tegra_output_probe(&hdmi->output);
if (err < 0)
return err;
@@ -1272,6 +1272,12 @@ static int tegra_hdmi_remove(struct platform_device *pdev)
return err;
}
err = tegra_output_remove(&hdmi->output);
if (err < 0) {
dev_err(&pdev->dev, "failed to remove output: %d\n", err);
return err;
}
clk_unprepare(hdmi->clk_parent);
clk_unprepare(hdmi->clk);