[Intel-gfx] [RFC][PATCH 07/11] drm/probe-helper: Avoid iterating the list twice on ww backoff

Ville Syrjala ville.syrjala at linux.intel.com
Tue Feb 27 12:56:56 UTC 2018


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

If we have to backoff there's no point in going over the mode list again
to mark all the modes as stale. We can defer that until we're ready to
refresh the mode list. Avoids multiple list walks if we have to do the
locking backoff.

Cc: Keith Packard <keithp at keithp.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 drivers/gpu/drm/drm_probe_helper.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 527743394150..7dc7e635d7e4 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -415,10 +415,6 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 	} else
 		WARN_ON(ret < 0);
 
-	/* set all old modes to the stale state */
-	list_for_each_entry(mode, &connector->modes, head)
-		mode->status = MODE_STALE;
-
 	old_status = connector->status;
 
 	if (connector->force) {
@@ -472,6 +468,10 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 
 	dev->mode_config.poll_running = drm_kms_helper_poll;
 
+	/* set all old modes to the stale state */
+	list_for_each_entry(mode, &connector->modes, head)
+		mode->status = MODE_STALE;
+
 	if (connector->status == connector_status_disconnected) {
 		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] disconnected\n",
 			connector->base.id, connector->name);
-- 
2.13.6



More information about the Intel-gfx mailing list