diff mbox

[v3,06/10] drm/rockchip: analogix_dp: make panel detect to an optional action

Message ID 1465904784-978-1-git-send-email-ykk@rock-chips.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Yakir Yang June 14, 2016, 11:46 a.m. UTC
Some boards don't need to declare a panel device node, like the
display interface is DP monitors, so it's necessary to make the
panel detect to an optional action.

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Acked-by: Mark Yao <mark.yao@rock-chips.com>
---
Changes in v3:
- Add the acked flag from Mark.

Changes in v2: None

 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 48 ++++++++++++-------------
 1 file changed, 22 insertions(+), 26 deletions(-)

Comments

Sean Paul June 23, 2016, 2:10 p.m. UTC | #1
On Tue, Jun 14, 2016 at 7:46 AM, Yakir Yang <ykk@rock-chips.com> wrote:
> Some boards don't need to declare a panel device node, like the
> display interface is DP monitors, so it's necessary to make the
> panel detect to an optional action.
>
> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
> Acked-by: Mark Yao <mark.yao@rock-chips.com>
> ---
> Changes in v3:
> - Add the acked flag from Mark.
>
> Changes in v2: None
>
>  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 48 ++++++++++++-------------
>  1 file changed, 22 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> index bcd9ecc..da2e844 100644
> --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
> @@ -332,38 +332,34 @@ static int rockchip_dp_probe(struct platform_device *pdev)
>  {
>         struct device *dev = &pdev->dev;
>         struct device_node *panel_node, *port, *endpoint;
> +       struct drm_panel *panel = NULL;
>         struct rockchip_dp_device *dp;
> -       struct drm_panel *panel;
>
>         port = of_graph_get_port_by_id(dev->of_node, 1);
> -       if (!port) {
> -               dev_err(dev, "can't find output port\n");
> -               return -EINVAL;
> -       }
> -
> -       endpoint = of_get_child_by_name(port, "endpoint");
> -       of_node_put(port);
> -       if (!endpoint) {
> -               dev_err(dev, "no output endpoint found\n");
> -               return -EINVAL;
> -       }
> -
> -       panel_node = of_graph_get_remote_port_parent(endpoint);
> -       of_node_put(endpoint);
> -       if (!panel_node) {
> -               dev_err(dev, "no output node found\n");
> -               return -EINVAL;
> -       }
> -
> -       panel = of_drm_find_panel(panel_node);
> -       if (!panel) {
> -               DRM_ERROR("failed to find panel\n");
> +       if (port) {
> +               endpoint = of_get_child_by_name(port, "endpoint");
> +               of_node_put(port);
> +               if (!endpoint) {
> +                       dev_err(dev, "no output endpoint found\n");
> +                       return -EINVAL;
> +               }
> +
> +               panel_node = of_graph_get_remote_port_parent(endpoint);
> +               of_node_put(endpoint);
> +               if (!panel_node) {
> +                       dev_err(dev, "no output node found\n");
> +                       return -EINVAL;
> +               }
> +
> +               panel = of_drm_find_panel(panel_node);
> +               if (!panel) {
> +                       DRM_ERROR("failed to find panel\n");
> +                       of_node_put(panel_node);
> +                       return -EPROBE_DEFER;
> +               }
>                 of_node_put(panel_node);

Minor nit: Move of_node_put(panel_node) directly below
of_drm_find_panel to avoid duplicating it in both error and normal
paths (like you've done above).

Sean

> -               return -EPROBE_DEFER;
>         }
>
> -       of_node_put(panel_node);
> -
>         dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
>         if (!dp)
>                 return -ENOMEM;
> --
> 1.9.1
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yakir Yang June 29, 2016, 6:43 a.m. UTC | #2
Sean,

On 06/23/2016 10:10 PM, Sean Paul wrote:
> On Tue, Jun 14, 2016 at 7:46 AM, Yakir Yang <ykk@rock-chips.com> wrote:
>> Some boards don't need to declare a panel device node, like the
>> display interface is DP monitors, so it's necessary to make the
>> panel detect to an optional action.
>>
>> Signed-off-by: Yakir Yang <ykk@rock-chips.com>
>> Acked-by: Mark Yao <mark.yao@rock-chips.com>
>> ---
>> Changes in v3:
>> - Add the acked flag from Mark.
>>
>> Changes in v2: None
>>
>>   drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 48 ++++++++++++-------------
>>   1 file changed, 22 insertions(+), 26 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
>> index bcd9ecc..da2e844 100644
>> --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
>> +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
>> @@ -332,38 +332,34 @@ static int rockchip_dp_probe(struct platform_device *pdev)
>>   {
>>          struct device *dev = &pdev->dev;
>>          struct device_node *panel_node, *port, *endpoint;
>> +       struct drm_panel *panel = NULL;
>>          struct rockchip_dp_device *dp;
>> -       struct drm_panel *panel;
>>
>>          port = of_graph_get_port_by_id(dev->of_node, 1);
>> -       if (!port) {
>> -               dev_err(dev, "can't find output port\n");
>> -               return -EINVAL;
>> -       }
>> -
>> -       endpoint = of_get_child_by_name(port, "endpoint");
>> -       of_node_put(port);
>> -       if (!endpoint) {
>> -               dev_err(dev, "no output endpoint found\n");
>> -               return -EINVAL;
>> -       }
>> -
>> -       panel_node = of_graph_get_remote_port_parent(endpoint);
>> -       of_node_put(endpoint);
>> -       if (!panel_node) {
>> -               dev_err(dev, "no output node found\n");
>> -               return -EINVAL;
>> -       }
>> -
>> -       panel = of_drm_find_panel(panel_node);
>> -       if (!panel) {
>> -               DRM_ERROR("failed to find panel\n");
>> +       if (port) {
>> +               endpoint = of_get_child_by_name(port, "endpoint");
>> +               of_node_put(port);
>> +               if (!endpoint) {
>> +                       dev_err(dev, "no output endpoint found\n");
>> +                       return -EINVAL;
>> +               }
>> +
>> +               panel_node = of_graph_get_remote_port_parent(endpoint);
>> +               of_node_put(endpoint);
>> +               if (!panel_node) {
>> +                       dev_err(dev, "no output node found\n");
>> +                       return -EINVAL;
>> +               }
>> +
>> +               panel = of_drm_find_panel(panel_node);
>> +               if (!panel) {
>> +                       DRM_ERROR("failed to find panel\n");
>> +                       of_node_put(panel_node);
>> +                       return -EPROBE_DEFER;
>> +               }
>>                  of_node_put(panel_node);
> Minor nit: Move of_node_put(panel_node) directly below
> of_drm_find_panel to avoid duplicating it in both error and normal
> paths (like you've done above).

Yep, done.

Thanks,
- Yakir

> Sean
>
>> -               return -EPROBE_DEFER;
>>          }
>>
>> -       of_node_put(panel_node);
>> -
>>          dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
>>          if (!dp)
>>                  return -ENOMEM;
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>


--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index bcd9ecc..da2e844 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -332,38 +332,34 @@  static int rockchip_dp_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct device_node *panel_node, *port, *endpoint;
+	struct drm_panel *panel = NULL;
 	struct rockchip_dp_device *dp;
-	struct drm_panel *panel;
 
 	port = of_graph_get_port_by_id(dev->of_node, 1);
-	if (!port) {
-		dev_err(dev, "can't find output port\n");
-		return -EINVAL;
-	}
-
-	endpoint = of_get_child_by_name(port, "endpoint");
-	of_node_put(port);
-	if (!endpoint) {
-		dev_err(dev, "no output endpoint found\n");
-		return -EINVAL;
-	}
-
-	panel_node = of_graph_get_remote_port_parent(endpoint);
-	of_node_put(endpoint);
-	if (!panel_node) {
-		dev_err(dev, "no output node found\n");
-		return -EINVAL;
-	}
-
-	panel = of_drm_find_panel(panel_node);
-	if (!panel) {
-		DRM_ERROR("failed to find panel\n");
+	if (port) {
+		endpoint = of_get_child_by_name(port, "endpoint");
+		of_node_put(port);
+		if (!endpoint) {
+			dev_err(dev, "no output endpoint found\n");
+			return -EINVAL;
+		}
+
+		panel_node = of_graph_get_remote_port_parent(endpoint);
+		of_node_put(endpoint);
+		if (!panel_node) {
+			dev_err(dev, "no output node found\n");
+			return -EINVAL;
+		}
+
+		panel = of_drm_find_panel(panel_node);
+		if (!panel) {
+			DRM_ERROR("failed to find panel\n");
+			of_node_put(panel_node);
+			return -EPROBE_DEFER;
+		}
 		of_node_put(panel_node);
-		return -EPROBE_DEFER;
 	}
 
-	of_node_put(panel_node);
-
 	dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
 	if (!dp)
 		return -ENOMEM;