diff mbox series

[v4,4/5] drm: bridge: dw-mipi-dsi: Switch to devm_drm_of_get_bridge

Message ID 20220331154503.66054-4-jagan@amarulasolutions.com (mailing list archive)
State New, archived
Headers show
Series [v4,1/5] Revert "drm/bridge: dw-mipi-dsi: Find the possible DSI devices" | expand

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.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v4, v3:
- none 
Changes for v2:
- split the patch

 drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Comments

Robert Foss March 31, 2022, 3:52 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.
>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v4, v3:
> - none
> Changes for v2:
> - split the patch
>
>  drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> index 1cc912b6e1f8..b2efecf7d160 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
> @@ -315,7 +315,6 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
>         struct dw_mipi_dsi *dsi = host_to_dsi(host);
>         const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data;
>         struct drm_bridge *bridge;
> -       struct drm_panel *panel;
>         int ret;
>
>         if (device->lanes > dsi->plat_data->max_data_lanes) {
> @@ -329,17 +328,9 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
>         dsi->format = device->format;
>         dsi->mode_flags = device->mode_flags;
>
> -       ret = drm_of_find_panel_or_bridge(host->dev->of_node, 1, 0,
> -                                         &panel, &bridge);
> -       if (ret)
> -               return ret;
> -
> -       if (panel) {
> -               bridge = drm_panel_bridge_add_typed(panel,
> -                                                   DRM_MODE_CONNECTOR_DSI);
> -               if (IS_ERR(bridge))
> -                       return PTR_ERR(bridge);
> -       }
> +       bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 1, 0);
> +       if (IS_ERR(bridge))
> +               return PTR_ERR(bridge);
>
>         dsi->panel_bridge = bridge;
>
> --
> 2.25.1
>

Reviewed-by: Robert Foss <robert.foss@linaro.org>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
index 1cc912b6e1f8..b2efecf7d160 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
@@ -315,7 +315,6 @@  static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
 	struct dw_mipi_dsi *dsi = host_to_dsi(host);
 	const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data;
 	struct drm_bridge *bridge;
-	struct drm_panel *panel;
 	int ret;
 
 	if (device->lanes > dsi->plat_data->max_data_lanes) {
@@ -329,17 +328,9 @@  static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host,
 	dsi->format = device->format;
 	dsi->mode_flags = device->mode_flags;
 
-	ret = drm_of_find_panel_or_bridge(host->dev->of_node, 1, 0,
-					  &panel, &bridge);
-	if (ret)
-		return ret;
-
-	if (panel) {
-		bridge = drm_panel_bridge_add_typed(panel,
-						    DRM_MODE_CONNECTOR_DSI);
-		if (IS_ERR(bridge))
-			return PTR_ERR(bridge);
-	}
+	bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 1, 0);
+	if (IS_ERR(bridge))
+		return PTR_ERR(bridge);
 
 	dsi->panel_bridge = bridge;