Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8491717ybi; Thu, 6 Jun 2019 13:18:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4jhZlEIp9lQSx8j1vE4LPYabsIeawmzKN058Kin4c0seKJwKUyBCvGs3I9Qw3SsDf9411 X-Received: by 2002:a17:90a:37c8:: with SMTP id v66mr1691930pjb.33.1559852312022; Thu, 06 Jun 2019 13:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559852312; cv=none; d=google.com; s=arc-20160816; b=J/ERINXXo6z9bXvkHUARHkWxAeBOBlKjYlVf2FDwEISB5qDVXU5IF3l0lQCCPsfohB +BEjNsclGa7ZudwI3GJLw9m8W58Yc72QAfGHHRxKUOzBgEcg+2VrVBZxMydxTKSKICV+ U3F/NBEG6Fl2xlZqlRrrbtx0wvTMD8bd0ZN3yfYdmKYAGdUHXExGOkmuKiEJas0vdWjS oOCsEW5pIFKb8BNK12RV7HM4LWMzdfc3BvnW6o8ojTUgXNW+t7RaIjcndZWDOw+J2Sh9 xEzEpWHp01t5socPwxy3TszNQNWBqlMttg2CCKojbh6pZQKbxYPpv7qJ8AJWd0HYwK3Q xrYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=k1YXtpNCDOosbHBL0TL+M3WAkRwQkUQShRW6iv3pI/E=; b=P6xx3oBGEkh2a6ncsG+kxyzBjZHHiCmtkJxUFcTfH37bPQR0L2vCWw+ix1xg9jBZ6t o3hA1TRQ+fuB3+XnJsgyDByOTi5dD9RhzdOxVUvr5dIm+xtmXeCcTSTttuIVvCT8KrMr qt6tedz3f5Q/iNSULqo6+rUZrx50yVSYrGkpp9czvJYzVtpZF1jaQXWx8pyIQCoFJIQI OP6zycxqrywcfk7T6FNK7XnSgOCyJiUvhOg1WfXq9xcrgHV5VJ6dsgML0FqqT9GgHFAB HSkYAMj6dyXInPZG9obXpvKR8drlQa+QCiLmlFWY+uyQXTLyj9Cfn/axcSeiZ3dHdwUh mesw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=elYAqTKj; 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 j14si2235839pfi.276.2019.06.06.13.18.16; Thu, 06 Jun 2019 13:18:32 -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=elYAqTKj; 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 S1729035AbfFFTS5 (ORCPT + 99 others); Thu, 6 Jun 2019 15:18:57 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:39329 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728504AbfFFTS4 (ORCPT ); Thu, 6 Jun 2019 15:18:56 -0400 Received: by mail-io1-f65.google.com with SMTP id r185so1110210iod.6 for ; Thu, 06 Jun 2019 12:18:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k1YXtpNCDOosbHBL0TL+M3WAkRwQkUQShRW6iv3pI/E=; b=elYAqTKjzYWFPW2KclIE/7D7+zcK6oEV+i0XXHhZSP+U/FvV2qo6zHq3e8SpKTkBiW pIhAHacyghUD4KEMdqoLklkIrGkgpAj5uBTVBQWI3nthQV0FAt/Wy380lL7ZvZubJvDi nskJjdPKBrSBrS7G2PXp/+dxi2HhqiOISv7sGMxfmWWc3f3zic/cQOWUc1FmMkG2Va+g bsfB7JpSfvq8BIiF03CQddwQhGD551SvzJj8MZ499QH1qbBv/ZD4PRr4wkvcc8nkqwc1 8CxZP880ZxXM3Bm/h4Vm7ykkkBw/5WnCzk3i65N+KGqcyOwODonNdFFP13QpnHb9+pHJ sWPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=k1YXtpNCDOosbHBL0TL+M3WAkRwQkUQShRW6iv3pI/E=; b=JezaVDMXB0nXkqKEq7crO7EdvVxV75jw6XHmiQoyyvePtf13v0xXN20iesAXWeJ7ct 9yrZ/VpxQMzHsE2pnvhIj0SCJK20c4WmABP04F3AYIv0C8GNYGloKzNzxyIl5Te7zz8o FFiEntnW4sbHagZDe54mLjGchqVX5bw5sfFNzxgJpxvBNX7SSGMkimakCkXYW7XxQO5N vp8lzVJqQ0+zl2nWNmLjM09k9MNtqlm77GtMNMLIpJCc4QwHPyViXnZlaoAg+vBiIAi9 eZNik6lWuK+JSZsBvrxd076Fg/djEdwBNnnydaRdweN5/WI1C8/QJqC5PS7P1kLahyIt GrKw== X-Gm-Message-State: APjAAAX7Y+YjC5m0wJxn9SEk1Ag3F+dAS933b57kMPbyTdsM2gnfatAQ bsy7tlny0CAw0DOyn4L9OdVPp8i6JrW85Ujoogk= X-Received: by 2002:a6b:f607:: with SMTP id n7mr7233987ioh.263.1559848735945; Thu, 06 Jun 2019 12:18:55 -0700 (PDT) MIME-Version: 1.0 References: <20190605070507.11417-1-andrew.smirnov@gmail.com> <20190605070507.11417-4-andrew.smirnov@gmail.com> <3c50e3e2-9fb8-6962-9988-32d14aa429b0@samsung.com> In-Reply-To: <3c50e3e2-9fb8-6962-9988-32d14aa429b0@samsung.com> From: Andrey Smirnov Date: Thu, 6 Jun 2019 12:18:44 -0700 Message-ID: Subject: Re: [PATCH v3 03/15] drm/bridge: tc358767: Simplify polling in tc_link_training() To: Andrzej Hajda Cc: dri-devel@lists.freedesktop.org, Archit Taneja , Laurent Pinchart , Tomi Valkeinen , Andrey Gusakov , Philipp Zabel , Cory Tusar , Chris Healy , Lucas Stach , linux-kernel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 6, 2019 at 1:08 AM Andrzej Hajda wrote: > > On 05.06.2019 09:04, Andrey Smirnov wrote: > > 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 > > Cc: Archit Taneja > > 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 5e1e73a91696..115cffc55a96 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; > > } > > > Inconsistent coding, in previous patch you check (ret == -ETIMEDOUT) but > not here. To simplify the code you can assume that tc_poll_timeout < 0, > means timeout, in such case please adjust previous patch. > Sure, will do. Thanks, Andrey Smirnov