From patchwork Wed Sep 27 18:29:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: James Ausmus X-Patchwork-Id: 9974545 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 E911E60365 for ; Wed, 27 Sep 2017 18:30:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2DF2292AF for ; Wed, 27 Sep 2017 18:30:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D4A2B292B3; Wed, 27 Sep 2017 18:30:23 +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]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6BE7C292AF for ; Wed, 27 Sep 2017 18:30:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 945376E7B3; Wed, 27 Sep 2017 18:30:22 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id DA4D16E7AA for ; Wed, 27 Sep 2017 18:30:20 +0000 (UTC) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2017 11:30:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,446,1500966000"; d="scan'208";a="156795403" Received: from jausmus-gentoo-dev5.jf.intel.com ([10.54.75.124]) by fmsmga006.fm.intel.com with ESMTP; 27 Sep 2017 11:30:19 -0700 From: James Ausmus To: intel-gfx@lists.freedesktop.org Date: Wed, 27 Sep 2017 11:29:06 -0700 Message-Id: <20170927182906.18793-2-james.ausmus@intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170927182906.18793-1-james.ausmus@intel.com> References: <20170914195935.2408-1-james.ausmus@intel.com> <20170927182906.18793-1-james.ausmus@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/2] drm/i915: Use for_each_pipe in intel_dp_mst.c 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Use the helper instead of manually looping through pipes. Suggested-by: Ville Syrjälä Signed-off-by: James Ausmus --- drivers/gpu/drm/i915/intel_dp_mst.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c b/drivers/gpu/drm/i915/intel_dp_mst.c index 8ceffad3e665..adb105bf98e2 100644 --- a/drivers/gpu/drm/i915/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/intel_dp_mst.c @@ -448,9 +448,11 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo struct intel_dp *intel_dp = container_of(mgr, struct intel_dp, mst_mgr); struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); struct drm_device *dev = intel_dig_port->base.base.dev; + struct drm_i915_private *dev_priv = to_i915(dev); struct intel_connector *intel_connector; struct drm_connector *connector; - int i, ret; + enum pipe p; + int ret; intel_connector = intel_connector_alloc(); if (!intel_connector) @@ -470,8 +472,8 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo intel_connector->mst_port = intel_dp; intel_connector->port = port; - for (i = PIPE_A; i <= PIPE_C; i++) { - struct drm_encoder *enc = &intel_dp->mst_encoders[i]->base.base; + for_each_pipe(dev_priv, p) { + struct drm_encoder *enc = &intel_dp->mst_encoders[p]->base.base; ret = drm_mode_connector_attach_encoder(&intel_connector->base, enc); @@ -580,11 +582,14 @@ intel_dp_create_fake_mst_encoder(struct intel_digital_port *intel_dig_port, enum static bool intel_dp_create_fake_mst_encoders(struct intel_digital_port *intel_dig_port) { - int i; + struct drm_device *dev = intel_dig_port->base.base.dev; + struct drm_i915_private *dev_priv = to_i915(dev); struct intel_dp *intel_dp = &intel_dig_port->dp; + enum pipe p; - for (i = PIPE_A; i <= PIPE_C; i++) - intel_dp->mst_encoders[i] = intel_dp_create_fake_mst_encoder(intel_dig_port, i); + for_each_pipe(dev_priv, p) + intel_dp->mst_encoders[p] = + intel_dp_create_fake_mst_encoder(intel_dig_port, p); return true; }