On Thu, 2025-11-13 at 15:51 +0100, Christian König wrote:
> Using the inline lock is now the recommended way for dma_fence 
> implementations.
> 
> So use this approach for the framework internal fences as well.

nit:
s/framework/framework's

> 
> Also saves about 4 bytes for the external spinlock.

On all platforms or just AMD64?

> 
> Signed-off-by: Christian König <[email protected]>
> Reviewed-by: Tvrtko Ursulin <[email protected]>
> ---
>  drivers/dma-buf/dma-fence.c | 20 ++++----------------
>  1 file changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/dma-buf/dma-fence.c b/drivers/dma-buf/dma-fence.c
> index 9a5aa9e44e13..e6d26c2e0391 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,8 @@ 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);
> -
> -     set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
> -             &dma_fence_stub.flags);

That change is unrelated, isn't it? Enlarges the diff and breaks git-
blame.

> -
> +     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,16 +155,9 @@ 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);
> -
> -     set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
> -             &fence->flags);

Same.

> -
> +     dma_fence_init(fence, &dma_fence_stub_ops, NULL, 0, 0);
> +     set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &fence->flags);
>       dma_fence_signal_timestamp(fence, timestamp);
> -

I wouldn't remove that empty line (nit).

>       return fence;
>  }
>  EXPORT_SYMBOL(dma_fence_allocate_private_stub);

Reply via email to