[PATCH] drm/probe-helper: convert drm_connector_helper_get_modes_from_ddc() to struct drm_edid

Jani Nikula jani.nikula at intel.com
Tue Nov 14 10:58:15 UTC 2023


Going forward, the struct drm_edid based functions drm_edid_read(),
drm_edid_connector_update() and drm_edid_connector_add_modes() are the
preferred ways of retrieving the EDID and updating the connector.

Cc: Thomas Zimmermann <tzimmermann at suse.de>
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 drivers/gpu/drm/drm_probe_helper.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 3f479483d7d8..309d88f13648 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -1116,21 +1116,20 @@ EXPORT_SYMBOL(drm_crtc_helper_mode_valid_fixed);
  */
 int drm_connector_helper_get_modes_from_ddc(struct drm_connector *connector)
 {
-	struct edid *edid;
-	int count = 0;
+	const struct drm_edid *drm_edid;
+	int count;
 
 	if (!connector->ddc)
 		return 0;
 
-	edid = drm_get_edid(connector, connector->ddc);
+	drm_edid = drm_edid_read(connector);
+
+	/* clears property if EDID is NULL */
+	drm_edid_connector_update(connector, drm_edid);
 
-	// clears property if EDID is NULL
-	drm_connector_update_edid_property(connector, edid);
+	count = drm_edid_connector_add_modes(connector);
 
-	if (edid) {
-		count = drm_add_edid_modes(connector, edid);
-		kfree(edid);
-	}
+	drm_edid_free(drm_edid);
 
 	return count;
 }
-- 
2.39.2



More information about the dri-devel mailing list