From patchwork Wed Mar 23 18:47:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 8653121 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7B020C0553 for ; Wed, 23 Mar 2016 18:47:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A3A6F203B1 for ; Wed, 23 Mar 2016 18:47:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3780F203E3 for ; Wed, 23 Mar 2016 18:47:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D74C6E90A; Wed, 23 Mar 2016 18:47:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-yw0-f175.google.com (mail-yw0-f175.google.com [209.85.161.175]) by gabe.freedesktop.org (Postfix) with ESMTPS id 942506E908 for ; Wed, 23 Mar 2016 18:47:45 +0000 (UTC) Received: by mail-yw0-f175.google.com with SMTP id g127so31039637ywf.2 for ; Wed, 23 Mar 2016 11:47:45 -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; bh=Oit9UqWk1pNofff1GnVSvKxgZMLRbNc3PtQAiIppsj4=; b=h59vOv9MkbvAtRsgd18MCedqeBy1SpsxCPAUetfoiGuIXwhX2BEL5WH66nRefr56tg 45meXGEULHWK0lJRuqiQSqtCakiEJOJQNAhGXM4IWXjs6oDlm+vjsgms70LXCWvDHuPo qtIEURW4JqkrVsrs9Y879Q3sgdZfQbzvtQiC+bcMQdqwIQMCSO9rpObYyx7s6tVUiAuK Ct6cgjYDe/9nTCI0OL8an9j38KYWjf3ZXCcCdDWkloegPKLOUgnNHmzgC/WvM3BSWOz7 q8sJ9a+tw3xAdzUbHpUsClFvZy1DK/zWnW8b0n7SGy2HKFQWZIjcKy/RD5IduFPhisQo DFWg== X-Gm-Message-State: AD7BkJJgljYXr1IhGf80UFHJg0bjnzvEe7F8PT+RcOIe65yyjLOMqS8s+xUUY9wjx2RsYQ== X-Received: by 10.37.231.23 with SMTP id e23mr2129923ybh.133.1458758863418; Wed, 23 Mar 2016 11:47:43 -0700 (PDT) Received: from jade.localdomain ([201.82.24.203]) by smtp.gmail.com with ESMTPSA id y138sm2146629ywa.28.2016.03.23.11.47.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Mar 2016 11:47:42 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [RFC 4/6] dma-buf/fence: add fence_collection_put() Date: Wed, 23 Mar 2016 15:47:25 -0300 Message-Id: <1458758847-21170-5-git-send-email-gustavo@padovan.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1458758847-21170-1-git-send-email-gustavo@padovan.org> References: <1458758847-21170-1-git-send-email-gustavo@padovan.org> Cc: Daniel Stone , Daniel Vetter , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , linux-kernel@vger.kernel.org, Riley Andrews , Gustavo Padovan , John Harrison 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00, RCVD_IN_BL_SPAMCOP_NET, 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: Gustavo Padovan Put fence_collection data. For that calls fence_put() on all fences and the user put callback. Signed-off-by: Gustavo Padovan --- drivers/dma-buf/fence.c | 17 +++++++++++++++++ include/linux/fence.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/drivers/dma-buf/fence.c b/drivers/dma-buf/fence.c index 7b05dbe..a3fe3e7 100644 --- a/drivers/dma-buf/fence.c +++ b/drivers/dma-buf/fence.c @@ -530,3 +530,20 @@ fence_init(struct fence *fence, const struct fence_ops *ops, trace_fence_init(fence); } EXPORT_SYMBOL(fence_init); + +/** + * fence_collection_put - put all the fences in a collection + * @collection: [in] the collection to put fences + * + * This functions unrefs all fences in the collection. + */ +void fence_collection_put(struct fence_collection *collection) +{ + int i; + + for (i = 0 ; i < collection->num_fences ; i++) + fence_put(collection->fences[i]); + + collection->func(collection->user_data); +} +EXPORT_SYMBOL(fence_collection_put); diff --git a/include/linux/fence.h b/include/linux/fence.h index 3d1151f..3f871b0 100644 --- a/include/linux/fence.h +++ b/include/linux/fence.h @@ -244,6 +244,8 @@ int fence_add_callback(struct fence *fence, struct fence_cb *cb, bool fence_remove_callback(struct fence *fence, struct fence_cb *cb); void fence_enable_sw_signaling(struct fence *fence); +void fence_collection_put(struct fence_collection *collection); + /** * fence_is_signaled_locked - Return an indication if the fence is signaled yet. * @fence: [in] the fence to check