UPSTREAM: drm/tegra: sor: Fully initialize SOR before registration

Before registering the SOR host1x client, make sure that it is fully
initialized. This avoids a potential race condition between the SOR's
probe and the host1x device initialization in cases where the SOR is
the final sub-device to register to a host1x instance.

Change-Id: If1a1e9aa66cef1e2aedd2099b01a86caf4b789dc
Reported-by: Jonathan Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545948
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Thierry Reding
2021-04-01 17:41:05 +02:00
committed by Laxman Dewangan
parent a2c744d2a2
commit 816dfcb103

View File

@@ -3918,17 +3918,10 @@ static int tegra_sor_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, sor); platform_set_drvdata(pdev, sor);
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
INIT_LIST_HEAD(&sor->client.list); host1x_client_init(&sor->client);
sor->client.ops = &sor_client_ops; sor->client.ops = &sor_client_ops;
sor->client.dev = &pdev->dev; sor->client.dev = &pdev->dev;
err = host1x_client_register(&sor->client);
if (err < 0) {
dev_err(&pdev->dev, "failed to register host1x client: %d\n",
err);
goto rpm_disable;
}
/* /*
* On Tegra210 and earlier, provide our own implementation for the * On Tegra210 and earlier, provide our own implementation for the
* pad output clock. * pad output clock.
@@ -3940,13 +3933,13 @@ static int tegra_sor_probe(struct platform_device *pdev)
sor->index); sor->index);
if (!name) { if (!name) {
err = -ENOMEM; err = -ENOMEM;
goto unregister; goto uninit;
} }
err = host1x_client_resume(&sor->client); err = host1x_client_resume(&sor->client);
if (err < 0) { if (err < 0) {
dev_err(sor->dev, "failed to resume: %d\n", err); dev_err(sor->dev, "failed to resume: %d\n", err);
goto unregister; goto uninit;
} }
sor->clk_pad = tegra_clk_sor_pad_register(sor, name); sor->clk_pad = tegra_clk_sor_pad_register(sor, name);
@@ -3957,14 +3950,20 @@ static int tegra_sor_probe(struct platform_device *pdev)
err = PTR_ERR(sor->clk_pad); err = PTR_ERR(sor->clk_pad);
dev_err(sor->dev, "failed to register SOR pad clock: %d\n", dev_err(sor->dev, "failed to register SOR pad clock: %d\n",
err); err);
goto unregister; goto uninit;
}
err = __host1x_client_register(&sor->client);
if (err < 0) {
dev_err(&pdev->dev, "failed to register host1x client: %d\n",
err);
goto uninit;
} }
return 0; return 0;
unregister: uninit:
host1x_client_unregister(&sor->client); host1x_client_exit(&sor->client);
rpm_disable:
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
remove: remove:
tegra_output_remove(&sor->output); tegra_output_remove(&sor->output);