From patchwork Fri Apr 27 06:17:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 10367457 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 A8C176053F for ; Fri, 27 Apr 2018 06:17:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98E5A2836F for ; Fri, 27 Apr 2018 06:17:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D59328458; Fri, 27 Apr 2018 06:17:39 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43D2728385 for ; Fri, 27 Apr 2018 06:17:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752799AbeD0GRf (ORCPT ); Fri, 27 Apr 2018 02:17:35 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:39769 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751348AbeD0GRd (ORCPT ); Fri, 27 Apr 2018 02:17:33 -0400 Received: by mail-wm0-f66.google.com with SMTP id b21so801577wme.4 for ; Thu, 26 Apr 2018 23:17:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=w1PgZFPqnlvgTsEbtP5QWgWfLTuf6/Kt4yOeMdMOSig=; b=LPEGWg8aE4VeNzX2NJH8Rxt0BC8J0zict8a2FEX9SgP0Zl+EOhkTZ68C01seO705YP SblrXiNAoMhFhN+ve34SRK7cYMCRvcnnBOlk90KwjjCsNPAxeoBcn1D7Z4io0I5Wa7ca 2iuBMhA6Y4kMZb82q67iBHEswn18zoqNJyUjg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=w1PgZFPqnlvgTsEbtP5QWgWfLTuf6/Kt4yOeMdMOSig=; b=CH/ggZLFtOrKdBZn/1/+ls684BY3PxQkFh/mrmN6jOQdeYa5wFqZ2hIsioyd96qCxc qrhGbcsGDoQq02wWVef8wTUv6AHSGXcsyIlTvSl1BUROm4d5jVASG7X/KAmgWWTUw+V0 ohFjY8p6tcyyiEYCyncz81NRwXDupoak+94W7M9lOy4LECYtEoMR4LuaXZ7kkJsbz2LY P18Iu2IjHLngxxVfE66qbWiLtgYfUgTSDiSjhzUceUPtaIvCxqHmX1ginRCTxUnlpmnx Nq5OgvYAoVzVy4V812BV6ajqkeGOXM0iPdDKVkEgoK3Q3K3o+MX3US6YyYGi52aCwFv3 DfIA== X-Gm-Message-State: ALQs6tACSRgX6ssC5GR9/c3MsNyVCuUdUVQE0lYeD3snPjQ9GkSGyaK5 arRor6z8akIytsgdwJzzOcLCZA== X-Google-Smtp-Source: AB8JxZp1nyJfEkCOip4RJiaZj0psWjxIckOPtLBZC+HUGJ2TdYwWl+nUoOuVhwsr7FnA7HaKJiLeow== X-Received: by 2002:a50:c8cb:: with SMTP id k11-v6mr1716590edh.94.1524809852848; Thu, 26 Apr 2018 23:17:32 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:5635:0:39d2:f87e:2033:9f6]) by smtp.gmail.com with ESMTPSA id r15-v6sm468897edq.40.2018.04.26.23.17.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 23:17:32 -0700 (PDT) From: Daniel Vetter To: DRI Development Cc: Intel Graphics Development , Daniel Vetter , Daniel Vetter , Sumit Semwal , Gustavo Padovan , linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH 03/17] dma-fence: Make ->enable_signaling optional Date: Fri, 27 Apr 2018 08:17:10 +0200 Message-Id: <20180427061724.28497-4-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427061724.28497-1-daniel.vetter@ffwll.ch> References: <20180427061724.28497-1-daniel.vetter@ffwll.ch> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Many drivers have a trivial implementation for ->enable_signaling. Let's make it optional by assuming that signalling is already available when the callback isn't present. Signed-off-by: Daniel Vetter Cc: Sumit Semwal Cc: Gustavo Padovan Cc: linux-media@vger.kernel.org Cc: linaro-mm-sig@lists.linaro.org --- drivers/dma-buf/dma-fence.c | 13 ++++++++++++- include/linux/dma-fence.h | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c index 4edb9fd3cf47..7b5b40d6b70e 100644 --- a/drivers/dma-buf/dma-fence.c +++ b/drivers/dma-buf/dma-fence.c @@ -181,6 +181,13 @@ void dma_fence_release(struct kref *kref) } EXPORT_SYMBOL(dma_fence_release); +/** + * dma_fence_free - default release function for &dma_fence. + * @fence: fence to release + * + * This is the default implementation for &dma_fence_ops.release. It calls + * kfree_rcu() on @fence. + */ void dma_fence_free(struct dma_fence *fence) { kfree_rcu(fence, rcu); @@ -560,7 +567,7 @@ dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops, spinlock_t *lock, u64 context, unsigned seqno) { BUG_ON(!lock); - BUG_ON(!ops || !ops->wait || !ops->enable_signaling || + BUG_ON(!ops || !ops->wait || !ops->get_driver_name || !ops->get_timeline_name); kref_init(&fence->refcount); @@ -572,6 +579,10 @@ dma_fence_init(struct dma_fence *fence, const struct dma_fence_ops *ops, fence->flags = 0UL; fence->error = 0; + if (!ops->enable_signaling) + set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, + &fence->flags); + trace_dma_fence_init(fence); } EXPORT_SYMBOL(dma_fence_init); diff --git a/include/linux/dma-fence.h b/include/linux/dma-fence.h index f9a6848f8558..c730f569621a 100644 --- a/include/linux/dma-fence.h +++ b/include/linux/dma-fence.h @@ -166,7 +166,8 @@ struct dma_fence_ops { * released when the fence is signalled (through e.g. the interrupt * handler). * - * This callback is mandatory. + * This callback is optional. If this callback is not present, then the + * driver must always have signaling enabled. */ bool (*enable_signaling)(struct dma_fence *fence);