aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tegra/hdmi.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2013-10-14 08:26:42 -0400
committerThierry Reding <treding@nvidia.com>2013-10-31 04:55:41 -0400
commit59d29c0ec93fe9879673b302a182fb3fb80896c3 (patch)
tree47158501586464399b9dd50da13cb7265166d7d3 /drivers/gpu/drm/tegra/hdmi.c
parentf002abc19acb6f7cdb3d320f3b6f1a565c0be63e (diff)
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>
Diffstat (limited to 'drivers/gpu/drm/tegra/hdmi.c')
-rw-r--r--drivers/gpu/drm/tegra/hdmi.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c
index f5663d15670b..3a00cb078041 100644
--- a/drivers/gpu/drm/tegra/hdmi.c
+++ b/drivers/gpu/drm/tegra/hdmi.c
@@ -1226,7 +1226,7 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
1226 1226
1227 hdmi->output.dev = &pdev->dev; 1227 hdmi->output.dev = &pdev->dev;
1228 1228
1229 err = tegra_output_parse_dt(&hdmi->output); 1229 err = tegra_output_probe(&hdmi->output);
1230 if (err < 0) 1230 if (err < 0)
1231 return err; 1231 return err;
1232 1232
@@ -1272,6 +1272,12 @@ static int tegra_hdmi_remove(struct platform_device *pdev)
1272 return err; 1272 return err;
1273 } 1273 }
1274 1274
1275 err = tegra_output_remove(&hdmi->output);
1276 if (err < 0) {
1277 dev_err(&pdev->dev, "failed to remove output: %d\n", err);
1278 return err;
1279 }
1280
1275 clk_unprepare(hdmi->clk_parent); 1281 clk_unprepare(hdmi->clk_parent);
1276 clk_unprepare(hdmi->clk); 1282 clk_unprepare(hdmi->clk);
1277 1283