From patchwork Wed Aug 3 01:46:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dhinakaran Pandiyan X-Patchwork-Id: 9260659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2CA9B60865 for ; Wed, 3 Aug 2016 01:34:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21DB428534 for ; Wed, 3 Aug 2016 01:34:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 157452853D; Wed, 3 Aug 2016 01:34:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5C4E28534 for ; Wed, 3 Aug 2016 01:34:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C4A566E6FD; Wed, 3 Aug 2016 01:34:08 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTP id D6FC06E6FB for ; Wed, 3 Aug 2016 01:34:05 +0000 (UTC) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP; 02 Aug 2016 18:34:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,463,1464678000"; d="scan'208";a="149683010" Received: from skynet.jf.intel.com ([10.54.75.148]) by fmsmga004.fm.intel.com with ESMTP; 02 Aug 2016 18:34:05 -0700 From: Dhinakaran Pandiyan To: intel-gfx@lists.freedesktop.org Date: Tue, 2 Aug 2016 18:46:36 -0700 Message-Id: <1470188796-31850-4-git-send-email-dhinakaran.pandiyan@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1470188796-31850-1-git-send-email-dhinakaran.pandiyan@intel.com> References: <1470188796-31850-1-git-send-email-dhinakaran.pandiyan@intel.com> Cc: Dhinakaran Pandiyan Subject: [Intel-gfx] [PATCH 3/3] drm/i915: Fix enc_to_dig_port for MST encoders X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;