From patchwork Fri Aug 5 02:24:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9264707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A88A60467 for ; Fri, 5 Aug 2016 02:24:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B207283AC for ; Fri, 5 Aug 2016 02:24:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F94828409; Fri, 5 Aug 2016 02:24:46 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAA4A283AC for ; Fri, 5 Aug 2016 02:24:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5AC8D6EAC2; Fri, 5 Aug 2016 02:24:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw0-f194.google.com (mail-yw0-f194.google.com [209.85.161.194]) by gabe.freedesktop.org (Postfix) with ESMTPS id 893106EAC2 for ; Fri, 5 Aug 2016 02:24:31 +0000 (UTC) Received: by mail-yw0-f194.google.com with SMTP id z8so21099909ywa.0 for ; Thu, 04 Aug 2016 19:24:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zsz10buqXNT6RE+KwZLPgeKnjGKCxDJTAzCyV0FXzb4=; b=mrgXp+5DjRyVzA4p4pyYsxCPH0FAfkKMB3TCn7ln3W1pBpFKkyJXXT+7+KFFpiJmLF RT+ahCHSvis3z6nNsYjwBIjOBCCofX9ywHyyDmovnvoIoBkfU6FcL8H0zQ2gH7wvs6fx AG3l8FaShhiTkXjJR7uKDBT2rbTf0K++0UWngm/sEpRYGUruHvzLsYZVmPXfPVGI6JCn voJRxQYD8n5jRrLTe6rdtJ6n7dbRnmP/1RpptJW5jTVBglJ+/DsryrushaGcZqgnuimN /34qMjWmaCTMKzaNSalGRf176rvvtsJZB32pkUCoFpMNuUgm2xe0atj4Mmi97paaIbhA fS+w== X-Gm-Message-State: AEkoouvVJJJbP7unvAE3f9opfKfamUZRIYGVauuwFZ2/DATxNWEi6W6AxMP6hDOEYH3uWQ== X-Received: by 10.129.107.86 with SMTP id g83mr62562895ywc.71.1470363869082; Thu, 04 Aug 2016 19:24:29 -0700 (PDT) Received: from jade.localdomain ([201.82.189.183]) by smtp.gmail.com with ESMTPSA id j189sm6894648ywc.32.2016.08.04.19.24.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 04 Aug 2016 19:24:26 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH v5 1/5] dma-buf/fence-array: add fence_is_array() Date: Thu, 4 Aug 2016 23:24:10 -0300 Message-Id: <1470363854-7846-1-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 MIME-Version: 1.0 Cc: marcheu@google.com, Daniel Stone , seanpaul@google.com, =?UTF-8?q?Christian=20K=C3=B6nig?= , Daniel Vetter , linux-kernel@vger.kernel.org, laurent.pinchart@ideasonboard.com, Gustavo Padovan , John Harrison , m.chehab@samsung.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan Add helper to check if fence is array. v2: Comments from Chris Wilson - remove ternary if from ops comparison - add EXPORT_SYMBOL(fence_array_ops) Cc: Chris Wilson Cc: Christian König Signed-off-by: Gustavo Padovan Reviewed-by: Chris Wilson Reviewed-by: Christian König --- drivers/dma-buf/fence-array.c | 1 + include/linux/fence-array.h | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/dma-buf/fence-array.c b/drivers/dma-buf/fence-array.c index a8731c8..ee50022 100644 --- a/drivers/dma-buf/fence-array.c +++ b/drivers/dma-buf/fence-array.c @@ -99,6 +99,7 @@ const struct fence_ops fence_array_ops = { .wait = fence_default_wait, .release = fence_array_release, }; +EXPORT_SYMBOL(fence_array_ops); /** * fence_array_create - Create a custom fence array diff --git a/include/linux/fence-array.h b/include/linux/fence-array.h index 86baaa4..a44794e 100644 --- a/include/linux/fence-array.h +++ b/include/linux/fence-array.h @@ -52,6 +52,16 @@ struct fence_array { extern const struct fence_ops fence_array_ops; /** + * fence_is_array - check if a fence is from the array subsclass + * + * Return true if it is a fence_array and false otherwise. + */ +static inline bool fence_is_array(struct fence *fence) +{ + return fence->ops == &fence_array_ops; +} + +/** * to_fence_array - cast a fence to a fence_array * @fence: fence to cast to a fence_array *