From patchwork Fri Aug 5 13:39:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9265403 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 13AEA60760 for ; Fri, 5 Aug 2016 13:40:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 006F528440 for ; Fri, 5 Aug 2016 13:40:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5F832844E; Fri, 5 Aug 2016 13:40:02 +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=-2.9 required=2.0 tests=BAYES_00, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5865E28440 for ; Fri, 5 Aug 2016 13:39:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C13626E067; Fri, 5 Aug 2016 13:39:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yb0-f196.google.com (mail-yb0-f196.google.com [209.85.213.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7E2F16E067 for ; Fri, 5 Aug 2016 13:39:50 +0000 (UTC) Received: by mail-yb0-f196.google.com with SMTP id e125so1352245ybc.0 for ; Fri, 05 Aug 2016 06:39:50 -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=kvGn3Yr09V2z37QmxXx8gJhxtI/c8WO51F3vEuq6NG02h98/zbKFb0SHX5fkq969EP EDZbv/1YQx/ItnUlZcL1lhNRO2OxF7pY4yJi+xAxXZWH45qxEA47dgDlNHgA2bpIq1rP nU//d/bcFWgcMHyBhsghfhr1LpfOdpBCNkzINrMFMw6Y7xRo450DNKcuPmIndbtrYoBI ybzoYHwHNbBpCvT98SQqb16G37Pr0sJ6cX03lg1xaUU1Mh168ThJUoqf+xSi/yifyBIf HSMKRXBmUN05gdVNXB7hrlUcPbhvXHOLuN47z+S7OM+SpCaJVJ2LevnkfrNg5zZ7zFVw 2VMg== X-Gm-Message-State: AEkoouuQrKNHQPMUS86gmFLKabF/uc5XIEDWiQX6JVkfL8ybIBe6EQFKlHYBtaDwtPHafA== X-Received: by 10.37.209.86 with SMTP id i83mr1111326ybg.40.1470404389638; Fri, 05 Aug 2016 06:39:49 -0700 (PDT) Received: from jade.localdomain ([201.82.189.183]) by smtp.gmail.com with ESMTPSA id a11sm7801449ywa.37.2016.08.05.06.39.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 Aug 2016 06:39:48 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [PATCH v6 1/5] dma-buf/fence-array: add fence_is_array() Date: Fri, 5 Aug 2016 10:39:34 -0300 Message-Id: <1470404378-27961-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 *