diff mbox series

[v3,1/6] drm/mediatek: mtk_dpi: Simplify with devm_drm_bridge_add()

Message ID 20230726082245.550929-2-angelogioacchino.delregno@collabora.com (mailing list archive)
State New, archived
Headers show
Series drm/mediatek: Small mtk-dpi cleanups | expand

Commit Message

AngeloGioacchino Del Regno July 26, 2023, 8:22 a.m. UTC
Change drm_bridge_add() to its devm variant to slightly simplify the
probe function.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Fei Shao <fshao@chromium.org>
---
 drivers/gpu/drm/mediatek/mtk_dpi.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

CK Hu (胡俊光) July 27, 2023, 3:11 a.m. UTC | #1
Hi, Angelo:

On Wed, 2023-07-26 at 10:22 +0200, AngeloGioacchino Del Regno wrote:
> Change drm_bridge_add() to its devm variant to slightly simplify the
> probe function.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> Reviewed-by: Fei Shao <fshao@chromium.org>
> ---
>  drivers/gpu/drm/mediatek/mtk_dpi.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 28bdb1f427ff..e4ee0d02893a 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -1089,11 +1089,12 @@ static int mtk_dpi_probe(struct
> platform_device *pdev)
>  	dpi->bridge.of_node = dev->of_node;
>  	dpi->bridge.type = DRM_MODE_CONNECTOR_DPI;
>  
> -	drm_bridge_add(&dpi->bridge);
> +	ret = devm_drm_bridge_add(dev, &dpi->bridge);
> +	if (ret)
> +		return ret;
>  
>  	ret = component_add(dev, &mtk_dpi_component_ops);
>  	if (ret) {
> -		drm_bridge_remove(&dpi->bridge);
>  		dev_err(dev, "Failed to add component: %d\n", ret);
>  		return ret;
>  	}
> @@ -1103,10 +1104,7 @@ static int mtk_dpi_probe(struct
> platform_device *pdev)
>  
>  static int mtk_dpi_remove(struct platform_device *pdev)
>  {
> -	struct mtk_dpi *dpi = platform_get_drvdata(pdev);
> -
>  	component_del(&pdev->dev, &mtk_dpi_component_ops);
> -	drm_bridge_remove(&dpi->bridge);
>  
>  	return 0;
>  }
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 28bdb1f427ff..e4ee0d02893a 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -1089,11 +1089,12 @@  static int mtk_dpi_probe(struct platform_device *pdev)
 	dpi->bridge.of_node = dev->of_node;
 	dpi->bridge.type = DRM_MODE_CONNECTOR_DPI;
 
-	drm_bridge_add(&dpi->bridge);
+	ret = devm_drm_bridge_add(dev, &dpi->bridge);
+	if (ret)
+		return ret;
 
 	ret = component_add(dev, &mtk_dpi_component_ops);
 	if (ret) {
-		drm_bridge_remove(&dpi->bridge);
 		dev_err(dev, "Failed to add component: %d\n", ret);
 		return ret;
 	}
@@ -1103,10 +1104,7 @@  static int mtk_dpi_probe(struct platform_device *pdev)
 
 static int mtk_dpi_remove(struct platform_device *pdev)
 {
-	struct mtk_dpi *dpi = platform_get_drvdata(pdev);
-
 	component_del(&pdev->dev, &mtk_dpi_component_ops);
-	drm_bridge_remove(&dpi->bridge);
 
 	return 0;
 }