From patchwork Fri Jul 20 18:23:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Ciobanu X-Patchwork-Id: 10538163 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 C687F6029B for ; Fri, 20 Jul 2018 18:31:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7444296DA for ; Fri, 20 Jul 2018 18:31:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB12B29445; Fri, 20 Jul 2018 18:31:50 +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=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, 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 581F62927F for ; Fri, 20 Jul 2018 18:31:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AC6AA6E424; Fri, 20 Jul 2018 18:31:44 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D2686E424 for ; Fri, 20 Jul 2018 18:31:43 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jul 2018 11:31:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,380,1526367600"; d="scan'208";a="241967522" Received: from nc-new.jf.intel.com (HELO linux.intel.com) ([10.54.75.147]) by orsmga005.jf.intel.com with SMTP; 20 Jul 2018 11:31:40 -0700 Received: by linux.intel.com (sSMTP sendmail emulation); Fri, 20 Jul 2018 11:24:22 -0700 From: Nathan Ciobanu To: intel-gfx@lists.freedesktop.org Date: Fri, 20 Jul 2018 11:23:43 -0700 Message-Id: <1532111023-18930-1-git-send-email-nathan.d.ciobanu@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532036887-11800-1-git-send-email-nathan.d.ciobanu@linux.intel.com> References: <1532036887-11800-1-git-send-email-nathan.d.ciobanu@linux.intel.com> Subject: [Intel-gfx] [PATCH v5] drm/i915/dp: Refactor max_vswing_tries variable X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Herbert , Dhinakaran Pandiyan , Rodrigo Vivi MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Changes the type and renames the max_vswing_tries variable which was declared as an integer but used as a boolean making it easy to be confused with a counter. Changes in v2: - updated the title and commit message - left the loop exit point in place v3: fix typo in title v4: renamed max_vswing to max_vswing_reached (Ville) Cc: Dhinakaran Pandiyan Cc: Rodrigo Vivi Cc: Marc Herbert Signed-off-by: Nathan Ciobanu Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/i915/intel_dp_link_training.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp_link_training.c b/drivers/gpu/drm/i915/intel_dp_link_training.c index 7903de7a54c9..0d418f5a59b0 100644 --- a/drivers/gpu/drm/i915/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/intel_dp_link_training.c @@ -129,7 +129,8 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) intel_dp_link_training_clock_recovery(struct intel_dp *intel_dp) { uint8_t voltage; - int voltage_tries, max_vswing_tries, cr_tries, max_cr_tries; + int voltage_tries, cr_tries, max_cr_tries; + bool max_vswing_reached = false; uint8_t link_config[2]; uint8_t link_bw, rate_select; @@ -181,7 +182,6 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) max_cr_tries = 80; voltage_tries = 1; - max_vswing_tries = 0; for (cr_tries = 0; cr_tries < max_cr_tries; ++cr_tries) { uint8_t link_status[DP_LINK_STATUS_SIZE]; @@ -202,7 +202,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) return false; } - if (max_vswing_tries == 1) { + if (max_vswing_reached) { DRM_DEBUG_KMS("Max Voltage Swing reached\n"); return false; } @@ -223,7 +223,7 @@ static bool intel_dp_link_max_vswing_reached(struct intel_dp *intel_dp) voltage_tries = 1; if (intel_dp_link_max_vswing_reached(intel_dp)) - ++max_vswing_tries; + max_vswing_reached = true; } DRM_ERROR("Failed clock recovery %d times, giving up!\n", max_cr_tries);