[v4,3/5] drm: bridge: mtk_dsi: Switch to devm_drm_of_get_bridge

Message ID 20220331154503.66054-3-jagan@amarulasolutions.com
State New
Headers show
Series
  • [v4,1/5] Revert "drm/bridge: dw-mipi-dsi: Find the possible DSI devices"
Related show

Commit Message

Jagan Teki March 31, 2022, 3:45 p.m. UTC
devm_drm_of_get_bridge is capable of looking up the downstream
bridge and panel and trying to add a panel bridge if the panel
is found.

Replace explicit finding calls with devm_drm_of_get_bridge.

Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v4, v3:
- none 
Changes for v2:
- split the patch

 drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

Comments

Robert Foss March 31, 2022, 3:50 p.m. UTC | #1
On Thu, 31 Mar 2022 at 17:45, Jagan Teki <jagan@amarulasolutions.com> wrote:
>
> devm_drm_of_get_bridge is capable of looking up the downstream
> bridge and panel and trying to add a panel bridge if the panel
> is found.
>
> Replace explicit finding calls with devm_drm_of_get_bridge.
>
> Cc: Chun-Kuang Hu <chunkuang.hu@kernel.org>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v4, v3:
> - none
> Changes for v2:
> - split the patch
>
>  drivers/gpu/drm/mediatek/mtk_dsi.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index e91b3fff4342..1487cc308c5d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -1016,7 +1016,6 @@ static int mtk_dsi_probe(struct platform_device *pdev)
>  {
>         struct mtk_dsi *dsi;
>         struct device *dev = &pdev->dev;
> -       struct drm_panel *panel;
>         struct resource *regs;
>         int irq_num;
>         int ret;
> @@ -1033,17 +1032,10 @@ static int mtk_dsi_probe(struct platform_device *pdev)
>                 return ret;
>         }
>
> -       ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
> -                                         &panel, &dsi->next_bridge);
> -       if (ret)
> +       dsi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
> +       if (IS_ERR(dsi->next_bridge)) {
> +               ret = PTR_ERR(dsi->next_bridge);
>                 goto err_unregister_host;
> -
> -       if (panel) {
> -               dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
> -               if (IS_ERR(dsi->next_bridge)) {
> -                       ret = PTR_ERR(dsi->next_bridge);
> -                       goto err_unregister_host;
> -               }
>         }
>
>         dsi->driver_data = of_device_get_match_data(dev);
> --
> 2.25.1
>

Reviewed-by: Robert Foss <robert.foss@linaro.org>
Robert Foss March 31, 2022, 5:54 p.m. UTC | #2
Philippe, Chun-Kuang,

I applied this patch without realizing it is outside of my maintainer
domain, and caused conflict in dim-tip, which I've resolved.
Even with the conflict resolved, I think getting an AB after the fact
would be good.

Sorry about the inconvenience.

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
index e91b3fff4342..1487cc308c5d 100644
--- a/drivers/gpu/drm/mediatek/mtk_dsi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
@@ -1016,7 +1016,6 @@  static int mtk_dsi_probe(struct platform_device *pdev)
 {
 	struct mtk_dsi *dsi;
 	struct device *dev = &pdev->dev;
-	struct drm_panel *panel;
 	struct resource *regs;
 	int irq_num;
 	int ret;
@@ -1033,17 +1032,10 @@  static int mtk_dsi_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0,
-					  &panel, &dsi->next_bridge);
-	if (ret)
+	dsi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0);
+	if (IS_ERR(dsi->next_bridge)) {
+		ret = PTR_ERR(dsi->next_bridge);
 		goto err_unregister_host;
-
-	if (panel) {
-		dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel);
-		if (IS_ERR(dsi->next_bridge)) {
-			ret = PTR_ERR(dsi->next_bridge);
-			goto err_unregister_host;
-		}
 	}
 
 	dsi->driver_data = of_device_get_match_data(dev);