Subject: [PATCH 04/37] drm/display: bridge-connector: store the drm_device pointer

From: Luca Ceresoli <[email-masked]>
Date: Tue, 19 May 2026 12:37:21 +0200

Currently the struct drm_device pointer is only needed during the initial
drm_bridge_connector_init() and in drm_bridge_connector_handle_hpd() which
gets it from the struct drm_connector.

This will be insufficient when introducing bridge hotplugging, because:

 * some of the actions in drm_bridge_connector_init() will have to be
   performed later on, when a bridge is hot(un)plugged
 * the connector will be removed and re-added based on hotplug events,
   so the drm_connector might just not exist or its content be cleared

Store the drm_device pointer in struct drm_bridge_connector for any later
needs. Also convert drm_bridge_connector_handle_hpd() to use the newly
stored value.

Signed-off-by: Luca Ceresoli <[email-masked]>
---
 drivers/gpu/drm/display/drm_bridge_connector.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c
index bf9b8a6bca78..62c4cb1e241f 100644
--- a/drivers/gpu/drm/display/drm_bridge_connector.c
+++ b/drivers/gpu/drm/display/drm_bridge_connector.c
@@ -60,6 +60,10 @@ struct drm_bridge_connector {
 	 * @base: The base DRM connector
 	 */
 	struct drm_connector base;
+	/**
+	 * @drm: The DRM device we belong to
+	 */
+	struct drm_device *drm;
 	/**
 	 * @encoder:
 	 *
@@ -157,7 +161,7 @@ static void drm_bridge_connector_handle_hpd(struct drm_bridge_connector *bridge_
 					    enum drm_connector_status status)
 {
 	struct drm_connector *connector = &bridge_connector->base;
-	struct drm_device *dev = connector->dev;
+	struct drm_device *dev = bridge_connector->drm;
 
 	mutex_lock(&dev->mode_config.mutex);
 	connector->status = status;
@@ -806,6 +810,7 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm,
 	if (ret)
 		return ERR_PTR(ret);
 
+	bridge_connector->drm = drm;
 	bridge_connector->encoder = encoder;
 
 	/*

-- 
2.54.0