diff mbox

[2/8] drm/i915: Introduce intel_encoder_is_dig_port()

Message ID 20180705164357.28512-3-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä July 5, 2018, 4:43 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add intel_encoder_is_dig_port() to match intel_encoder_is_dp().

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_drv.h | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

Comments

Rodrigo Vivi July 6, 2018, 5:01 p.m. UTC | #1
On Thu, Jul 05, 2018 at 07:43:51PM +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add intel_encoder_is_dig_port() to match intel_encoder_is_dp().
> 
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_drv.h | 24 +++++++++++++++---------
>  1 file changed, 15 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 6fe3adafaf20..077189ed9e46 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1246,23 +1246,29 @@ intel_attached_encoder(struct drm_connector *connector)
>  	return to_intel_connector(connector)->encoder;
>  }
>  
> -static inline struct intel_digital_port *
> -enc_to_dig_port(struct drm_encoder *encoder)
> +static inline bool intel_encoder_is_dig_port(struct intel_encoder *encoder)
>  {
> -	struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
> -
> -	switch (intel_encoder->type) {
> +	switch (encoder->type) {
>  	case INTEL_OUTPUT_DDI:
> -		WARN_ON(!HAS_DDI(to_i915(encoder->dev)));
> -		/* fall through */
>  	case INTEL_OUTPUT_DP:
>  	case INTEL_OUTPUT_EDP:
>  	case INTEL_OUTPUT_HDMI:
> +		return true;
> +	default:
> +		return false;
> +	}
> +}
> +
> +static inline struct intel_digital_port *
> +enc_to_dig_port(struct drm_encoder *encoder)
> +{
> +	struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
> +
> +	if (intel_encoder_is_dig_port(intel_encoder))
>  		return container_of(encoder, struct intel_digital_port,
>  				    base.base);
> -	default:
> +	else
>  		return NULL;
> -	}
>  }
>  
>  static inline struct intel_dp_mst_encoder *
> -- 
> 2.16.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_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 6fe3adafaf20..077189ed9e46 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1246,23 +1246,29 @@  intel_attached_encoder(struct drm_connector *connector)
 	return to_intel_connector(connector)->encoder;
 }
 
-static inline struct intel_digital_port *
-enc_to_dig_port(struct drm_encoder *encoder)
+static inline bool intel_encoder_is_dig_port(struct intel_encoder *encoder)
 {
-	struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
-
-	switch (intel_encoder->type) {
+	switch (encoder->type) {
 	case INTEL_OUTPUT_DDI:
-		WARN_ON(!HAS_DDI(to_i915(encoder->dev)));
-		/* fall through */
 	case INTEL_OUTPUT_DP:
 	case INTEL_OUTPUT_EDP:
 	case INTEL_OUTPUT_HDMI:
+		return true;
+	default:
+		return false;
+	}
+}
+
+static inline struct intel_digital_port *
+enc_to_dig_port(struct drm_encoder *encoder)
+{
+	struct intel_encoder *intel_encoder = to_intel_encoder(encoder);
+
+	if (intel_encoder_is_dig_port(intel_encoder))
 		return container_of(encoder, struct intel_digital_port,
 				    base.base);
-	default:
+	else
 		return NULL;
-	}
 }
 
 static inline struct intel_dp_mst_encoder *