Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp285206img; Thu, 21 Mar 2019 20:32:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqyU5qjxxnk2x9k94Kx01SVOF0cjYBDDHl2cUupoby+z5jql8FcgSP8FxkjP7OgWzGWHAKJ8 X-Received: by 2002:a62:e315:: with SMTP id g21mr5110214pfh.2.1553225532247; Thu, 21 Mar 2019 20:32:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553225532; cv=none; d=google.com; s=arc-20160816; b=svDQjrc979NYHggvFSpAyLY7FOsWZ8tZT8cffO9sSIYgHjuAVIpjR+QudewS93FJ5t TMfTDN0O6iIszaiPeePhkakEbM69QbJZqVXSI3n/cUN25kAhZbCLMqSQBED0TzcWSXGA bhx9n0IJd1v/K1k5tJ3+LTF6rT2H9bWB3GkEatWt42Ps3gOrFK4+kuIDa5rENp33PuwB GZtqHwwSurg9pQQtL+51uHWePgBrgD0ZLJhPnPAFFY+oKpPqxlVwxtnlnn8L3W/LcEhj QMa7WBoJG67Xud93jK62YqYt/NA5TEDPE2IMun19P1fbCTx/SUkv7s8zO3HuBmlA7qj2 kAgw== 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=VOc/5yQCsAvD8OjvVz+n50OZOgpX7N3tx64piXBEesg=; b=ZYoRKPsoo6sWzYRdp15/P/ps4Ftyvc25SaXMUb/pJft7YbisMrSWon18RbSzCE4WeO jYwFJppAzodUUqnaBUHIxeS1J2emOj/slUCkMZcOWHi+LL6+cwRQN+37l8bu6cDWdFC4 olhbRJV00UcVs94duklxgwIqCYmp1dwwWYVNhAwy0g4PptYJyxaOLNB2ZLYmPKbBFpE5 64BZ2805teut8Kwb+2ozntJoGNdUXZqtxLjPeZc/xPyWQrAvf8lszWuE/jmc7g+xgMcl 0QWTvAKpEzHaATZ0pQhkqNd/nfB+4FY0pj7clfXGqK8qFVj1YC13zSYKZktx7XNV1H0Q iCuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="Blt/HSdU"; 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 x18si5913708plr.76.2019.03.21.20.31.55; Thu, 21 Mar 2019 20:32:12 -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="Blt/HSdU"; 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 S1727837AbfCVDaS (ORCPT + 99 others); Thu, 21 Mar 2019 23:30:18 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:37368 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727617AbfCVD3T (ORCPT ); Thu, 21 Mar 2019 23:29:19 -0400 Received: by mail-pg1-f194.google.com with SMTP id q206so505895pgq.4 for ; Thu, 21 Mar 2019 20:29:18 -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=VOc/5yQCsAvD8OjvVz+n50OZOgpX7N3tx64piXBEesg=; b=Blt/HSdUEH/v/5vwEHd0IJzvLpi/M1PDMXkn2f7n8RlRDaNJWV831F5ZTdLWbV3vht +OvDDJvJ1fNEL+EjA72VCRVDJKxu83PhwTkISn0rz3kYexr1U9mO8u9DOICOFlzHoTzW qJNw3M2q/NB17jWf2tyWD0+8vTkMS1iv/a45bySuESh56NXi8ORjUHZF0/CUOAao9GrG MtQcUQtAGAqZMaA2zBcExydLq53LiVcftw8w32+nS0PWQ6ZENXKtG4YFYiOCNkRXG8tw 991GwJP4UJU7ifsDFsy1dsmzNZnNg5zhGhalD9Nhk2L4Uif905ZO9QVFZnzuHWcitn0r 8o6Q== 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=VOc/5yQCsAvD8OjvVz+n50OZOgpX7N3tx64piXBEesg=; b=joPz4cSKvHh6VrAuxqbA26DyCFgbzqHy9Pfsjp2ECI5nQKM4bPY7DhDfxqqd5GLHA7 tojIX11l4sfjwx4b2OnjQrp3K/T4jYdkeEoEC/LCoA8fjcZhiFXEbxhFE1yM0dq1vztu v4zIAqXgguZto9IfaEOIfKGOhwDhr1tBUk8GqJx6cO7X/K4eiqmoZXbOiQZtEeFfAvfU 8OKWY2mX3VQy+XeHwCZ9wdxcf1KPpYUMs058hofVAUdNhmR9V7vQXS/czaovj2n3Jbg8 uf7C/Ok41cpPQfkSX55S8qnoDvfK51GfR3IdFnozliPIqA57iy8OxTzC8QdSDePXRwj5 VX5w== X-Gm-Message-State: APjAAAWesiRo6vO/MEDtzzXWX0fAe5J2Boq6tr6oNaosEVZ+RT5XWfB8 5OfZRfG2JoJ/Aais6rTAncY= X-Received: by 2002:a63:3fc8:: with SMTP id m191mr6722072pga.240.1553225358146; Thu, 21 Mar 2019 20:29:18 -0700 (PDT) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id o76sm16154476pfa.156.2019.03.21.20.29.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Mar 2019 20:29:17 -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 , Chris Healy , Lucas Stach , linux-kernel@vger.kernel.org Subject: [PATCH v2 03/15] drm/bridge: tc358767: Simplify polling in tc_link_training() Date: Thu, 21 Mar 2019 20:28:49 -0700 Message-Id: <20190322032901.12045-4-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190322032901.12045-1-andrew.smirnov@gmail.com> References: <20190322032901.12045-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: Chris Healy Cc: Lucas Stach Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org --- drivers/gpu/drm/bridge/tc358767.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 2531f4dadbf8..38d542f553cd 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -733,21 +733,18 @@ static int tc_set_video_mode(struct tc_data *tc, struct drm_display_mode *mode) static int tc_wait_link_training(struct tc_data *tc, u32 *error) { - 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"); - ret = -ETIMEDOUT; goto err; } + tc_read(DP0_LTSTAT, &value); + *error = (value >> 8) & 0x7; return 0; -- 2.20.1