Replace iteration over encoders with iteration over connectors. This is a bit more aligned with the atomic framework, but more importantly, the change prepares for code that will need to access the connector. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx> --- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index d73e88ddecd0..fbe927278634 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c @@ -685,7 +685,9 @@ static int rcar_du_crtc_atomic_check(struct drm_crtc *crtc, struct drm_crtc_state *state) { struct rcar_du_crtc_state *rstate = to_rcar_crtc_state(state); - struct drm_encoder *encoder; + struct drm_connector_state *conn_state; + struct drm_connector *connector; + unsigned int i; int ret; ret = rcar_du_cmm_check(crtc, state); @@ -695,15 +697,17 @@ static int rcar_du_crtc_atomic_check(struct drm_crtc *crtc, /* Store the routes from the CRTC output to the DU outputs. */ rstate->outputs = 0; - drm_for_each_encoder_mask(encoder, crtc->dev, state->encoder_mask) { - struct rcar_du_encoder *renc; + for_each_new_connector_in_state(state->state, connector, conn_state, i) { + struct drm_encoder *encoder = conn_state->best_encoder; + + if (!encoder) + continue; /* Skip the writeback encoder. */ if (encoder->encoder_type == DRM_MODE_ENCODER_VIRTUAL) continue; - renc = to_rcar_encoder(encoder); - rstate->outputs |= BIT(renc->output); + rstate->outputs |= BIT(to_rcar_encoder(encoder)->output); } return 0; -- Regards, Laurent Pinchart