From patchwork Wed Apr 27 17:34:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: cpaul@redhat.com X-Patchwork-Id: 8960831 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 612AABF29F for ; Wed, 27 Apr 2016 17:35:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8145D2024D for ; Wed, 27 Apr 2016 17:35:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A41462014A for ; Wed, 27 Apr 2016 17:35:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 47D306EBBD; Wed, 27 Apr 2016 17:35:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTPS id 468E86EBBD; Wed, 27 Apr 2016 17:35:01 +0000 (UTC) Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BCBAEC0467E7; Wed, 27 Apr 2016 17:35:00 +0000 (UTC) Received: from ecstaticemu.bos.redhat.com (dhcp-25-142.bos.redhat.com [10.18.25.142]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3RHYwxx013423; Wed, 27 Apr 2016 13:34:59 -0400 From: Lyude To: intel-gfx@lists.freedesktop.org, Rob Clark 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Cc: stable@vger.kernel.org, "open list:INTEL DRM DRIVERS excluding Poulsbo, Moorestow..., linux-kernel@vger.kernel.org open list" , Daniel Vetter , Lyude X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;