Patchwork [v2] drm/vc4: use drm_for_each_connector_iter()

login
register
mail settings
Submitter Gustavo F. Padovan
Date May 12, 2017, 4:41 p.m.
Message ID <20170512164100.7649-1-gustavo@padovan.org>
Download mbox | patch
Permalink /patch/9724587/
State New
Headers show

Comments

Gustavo F. Padovan - May 12, 2017, 4:41 p.m.
From: Gustavo Padovan <gustavo.padovan@collabora.com>

Drop legacy drm_for_each_connector() in favor of the race-free
drm_for_each_connector_iter().

v2: add missing drm_connector_list_iter_end(Daniel Vetter)

Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

---
only built-tested!
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Eric Anholt - May 12, 2017, 9:06 p.m.
Gustavo Padovan <gustavo@padovan.org> writes:

> From: Gustavo Padovan <gustavo.padovan@collabora.com>
>
> Drop legacy drm_for_each_connector() in favor of the race-free
> drm_for_each_connector_iter().
>
> v2: add missing drm_connector_list_iter_end(Daniel Vetter)
>
> Cc: Eric Anholt <eric@anholt.net>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Acked-by: Eric Anholt <eric@anholt.net>

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index d86c8cc..d66345f 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -359,12 +359,16 @@  static u32 vc4_get_fifo_full_level(u32 format)
 static struct drm_encoder *vc4_get_crtc_encoder(struct drm_crtc *crtc)
 {
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 
-	drm_for_each_connector(connector, crtc->dev) {
+	drm_connector_list_iter_begin(crtc->dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		if (connector->state->crtc == crtc) {
+			drm_connector_list_iter_end(&conn_iter);
 			return connector->encoder;
 		}
 	}
+	drm_connector_list_iter_end(&conn_iter);
 
 	return NULL;
 }