summaryrefslogtreecommitdiffstats
path: root/include/linux/dma-resv.h
diff options
context:
space:
mode:
authorChristian König <christian.koenig@amd.com>2021-05-10 16:14:09 +0200
committerChristian König <christian.koenig@amd.com>2021-06-06 11:17:58 +0200
commit6edbd6abb783d54f6ac4c3ed5cd9e50cff6c15e9 (patch)
tree341a16a1af131c43523e4da3a84f5f13657c75cb /include/linux/dma-resv.h
parent415f6767d80761997f6dbe8b72864ca5eb3ddf40 (diff)
downloadlinux-stable-6edbd6abb783d54f6ac4c3ed5cd9e50cff6c15e9.tar.gz
linux-stable-6edbd6abb783d54f6ac4c3ed5cd9e50cff6c15e9.tar.bz2
linux-stable-6edbd6abb783d54f6ac4c3ed5cd9e50cff6c15e9.zip
dma-buf: rename and cleanup dma_resv_get_excl v3
When the comment needs to state explicitly that this doesn't get a reference to the object then the function is named rather badly. Rename the function and use rcu_dereference_check(), this way it can be used from both rcu as well as lock protected critical sections. v2: improve kerneldoc as suggested by Daniel v3: use dma_resv_excl_fence as function name Signed-off-by: Christian König <christian.koenig@amd.com> Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Link: https://patchwork.freedesktop.org/patch/msgid/20210602111714.212426-4-christian.koenig@amd.com
Diffstat (limited to 'include/linux/dma-resv.h')
-rw-r--r--include/linux/dma-resv.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h
index f32a3d176513..e3a7f740bb06 100644
--- a/include/linux/dma-resv.h
+++ b/include/linux/dma-resv.h
@@ -226,22 +226,20 @@ static inline void dma_resv_unlock(struct dma_resv *obj)
}
/**
- * dma_resv_get_excl - get the reservation object's
- * exclusive fence, with update-side lock held
+ * dma_resv_exclusive - return the object's exclusive fence
* @obj: the reservation object
*
- * Returns the exclusive fence (if any). Does NOT take a
- * reference. Writers must hold obj->lock, readers may only
- * hold a RCU read side lock.
+ * Returns the exclusive fence (if any). Caller must either hold the objects
+ * through dma_resv_lock() or the RCU read side lock through rcu_read_lock(),
+ * or one of the variants of each
*
* RETURNS
* The exclusive fence or NULL
*/
static inline struct dma_fence *
-dma_resv_get_excl(struct dma_resv *obj)
+dma_resv_excl_fence(struct dma_resv *obj)
{
- return rcu_dereference_protected(obj->fence_excl,
- dma_resv_held(obj));
+ return rcu_dereference_check(obj->fence_excl, dma_resv_held(obj));
}
/**