[Intel-gfx] [PATCH 3/3] drm/i915: Fix enc_to_dig_port for MST encoders

Dhinakaran Pandiyan dhinakaran.pandiyan at intel.com
Wed Aug 3 01:46:36 UTC 2016


When a MST encoder is passed to enc_to_dig_port(), the container_of() macro
does not return the digital port. Handle this by returning the member
"primary" in "struct intel_dp_mst_encoder"

Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan at intel.com>
---
 drivers/gpu/drm/i915/intel_drv.h | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 45020d2..66af444 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1023,18 +1023,22 @@ 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)
-{
-	return container_of(encoder, struct intel_digital_port, base.base);
-}
-
 static inline struct intel_dp_mst_encoder *
 enc_to_mst(struct drm_encoder *encoder)
 {
 	return container_of(encoder, struct intel_dp_mst_encoder, base.base);
 }
 
+static inline struct intel_digital_port *
+enc_to_dig_port(struct drm_encoder *encoder)
+{
+	if (encoder->encoder_type == DRM_MODE_ENCODER_DPMST)
+		return enc_to_mst(encoder)->primary;
+	else
+		return container_of(encoder, struct intel_digital_port,
+				    base.base);
+}
+
 static inline struct intel_dp *enc_to_intel_dp(struct drm_encoder *encoder)
 {
 	return &enc_to_dig_port(encoder)->dp;
-- 
2.5.0



More information about the Intel-gfx mailing list