diff options
author | Maarten Lankhorst | 2016-03-03 10:17:41 +0100 |
---|---|---|
committer | Daniel Vetter | 2016-03-08 11:06:41 +0100 |
commit | ec5aaa586fe0d826b6e65a60756b9bbf4d93e011 (patch) | |
tree | af0167cc5185b318f3de3ffceb2bed955bbe0196 /drivers/gpu/drm/drm_atomic_helper.c | |
parent | 8248b65df653c0a536bdd64f8a6c8bb150bfdd60 (diff) |
drm/atomic: Clean up steal_encoder, v2.
Now that only encoders can be stolen that are part of the state
steal_encoder no longer needs to inspect all connectors,
just those that are part of the atomic state.
Changes since v1:
- Change return value to void, can no longer fail.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
[danvet: Appease gcc, reported by kbuild.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1456996662-8704-7-git-send-email-maarten.lankhorst@linux.intel.com
Diffstat (limited to 'drivers/gpu/drm/drm_atomic_helper.c')
-rw-r--r-- | drivers/gpu/drm/drm_atomic_helper.c | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 52c03cea6cf9..baa0fc652f43 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -227,25 +227,18 @@ set_best_encoder(struct drm_atomic_state *state, conn_state->best_encoder = encoder; } -static int +static void steal_encoder(struct drm_atomic_state *state, struct drm_encoder *encoder) { struct drm_crtc_state *crtc_state; struct drm_connector *connector; struct drm_connector_state *connector_state; + int i; - drm_for_each_connector(connector, state->dev) { + for_each_connector_in_state(state, connector, connector_state, i) { struct drm_crtc *encoder_crtc; - if (connector->state->best_encoder != encoder) - continue; - - connector_state = drm_atomic_get_connector_state(state, - connector); - if (IS_ERR(connector_state)) - return PTR_ERR(connector_state); - if (connector_state->best_encoder != encoder) continue; @@ -260,10 +253,8 @@ steal_encoder(struct drm_atomic_state *state, crtc_state = drm_atomic_get_existing_crtc_state(state, encoder_crtc); crtc_state->connectors_changed = true; - return 0; + return; } - - return 0; } static int @@ -274,7 +265,7 @@ update_connector_routing(struct drm_atomic_state *state, const struct drm_connector_helper_funcs *funcs; struct drm_encoder *new_encoder; struct drm_crtc_state *crtc_state; - int idx, ret; + int idx; DRM_DEBUG_ATOMIC("Updating routing for [CONNECTOR:%d:%s]\n", connector->base.id, @@ -343,13 +334,7 @@ update_connector_routing(struct drm_atomic_state *state, return 0; } - ret = steal_encoder(state, new_encoder); - if (ret) { - DRM_DEBUG_ATOMIC("Encoder stealing failed for [CONNECTOR:%d:%s]\n", - connector->base.id, - connector->name); - return ret; - } + steal_encoder(state, new_encoder); if (WARN_ON(!connector_state->crtc)) return -EINVAL; |