[PATCH 09/12] drm/bridge: imx8qxp-ldb: convert to of_drm_find_and_get_bridge()

Luca Ceresoli posted 12 patches 1 month ago
There is a newer version of this series
[PATCH 09/12] drm/bridge: imx8qxp-ldb: convert to of_drm_find_and_get_bridge()
Posted by Luca Ceresoli 1 month ago
of_drm_find_bridge() is deprecated. Move to its replacement
of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
is put when done.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
index 122502968927..6b80d798b27a 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
@@ -552,7 +552,7 @@ static int imx8qxp_ldb_parse_dt_companion(struct imx8qxp_ldb *imx8qxp_ldb)
 		goto out;
 	}
 
-	imx8qxp_ldb->companion = of_drm_find_bridge(companion_port);
+	imx8qxp_ldb->companion = of_drm_find_and_get_bridge(companion_port);
 	if (!imx8qxp_ldb->companion) {
 		ret = -EPROBE_DEFER;
 		DRM_DEV_DEBUG_DRIVER(dev,
@@ -679,6 +679,7 @@ static void imx8qxp_ldb_remove(struct platform_device *pdev)
 	struct ldb *ldb = &imx8qxp_ldb->base;
 
 	ldb_remove_bridge_helper(ldb);
+	drm_bridge_put(imx8qxp_ldb->companion);
 
 	pm_runtime_disable(&pdev->dev);
 }

-- 
2.52.0
Re: [PATCH 09/12] drm/bridge: imx8qxp-ldb: convert to of_drm_find_and_get_bridge()
Posted by Maxime Ripard 1 month ago
Hi,

On Wed, Jan 07, 2026 at 02:13:00PM +0100, Luca Ceresoli wrote:
> of_drm_find_bridge() is deprecated. Move to its replacement
> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
> is put when done.
> 
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
>  drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
> index 122502968927..6b80d798b27a 100644
> --- a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
> +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
> @@ -552,7 +552,7 @@ static int imx8qxp_ldb_parse_dt_companion(struct imx8qxp_ldb *imx8qxp_ldb)
>  		goto out;
>  	}
>  
> -	imx8qxp_ldb->companion = of_drm_find_bridge(companion_port);
> +	imx8qxp_ldb->companion = of_drm_find_and_get_bridge(companion_port);
>  	if (!imx8qxp_ldb->companion) {
>  		ret = -EPROBE_DEFER;
>  		DRM_DEV_DEBUG_DRIVER(dev,
> @@ -679,6 +679,7 @@ static void imx8qxp_ldb_remove(struct platform_device *pdev)
>  	struct ldb *ldb = &imx8qxp_ldb->base;
>  
>  	ldb_remove_bridge_helper(ldb);
> +	drm_bridge_put(imx8qxp_ldb->companion);

the companion bridge is used in pretty much every KMS hook, we need to
put the reference in destroy.

Maxime
Re: [PATCH 09/12] drm/bridge: imx8qxp-ldb: convert to of_drm_find_and_get_bridge()
Posted by Luca Ceresoli 1 month ago
Hi Maxime,

Thanks for the blazingly fast review of the entire series!

On Wed Jan 7, 2026 at 3:08 PM CET, Maxime Ripard wrote:
> Hi,
>
> On Wed, Jan 07, 2026 at 02:13:00PM +0100, Luca Ceresoli wrote:
>> of_drm_find_bridge() is deprecated. Move to its replacement
>> of_drm_find_and_get_bridge() which gets a bridge reference, and ensure it
>> is put when done.
>>
>> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
>> ---
>>  drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
>> index 122502968927..6b80d798b27a 100644
>> --- a/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
>> +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c
>> @@ -552,7 +552,7 @@ static int imx8qxp_ldb_parse_dt_companion(struct imx8qxp_ldb *imx8qxp_ldb)
>>  		goto out;
>>  	}
>>
>> -	imx8qxp_ldb->companion = of_drm_find_bridge(companion_port);
>> +	imx8qxp_ldb->companion = of_drm_find_and_get_bridge(companion_port);
>>  	if (!imx8qxp_ldb->companion) {
>>  		ret = -EPROBE_DEFER;
>>  		DRM_DEV_DEBUG_DRIVER(dev,
>> @@ -679,6 +679,7 @@ static void imx8qxp_ldb_remove(struct platform_device *pdev)
>>  	struct ldb *ldb = &imx8qxp_ldb->base;
>>
>>  	ldb_remove_bridge_helper(ldb);
>> +	drm_bridge_put(imx8qxp_ldb->companion);
>
> the companion bridge is used in pretty much every KMS hook, we need to
> put the reference in destroy.

Ouch, indeed! Will fix in v2.

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com