diff mbox

[5/8] drm/nouveau: use drm_for_each_connector_iter()

Message ID 20170511191049.28944-6-gustavo@padovan.org (mailing list archive)
State New, archived
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: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>

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

Comments

Daniel Vetter May 12, 2017, 7:45 a.m. UTC | #1
On Thu, May 11, 2017 at 04:10:46PM -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: Ben Skeggs <bskeggs@redhat.com>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
> 
> ---
> only built-tested!
> ---
>  drivers/gpu/drm/nouveau/nv50_display.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
> index 0e58537..8790bdc 100644
> --- a/drivers/gpu/drm/nouveau/nv50_display.c
> +++ b/drivers/gpu/drm/nouveau/nv50_display.c
> @@ -2871,17 +2871,20 @@ nv50_msto_enable(struct drm_encoder *encoder)
>  	struct nv50_mstc *mstc = NULL;
>  	struct nv50_mstm *mstm = NULL;
>  	struct drm_connector *connector;
> +	struct drm_connector_list_iter conn_iter;
>  	u8 proto, depth;
>  	int slots;
>  	bool r;
>  
> -	drm_for_each_connector(connector, encoder->dev) {
> +	drm_connector_list_iter_begin(encoder->dev, &conn_iter);
> +	drm_for_each_connector_iter(connector, &conn_iter) {
>  		if (connector->state->best_encoder == &msto->encoder) {
>  			mstc = nv50_mstc(connector);
>  			mstm = mstc->mstm;
>  			break;

We probably want an encoder->atomic_enable which passes both states
(crtc&connector) instead of fun like this. But that's a different storey.
See i915 for how we've done this for our intel-specific encoder callbacks.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

>  		}
>  	}
> +	drm_connector_list_iter_end(&conn_iter);
>  
>  	if (WARN_ON(!mstc))
>  		return;
> -- 
> 2.9.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c
index 0e58537..8790bdc 100644
--- a/drivers/gpu/drm/nouveau/nv50_display.c
+++ b/drivers/gpu/drm/nouveau/nv50_display.c
@@ -2871,17 +2871,20 @@  nv50_msto_enable(struct drm_encoder *encoder)
 	struct nv50_mstc *mstc = NULL;
 	struct nv50_mstm *mstm = NULL;
 	struct drm_connector *connector;
+	struct drm_connector_list_iter conn_iter;
 	u8 proto, depth;
 	int slots;
 	bool r;
 
-	drm_for_each_connector(connector, encoder->dev) {
+	drm_connector_list_iter_begin(encoder->dev, &conn_iter);
+	drm_for_each_connector_iter(connector, &conn_iter) {
 		if (connector->state->best_encoder == &msto->encoder) {
 			mstc = nv50_mstc(connector);
 			mstm = mstc->mstm;
 			break;
 		}
 	}
+	drm_connector_list_iter_end(&conn_iter);
 
 	if (WARN_ON(!mstc))
 		return;