From patchwork Fri Jul 1 13:05:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9209849 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 4EEB160752 for ; Fri, 1 Jul 2016 13:05:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F95B2868E for ; Fri, 1 Jul 2016 13:05:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 348442869C; Fri, 1 Jul 2016 13:05:25 +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 3392D2868E for ; Fri, 1 Jul 2016 13:05:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 660616EA5D; Fri, 1 Jul 2016 13:05:23 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-f194.google.com (mail-qk0-f194.google.com [209.85.220.194]) by gabe.freedesktop.org (Postfix) with ESMTPS id 617576EA5F for ; Fri, 1 Jul 2016 13:05:18 +0000 (UTC) Received: by mail-qk0-f194.google.com with SMTP id t2so179382qkh.2 for ; Fri, 01 Jul 2016 06:05:18 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=b07obJaZNJpZ0aos7uvHkI6SDhvMGis5df/x9Jfo6Zs=; b=Yr+ZuFNyXznFIpUWFrFVmXXDgmMthjlpG87Fzg0l60Xu2ChegoBmisPCsL/0gKY3a7 dx6TtfcZea3mW6QuniJr8WusIwULbqqtlhXLroXG34cMvFyMhGLF5NqoIMVYl3eIvjLZ 2W89k49WOidEo4uF+9VkH7uunCywFiBlmWpMTPZkFcBHRSOuW6pvr0bLNGDxOKF9220f bU7JNpxP1ymXk2qwP7UEeHbASts2FpZ//HEDtROz+SzVq9OgBtJFhgAih5S2/fK6a5Lx isI3ZoQbV7TdOveTz7L+6+xCvY49ttSUvHpzH85tgSfSsiIfp6eQmnwbN75ktrCO0WWz UdDA== X-Gm-Message-State: ALyK8tJvHQVS2YVY9RvHEP45YA/AOuHOI9dvJzWd8mqpoN4AIBP4NcuRjmHq1C+NPlowkw== X-Received: by 10.37.34.84 with SMTP id i81mr8919160ybi.156.1467378317345; Fri, 01 Jul 2016 06:05:17 -0700 (PDT) Received: from jade.localdomain ([189.61.225.79]) by smtp.gmail.com with ESMTPSA id g4sm6516973ywa.48.2016.07.01.06.05.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jul 2016 06:05:16 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/4] dma-buf/fence-array: add fence_is_array() Date: Fri, 1 Jul 2016 10:05:04 -0300 Message-Id: <1467378307-28088-2-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1467378307-28088-1-git-send-email-gustavo@padovan.org> References: <1467378307-28088-1-git-send-email-gustavo@padovan.org> 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 --- 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 *