[PATCH RFC 2/3] drm/bridge: ti-tfp410: Adapt to bridge object and module refcounting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Jyri Sarha <jsarha@xxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux