diff options
author | Christian König <christian.koenig@amd.com> | 2022-01-20 11:42:40 +0100 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2022-02-08 09:25:16 +0100 |
commit | 18f5fad275efef015226ee4f90eae34d8f44aa5e (patch) | |
tree | c8ed7d50c0814c29f1c3abb82054b92a4bf3bcf7 /include | |
parent | 68129f431faab376c1dd1c701f2fb999eea53383 (diff) | |
download | linux-rpi-18f5fad275efef015226ee4f90eae34d8f44aa5e.tar.gz linux-rpi-18f5fad275efef015226ee4f90eae34d8f44aa5e.tar.bz2 linux-rpi-18f5fad275efef015226ee4f90eae34d8f44aa5e.zip |
dma-buf: add dma_fence_chain_contained helper
It's a reoccurring pattern that we need to extract the fence
from a dma_fence_chain object. Add a helper for this.
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220204100429.2049-6-christian.koenig@amd.com
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/dma-fence-chain.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/dma-fence-chain.h b/include/linux/dma-fence-chain.h index ee906b659694..10d51bcdf7b7 100644 --- a/include/linux/dma-fence-chain.h +++ b/include/linux/dma-fence-chain.h @@ -67,6 +67,21 @@ to_dma_fence_chain(struct dma_fence *fence) } /** + * dma_fence_chain_contained - return the contained fence + * @fence: the fence to test + * + * If the fence is a dma_fence_chain the function returns the fence contained + * inside the chain object, otherwise it returns the fence itself. + */ +static inline struct dma_fence * +dma_fence_chain_contained(struct dma_fence *fence) +{ + struct dma_fence_chain *chain = to_dma_fence_chain(fence); + + return chain ? chain->fence : fence; +} + +/** * dma_fence_chain_alloc * * Returns a new struct dma_fence_chain object or NULL on failure. |