[PATCH v3 3/3] drm: clean cached display info

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

 



This patch adds a small helper function, which clears the cached
information about a hot-pluggable display, from connector. On event
This will run on event of a hot-unplug, keeping the connector's display
info up-to-date, avoiding any errors due to invalid cached data.

Cc: Jose Abreu <joabreu@xxxxxxxxxxxx>

Suggested-by: Jose Abreu <joabreu@xxxxxxxxxxxx>
Signed-off-by: Shashank Sharma <shashank.sharma@xxxxxxxxx>
---
 drivers/gpu/drm/drm_probe_helper.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 7cff91e..9e97b45 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -164,6 +164,18 @@ void drm_kms_helper_poll_enable_locked(struct drm_device *dev)
 }
 
 /**
+ * drm_helper_clear_display_info - clean cached display information for
+ * hot pluggable displays, on event of hot-unplug
+ * @connector: connector under event
+ */
+void drm_helper_clear_display_info(struct drm_connector *connector)
+{
+	struct drm_display_info *info = &connector->display_info;
+
+	memset(info, 0, sizeof(*info));
+}
+
+/**
  * drm_helper_probe_single_connector_modes - get complete set of display modes
  * @connector: connector to probe
  * @maxX: max width for modes
@@ -288,6 +300,14 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
 			connector->base.id, connector->name);
 		drm_mode_connector_update_edid_property(connector, NULL);
+
+		/*
+		 * Connector status change to disconnected, time to clean
+		 * cached display information
+		 */
+		if (connector->status == connector_status_disconnected)
+			drm_helper_clear_display_info(connector);
+
 		verbose_prune = false;
 		goto prune;
 	}
-- 
1.9.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux