diff mbox series

[v3,11/35] drm/bridge/analogix: Use drm_bridge_init()

Message ID 20191224173408.25624-12-mihail.atanassov@arm.com (mailing list archive)
State New, archived
Headers show
Series drm/bridge: Consolidate initialization | expand

Commit Message

Mihail Atanassov Dec. 24, 2019, 5:34 p.m. UTC
No functional change.

The setting of bridge->of_node by drm_bridge_init() in
analogix_dp_core.c is safe, since ->of_node isn't used directly and the
bridge isn't published with drm_bridge_add().

v3:
 - drop driver_private argument (Laurent)
 - pass correct struct device pointer to drm_bridge_init (Laurent)

Signed-off-by: Mihail Atanassov <mihail.atanassov@arm.com>
---
 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 5 ++---
 drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 8 ++------
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 8 ++++----
 3 files changed, 8 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
index 5b806d23fcb3..62404b0f2fc1 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
@@ -696,8 +696,6 @@  static int anx6345_i2c_probe(struct i2c_client *client,
 
 	mutex_init(&anx6345->lock);
 
-	anx6345->bridge.of_node = client->dev.of_node;
-
 	anx6345->client = client;
 	i2c_set_clientdata(client, anx6345);
 
@@ -760,7 +758,8 @@  static int anx6345_i2c_probe(struct i2c_client *client,
 	/* Look for supported chip ID */
 	anx6345_poweron(anx6345);
 	if (anx6345_get_chip_id(anx6345)) {
-		anx6345->bridge.funcs = &anx6345_bridge_funcs;
+		drm_bridge_init(&anx6345->bridge, &client->dev,
+				&anx6345_bridge_funcs, NULL);
 		drm_bridge_add(&anx6345->bridge);
 
 		return 0;
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
index 7463537950cb..e30df40ec512 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
@@ -1214,10 +1214,6 @@  static int anx78xx_i2c_probe(struct i2c_client *client,
 
 	mutex_init(&anx78xx->lock);
 
-#if IS_ENABLED(CONFIG_OF)
-	anx78xx->bridge.of_node = client->dev.of_node;
-#endif
-
 	anx78xx->client = client;
 	i2c_set_clientdata(client, anx78xx);
 
@@ -1321,8 +1317,8 @@  static int anx78xx_i2c_probe(struct i2c_client *client,
 		goto err_poweroff;
 	}
 
-	anx78xx->bridge.funcs = &anx78xx_bridge_funcs;
-
+	drm_bridge_init(&anx78xx->bridge, &client->dev, &anx78xx_bridge_funcs,
+			NULL);
 	drm_bridge_add(&anx78xx->bridge);
 
 	/* If cable is pulled out, just poweroff and wait for HPD event */
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 56ea3be27f2b..29693d48682e 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1571,13 +1571,13 @@  static const struct drm_bridge_funcs analogix_dp_bridge_funcs = {
 	.attach = analogix_dp_bridge_attach,
 };
 
-static int analogix_dp_attach_bridge(struct drm_device *drm_dev,
+static int analogix_dp_attach_bridge(struct device *dev,
+				     struct drm_device *drm_dev,
 				     struct analogix_dp_device *dp)
 {
 	int ret;
 
-	dp->bridge.funcs = &analogix_dp_bridge_funcs;
-
+	drm_bridge_init(&dp->bridge, dev, &analogix_dp_bridge_funcs, NULL);
 	ret = drm_bridge_attach(dp->encoder, &dp->bridge, NULL);
 	if (ret)
 		return -EINVAL;
@@ -1745,7 +1745,7 @@  analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
 
 	pm_runtime_enable(dev);
 
-	ret = analogix_dp_attach_bridge(drm_dev, dp);
+	ret = analogix_dp_attach_bridge(dev, drm_dev, dp);
 	if (ret) {
 		DRM_ERROR("failed to attach bridge (%d)\n", ret);
 		goto err_disable_pm_runtime;