From patchwork Wed Jun 5 11:19:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 165865 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp7208119ili; Wed, 5 Jun 2019 04:34:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLKup9NMiUpPxHIQefTjRfhgQ8VdpSLJTdDqYnZuOF4Vrf2ysYh62cY/rXEHyQJJy8NRVi X-Received: by 2002:a17:902:324:: with SMTP id 33mr42957661pld.284.1559734476419; Wed, 05 Jun 2019 04:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559734476; cv=none; d=google.com; s=arc-20160816; b=SEIY3YqAO0M6HV4QEaNpX9azk3lRPpXBz5Vn6MIihuuxs5Fl17tCUzroV8UbJEE1S1 ruacQdvL7a9bZFMJd9w/rxnolZgm7xdsiAq9UKvxtkKhS7ynVV14Z3C7YujMj0DcvfzR qIDrAsCOXy/ge9p5jf2G6ZWyhNZumzQptdoyJDwitoXTA1RwgFZvrhDNx2GHlXISY+op JTK2N1HrA+p+OCNrZDKWpOxLUJVLIpWScFSDbq+XLd2HSSrT98OX5fTEg4ESA4xBfGWR JpkZOc+mbqg9JlXSm942fLZmcLYWm0t5D82RfZOqBTd2PYEDA0CMH6eWXHKyOsdq9Rn9 NXMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to; bh=q3yGqo+1UaFjnjJE20th3xlqTrqVq1R2KmEDV05UMk8=; b=1C3IetBlsUG4mzz+iykU+hSOPr8RW+u1LQ+l1aofP/d7zWPWEQzmZpY6xx8LoH/rRx VH7wY90Yd8B5qO3NTsUEhkZ5smrBGQyDsKTnywzIt+p0Gn0mWEeDpoUa65kuLdp+3yqJ u261rEhMYZjZKu6WdO1OWNdyhm/RIw7BhuhkcisSpWkseeIxTRR/PXOL0/i0cSd86VhL 4JMssFJtsa1vKm1SM7B9N/NLaFmQVeccUe+su4l05BoUWLNA4R2agATSAULy1yzAoyQn 20QJ/AxAACMsU+sQiOBuxL+RFnryXQHOVgOv0JBVz78qo7n+vCqejAXVOPy0xZ4GUhdB 5P0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id b2si22078454pls.93.2019.06.05.04.34.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jun 2019 04:34:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 630E08987C; Wed, 5 Jun 2019 11:34:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org X-Greylist: delayed 900 seconds by postgrey-1.36 at gabe; Wed, 05 Jun 2019 11:34:33 UTC Received: from cam-smtp0.cambridge.arm.com (unknown [217.140.106.53]) by gabe.freedesktop.org (Postfix) with ESMTPS id 418DB8987C for ; Wed, 5 Jun 2019 11:34:32 +0000 (UTC) Received: from e110455-lin.cambridge.arm.com (e110455-lin.cambridge.arm.com [10.2.131.87]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id x55BJT2s005442; Wed, 5 Jun 2019 12:19:29 +0100 From: Liviu Dudau To: "James (Qian) Wang" Subject: [PATCH] arm/komeda: Convert dp_wait_cond() to return an error code. Date: Wed, 5 Jun 2019 12:19:29 +0100 Message-Id: <20190605111929.18478-1-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 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: Liviu Dudau , "Lowry Li \(Arm Technology China\)" , Mali DP developers , DRI devel Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" dp_wait_cond() currently returns the number of retries left over which is hardly an useful information. Convert to returning -ETIMEDOUT when the wait times out, or 0 (zero) when condition is met before deadline. Also convert the users of the function to return the error value. Signed-off-by: Liviu Dudau Reviewed-by: James Qian Wang (Arm Technology China) --- drivers/gpu/drm/arm/display/include/malidp_utils.h | 5 ++--- drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arm/display/include/malidp_utils.h b/drivers/gpu/drm/arm/display/include/malidp_utils.h index 8cfd91196e15..3bc383d5bf73 100644 --- a/drivers/gpu/drm/arm/display/include/malidp_utils.h +++ b/drivers/gpu/drm/arm/display/include/malidp_utils.h @@ -8,6 +8,7 @@ #define _MALIDP_UTILS_ #include +#include #define has_bit(nr, mask) (BIT(nr) & (mask)) #define has_bits(bits, mask) (((bits) & (mask)) == (bits)) @@ -20,11 +21,9 @@ int num_tries = __tries; \ while (!__cond && (num_tries > 0)) { \ usleep_range(__min_range, __max_range); \ - if (__cond) \ - break; \ num_tries--; \ } \ - num_tries; \ + (__cond) ? 0 : -ETIMEDOUT; \ }) /* the restriction of range is [start, end] */ diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c index 1c914f8ca016..68f27c5cffcd 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -280,7 +280,7 @@ static int d71_change_opmode(struct komeda_dev *mdev, int new_mode) ret = dp_wait_cond(((malidp_read32(d71->gcu_addr, BLK_CONTROL) & 0x7) == opmode), 100, 1000, 10000); - return ret > 0 ? 0 : -ETIMEDOUT; + return ret; } static void d71_flush(struct komeda_dev *mdev, @@ -304,7 +304,7 @@ static int d71_reset(struct d71_dev *d71) ret = dp_wait_cond(!(malidp_read32(gcu, BLK_CONTROL) & GCU_CONTROL_SRST), 100, 1000, 10000); - return ret > 0 ? 0 : -ETIMEDOUT; + return ret; } void d71_read_block_header(u32 __iomem *reg, struct block_header *blk)