[1/6] drm/i915: Polish possible_clones setup
diff mbox series

Message ID 20191002162505.30716-1-ville.syrjala@linux.intel.com
State New
Headers show
Series
  • [1/6] drm/i915: Polish possible_clones setup
Related show

Commit Message

Ville Syrjälä Oct. 2, 2019, 4:25 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Replace the hand rolled stuff with drm_encoder_mask() when populating
possible_clones, and rename the function to
intel_encoder_possible_clones() to make it clear what it's used for.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_display.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Juha-Pekka Heikkila Oct. 16, 2019, 8:29 p.m. UTC | #1
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>

On 2.10.2019 19.25, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Replace the hand rolled stuff with drm_encoder_mask() when populating
> possible_clones, and rename the function to
> intel_encoder_possible_clones() to make it clear what it's used for.
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_display.c | 13 +++++--------
>   1 file changed, 5 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index 20ec8a1dc5e1..d10e118b9a7c 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -15240,21 +15240,18 @@ int intel_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data,
>   	return 0;
>   }
>   
> -static int intel_encoder_clones(struct intel_encoder *encoder)
> +static u32 intel_encoder_possible_clones(struct intel_encoder *encoder)
>   {
>   	struct drm_device *dev = encoder->base.dev;
>   	struct intel_encoder *source_encoder;
> -	int index_mask = 0;
> -	int entry = 0;
> +	u32 possible_clones = 0;
>   
>   	for_each_intel_encoder(dev, source_encoder) {
>   		if (encoders_cloneable(encoder, source_encoder))
> -			index_mask |= (1 << entry);
> -
> -		entry++;
> +			possible_clones |= drm_encoder_mask(&source_encoder->base);
>   	}
>   
> -	return index_mask;
> +	return possible_clones;
>   }
>   
>   static u32 intel_encoder_possible_crtcs(struct intel_encoder *encoder)
> @@ -15574,7 +15571,7 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>   		encoder->base.possible_crtcs =
>   			intel_encoder_possible_crtcs(encoder);
>   		encoder->base.possible_clones =
> -			intel_encoder_clones(encoder);
> +			intel_encoder_possible_clones(encoder);
>   	}
>   
>   	intel_init_pch_refclk(dev_priv);
>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 20ec8a1dc5e1..d10e118b9a7c 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -15240,21 +15240,18 @@  int intel_get_pipe_from_crtc_id_ioctl(struct drm_device *dev, void *data,
 	return 0;
 }
 
-static int intel_encoder_clones(struct intel_encoder *encoder)
+static u32 intel_encoder_possible_clones(struct intel_encoder *encoder)
 {
 	struct drm_device *dev = encoder->base.dev;
 	struct intel_encoder *source_encoder;
-	int index_mask = 0;
-	int entry = 0;
+	u32 possible_clones = 0;
 
 	for_each_intel_encoder(dev, source_encoder) {
 		if (encoders_cloneable(encoder, source_encoder))
-			index_mask |= (1 << entry);
-
-		entry++;
+			possible_clones |= drm_encoder_mask(&source_encoder->base);
 	}
 
-	return index_mask;
+	return possible_clones;
 }
 
 static u32 intel_encoder_possible_crtcs(struct intel_encoder *encoder)
@@ -15574,7 +15571,7 @@  static void intel_setup_outputs(struct drm_i915_private *dev_priv)
 		encoder->base.possible_crtcs =
 			intel_encoder_possible_crtcs(encoder);
 		encoder->base.possible_clones =
-			intel_encoder_clones(encoder);
+			intel_encoder_possible_clones(encoder);
 	}
 
 	intel_init_pch_refclk(dev_priv);