diff mbox

[FOR,CI,v2] drm/i915: Generalize transcoder looping

Message ID 1510216670-16848-1-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola Nov. 9, 2017, 8:37 a.m. UTC
To make looping through transcoders in intel_ddi.c more generic, let's switch
to use 'for_each_pipe()' macro to do this.

v2: Add a notion that we are dealing with transcoders instead of pipes (Jani)

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Ville Syrjälä Nov. 14, 2017, 2:26 p.m. UTC | #1
On Thu, Nov 09, 2017 at 10:37:50AM +0200, Mika Kahola wrote:
> To make looping through transcoders in intel_ddi.c more generic, let's switch
> to use 'for_each_pipe()' macro to do this.
> 
> v2: Add a notion that we are dealing with transcoders instead of pipes (Jani)
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>

Pushed to dinq. Thanks for the patch.

> ---
>  drivers/gpu/drm/i915/intel_ddi.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
> index ace674c..31ef376 100644
> --- a/drivers/gpu/drm/i915/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/intel_ddi.c
> @@ -1681,8 +1681,8 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
>  	struct drm_device *dev = encoder->base.dev;
>  	struct drm_i915_private *dev_priv = to_i915(dev);
>  	enum port port = encoder->port;
> +	enum pipe p;
>  	u32 tmp;
> -	int i;
>  	bool ret;
>  
>  	if (!intel_display_power_get_if_enabled(dev_priv,
> @@ -1717,15 +1717,17 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
>  		goto out;
>  	}
>  
> -	for (i = TRANSCODER_A; i <= TRANSCODER_C; i++) {
> -		tmp = I915_READ(TRANS_DDI_FUNC_CTL(i));
> +	for_each_pipe(dev_priv, p) {
> +		enum transcoder cpu_transcoder = (enum transcoder) p;
> +
> +		tmp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
>  
>  		if ((tmp & TRANS_DDI_PORT_MASK) == TRANS_DDI_SELECT_PORT(port)) {
>  			if ((tmp & TRANS_DDI_MODE_SELECT_MASK) ==
>  			    TRANS_DDI_MODE_SELECT_DP_MST)
>  				goto out;
>  
> -			*pipe = i;
> +			*pipe = p;
>  			ret = true;
>  
>  			goto out;
> -- 
> 2.7.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index ace674c..31ef376 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -1681,8 +1681,8 @@  bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
 	struct drm_device *dev = encoder->base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
 	enum port port = encoder->port;
+	enum pipe p;
 	u32 tmp;
-	int i;
 	bool ret;
 
 	if (!intel_display_power_get_if_enabled(dev_priv,
@@ -1717,15 +1717,17 @@  bool intel_ddi_get_hw_state(struct intel_encoder *encoder,
 		goto out;
 	}
 
-	for (i = TRANSCODER_A; i <= TRANSCODER_C; i++) {
-		tmp = I915_READ(TRANS_DDI_FUNC_CTL(i));
+	for_each_pipe(dev_priv, p) {
+		enum transcoder cpu_transcoder = (enum transcoder) p;
+
+		tmp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
 
 		if ((tmp & TRANS_DDI_PORT_MASK) == TRANS_DDI_SELECT_PORT(port)) {
 			if ((tmp & TRANS_DDI_MODE_SELECT_MASK) ==
 			    TRANS_DDI_MODE_SELECT_DP_MST)
 				goto out;
 
-			*pipe = i;
+			*pipe = p;
 			ret = true;
 
 			goto out;