[6/8] drm/vc4: use drm_for_each_connector_iter()
diff mbox

Message ID 20170511191049.28944-7-gustavo@padovan.org
State New
Headers show

Commit Message

Gustavo Padovan May 11, 2017, 7:10 p.m. UTC
From: Gustavo Padovan <gustavo.padovan@collabora.com>

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

Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>

---
only built-tested!
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Daniel Vetter May 12, 2017, 7:49 a.m. UTC | #1
On Thu, May 11, 2017 at 04:10:47PM -0300, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.com>
> 
> Drop legacy drm_for_each_connector() in favor of the race-free
> drm_for_each_connector_iter().
> 
> Cc: Eric Anholt <eric@anholt.net>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
> 
> ---
> only built-tested!
> ---
>  drivers/gpu/drm/vc4/vc4_crtc.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
> index d86c8cc..feee83a 100644
> --- a/drivers/gpu/drm/vc4/vc4_crtc.c
> +++ b/drivers/gpu/drm/vc4/vc4_crtc.c
> @@ -359,12 +359,15 @@ 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) {

Needs an iter_end here. With that fixed,

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

>  			return connector->encoder;
>  		}
>  	}
> +	drm_connector_list_iter_end(&conn_iter);
>  
>  	return NULL;
>  }
> -- 
> 2.9.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index d86c8cc..feee83a 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -359,12 +359,15 @@  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) {
 			return connector->encoder;
 		}
 	}
+	drm_connector_list_iter_end(&conn_iter);
 
 	return NULL;
 }