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 2/3] drm/bridge: ti-tfp410: Adapt to bridge object and module refcounting
Date: Thu, 1 Dec 2016 17:52:05 +0200	[thread overview]
Message-ID: <04ef63804ffce4c51a17cf8d3e8dbe1bdcd6c3ce.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/bridge/ti-tfp410.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
index b054ea3..f0c81dd 100644
--- a/drivers/gpu/drm/bridge/ti-tfp410.c
+++ b/drivers/gpu/drm/bridge/ti-tfp410.c
@@ -19,7 +19,7 @@
 #include <drm/drm_crtc_helper.h>
 
 struct tfp410 {
-	struct drm_bridge	bridge;
+	struct drm_bridge	*bridge;
 	struct drm_connector	connector;
 
 	struct i2c_adapter	*ddc;
@@ -30,7 +30,7 @@ struct tfp410 {
 static inline struct tfp410 *
 drm_bridge_to_tfp410(struct drm_bridge *bridge)
 {
-	return container_of(bridge, struct tfp410, bridge);
+	return bridge->driver_private;
 }
 
 static inline struct tfp410 *
@@ -171,16 +171,18 @@ static int tfp410_init(struct device *dev)
 	if (!dvi)
 		return -ENOMEM;
 	dev_set_drvdata(dev, dvi);
+	dvi->bridge = drm_bridge_alloc(THIS_MODULE);
+	dvi->bridge->driver_private = dvi;
 
-	dvi->bridge.funcs = &tfp410_bridge_funcs;
-	dvi->bridge.of_node = dev->of_node;
+	dvi->bridge->funcs = &tfp410_bridge_funcs;
+	dvi->bridge->of_node = dev->of_node;
 	dvi->dev = dev;
 
 	ret = tfp410_get_connector_ddc(dvi);
 	if (ret)
 		goto fail;
 
-	ret = drm_bridge_add(&dvi->bridge);
+	ret = drm_bridge_add(dvi->bridge);
 	if (ret) {
 		dev_err(dev, "drm_bridge_add() failed: %d\n", ret);
 		goto fail;
@@ -196,11 +198,13 @@ static int tfp410_fini(struct device *dev)
 {
 	struct tfp410 *dvi = dev_get_drvdata(dev);
 
-	drm_bridge_remove(&dvi->bridge);
+	drm_bridge_remove(dvi->bridge);
 
 	if (dvi->ddc)
 		i2c_put_adapter(dvi->ddc);
 
+	drm_bridge_put(dvi->bridge);
+
 	return 0;
 }
 
-- 
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 ` Jyri Sarha [this message]
2016-12-01 15:52 ` [PATCH RFC 3/3] drm/tilcdc: Adapt to bridge object refcounting Jyri Sarha
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=04ef63804ffce4c51a17cf8d3e8dbe1bdcd6c3ce.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).