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
This commit is contained in:
Christian König
2021-05-10 16:14:09 +02:00
parent 415f6767d8
commit 6edbd6abb7
15 changed files with 26 additions and 30 deletions

View File

@@ -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));
}
/**