summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2025-10-09 17:07:49 +0300
committerChristian König <christian.koenig@amd.com>2026-02-23 18:14:20 +0300
commited0d6a0003fdcf8c93ff1544cf104a5456bf520e (patch)
tree8b9189d6a368cf2305d876f2a9416c6fe38e243f
parent3695d754ffbb176afe3cb47b705b72bf85ed63f0 (diff)
downloadlinux-ed0d6a0003fdcf8c93ff1544cf104a5456bf520e.tar.xz
dma-buf: use inline lock for the stub fence v2
Using the inline lock is now the recommended way for dma_fence implementations. So use this approach for the framework's internal fences as well. Also saves about 4 bytes for the external spinlock. v2: drop unnecessary changes Signed-off-by: Christian König <christian.koenig@amd.com> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Reviewed-by: Philipp Stanner <phasta@kernel.org> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Link: https://lore.kernel.org/r/20260219160822.1529-7-christian.koenig@amd.com
-rw-r--r--drivers/dma-buf/dma-fence.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
index 4ad863d2a52c..1826ba73094c 100644
--- a/drivers/dma-buf/dma-fence.c
+++ b/drivers/dma-buf/dma-fence.c
@@ -24,7 +24,6 @@ EXPORT_TRACEPOINT_SYMBOL(dma_fence_emit);
EXPORT_TRACEPOINT_SYMBOL(dma_fence_enable_signal);
EXPORT_TRACEPOINT_SYMBOL(dma_fence_signaled);
-static DEFINE_SPINLOCK(dma_fence_stub_lock);
static struct dma_fence dma_fence_stub;
/*
@@ -123,12 +122,9 @@ static const struct dma_fence_ops dma_fence_stub_ops = {
static int __init dma_fence_init_stub(void)
{
- dma_fence_init(&dma_fence_stub, &dma_fence_stub_ops,
- &dma_fence_stub_lock, 0, 0);
-
+ dma_fence_init(&dma_fence_stub, &dma_fence_stub_ops, NULL, 0, 0);
set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
&dma_fence_stub.flags);
-
dma_fence_signal(&dma_fence_stub);
return 0;
}
@@ -160,11 +156,7 @@ struct dma_fence *dma_fence_allocate_private_stub(ktime_t timestamp)
if (fence == NULL)
return NULL;
- dma_fence_init(fence,
- &dma_fence_stub_ops,
- &dma_fence_stub_lock,
- 0, 0);
-
+ dma_fence_init(fence, &dma_fence_stub_ops, NULL, 0, 0);
set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
&fence->flags);