Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6400191ybi; Wed, 5 Jun 2019 00:07:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+gYqtClLsX1+iXpvsNatJey3HyxPFpWcYuLAspXEg0l/zsRS4RvDwEtqAt9VJ4d624x44 X-Received: by 2002:a62:4d03:: with SMTP id a3mr44625728pfb.2.1559718421153; Wed, 05 Jun 2019 00:07:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559718421; cv=none; d=google.com; s=arc-20160816; b=U95x+o0xr3T/5nCJtheWNrPMTUzPE9xusorQYWPypa8UKEU5Q1BSwx66yz2XVaYQ+w JQiKEOjRQ5FZnhVwgq++mCEro/13BrpR83/WCYoMskX5zDjti42SFiodC3FQW/yuZtzn h99gVji+dLuNIqixHxiSFHMs3vIH6EKsShItRd80kCXTlkeFLwW9RNUjHjmmggu447MD 4OuVjuRgtqnSeP7600e8hjYiWCStYVFTbSvC042SycmbC5sEnTspASWS9AfPwT18iraS IDxrynep6FQvVhJX29O5Wdu9HhvRYZiTUaIJii2huR2HNsV4yVa6Olcbn7f25KU3SniN hlaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wirFf7Bfi/9XjwkqOXDgrZYsLDnJpPp9vEZbkrcNQgM=; b=snKVs//HMJ2ernmelvoBDrPKm0ooF8iXuQ1vTatM93D/sTYfqs0sWTTOdxbhQKr8pu 5iFhTuVtWPs5fb8C3obiDDQf0+Pd2sjA0klZAMzMeWVz3WJ8vs04Yn6sDnNsnpaBxfsc bc360l00M9OW0QTgjrNOdbbMmLwJJRvnmbEu7BNHlZNt+uCmm3S/VNXjbPMNMVWJ2asL 1LjhHOBTDnIYrXHXk9U5SPrHb99Z/VtSK8JTybuAjXQeW1IoiRHckfAWkP3/4z/0pOiW BRpqlHu4t1bqlajEPr7ook+HtUIo4jrmLMSBT3I0x2Ashyt/xg45wEEjHx9toPRvizQx dPtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NIHBvw4D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si24514989pls.233.2019.06.05.00.06.44; Wed, 05 Jun 2019 00:07:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=NIHBvw4D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726725AbfFEHF3 (ORCPT + 99 others); Wed, 5 Jun 2019 03:05:29 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:35055 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726714AbfFEHF1 (ORCPT ); Wed, 5 Jun 2019 03:05:27 -0400 Received: by mail-pg1-f194.google.com with SMTP id s27so6264776pgl.2 for ; Wed, 05 Jun 2019 00:05:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wirFf7Bfi/9XjwkqOXDgrZYsLDnJpPp9vEZbkrcNQgM=; b=NIHBvw4DzFLmSh+4MdmMCikQr0aNv7Gkhi7yCDFo0EYZH942t+X3CFLkzVladA3Swb 71Q8gWyOMwE3jAO5/hyjtYSrn6iR2qWSCXbJtWy8uax9XJLaSngzuIwi/YXsgG1aH7Pd haLYlVRzocFh+mB2qOhYiuw+xQbShOfzrN0O3xFV5DUjzqgDHw8/JboORuS6I74vjeSl uLZk7SSwhbspqq1qCdzWVDAQKZs50ov7P8cjBVcmiFW3RYf/0KbI22pVj/by6wPkG/uH 2fzmlJcvJgU/DYfXDRkFPnc7s4QNVxJkxftGNP7WK+d73ctFN6/TW3yDjP+ZZCTyBtxn pu1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wirFf7Bfi/9XjwkqOXDgrZYsLDnJpPp9vEZbkrcNQgM=; b=WVWd03ElgT/5x2bHg1gxIQK/NZESEvsjjO3IGekOus7O8S+apMQOXVoNc/keWjlUqt 1ca+iQDuc7U7pzrZPyRsO8dA/XZWr0uoO5YFku4prLr/NVc/QwO2Arp561fytQKlmcJI MO9R6k6uHeu+G1iHyzuGFXqfTSWlmBa7Doaawqv2K88mYC7WwgXbRpfLrTv/onG5iKbt BXUcnnZf5J9VTWiV5lLFP7S/bFU6kiUCxJySX6oIdcNWhhPym6uYMAPtXxq8VTsYIgeK 5/20+AdW8eS9z+cwQsUwkWqQa3qpNQHR+JN09S7LJA740Y/+l4rl8pktTc+HsZziyxl8 VIag== X-Gm-Message-State: APjAAAURs6GqtmK4TMlIzR9SNDlChPQgJob2vfFXQi5dOi7GJcirdR4o Wp6i4Tooe6z1Up5Pe9C1Cfo= X-Received: by 2002:a63:f44b:: with SMTP id p11mr2435554pgk.225.1559718326197; Wed, 05 Jun 2019 00:05:26 -0700 (PDT) Received: from localhost.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id d132sm6527348pfd.61.2019.06.05.00.05.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2019 00:05:25 -0700 (PDT) From: Andrey Smirnov To: dri-devel@lists.freedesktop.org Cc: Andrey Smirnov , Archit Taneja , Andrzej Hajda , Laurent Pinchart , Tomi Valkeinen , Andrey Gusakov , Philipp Zabel , Cory Tusar , Chris Healy , Lucas Stach , linux-kernel@vger.kernel.org Subject: [PATCH v3 03/15] drm/bridge: tc358767: Simplify polling in tc_link_training() Date: Wed, 5 Jun 2019 00:04:55 -0700 Message-Id: <20190605070507.11417-4-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190605070507.11417-1-andrew.smirnov@gmail.com> References: <20190605070507.11417-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace explicit polling in tc_link_training() with equivalent call to tc_poll_timeout() for simplicity. No functional change intended (not including slightly altered debug output). Signed-off-by: Andrey Smirnov Cc: Archit Taneja Cc: Andrzej Hajda Cc: Laurent Pinchart Cc: Tomi Valkeinen Cc: Andrey Gusakov Cc: Philipp Zabel Cc: Cory Tusar Cc: Chris Healy Cc: Lucas Stach Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org --- drivers/gpu/drm/bridge/tc358767.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 5e1e73a91696..115cffc55a96 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -748,22 +748,19 @@ static int tc_set_video_mode(struct tc_data *tc, static int tc_wait_link_training(struct tc_data *tc) { - u32 timeout = 1000; u32 value; int ret; - do { - udelay(1); - tc_read(DP0_LTSTAT, &value); - } while ((!(value & LT_LOOPDONE)) && (--timeout)); - - if (timeout == 0) { + ret = tc_poll_timeout(tc, DP0_LTSTAT, LT_LOOPDONE, + LT_LOOPDONE, 1, 1000); + if (ret) { dev_err(tc->dev, "Link training timeout waiting for LT_LOOPDONE!\n"); - return -ETIMEDOUT; + return ret; } - return (value >> 8) & 0x7; + tc_read(DP0_LTSTAT, &value); + return (value >> 8) & 0x7; err: return ret; } -- 2.21.0