diff mbox series

[v6,04/11] drm/mediatek: dp: Use devm variant of drm_bridge_add()

Message ID 20230717141438.274419-5-angelogioacchino.delregno@collabora.com (mailing list archive)
State New, archived
Headers show
Series MediaTek DisplayPort: support eDP and aux-bus | expand

Commit Message

AngeloGioacchino Del Regno July 17, 2023, 2:14 p.m. UTC
In preparation for adding support for aux-bus, which will add a code
path that may fail after the drm_bridge_add() call, change that to
devm_drm_bridge_add() to simplify failure paths later.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: Chen-Yu Tsai <wenst@chromium.org>
---
 drivers/gpu/drm/mediatek/mtk_dp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

CK Hu (胡俊光) July 18, 2023, 9:33 a.m. UTC | #1
Hi, Angelo:

On Mon, 2023-07-17 at 16:14 +0200, AngeloGioacchino Del Regno wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  In preparation for adding support for aux-bus, which will add a code
> path that may fail after the drm_bridge_add() call, change that to
> devm_drm_bridge_add() to simplify failure paths later.

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

> 
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> Tested-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
>  drivers/gpu/drm/mediatek/mtk_dp.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c
> b/drivers/gpu/drm/mediatek/mtk_dp.c
> index 98f63d8230e4..fc6cabf5370b 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dp.c
> @@ -2552,7 +2552,9 @@ static int mtk_dp_probe(struct platform_device
> *pdev)
>  		DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID |
> DRM_BRIDGE_OP_HPD;
>  	mtk_dp->bridge.type = mtk_dp->data->bridge_type;
>  
> -	drm_bridge_add(&mtk_dp->bridge);
> +	ret = devm_drm_bridge_add(dev, &mtk_dp->bridge);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "Failed to add
> bridge\n");
>  
>  	mtk_dp->need_debounce = true;
>  	timer_setup(&mtk_dp->debounce_timer, mtk_dp_debounce_timer, 0);
> @@ -2570,7 +2572,6 @@ static int mtk_dp_remove(struct platform_device
> *pdev)
>  	pm_runtime_put(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
>  	del_timer_sync(&mtk_dp->debounce_timer);
> -	drm_bridge_remove(&mtk_dp->bridge);
>  	platform_device_unregister(mtk_dp->phy_dev);
>  	if (mtk_dp->audio_pdev)
>  		platform_device_unregister(mtk_dp->audio_pdev);
> -- 
> 2.40.1
Alexandre Mergnat July 20, 2023, 3:58 p.m. UTC | #2
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>

On 17/07/2023 16:14, AngeloGioacchino Del Regno wrote:
> In preparation for adding support for aux-bus, which will add a code
> path that may fail after the drm_bridge_add() call, change that to
> devm_drm_bridge_add() to simplify failure paths later.
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
index 98f63d8230e4..fc6cabf5370b 100644
--- a/drivers/gpu/drm/mediatek/mtk_dp.c
+++ b/drivers/gpu/drm/mediatek/mtk_dp.c
@@ -2552,7 +2552,9 @@  static int mtk_dp_probe(struct platform_device *pdev)
 		DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | DRM_BRIDGE_OP_HPD;
 	mtk_dp->bridge.type = mtk_dp->data->bridge_type;
 
-	drm_bridge_add(&mtk_dp->bridge);
+	ret = devm_drm_bridge_add(dev, &mtk_dp->bridge);
+	if (ret)
+		return dev_err_probe(dev, ret, "Failed to add bridge\n");
 
 	mtk_dp->need_debounce = true;
 	timer_setup(&mtk_dp->debounce_timer, mtk_dp_debounce_timer, 0);
@@ -2570,7 +2572,6 @@  static int mtk_dp_remove(struct platform_device *pdev)
 	pm_runtime_put(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 	del_timer_sync(&mtk_dp->debounce_timer);
-	drm_bridge_remove(&mtk_dp->bridge);
 	platform_device_unregister(mtk_dp->phy_dev);
 	if (mtk_dp->audio_pdev)
 		platform_device_unregister(mtk_dp->audio_pdev);