From patchwork Wed Oct 8 15:32:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ander Conselvan de Oliveira X-Patchwork-Id: 5054211 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 29AF99F30B for ; Wed, 8 Oct 2014 15:32:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DAEA20200 for ; Wed, 8 Oct 2014 15:32:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 527DB201F2 for ; Wed, 8 Oct 2014 15:32:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3845A6E2D3; Wed, 8 Oct 2014 08:32:49 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-lb0-f173.google.com (mail-lb0-f173.google.com [209.85.217.173]) by gabe.freedesktop.org (Postfix) with ESMTP id 12CEB6E2BC for ; Wed, 8 Oct 2014 08:32:47 -0700 (PDT) Received: by mail-lb0-f173.google.com with SMTP id 10so8420386lbg.32 for ; Wed, 08 Oct 2014 08:32:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A+Rww0uzUM02Fn1s01rMDr3BUeVnRtNcoHAAkfp8hR8=; b=SewoLHHlqlgw3dUSqQVlVOHn1QpaCEQQBuq2yxEJP6jElBSaqYztl7ljbGeNGFQWQA Kk6c5qbCnpe6G4jZ2BQV1JibEzke19Co+YCODCe+YHNFRczDs+f6cnv2mliqh1A3sXhL L/uz4XSeJqMLJYvjLNFZ0W3UNhnM8gdOS/gWYTxp7aVizVKKDwxHloVxhcku0IZDkfns Qwoj4Kbh0Qk93joWUFZAUtxxpYYz63+rhOKqp3OaHUloqGZhwNfanCuz9QT1MRTLk4ZB RyCx6yVAuQVVjBRqkae+p22/OL7yQqi7MTf6ZIZ2wYWOY85cxlI/jArDOY5zibR+tWu5 zk0w== X-Received: by 10.112.26.103 with SMTP id k7mr11680051lbg.86.1412782367042; Wed, 08 Oct 2014 08:32:47 -0700 (PDT) Received: from snb-laptop.Elisa (a88-114-204-203.elisa-laajakaista.fi. [88.114.204.203]) by mx.google.com with ESMTPSA id s8sm124598las.29.2014.10.08.08.32.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Oct 2014 08:32:46 -0700 (PDT) From: Ander Conselvan de Oliveira To: intel-gfx@lists.freedesktop.org Date: Wed, 8 Oct 2014 18:32:20 +0300 Message-Id: <1412782343-28836-2-git-send-email-conselvan2@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1412782343-28836-1-git-send-email-conselvan2@gmail.com> References: <1412782343-28836-1-git-send-email-conselvan2@gmail.com> Cc: Ander Conselvan de Oliveira Subject: [Intel-gfx] [PATCH 1/4] drm/i915: Replace some loop through encoders with intel_pipe_has_type() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 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-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_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 From: Ander Conselvan de Oliveira In the ironlake mode set code, there was two instances of a loop through encoders to find out if one of them has INTEL_OUTPUT_LVDS type. Simplify the code by deleting some lines and use intel_pipe_has_type() instead. Signed-off-by: Ander Conselvan de Oliveira --- drivers/gpu/drm/i915/intel_display.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 7b5639d..3a06c3d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -7110,18 +7110,11 @@ static bool ironlake_compute_clocks(struct drm_crtc *crtc, { struct drm_device *dev = crtc->dev; struct drm_i915_private *dev_priv = dev->dev_private; - struct intel_encoder *intel_encoder; int refclk; const intel_limit_t *limit; bool ret, is_lvds = false; - for_each_encoder_on_crtc(dev, crtc, intel_encoder) { - switch (intel_encoder->type) { - case INTEL_OUTPUT_LVDS: - is_lvds = true; - break; - } - } + is_lvds = intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS); refclk = ironlake_get_refclk(crtc); @@ -7261,23 +7254,13 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, { struct drm_device *dev = crtc->dev; struct intel_crtc *intel_crtc = to_intel_crtc(crtc); - int num_connectors = 0; intel_clock_t clock, reduced_clock; u32 dpll = 0, fp = 0, fp2 = 0; bool ok, has_reduced_clock = false; bool is_lvds = false; - struct intel_encoder *encoder; struct intel_shared_dpll *pll; - for_each_encoder_on_crtc(dev, crtc, encoder) { - switch (encoder->type) { - case INTEL_OUTPUT_LVDS: - is_lvds = true; - break; - } - - num_connectors++; - } + is_lvds = intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS); WARN(!(HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev)), "Unexpected PCH type %d\n", INTEL_PCH_TYPE(dev));