diff options
author | Christian König <christian.koenig@amd.com> | 2021-05-11 15:11:41 +0300 |
---|---|---|
committer | Christian König <christian.koenig@amd.com> | 2021-06-06 12:18:19 +0300 |
commit | fb5ce730f21434d8100942cf1dbe1acda255fbeb (patch) | |
tree | e0dd76d6ce43a30cd53d4b6e60379339afe4110c /include | |
parent | 6edbd6abb783d54f6ac4c3ed5cd9e50cff6c15e9 (diff) | |
download | linux-fb5ce730f21434d8100942cf1dbe1acda255fbeb.tar.xz |
dma-buf: rename and cleanup dma_resv_get_list v2
When the comment needs to state explicitly that this is doesn't get a reference
to the object then the function is named rather badly.
Rename the function and use it in even more places.
v2: use dma_resv_shared_list as new name
Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210602111714.212426-5-christian.koenig@amd.com
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/dma-resv.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/include/linux/dma-resv.h b/include/linux/dma-resv.h index e3a7f740bb06..8dc19d65a217 100644 --- a/include/linux/dma-resv.h +++ b/include/linux/dma-resv.h @@ -78,20 +78,6 @@ struct dma_resv { #define dma_resv_held(obj) lockdep_is_held(&(obj)->lock.base) #define dma_resv_assert_held(obj) lockdep_assert_held(&(obj)->lock.base) -/** - * dma_resv_get_list - get the reservation object's - * shared fence list, with update-side lock held - * @obj: the reservation object - * - * Returns the shared fence list. Does NOT take references to - * the fence. The obj->lock must be held. - */ -static inline struct dma_resv_list *dma_resv_get_list(struct dma_resv *obj) -{ - return rcu_dereference_protected(obj->fence, - dma_resv_held(obj)); -} - #ifdef CONFIG_DEBUG_MUTEXES void dma_resv_reset_shared_max(struct dma_resv *obj); #else @@ -268,6 +254,19 @@ dma_resv_get_excl_rcu(struct dma_resv *obj) return fence; } +/** + * dma_resv_shared_list - get the reservation object's shared fence list + * @obj: the reservation object + * + * Returns the shared fence list. 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 + */ +static inline struct dma_resv_list *dma_resv_shared_list(struct dma_resv *obj) +{ + return rcu_dereference_check(obj->fence, dma_resv_held(obj)); +} + void dma_resv_init(struct dma_resv *obj); void dma_resv_fini(struct dma_resv *obj); int dma_resv_reserve_shared(struct dma_resv *obj, unsigned int num_fences); |