From patchwork Tue Feb 26 19:36:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10831427 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 A30B713B5 for ; Wed, 27 Feb 2019 08:56:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ED392B002 for ; Wed, 27 Feb 2019 08:56:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 832742C162; Wed, 27 Feb 2019 08:56:42 +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 3C4E52B002 for ; Wed, 27 Feb 2019 08:56:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B53FC6E037; Wed, 27 Feb 2019 08:56:30 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by gabe.freedesktop.org (Postfix) with ESMTPS id B95826E01B for ; Tue, 26 Feb 2019 19:36:28 +0000 (UTC) Received: by mail-pl1-x644.google.com with SMTP id q3so6720197pll.4 for ; Tue, 26 Feb 2019 11:36:28 -0800 (PST) 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=YVXBfapIBPv9u2kzIyOKvGLdHh31BstlJtoKLehz/ro=; b=EzGRjm7xotFoSR7BqT8pqRnaqQVbECioUs+gN+wxcsFP5HNnZty4HmR1Aa+66cpWBF 4Iay4qKI9SiHLrwZDC74p41lG+WFf8avd2LcuDna8Cirr7zhcTTAFRVdwQpK7AY8Q1no uTGmvMsWpMo7BXoEMBJY42uom0qTNn91GUdcxANRekEatp4vx4PGVYuUp0z1xdWUxqr1 SaECdYazdU+1aCEtKRGHU+rGsaP9MywNvCOcj28H84QFvNVcxYny/qC5QTn6FcjSR1PX SsyGUVY8tWBcx6nA7gnFkjV48b6XxB2SHel9LooB40RTWU9CjVmJM7gSZahnM9yhe/9d jcwQ== X-Gm-Message-State: AHQUAuZcUbzR2cwrwBsTJYpFMbITGEE+Ykf+0MLozqSAapWE4dYirjrT bvzv3PdxZCFJ1HxnVygoOHyLCC6kI5c= X-Google-Smtp-Source: AHgI3IYLOxDuyqQ8mbfqACEV3AngV+icEFTS1xsMJdZHGpimzvUBJXiQXvv8hLtOugAL7eLnbUyOog== X-Received: by 2002:a17:902:bd06:: with SMTP id p6mr6006380pls.130.1551209787748; Tue, 26 Feb 2019 11:36:27 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id l79sm28951220pfb.102.2019.02.26.11.36.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Feb 2019 11:36:26 -0800 (PST) From: Andrey Smirnov To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/9] drm/bridge: tc358767: Simplify tc_poll_timeout() Date: Tue, 26 Feb 2019 11:36:01 -0800 Message-Id: <20190226193609.9862-2-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190226193609.9862-1-andrew.smirnov@gmail.com> References: <20190226193609.9862-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 27 Feb 2019 08:56:29 +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=YVXBfapIBPv9u2kzIyOKvGLdHh31BstlJtoKLehz/ro=; b=qZS6HpZMXIb4jSEp5ugOY+XQYJL3OF29uRIh7vTNcXnJt95jSpFxGSXZPy5b4BPJdn ex5rSQemwGkSj9lMe4Ir6DTBf9LlcWvvKpINvUinoWXunfuklh+dSO7V4dtn4BTuh/ns 7aHRE+ZwGQ5wSTB2aAKfPSS84LLpqu7GXJe2R86Vp6mebrjCyvdFwiDTJdJrasZoU3do zus5suIVvq73t3tDJ3He0mJyu0zA9DB1zlYBaicP/y5nHiJAns410fTDx5uL+zDu+5u5 MDPIj9vFbAYct3BXdxnaPnLVdjJ0ppCwIYyH3lmHD8wmHpTc6ArvaDrzOxv8Z4qtYJ5k BysA== 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: Andrey Smirnov , linux-kernel@vger.kernel.org, Laurent Pinchart , Chris Healy Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Implementation of tc_poll_timeout() is almost a 100% copy-and-paste of the code for regmap_read_poll_timeout(). Replace copied code with a call to the original. No functional change intended. Signed-off-by: Andrey Smirnov Cc: Archit Taneja Cc: Andrzej Hajda Cc: Laurent Pinchart Cc: Chris Healy Cc: Lucas Stach Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Andrzej Hajda Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/tc358767.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index e6403b9549f1..b0f8264a1285 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -252,24 +252,11 @@ static inline int tc_poll_timeout(struct regmap *map, unsigned int addr, unsigned int cond_value, unsigned long sleep_us, u64 timeout_us) { - ktime_t timeout = ktime_add_us(ktime_get(), timeout_us); unsigned int val; - int ret; - for (;;) { - ret = regmap_read(map, addr, &val); - if (ret) - break; - if ((val & cond_mask) == cond_value) - break; - if (timeout_us && ktime_compare(ktime_get(), timeout) > 0) { - ret = regmap_read(map, addr, &val); - break; - } - if (sleep_us) - usleep_range((sleep_us >> 2) + 1, sleep_us); - } - return ret ?: (((val & cond_mask) == cond_value) ? 0 : -ETIMEDOUT); + return regmap_read_poll_timeout(map, addr, val, + (val & cond_mask) == cond_value, + sleep_us, timeout_us); } static int tc_aux_wait_busy(struct tc_data *tc, unsigned int timeout_ms)