[PATCH] drm/i915: Fix enc_to_dig_port() for MST encoders

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For MST encoders, the encoder struct is stored in the intel_dp_mst
struct, not a intel_digital_port struct.

This fixes issues with hotplugging MST displays that support MST audio,
where hotplugging had a surprisingly good chance of accidentally
overwriting other parts of the kernel leading to seemingly unrelated
backtraces in sysfs, ext4, etc.

Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lyude <cpaul@xxxxxxxxxx>
---
 drivers/gpu/drm/i915/intel_drv.h | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 4c027d6..81f2212 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -918,18 +918,23 @@ 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.5

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]