Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5406978ybi; Wed, 12 Jun 2019 01:54:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxs1FdCOhJLwykrp5SzqcSlL6vG8eaSxUJruP5ucGeMH/m3HYTkAXMeryKX/ro1EGfcU82K X-Received: by 2002:aa7:8711:: with SMTP id b17mr27909849pfo.234.1560329690215; Wed, 12 Jun 2019 01:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560329690; cv=none; d=google.com; s=arc-20160816; b=oCC1ncTTuhmXY+w80NbrpI6r0bRi7zxmpmu42NRY/iOZi5+WrmVnngFRT75/7iGjSL iUSTiAmPnzRSL5Wd54MerymUgfxlqZeEK3eZNvPyA8eGhfK15sdBcfMTjUCPdyQKTTVw FFhr0ucR8h8qNvhsnK51fUTlSKIK36jcn8Kla6VvgoMtKYs/IpESoC0rvlZ9yfn5odFm g4JWqkaKYIUnlJzbdGOryDrf5H0b5Vezs1IRYcRKYjq34/VWkBJPJp7/ZNn2nA8lsXLu RN5YlkugSHh2y4wm3l9C76Ng2kgLn103V4YSfop33O1eCQB27stN+OuRzb3fip3GI2V2 R8Ow== 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=86+1jUaVqNTDsIoNrTtwtftI7vuyj9YpQeH9VRCoSLE=; b=ohqsfNdP6zg4CfhUAg2TGA28Rn4gJzKCS8pthUieAgly7poHsJrH+6vZ3OIb6UobNj /3z5iFe+J1R+Bzd0HybImN57nbxdH2lBffLdtauQFE/G7H7AZZavBsf0frLeaOqtPGzf 0zOp4094BTBZTBS7NppRGZxUgUDxDBjD3jG+rtp6j4mjsA/4gOYLmiiIozgpb9mh6BW1 idnvXL91QWKn02hwY06U2WvZzQUB9sJ/27XJ3isVdK6LGA3wJp/R+OC+sDxcjK58sKxv M3SvNsTnm16XWvWdy2TaXgXtJpLn5QeMMVM5GIFvWZgQsG5sgnxFVNC6HREU0tQNltCw 9mcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=afohXmex; 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 c19si14767963pgc.425.2019.06.12.01.54.34; Wed, 12 Jun 2019 01:54:50 -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=afohXmex; 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 S2437233AbfFLIdO (ORCPT + 99 others); Wed, 12 Jun 2019 04:33:14 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:39333 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437223AbfFLIdK (ORCPT ); Wed, 12 Jun 2019 04:33:10 -0400 Received: by mail-pl1-f195.google.com with SMTP id b7so1289882pls.6 for ; Wed, 12 Jun 2019 01:33:09 -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=86+1jUaVqNTDsIoNrTtwtftI7vuyj9YpQeH9VRCoSLE=; b=afohXmexYd3wJdVyxOx1FBcrsMl+tDot6Jng9UlzTGqxMXcYq+tgzttatlHemrQKND QeaKnTN+FkYrkunmEJVmuwWPe3/4x2FIddEC+yBK7Tl5JYVcTJR3xQV/8rkJowf99Z2o c7wNrZmPqJsWBnVpyO25HUg/GHR9YcnexkxczY2Z9bREN0caDhSBs3fUHU8DjmaV2IMg MuyWybBxEAenUYMLruBmEdUNpQvmjoaSdovTbMP31CbASi8JhOwZ6Dx1xuDOj21o4Dhw 2wAJ78x/T1YIiDQbg1ccJscQbDxTH6XpJ4fhMZ8FFqsIOdJqnqMjT845JNNNYBJpCDh+ CfXQ== 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=86+1jUaVqNTDsIoNrTtwtftI7vuyj9YpQeH9VRCoSLE=; b=NDa03Qt3P7PBj+5Sj36JEBcH7meuqoSQenwkkH6cDVFAId10yKxOM/wWjy6v2wkTyq tQ4pmY2dXMB5/xPZhgTuWH47cgJA1usWW6hBK09eBArx2hcctmDhC134Q+d0jeHprIyc sQ6PasYAwubo2atzgOYmN68SMDbyNbmfUAZlI9gjt/Ix+i97DlFBcyzOGb6TN7xbih6W m8vc7baIVBD8RzCwQOeALvW7p5W59/edmXQ07OmZoaGEc8V5Lj7FimDF+85pBz6ayjn2 8nBE1Cd0e5bLp2xwgSdHXc6baWoPrD4C/i/LKneTiE+B/yp8C7/NWUVubzxo37W/fhKG AjVA== X-Gm-Message-State: APjAAAUf9JUFtMq4DZMXSW2xG6cnuDwgvm0uygzXTjmj4xgJLTB+LfxC sXFy2ul2GeZysk3KO3FGAh9e4bN5Lh0= X-Received: by 2002:a17:902:7246:: with SMTP id c6mr20638789pll.248.1560328389392; Wed, 12 Jun 2019 01:33:09 -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.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 12 Jun 2019 01:33:08 -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 03/15] drm/bridge: tc358767: Simplify polling in tc_link_training() Date: Wed, 12 Jun 2019 01:32:40 -0700 Message-Id: <20190612083252.15321-4-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 in tc_link_training() with equivalent call to tc_poll_timeout() for simplicity. No functional change intended (not including slightly altered debug output). 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 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index f463ef6d4271..31f5045e7e42 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -748,22 +748,19 @@ static int tc_set_video_mode(struct tc_data *tc, static int tc_wait_link_training(struct tc_data *tc) { - u32 timeout = 1000; u32 value; int ret; - do { - udelay(1); - tc_read(DP0_LTSTAT, &value); - } while ((!(value & LT_LOOPDONE)) && (--timeout)); - - if (timeout == 0) { + ret = tc_poll_timeout(tc, DP0_LTSTAT, LT_LOOPDONE, + LT_LOOPDONE, 1, 1000); + if (ret) { dev_err(tc->dev, "Link training timeout waiting for LT_LOOPDONE!\n"); - return -ETIMEDOUT; + return ret; } - return (value >> 8) & 0x7; + tc_read(DP0_LTSTAT, &value); + return (value >> 8) & 0x7; err: return ret; } -- 2.21.0