From patchwork Tue Jul 12 18:08:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9225883 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 C783860868 for ; Tue, 12 Jul 2016 18:09:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCD7A2787D for ; Tue, 12 Jul 2016 18:09:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B102A27D85; Tue, 12 Jul 2016 18:09:04 +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 1B9E02787D for ; Tue, 12 Jul 2016 18:09:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8B7DA6E276; Tue, 12 Jul 2016 18:09:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw0-f195.google.com (mail-yw0-f195.google.com [209.85.161.195]) by gabe.freedesktop.org (Postfix) with ESMTPS id 870B56E276 for ; Tue, 12 Jul 2016 18:08:59 +0000 (UTC) Received: by mail-yw0-f195.google.com with SMTP id l125so1499469ywb.1 for ; Tue, 12 Jul 2016 11:08:59 -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=DPxNyv87P4EonaoovIOO+7VNxCF8Iu4tdxZVDC20YiVGv94FPnrRBwur14B61Q3PjJ AAuoD83VsL17LqOwaaQ02WFUTaJ5Tt385sU/eHoKQETcfQ7fBgjjNsefXUf6J6K4xORI krXHw2txBEUdRCoZ1eDLRHnl5b7keI+xT2bm1Am/L3mdViOkZ41lh1ZgVa+HBIhbO7v0 YKv+PUqX8QgxBi8V44xehrbiD1v9G8SEkACYw/R8pzNmw/piIgPgkNeu3DauX76dDlwH UEkWq2u+TAyQQab3Rmid1/1/6Vkx83MI6iNLNKxr6Z13cZOV5Qi/7SE0ZSg+KJd6msbK ALpQ== X-Gm-Message-State: ALyK8tJhlKDRU57SLX2ZMfO/tLWt5c/ECsmsBw5FynOkGMuHVkTDQZQoan11vMduWAb+SA== X-Received: by 10.13.229.131 with SMTP id o125mr2780664ywe.36.1468346938317; Tue, 12 Jul 2016 11:08:58 -0700 (PDT) Received: from jade.localdomain ([189.61.225.79]) by smtp.gmail.com with ESMTPSA id v68sm196062ywg.31.2016.07.12.11.08.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jul 2016 11:08:57 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 1/5] dma-buf/fence-array: add fence_is_array() Date: Tue, 12 Jul 2016 15:08:41 -0300 Message-Id: <1468346925-12774-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 *