summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2018-06-26 22:47:09 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2018-07-02 18:45:55 +0300
commit6f3be036da5cf6b192966ebea250cf9c8b1fd4a0 (patch)
tree71b002ba15b737494b455b45c07ceca6923360fb /include
parent6a52193bd0dd683607793bea0caf6be94b32b333 (diff)
downloadlinux-6f3be036da5cf6b192966ebea250cf9c8b1fd4a0.tar.bz2
drm: Add drm_encoder_mask()
Add drm_encoder_mask() which returns the 1<<index for the encoder. We already have an identical drm_crtc_mask() for crtcs. Mostly performed with coccinelle: @@ @@ - (1<<drm_encoder_index( + drm_encoder_mask( ...) - ) @@ @@ - 1<<drm_encoder_index( + drm_encoder_mask( ...) @@ @@ - BIT(drm_encoder_index( + drm_encoder_mask( ...) - ) Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20180626194716.12522-3-ville.syrjala@linux.intel.com Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/drm/drm_encoder.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h
index fb299696c7c4..4f597c0730b4 100644
--- a/include/drm/drm_encoder.h
+++ b/include/drm/drm_encoder.h
@@ -191,12 +191,24 @@ int drm_encoder_init(struct drm_device *dev,
* Given a registered encoder, return the index of that encoder within a DRM
* device's list of encoders.
*/
-static inline unsigned int drm_encoder_index(struct drm_encoder *encoder)
+static inline unsigned int drm_encoder_index(const struct drm_encoder *encoder)
{
return encoder->index;
}
/**
+ * drm_encoder_mask - find the mask of a registered ENCODER
+ * @encoder: encoder to find mask for
+ *
+ * Given a registered encoder, return the mask bit of that encoder for an
+ * encoder's possible_clones field.
+ */
+static inline u32 drm_encoder_mask(const struct drm_encoder *encoder)
+{
+ return 1 << drm_encoder_index(encoder);
+}
+
+/**
* drm_encoder_crtc_ok - can a given crtc drive a given encoder?
* @encoder: encoder to test
* @crtc: crtc to test
@@ -241,7 +253,7 @@ void drm_encoder_cleanup(struct drm_encoder *encoder);
*/
#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)))
+ for_each_if ((encoder_mask) & drm_encoder_mask(encoder))
/**
* drm_for_each_encoder - iterate over all encoders