[v2,2/8] drm: bridge: nwl-dsi: Switch to devm_drm_of_get_bridge

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

Commit Message

Jagan Teki March 1, 2022, 2:12 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: Guido Günther <agx@sigxcpu.org>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- split the patch

 drivers/gpu/drm/bridge/nwl-dsi.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

Comments

Guido Günther March 2, 2022, 11:22 a.m. UTC | #1
Hi,
On Tue, Mar 01, 2022 at 07:42:41PM +0530, Jagan Teki 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: Guido Günther <agx@sigxcpu.org>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
> Changes for v2:
> - split the patch
> 
>  drivers/gpu/drm/bridge/nwl-dsi.c | 18 +++---------------
>  1 file changed, 3 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
> index 30aacd939dc3..c9e108a7eca2 100644
> --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> @@ -916,22 +916,10 @@ static int nwl_dsi_bridge_attach(struct drm_bridge *bridge,
>  {
>  	struct nwl_dsi *dsi = bridge_to_dsi(bridge);
>  	struct drm_bridge *panel_bridge;
> -	struct drm_panel *panel;
> -	int ret;
> -
> -	ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 1, 0, &panel,
> -					  &panel_bridge);
> -	if (ret)
> -		return ret;
> -
> -	if (panel) {
> -		panel_bridge = drm_panel_bridge_add(panel);
> -		if (IS_ERR(panel_bridge))
> -			return PTR_ERR(panel_bridge);
> -	}
>  
> -	if (!panel_bridge)
> -		return -EPROBE_DEFER;
> +	panel_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 1, 0);
> +	if (IS_ERR(panel_bridge))
> +		return PTR_ERR(panel_bridge);
>  
>  	return drm_bridge_attach(bridge->encoder, panel_bridge, bridge, flags);
>  }

Reviewed-by: Guido Günther <agx@sigxcpu.org>

Thanks,
 -- Guido

> -- 
> 2.25.1
>

Patch

diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-dsi.c
index 30aacd939dc3..c9e108a7eca2 100644
--- a/drivers/gpu/drm/bridge/nwl-dsi.c
+++ b/drivers/gpu/drm/bridge/nwl-dsi.c
@@ -916,22 +916,10 @@  static int nwl_dsi_bridge_attach(struct drm_bridge *bridge,
 {
 	struct nwl_dsi *dsi = bridge_to_dsi(bridge);
 	struct drm_bridge *panel_bridge;
-	struct drm_panel *panel;
-	int ret;
-
-	ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 1, 0, &panel,
-					  &panel_bridge);
-	if (ret)
-		return ret;
-
-	if (panel) {
-		panel_bridge = drm_panel_bridge_add(panel);
-		if (IS_ERR(panel_bridge))
-			return PTR_ERR(panel_bridge);
-	}
 
-	if (!panel_bridge)
-		return -EPROBE_DEFER;
+	panel_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 1, 0);
+	if (IS_ERR(panel_bridge))
+		return PTR_ERR(panel_bridge);
 
 	return drm_bridge_attach(bridge->encoder, panel_bridge, bridge, flags);
 }