Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp284174img; Thu, 21 Mar 2019 20:30:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwT3Vn0rFcUVZU68m9N4ppiId2kC/NubVRUGh9BsRVxHBVKU30jRMur0dTUmlKvizHRS8Q4 X-Received: by 2002:a17:902:bb90:: with SMTP id m16mr7442970pls.49.1553225426180; Thu, 21 Mar 2019 20:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553225426; cv=none; d=google.com; s=arc-20160816; b=SPhnbhkrxG/WU1UwToS4PU7GAfga0iEskYMAvB6EhAmnRZ9xm6LMmovtDS3gqIrNN2 lYPuvbli8tZEIfwJcdLq/8q9rl3UZ3PJwB9BSdyL8HuYl1xcmSJ/XXKNmY/yJvMxZyhq k4vxdceXoYwTdLhnwqGVr00/WvXeHhHqqEF0X+eHwYtnxoGvV/YQcCKKXfOsg0wTXHjP 6Y1X++r4/RLMOzfrlXhKRKQ1u9DJTYDshrEbxKqltvmQcqv3gv95UONaQXkd8+C3zdFK Sj8dR3O69X8+GL+lD2wLopdJoXMMBgIMFbZ0DA1wRzGybDZNXqHuuyzgr1c/swmmJVLE u+2Q== 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=mDOxiUU7Ui5Bt+r0LjeQZZzpwc0N9T5pZP48PklvOT0=; b=sJxCeuw5Dke4i79PXcxsfY+C07vnjJGLvwTm7Z3ionJow/6haDAwiYKvwMDdk+4NUP eCurqgjAAfpO4IsaYoAE9FtaMiuk7FasxtpdgjlS70TnxnMko+GY4fQv1XD5ekb7uCHX bzBG2ISKkeiTeF8NirHrMd8CbYnY2c4VnGGlo9N/VfyNAYGkLIupsfU9o23Jl6rpg7ye fPZ3rkGBAyBVEE0+Za7FwMMG2uKHDl+yqlPOiL8xyRV8ajcDATzJg0aiLILIt7oQQZl/ nE8cerlfSd8H8+vVErQGHfoogy3GYRral2Y+cGYcZKZgYIctSIkFm86Tzk36/0TCerwC UUAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pva7vkP2; 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 t16si5625885pgu.51.2019.03.21.20.30.08; Thu, 21 Mar 2019 20:30:26 -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=pva7vkP2; 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 S1727632AbfCVD3U (ORCPT + 99 others); Thu, 21 Mar 2019 23:29:20 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:38201 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727595AbfCVD3R (ORCPT ); Thu, 21 Mar 2019 23:29:17 -0400 Received: by mail-pf1-f194.google.com with SMTP id 10so535753pfo.5 for ; Thu, 21 Mar 2019 20:29:17 -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=mDOxiUU7Ui5Bt+r0LjeQZZzpwc0N9T5pZP48PklvOT0=; b=pva7vkP2bOWbxgia9upiIVTREtJhkJ97LTEOKexjCguUZUlWsRU9+OfJ+eKopsIqpC YVFFM4/OdWK1R/mnDJ4lUjd7EcjsKAVA/CraC1QhPn1WVjBTOHX+4+ekZgRMWShuPkg2 uM3XpSQ3EwHNxsHB9xByQDQnQSdEIL5DTwKlcqFklbg9Y72HMPYgz/ZIzChtbC+A1xJv HCLRxUU5e75FXyiifLGI6rtuqoaua1nyVst7wCjOdU7/IAtOmIcEMunRGBH6zMfOV0VJ TqfbMUHZtMXYLiPuTdaUlCyA42bHz58dcqKghBieYw06/4D2udew1TsjIj1rxvGUbqQl nRpA== 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=mDOxiUU7Ui5Bt+r0LjeQZZzpwc0N9T5pZP48PklvOT0=; b=H/VDLMBvBEc26wDB8OYNMp9KinTdY1tQuFV/0IGp+xI7o6gm5IvLMqFGQRFkni8xjc /oalwYzw0DlgajfhW6jOei3yjiooNSjswZ8PIzTCBzOhmArwVBprne2uNr5tTlfyT2Cr P/tnUL3KmV7f6oKTaY+mG/nDbfbPbc6m/bGYzrUn9IaTiOGe4m7RXvNBZAXuhqUCgyQw 3BBNHOJF1eU44UnMwgsR82VQ5AJQJYKRFhXbjW40cAgqLG/dFFt1AMOQXrNKgXloRFx4 hiJazhwK6CqBUTtxwdcgtJJ9t5Uzop3cEHMdcKrGoZascQKpkuO412kBZtmPYZXuHKON 1wSA== X-Gm-Message-State: APjAAAUkEclRLxSiZumL4562SMarux2cWo7Qoferb99is/b9ZEGykzHj pkNNcRS4BlRFoh2AiYpNRVQ= X-Received: by 2002:a65:614a:: with SMTP id o10mr6780292pgv.51.1553225356934; Thu, 21 Mar 2019 20:29:16 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Mar 2019 20:29:16 -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 02/15] drm/bridge: tc358767: Simplify polling in tc_main_link_setup() Date: Thu, 21 Mar 2019 20:28:48 -0700 Message-Id: <20190322032901.12045-3-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 loop with equivalent call to tc_poll_timeout() for brevity. No functional change intended. 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 | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 89a4392dfa35..2531f4dadbf8 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -761,7 +761,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]; @@ -817,15 +816,11 @@ 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) { - dev_err(dev, "timeout waiting for phy become ready"); - return -ETIMEDOUT; + ret = tc_poll_timeout(tc, DP_PHY_CTRL, PHY_RDY, PHY_RDY, 1, 1000); + if (ret) { + if (ret == -ETIMEDOUT) + dev_err(dev, "timeout waiting for phy become ready"); + return ret; } /* Set misc: 8 bits per color */ -- 2.20.1