[PATCH 2/2] drm/tegra: sor: Fully initialize SOR before registration

Jon Hunter jonathanh at nvidia.com
Thu Apr 1 20:08:06 UTC 2021


On 01/04/2021 16:41, Thierry Reding wrote:
> From: Thierry Reding <treding at nvidia.com>
> 
> 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.
> 
> Reported-by: Jonathan Hunter <jonathanh at nvidia.com>
> Signed-off-by: Thierry Reding <treding at nvidia.com>
> ---
>  drivers/gpu/drm/tegra/sor.c | 27 +++++++++++++--------------
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c
> index 7b88261f57bb..b29bc10a0a4d 100644
> --- a/drivers/gpu/drm/tegra/sor.c
> +++ b/drivers/gpu/drm/tegra/sor.c
> @@ -3916,17 +3916,10 @@ static int tegra_sor_probe(struct platform_device *pdev)
>  	platform_set_drvdata(pdev, sor);
>  	pm_runtime_enable(&pdev->dev);
>  
> -	INIT_LIST_HEAD(&sor->client.list);
> +	host1x_client_init(&sor->client);
>  	sor->client.ops = &sor_client_ops;
>  	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
>  	 * pad output clock.
> @@ -3938,13 +3931,13 @@ static int tegra_sor_probe(struct platform_device *pdev)
>  				      sor->index);
>  		if (!name) {
>  			err = -ENOMEM;
> -			goto unregister;
> +			goto uninit;
>  		}
>  
>  		err = host1x_client_resume(&sor->client);
>  		if (err < 0) {
>  			dev_err(sor->dev, "failed to resume: %d\n", err);
> -			goto unregister;
> +			goto uninit;
>  		}
>  
>  		sor->clk_pad = tegra_clk_sor_pad_register(sor, name);
> @@ -3955,14 +3948,20 @@ static int tegra_sor_probe(struct platform_device *pdev)
>  		err = PTR_ERR(sor->clk_pad);
>  		dev_err(sor->dev, "failed to register SOR pad clock: %d\n",
>  			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;
>  
> -unregister:
> -	host1x_client_unregister(&sor->client);
> -rpm_disable:
> +uninit:
> +	host1x_client_exit(&sor->client);
>  	pm_runtime_disable(&pdev->dev);
>  remove:
>  	tegra_output_remove(&sor->output);
> 


Thanks! Completed 200 boots on Jetson TX1 without any further probing
issues, so ...

Tested-by: Jon Hunter <jonathanh at nvidia.com>

Cheers
Jon

-- 
nvpublic


More information about the dri-devel mailing list