提交 0de2412b 编写于 作者: D Dmitry Osipenko 提交者: Mauro Carvalho Chehab

media: staging: tegra-vde: Reorder misc device registration

Register misc device in the end of driver's probing since device should
become visible to userspace once driver is fully prepared. Do the opposite
in case of driver removal. This is a minor improvement that doesn't solve
any problem, but makes code more consistent.
Signed-off-by: NDmitry Osipenko <digetx@gmail.com>
Signed-off-by: NHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
上级 439c827e
...@@ -1151,12 +1151,6 @@ static int tegra_vde_probe(struct platform_device *pdev) ...@@ -1151,12 +1151,6 @@ static int tegra_vde_probe(struct platform_device *pdev)
goto err_gen_free; goto err_gen_free;
} }
err = misc_register(&vde->miscdev);
if (err) {
dev_err(dev, "Failed to register misc device: %d\n", err);
goto err_deinit_iommu;
}
pm_runtime_enable(dev); pm_runtime_enable(dev);
pm_runtime_use_autosuspend(dev); pm_runtime_use_autosuspend(dev);
pm_runtime_set_autosuspend_delay(dev, 300); pm_runtime_set_autosuspend_delay(dev, 300);
...@@ -1178,15 +1172,20 @@ static int tegra_vde_probe(struct platform_device *pdev) ...@@ -1178,15 +1172,20 @@ static int tegra_vde_probe(struct platform_device *pdev)
goto err_pm_runtime; goto err_pm_runtime;
} }
err = misc_register(&vde->miscdev);
if (err) {
dev_err(dev, "Failed to register misc device: %d\n", err);
goto err_free_secure_bo;
}
return 0; return 0;
err_free_secure_bo:
tegra_vde_free_bo(vde->secure_bo);
err_pm_runtime: err_pm_runtime:
misc_deregister(&vde->miscdev);
pm_runtime_dont_use_autosuspend(dev); pm_runtime_dont_use_autosuspend(dev);
pm_runtime_disable(dev); pm_runtime_disable(dev);
err_deinit_iommu:
tegra_vde_iommu_deinit(vde); tegra_vde_iommu_deinit(vde);
err_gen_free: err_gen_free:
...@@ -1201,6 +1200,8 @@ static int tegra_vde_remove(struct platform_device *pdev) ...@@ -1201,6 +1200,8 @@ static int tegra_vde_remove(struct platform_device *pdev)
struct tegra_vde *vde = platform_get_drvdata(pdev); struct tegra_vde *vde = platform_get_drvdata(pdev);
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
misc_deregister(&vde->miscdev);
tegra_vde_free_bo(vde->secure_bo); tegra_vde_free_bo(vde->secure_bo);
/* /*
...@@ -1219,8 +1220,6 @@ static int tegra_vde_remove(struct platform_device *pdev) ...@@ -1219,8 +1220,6 @@ static int tegra_vde_remove(struct platform_device *pdev)
pm_runtime_put_noidle(dev); pm_runtime_put_noidle(dev);
clk_disable_unprepare(vde->clk); clk_disable_unprepare(vde->clk);
misc_deregister(&vde->miscdev);
tegra_vde_dmabuf_cache_unmap_all(vde); tegra_vde_dmabuf_cache_unmap_all(vde);
tegra_vde_iommu_deinit(vde); tegra_vde_iommu_deinit(vde);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册