dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jyri Sarha <jsarha@ti.com>
To: dri-devel@lists.freedesktop.org
Cc: Jyri Sarha <jsarha@ti.com>,
	tomi.valkeinen@ti.com, laurent.pinchart@ideasonboard.com
Subject: [PATCH RFC 3/3] drm/tilcdc: Adapt to bridge object refcounting
Date: Thu, 1 Dec 2016 17:52:06 +0200	[thread overview]
Message-ID: <9e7ececc0e0954e9608cfcd5e173adda0de6594b.1480603126.git.jsarha@ti.com> (raw)
In-Reply-To: <cover.1480603126.git.jsarha@ti.com>

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/tilcdc/tilcdc_external.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_external.c b/drivers/gpu/drm/tilcdc/tilcdc_external.c
index 80184f0..31c6092 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_external.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_external.c
@@ -154,8 +154,10 @@ void tilcdc_remove_external_device(struct drm_device *dev)
 		drm_connector_helper_add(priv->external_connector,
 					 priv->connector_funcs);
 
-	if (priv->external_encoder && priv->external_encoder->bridge)
+	if (priv->external_encoder && priv->external_encoder->bridge) {
 		drm_bridge_detach(priv->external_encoder->bridge);
+		drm_bridge_put(priv->external_encoder->bridge);
+	}
 }
 
 static const struct drm_encoder_funcs tilcdc_external_encoder_funcs = {
@@ -234,7 +236,7 @@ int tilcdc_attach_external_device(struct drm_device *ddev)
 	if (!remote_node)
 		return 0;
 
-	bridge = of_drm_find_bridge(remote_node);
+	bridge = of_drm_get_bridge(remote_node);
 	of_node_put(remote_node);
 	if (!bridge)
 		return -EPROBE_DEFER;
@@ -242,20 +244,25 @@ int tilcdc_attach_external_device(struct drm_device *ddev)
 	priv->external_encoder = devm_kzalloc(ddev->dev,
 					      sizeof(*priv->external_encoder),
 					      GFP_KERNEL);
-	if (!priv->external_encoder)
+	if (!priv->external_encoder) {
+		drm_bridge_put(bridge);
 		return -ENOMEM;
+	}
 
 	ret = drm_encoder_init(ddev, priv->external_encoder,
 			       &tilcdc_external_encoder_funcs,
 			       DRM_MODE_ENCODER_NONE, NULL);
 	if (ret) {
 		dev_err(ddev->dev, "drm_encoder_init() failed %d\n", ret);
+		drm_bridge_put(bridge);
 		return ret;
 	}
 
 	ret = tilcdc_attach_bridge(ddev, bridge);
-	if (ret)
+	if (ret) {
 		drm_encoder_cleanup(priv->external_encoder);
+		drm_bridge_put(bridge);
+	}
 
 	return ret;
 }
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2016-12-01 15:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-01 15:52 [PATCH RFC 0/3] drm/bridge: adjust bridge module's refcount and more Jyri Sarha
2016-12-01 15:52 ` [PATCH RFC 1/3] drm/drm_bridge: adjust bridge module's refcount Jyri Sarha
2016-12-01 15:52 ` [PATCH RFC 2/3] drm/bridge: ti-tfp410: Adapt to bridge object and module refcounting Jyri Sarha
2016-12-01 15:52 ` Jyri Sarha [this message]
2016-12-08 20:57 ` [PATCH RFC 0/3] drm/bridge: adjust bridge module's refcount and more Jyri Sarha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e7ececc0e0954e9608cfcd5e173adda0de6594b.1480603126.git.jsarha@ti.com \
    --to=jsarha@ti.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).