From patchwork Fri Jun 7 04:45:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10980981 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 AE3E614B6 for ; Fri, 7 Jun 2019 07:46:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FE8F28AB6 for ; Fri, 7 Jun 2019 07:46:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9473D28AEB; Fri, 7 Jun 2019 07:46:04 +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 48C6028AB6 for ; Fri, 7 Jun 2019 07:46:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5414789B45; Fri, 7 Jun 2019 07:44:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6E568940F for ; Fri, 7 Jun 2019 04:46:29 +0000 (UTC) Received: by mail-pg1-x544.google.com with SMTP id 196so480260pgc.6 for ; Thu, 06 Jun 2019 21:46:29 -0700 (PDT) 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=sNUSTTlgNiWC8Lw3Pxd1ZA12bY4NndmIZ94nnKh/X030Uf6LKSoLx/Pc3zyZOuCLND 6Qiw1abi3PhgngTEtUI8QPhFk6WOL8sCHYYkzVB4Nbg/xcGTRXGzWuhab3sUsLHbx5vt XLtmrgY2wELoIpXsK0780N43XSKZRkR8piU2z2xmI0umh8GcSp6kPZTM6X5m9qZYof8L CRtEvT9W2dZf5uikbNT0e7XwZAYoDY2OFbMR0SGvyJBAAF/KDndEi5ITpLXVED3p+8gS mVA+AqtrJxRrXSFl0jrUtCUyZ1swg0vCeneYZoPMmFvMOkaW7SL5Or9pjI4ye+t8qcbj 8+5w== X-Gm-Message-State: APjAAAUrXuuITxTk+nz5ru22sKxAT9DLE9nFcvtKJwIoXkX3jkarAFFF 6WEbmwxG6M9N1qPfl2XzmBMt+D1FQF8= X-Google-Smtp-Source: APXvYqwldgVunQd7qxmyJ+Xn/e/agu1l+MYj5yw0wR8Ter7sPfmPIFdnHlyKscrzkGRhciJLS4S4Zw== X-Received: by 2002:aa7:9095:: with SMTP id i21mr52436969pfa.119.1559882788909; Thu, 06 Jun 2019 21:46:28 -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 o13sm919516pfh.23.2019.06.06.21.46.27 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 06 Jun 2019 21:46:28 -0700 (PDT) From: Andrey Smirnov To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 02/15] drm/bridge: tc358767: Simplify polling in tc_main_link_setup() Date: Thu, 6 Jun 2019 21:45:37 -0700 Message-Id: <20190607044550.13361-3-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190607044550.13361-1-andrew.smirnov@gmail.com> References: <20190607044550.13361-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Fri, 07 Jun 2019 07:43:40 +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=TKj94I1UJ9U1wimP1ZXUVhx4jFR4v9J2rmetWcqu/jc=; b=rDQ50ait0AZSnhNs+94DRKzZufz/mXjTyd6b5gGmiEbxWpq/cW1J35S7np/gsPajII uyA5y5WQIZ7KAwEy4a8W1KlnNjodjoFYMlKh8Ti9RTCaNJH2cMZhBBIlpikE3Ruz3rmz td8fuGtMY5YgUuLkQyon29mrFvOfGnkxzG+mg9zxbG41Krv0zWaPxrbm5SmIZU/5stH1 Tj7o71t+Xd9RwZAh/EbWuWRq6R5PInS0vUE8DmePswBCkpc3t3rYJ3IzyNLqAgumsK6C yuWkxzzNrekpGSexrj1/O6t4Im23EUL8SlxjfRFhC62yeu9H+dmmNbEnYlOb5EAktV7Z +ENg== 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: Cory Tusar , Andrey Smirnov , Andrey Gusakov , linux-kernel@vger.kernel.org, Tomi Valkeinen , 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 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 */