Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753629AbcD0RfE (ORCPT ); Wed, 27 Apr 2016 13:35:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49315 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752656AbcD0RfB (ORCPT ); Wed, 27 Apr 2016 13:35:01 -0400 From: Lyude To: intel-gfx@lists.freedesktop.org, Rob Clark Cc: Lyude , stable@vger.kernel.org, Daniel Vetter , Jani Nikula , David Airlie , dri-devel@lists.freedesktop.org (open list:INTEL DRM DRIVERS (excluding Poulsbo, Moorestow...), linux-kernel@vger.kernel.org (open list)) Subject: [PATCH] drm/i915: Fix enc_to_dig_port() for MST encoders Date: Wed, 27 Apr 2016 13:34:26 -0400 Message-Id: <1461778466-17747-1-git-send-email-cpaul@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1596 Lines: 50 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@vger.kernel.org Signed-off-by: Lyude --- 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