From patchwork Tue Feb 26 19:36:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10831435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C31AA1390 for ; Wed, 27 Feb 2019 08:56:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF13F2B002 for ; Wed, 27 Feb 2019 08:56:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A36402C162; Wed, 27 Feb 2019 08:56:51 +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,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,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 6221F2B002 for ; Wed, 27 Feb 2019 08:56:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C6D9C6E03A; Wed, 27 Feb 2019 08:56:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by gabe.freedesktop.org (Postfix) with ESMTPS id 330076E01F for ; Tue, 26 Feb 2019 19:36:33 +0000 (UTC) Received: by mail-pl1-x643.google.com with SMTP id p19so6723410plo.2 for ; Tue, 26 Feb 2019 11:36:33 -0800 (PST) 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=ICgFrTld9JRHTgnIIEzO9Y6X45uTsmJMMuA3yPbCJ84=; b=g33DOt+u1Vwt8WHniBoyLxAYRWD2xt/B/9AU0Ev5z7GHMfCmrECjnCGTbUNGRkGnXV tKjZgMciDuNosMASl6Cl8YI+18wMQUPcjj3ku0tWzNxXDb4lC30yspeGZ5sMyh8ayAfw JrEDLdJ9EAnqHDwAGYATibDFyFNXhpI/PwuzwTPzkx6vVIGvjHCB/HbdIZrfoqMP9NnO W8wC2xA3TwSz/KIswLSHjh8izLLhu3tRQ29p8OWazrgoqOs+2ypK3jT+EECY/SMsVoFW bcc9c2H/laaw8Mv6MEY8spBqHwVM/ypZ7U/vJtUJkn5NpDfslNNkpblLgguY+gWUUFat tKzQ== X-Gm-Message-State: AHQUAuYSV4y04LRaRD60gutyDyRjZCGahv1en5fR1PHXmIDHXeF96ytf ttTE9fv56Lt6BdRQlt00RqIjKBc3orQ= X-Google-Smtp-Source: AHgI3IYrdozcRXu7rccU9mHllRR136wgVElc55P0euzyBFsvrKiwM8g/8mNo4n1Wzi6cXG/2Qagarg== X-Received: by 2002:a17:902:6949:: with SMTP id k9mr28310371plt.188.1551209792387; Tue, 26 Feb 2019 11:36:32 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id l79sm28951220pfb.102.2019.02.26.11.36.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 11:36:31 -0800 (PST) From: Andrey Smirnov To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/9] drm/bridge: tc358767: Simplify polling in tc_main_link_setup() Date: Tue, 26 Feb 2019 11:36:04 -0800 Message-Id: <20190226193609.9862-5-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226193609.9862-1-andrew.smirnov@gmail.com> References: <20190226193609.9862-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 27 Feb 2019 08:56:29 +0000 X-Mailman-Original-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=ICgFrTld9JRHTgnIIEzO9Y6X45uTsmJMMuA3yPbCJ84=; b=HHPycQ3kzU+Y2D8FPejN9JFINOdXQLaHw64LcLJD2HuungpnukAEhQMSynAGX2zfII L0tK0ZXwYH7oIjlor8PlP8fkIcC2Ar6tbmksTaRRCIoegXUIpLMvtMW8fAzcyCJXWYk7 Yn0EwA4nrM0P4JQhE0Kmef5cLfpk6Aa7DxlbT69NI3cLL0fRAn9z8ab8ZWKDpwCFNH9X 3yRMQFHQxqYAhqyR51a0cxUMLnx8v606OTDuMkThmdB0oBwaXXdDhGK0DA7r44vbtCyI kDBKUE7jSPQyMX+18+YHhc8Sy4dk6bD4ubV3dipOUMXpCQ3H078T7MbGppXq0CrmC4Ix a8Rg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrey Smirnov , linux-kernel@vger.kernel.org, Laurent Pinchart , Chris Healy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Replace explicit polling loop with equivalent call to regmap_read_poll_timeout() for simplicity. No functional change intended. Signed-off-by: Andrey Smirnov Cc: Archit Taneja Cc: Andrzej Hajda Cc: Laurent Pinchart Cc: Chris Healy Cc: Lucas Stach Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/tc358767.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index c85468fcc157..6455e6484722 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -882,15 +882,11 @@ static int tc_main_link_setup(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 = regmap_read_poll_timeout(tc->regmap, DP_PHY_CTRL, value, + value & 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 */