From ead8b665705a0926442fbd3f4dbccbec36e5b8f4 Mon Sep 17 00:00:00 2001 From: Maarten Lankhorst Date: Thu, 7 Jan 2016 10:59:19 +0100 Subject: [PATCH] drm/core: Add drm_for_each_encoder_mask, v2. This is similar to the other drm_for_each_*_mask functions. Changes since v1: - Use for_each_if Signed-off-by: Maarten Lankhorst Reviewed-by: Gustavo Padovan Signed-off-by: Daniel Vetter Link: http://patchwork.freedesktop.org/patch/msgid/1452160762-30487-3-git-send-email-maarten.lankhorst@linux.intel.com --- include/drm/drm_crtc.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index fd2ace4a18de..c0226f945d62 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -2153,6 +2153,17 @@ struct drm_mode_config { list_for_each_entry((plane), &(dev)->mode_config.plane_list, head) \ for_each_if ((plane_mask) & (1 << drm_plane_index(plane))) +/** + * drm_for_each_encoder_mask - iterate over encoders specified by bitmask + * @encoder: the loop cursor + * @dev: the DRM device + * @encoder_mask: bitmask of encoder indices + * + * Iterate over all encoders specified by bitmask. + */ +#define drm_for_each_encoder_mask(encoder, dev, encoder_mask) \ + list_for_each_entry((encoder), &(dev)->mode_config.encoder_list, head) \ + for_each_if ((encoder_mask) & (1 << drm_encoder_index(encoder))) #define obj_to_crtc(x) container_of(x, struct drm_crtc, base) #define obj_to_connector(x) container_of(x, struct drm_connector, base) -- 2.20.1