[PATCH v4 07/13] drm/bridge: lvds-codec: Simplify panel DT node localisation

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue Nov 19 00:03:50 UTC 2019


Hi Fabrizio,

Thank you for the patch.

On Wed, Nov 13, 2019 at 03:51:26PM +0000, Fabrizio Castro wrote:
> The probe function needs to get ahold of the panel device tree
> node, and it achieves that by using a combination of
> of_graph_get_port_by_id, of_get_child_by_name, and
> of_graph_get_remote_port_parent. We can achieve the same goal
> by replacing those calls with a call to of_graph_get_remote_node
> these days.
> 
> Signed-off-by: Fabrizio Castro <fabrizio.castro at bp.renesas.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> ---
> v3->v4:
> * New patch
> ---
>  drivers/gpu/drm/bridge/lvds-codec.c | 20 ++------------------
>  1 file changed, 2 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/lvds-codec.c
> index c32e125..784bbd3 100644
> --- a/drivers/gpu/drm/bridge/lvds-codec.c
> +++ b/drivers/gpu/drm/bridge/lvds-codec.c
> @@ -57,8 +57,6 @@ static struct drm_bridge_funcs funcs = {
>  static int lvds_codec_probe(struct platform_device *pdev)
>  {
>  	struct device *dev = &pdev->dev;
> -	struct device_node *port;
> -	struct device_node *endpoint;
>  	struct device_node *panel_node;
>  	struct drm_panel *panel;
>  	struct lvds_codec *lvds_codec;
> @@ -79,23 +77,9 @@ static int lvds_codec_probe(struct platform_device *pdev)
>  	}
>  
>  	/* Locate the panel DT node. */
> -	port = of_graph_get_port_by_id(dev->of_node, 1);
> -	if (!port) {
> -		dev_dbg(dev, "port 1 not found\n");
> -		return -ENXIO;
> -	}
> -
> -	endpoint = of_get_child_by_name(port, "endpoint");
> -	of_node_put(port);
> -	if (!endpoint) {
> -		dev_dbg(dev, "no endpoint for port 1\n");
> -		return -ENXIO;
> -	}
> -
> -	panel_node = of_graph_get_remote_port_parent(endpoint);
> -	of_node_put(endpoint);
> +	panel_node = of_graph_get_remote_node(dev->of_node, 1, 0);
>  	if (!panel_node) {
> -		dev_dbg(dev, "no remote endpoint for port 1\n");
> +		dev_dbg(dev, "panel DT node not found\n");
>  		return -ENXIO;
>  	}
>  

-- 
Regards,

Laurent Pinchart


More information about the dri-devel mailing list