diff mbox

drm/arm: mali-dp: Set crtc.port to the port instead of the endpoint

Message ID 1469549725-19577-1-git-send-email-brian.starkey@arm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Brian Starkey July 26, 2016, 4:15 p.m. UTC
The CRTC's port pointer was being set to the endpoint node instead of
the port. Fix that, and hold a reference on the port node.

Signed-off-by: Brian Starkey <brian.starkey@arm.com>
Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>
---
 drivers/gpu/drm/arm/malidp_drv.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Sean Paul July 26, 2016, 5:51 p.m. UTC | #1
On Tue, Jul 26, 2016 at 12:15 PM, Brian Starkey <brian.starkey@arm.com> wrote:
> The CRTC's port pointer was being set to the endpoint node instead of
> the port. Fix that, and hold a reference on the port node.
>
> Signed-off-by: Brian Starkey <brian.starkey@arm.com>
> Acked-by: Liviu Dudau <Liviu.Dudau@arm.com>

Applied to drm-misc

> ---
>  drivers/gpu/drm/arm/malidp_drv.c |   13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index e5b44e9..4e61ea5 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -257,6 +257,7 @@ static int malidp_bind(struct device *dev)
>  {
>         struct resource *res;
>         struct drm_device *drm;
> +       struct device_node *ep;
>         struct malidp_drm *malidp;
>         struct malidp_hw_device *hwdev;
>         struct platform_device *pdev = to_platform_device(dev);
> @@ -360,11 +361,12 @@ static int malidp_bind(struct device *dev)
>                 goto register_fail;
>
>         /* Set the CRTC's port so that the encoder component can find it */
> -       malidp->crtc.port = of_graph_get_next_endpoint(dev->of_node, NULL);
> +       ep = of_graph_get_next_endpoint(dev->of_node, NULL);
> +       if (!ep)
> +               goto port_fail;
> +       malidp->crtc.port = of_get_next_parent(ep);
>
>         ret = component_bind_all(dev, drm);
> -       of_node_put(malidp->crtc.port);
> -
>         if (ret) {
>                 DRM_ERROR("Failed to bind all components\n");
>                 goto bind_fail;
> @@ -402,6 +404,9 @@ vblank_fail:
>  irq_init_fail:
>         component_unbind_all(dev, drm);
>  bind_fail:
> +       of_node_put(malidp->crtc.port);
> +       malidp->crtc.port = NULL;
> +port_fail:
>         drm_dev_unregister(drm);
>  register_fail:
>         malidp_de_planes_destroy(drm);
> @@ -435,6 +440,8 @@ static void malidp_unbind(struct device *dev)
>         malidp_de_irq_fini(drm);
>         drm_vblank_cleanup(drm);
>         component_unbind_all(dev, drm);
> +       of_node_put(malidp->crtc.port);
> +       malidp->crtc.port = NULL;
>         drm_dev_unregister(drm);
>         malidp_de_planes_destroy(drm);
>         drm_mode_config_cleanup(drm);
> --
> 1.7.9.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index e5b44e9..4e61ea5 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -257,6 +257,7 @@  static int malidp_bind(struct device *dev)
 {
 	struct resource *res;
 	struct drm_device *drm;
+	struct device_node *ep;
 	struct malidp_drm *malidp;
 	struct malidp_hw_device *hwdev;
 	struct platform_device *pdev = to_platform_device(dev);
@@ -360,11 +361,12 @@  static int malidp_bind(struct device *dev)
 		goto register_fail;
 
 	/* Set the CRTC's port so that the encoder component can find it */
-	malidp->crtc.port = of_graph_get_next_endpoint(dev->of_node, NULL);
+	ep = of_graph_get_next_endpoint(dev->of_node, NULL);
+	if (!ep)
+		goto port_fail;
+	malidp->crtc.port = of_get_next_parent(ep);
 
 	ret = component_bind_all(dev, drm);
-	of_node_put(malidp->crtc.port);
-
 	if (ret) {
 		DRM_ERROR("Failed to bind all components\n");
 		goto bind_fail;
@@ -402,6 +404,9 @@  vblank_fail:
 irq_init_fail:
 	component_unbind_all(dev, drm);
 bind_fail:
+	of_node_put(malidp->crtc.port);
+	malidp->crtc.port = NULL;
+port_fail:
 	drm_dev_unregister(drm);
 register_fail:
 	malidp_de_planes_destroy(drm);
@@ -435,6 +440,8 @@  static void malidp_unbind(struct device *dev)
 	malidp_de_irq_fini(drm);
 	drm_vblank_cleanup(drm);
 	component_unbind_all(dev, drm);
+	of_node_put(malidp->crtc.port);
+	malidp->crtc.port = NULL;
 	drm_dev_unregister(drm);
 	malidp_de_planes_destroy(drm);
 	drm_mode_config_cleanup(drm);