Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8844672ybi; Thu, 6 Jun 2019 21:55:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYQoQoE3NXWmM++bFpqw1D7eFb1FW3dxnA8rYKrjvZ4SjQg6SR9iI3QUDIcCtGQ4ZFLul5 X-Received: by 2002:a17:902:24b:: with SMTP id 69mr53443850plc.255.1559883345966; Thu, 06 Jun 2019 21:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559883345; cv=none; d=google.com; s=arc-20160816; b=jIADBFFy18SLqUjA+s80cGvJwolWSgDVrD9hbun1ANzR/pj2hmnQMf25pXoDHbCsoS yf046DqeJC4onUguzdESBSYZTW+ZpqAyZ9Gnd11akX+y1MN6aHam3SqLIz+YqzD/c9B5 Dp9l/2uAe793VS8x8FSJMlig1zN5J0OOPD+hdwMeAl/w83v36RtuM2vlryvvKXEOyp9z sxYWqv70+OCFOgXinbQzXfaoO5TuaIcH7OF7IM5xJVav0l7X2oxeog75FnHfwKJ91M6j xsLapWtifka08+PZZJWfpG9gbLPtUevuqJImef9gDSaexAruyI+TfdqVcWVZuw3Kd5E5 zqvg== 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=OkJHuoJkxZ1Zfi+L4DP1CWk2w1t7nYeDgCcJUlw7bGLwxsvv5/TmeZISAj6B1Q1M8X PISGqHyfgFalj5QGQ6o6VHiUzLGjBcT4TfDG58cBihr3uSrt8aU0wSiauReBP6Xc+KcY pYkvvLb0+rKuZnPhWI+czdLZqhHkvxffI/qWQ7eoMXpdHqtTZLKVNkJVwRKreala/IRI mdc8SLwapq4jqOm9SsUE6HNZ9h+cDaGtvA+zHddSPMbpQra8CUU1IYlOv6TlauOutUxb zUqi7X8Bzuolz36PA0gDnjLGmSAl11segOfZzU8TO89RMt3R4KGpQ+WC2SifJLV/fYR6 nkyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rDQ50ait; 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 x24si878626pgh.393.2019.06.06.21.55.27; Thu, 06 Jun 2019 21:55:45 -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=rDQ50ait; 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 S1726164AbfFGEqa (ORCPT + 99 others); Fri, 7 Jun 2019 00:46:30 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:35988 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725372AbfFGEq3 (ORCPT ); Fri, 7 Jun 2019 00:46:29 -0400 Received: by mail-pg1-f195.google.com with SMTP id a3so486468pgb.3 for ; Thu, 06 Jun 2019 21:46:29 -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=rDQ50ait0AZSnhNs+94DRKzZufz/mXjTyd6b5gGmiEbxWpq/cW1J35S7np/gsPajII uyA5y5WQIZ7KAwEy4a8W1KlnNjodjoFYMlKh8Ti9RTCaNJH2cMZhBBIlpikE3Ruz3rmz td8fuGtMY5YgUuLkQyon29mrFvOfGnkxzG+mg9zxbG41Krv0zWaPxrbm5SmIZU/5stH1 Tj7o71t+Xd9RwZAh/EbWuWRq6R5PInS0vUE8DmePswBCkpc3t3rYJ3IzyNLqAgumsK6C yuWkxzzNrekpGSexrj1/O6t4Im23EUL8SlxjfRFhC62yeu9H+dmmNbEnYlOb5EAktV7Z +ENg== 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=m7goBTiBuYr14fXAIBo91a9OtPoS8LPMZAib/uJ1kF8wTr9svU+YrhJOYzGGGLZZnT LCjUZ1vJkSllxbf3YEj6CGDvLWunfxOJ2LGNDHstTr5jLK3f2h45HsaX8YIHdNfgehRo oYrPhJlmk313KMlvF197k0n4ovZv8m9THLQPWPygHzNFah9DNloovP4y2Eoe2+MpYlFM k+rqExdDpF9R2MKOKfHzHS1ewWVtdUhNSlPzNIA4Ha+2dQxZa2vBrBzcuHLQmBv+5lUP diKBHJV5gHaiLD0hV4/wsHGeF1V0I5+uAomoZMAtKTsjqMqtavHErUZUs537+UgrQYB8 J+tQ== X-Gm-Message-State: APjAAAXwHlA3EEhZP5HAUDfuA8ltNSynvoArXlzkn7myWbjJrJCDCUVb 7lqvbMQdspfP0T7o9Qs8i6A= 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 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 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 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