From patchwork Fri Dec 11 13:11:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Harrison X-Patchwork-Id: 7829511 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A44209F54F for ; Fri, 11 Dec 2015 13:12:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BFF24205C2 for ; Fri, 11 Dec 2015 13:12:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AB91E20570 for ; Fri, 11 Dec 2015 13:12:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9ADC36EFAC; Fri, 11 Dec 2015 05:12:35 -0800 (PST) X-Original-To: Intel-GFX@lists.freedesktop.org Delivered-To: Intel-GFX@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id C808D6EFA5 for ; Fri, 11 Dec 2015 05:12:28 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP; 11 Dec 2015 05:12:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,413,1444719600"; d="scan'208";a="11525682" Received: from johnharr-linux.isw.intel.com ([10.102.226.93]) by fmsmga004.fm.intel.com with ESMTP; 11 Dec 2015 05:12:18 -0800 From: John.C.Harrison@Intel.com To: Intel-GFX@Lists.FreeDesktop.Org Date: Fri, 11 Dec 2015 13:11:59 +0000 Message-Id: <1449839521-21958-12-git-send-email-John.C.Harrison@Intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449839521-21958-1-git-send-email-John.C.Harrison@Intel.com> References: <1449839521-21958-1-git-send-email-John.C.Harrison@Intel.com> Organization: Intel Corporation (UK) Ltd. - Co. Reg. #1134945 - Pipers Way, Swindon SN3 1RJ Subject: [Intel-gfx] [PATCH 11/13] android/sync: Fix reversed sense of signaled fence X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Lawthers In the 3.14 kernel, a signaled fence was indicated by the status field == 1. In 4.x, a status == 0 indicates signaled, status < 0 indicates error, and status > 0 indicates active. This patch wraps the check for a signaled fence in a function so that callers no longer needs to know the underlying implementation. v3: New patch for series. Change-Id: I8e565e49683e3efeb9474656cd84cf4add6ad6a2 Tracked-On: https://jira01.devtools.intel.com/browse/ACD-308 Signed-off-by: Peter Lawthers --- drivers/android/sync.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/android/sync.h b/drivers/android/sync.h index d57fa0a..75532d8 100644 --- a/drivers/android/sync.h +++ b/drivers/android/sync.h @@ -345,6 +345,27 @@ int sync_fence_cancel_async(struct sync_fence *fence, */ int sync_fence_wait(struct sync_fence *fence, long timeout); +/** + * sync_fence_is_signaled() - Return an indication if the fence is signaled + * @fence: fence to check + * + * returns 1 if fence is signaled + * returns 0 if fence is not signaled + * returns < 0 if fence is in error state + */ +static inline int +sync_fence_is_signaled(struct sync_fence *fence) +{ + int status; + + status = atomic_read(&fence->status); + if (status == 0) + return 1; + if (status > 0) + return 0; + return status; +} + #ifdef CONFIG_DEBUG_FS void sync_timeline_debug_add(struct sync_timeline *obj);