Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5406971ybi; Wed, 12 Jun 2019 01:54:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsl2OHMur/++EqIX1ZI7DxEXRA9RAAH1LD3rmJZYUlmXYzfY2vULZHMuW3tqFnlw391yMX X-Received: by 2002:aa7:8f2c:: with SMTP id y12mr612167pfr.38.1560329689148; Wed, 12 Jun 2019 01:54:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560329689; cv=none; d=google.com; s=arc-20160816; b=qK0SSskUJ3KKf/CmQR3teYSazQNk/uSmw6xA5bp6ojjVQZcWKo3/shhTeI/Q4u7VLL fyAAgl6shyUEhN653ubO5gUVTbwnXWB3LolTYXiJhwTdveJv5EmjpbWoDvwgsBPpFner 4xtWf8KTpTCqy6xR1GXn+STo+JdcNz1wgfjZEbWgwLViCnKlgqk1BjaalhkEApf/L3vq lUSAkC7q5tAzYB3gNCGvHKzBCd0nR3z5RuPVvgQreN3yKlesh9yfQtxJTTPRSybzd4k9 CiL9mrHeiBW26OEts75YgumbHOPvSB2/IwW4jTsr2lDnehqNsSEx5JYAry+bdodtR06S S7oA== 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=TKj94I1UJ9U1wimP1ZXUVhx4jFR4v9J2rmetWcqu/jc=; b=YxGXGpZxasA4XkdObwdNQrNaw47f9fMWHqKXLX3xE1ib90HXhpoeqBOG1UL6bLX/PW dsE0tLXF/DzC0q0eBjErxZ40T+qJHR3tHPnXlCpZ12mEmYUOIz1Pdgx5gjTY/V+eUlaV c5A0S1A58LlRMuSC3uKMGgkR+EQeoFjZexvEnZfZFVG4z5fUAg4odysWQFrk62HQrd6/ vH0uh3VvgDt4YSAgB3qvXcBylJ520IQTZu0prkfreS8DheNWfTYLhO7tuagPxAZFl5Ov vopWcspJ1i4IbGgGJ1LRuY0pmliV2K8QrjQotr4ncZzzbfu+mEnKk+wbBB/w8kU01QXg 0kWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Px0moJIg; 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 k9si7187110pfh.56.2019.06.12.01.54.33; Wed, 12 Jun 2019 01:54:49 -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=Px0moJIg; 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 S2437215AbfFLIdK (ORCPT + 99 others); Wed, 12 Jun 2019 04:33:10 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:33014 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437214AbfFLIdI (ORCPT ); Wed, 12 Jun 2019 04:33:08 -0400 Received: by mail-pf1-f195.google.com with SMTP id x15so9251387pfq.0 for ; Wed, 12 Jun 2019 01:33:08 -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=TKj94I1UJ9U1wimP1ZXUVhx4jFR4v9J2rmetWcqu/jc=; b=Px0moJIgf6UCrKTsv66zOIr2CYRDTt3kp+Jx5ZHdJ10awkaKiL6pec965dOTq+x1DR KG7T24uyStQyE0xe/gMNpF0m1qOC1PuA/4oBYrCOljZWw6orrW0vmC0azJi1RIIRD9Ha ZC7L4LSstWfFPVC3i650UQAf55O8QsLXO3m5yR4l4brmM+GxnAcdgZkw5Dlvz80vVdR/ WBDhe/qQlwDH5M952VeQO8YwdXJkhzV0cRrRxqDvV4QoWNNx5j6qXcHjHy37cfkvsscX yxH7sV9dTaBesygfWjDUrRhteGEhoC7cWef9CIf42q3VHgXG1iPUsd7aMw/zpujDoUQR Rvqw== 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=TKj94I1UJ9U1wimP1ZXUVhx4jFR4v9J2rmetWcqu/jc=; b=sr/m0oUYfgl2wjEnY+NZo7+19vNcEQaBl9M+TBmVsmnuOrHMY08fxxGHc5ltMy83bT 4EInsKnL3SNmrZ7knHCiBBuYsWMujmyEb1iIOoaFcHvM076WUZeNbbS3UJ6uRdHwwdHs Ol38FdqpQdVCIsBTY4n3xsHVXqxJXo1uLgivnOs8i5JbWxf0rnC3ZAsHt0lzkKiTp0Hl YdbMm8DUrdzbuJwMrS7gNPfmyRE4OKjO8mltKU9qP/mgoPjPv/JaR2SseLJtH2DxR57/ nA1CUF6+MMxNXNEU1wnk/1/X1VD9YarkpRReKnOjdr9+JUjfSD8ycUmTt5trU4xRbA30 sz8w== X-Gm-Message-State: APjAAAU1EGLL6xxioSlLCSZTZOSe+C69IduFwuF3Of/RbeN+SSNyavPc wFGisAR1V44beQsmD3MUffs= X-Received: by 2002:a62:ed09:: with SMTP id u9mr84945237pfh.23.1560328387838; Wed, 12 Jun 2019 01:33:07 -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 d21sm18845991pfr.162.2019.06.12.01.33.05 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 12 Jun 2019 01:33:06 -0700 (PDT) From: Andrey Smirnov To: dri-devel@lists.freedesktop.org Cc: Andrey Smirnov , Andrzej Hajda , Laurent Pinchart , Tomi Valkeinen , Andrey Gusakov , Philipp Zabel , Cory Tusar , Chris Healy , Lucas Stach , linux-kernel@vger.kernel.org Subject: [PATCH v5 02/15] drm/bridge: tc358767: Simplify polling in tc_main_link_setup() Date: Wed, 12 Jun 2019 01:32:39 -0700 Message-Id: <20190612083252.15321-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190612083252.15321-1-andrew.smirnov@gmail.com> References: <20190612083252.15321-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 loop with equivalent call to tc_poll_timeout() for brevity. No functional change intended. Signed-off-by: Andrey Smirnov Reviewed-by: Andrzej Hajda 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 | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index fb8a1942ec54..f463ef6d4271 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -774,7 +774,6 @@ static int tc_main_link_enable(struct tc_data *tc) struct device *dev = tc->dev; unsigned int rate; u32 dp_phy_ctrl; - int timeout; u32 value; int ret; u8 tmp[8]; @@ -831,15 +830,10 @@ static int tc_main_link_enable(struct tc_data *tc) dp_phy_ctrl &= ~(DP_PHY_RST | PHY_M1_RST | PHY_M0_RST); tc_write(DP_PHY_CTRL, dp_phy_ctrl); - timeout = 1000; - do { - tc_read(DP_PHY_CTRL, &value); - udelay(1); - } while ((!(value & PHY_RDY)) && (--timeout)); - - if (timeout == 0) { + ret = tc_poll_timeout(tc, DP_PHY_CTRL, PHY_RDY, PHY_RDY, 1, 1000); + if (ret) { dev_err(dev, "timeout waiting for phy become ready"); - return -ETIMEDOUT; + return ret; } /* Set misc: 8 bits per color */ -- 2.21.0