Lines Matching refs:base

158 			 struct ttm_base_object *base,  in ttm_base_object_init()  argument
168 base->shareable = shareable; in ttm_base_object_init()
169 base->tfile = ttm_object_file_ref(tfile); in ttm_base_object_init()
170 base->refcount_release = refcount_release; in ttm_base_object_init()
171 base->ref_obj_release = ref_obj_release; in ttm_base_object_init()
172 base->object_type = object_type; in ttm_base_object_init()
173 kref_init(&base->refcount); in ttm_base_object_init()
176 &base->hash, in ttm_base_object_init()
177 (unsigned long)base, 31, 0, 0); in ttm_base_object_init()
182 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL); in ttm_base_object_init()
186 ttm_base_object_unref(&base); in ttm_base_object_init()
191 (void)drm_ht_remove_item_rcu(&tdev->object_hash, &base->hash); in ttm_base_object_init()
200 struct ttm_base_object *base = in ttm_release_base() local
202 struct ttm_object_device *tdev = base->tfile->tdev; in ttm_release_base()
205 (void)drm_ht_remove_item_rcu(&tdev->object_hash, &base->hash); in ttm_release_base()
214 ttm_object_file_unref(&base->tfile); in ttm_release_base()
215 if (base->refcount_release) in ttm_release_base()
216 base->refcount_release(&base); in ttm_release_base()
221 struct ttm_base_object *base = *p_base; in ttm_base_object_unref() local
225 kref_put(&base->refcount, ttm_release_base); in ttm_base_object_unref()
232 struct ttm_base_object *base = NULL; in ttm_base_object_lookup() local
241 base = drm_hash_entry(hash, struct ttm_ref_object, hash)->obj; in ttm_base_object_lookup()
242 if (!kref_get_unless_zero(&base->refcount)) in ttm_base_object_lookup()
243 base = NULL; in ttm_base_object_lookup()
247 return base; in ttm_base_object_lookup()
254 struct ttm_base_object *base = NULL; in ttm_base_object_lookup_for_ref() local
263 base = drm_hash_entry(hash, struct ttm_base_object, hash); in ttm_base_object_lookup_for_ref()
264 if (!kref_get_unless_zero(&base->refcount)) in ttm_base_object_lookup_for_ref()
265 base = NULL; in ttm_base_object_lookup_for_ref()
269 return base; in ttm_base_object_lookup_for_ref()
284 struct ttm_base_object *base) in ttm_ref_object_exists() argument
291 if (unlikely(drm_ht_find_item_rcu(ht, base->hash.key, &hash) != 0)) in ttm_ref_object_exists()
300 if (unlikely(base != ref->obj)) in ttm_ref_object_exists()
320 struct ttm_base_object *base, in ttm_ref_object_add() argument
329 if (base->tfile != tfile && !base->shareable) in ttm_ref_object_add()
337 ret = drm_ht_find_item_rcu(ht, base->hash.key, &hash); in ttm_ref_object_add()
358 ref->hash.key = base->hash.key; in ttm_ref_object_add()
359 ref->obj = base; in ttm_ref_object_add()
369 kref_get(&base->refcount); in ttm_ref_object_add()
391 struct ttm_base_object *base = ref->obj; in ttm_ref_object_release() local
401 if (ref->ref_type != TTM_REF_USAGE && base->ref_obj_release) in ttm_ref_object_release()
402 base->ref_obj_release(base, ref->ref_type); in ttm_ref_object_release()
570 struct ttm_base_object *base = *p_base; in ttm_prime_refcount_release() local
574 prime = container_of(base, struct ttm_prime_object, base); in ttm_prime_refcount_release()
578 prime->refcount_release(&base); in ttm_prime_refcount_release()
595 struct ttm_base_object *base = &prime->base; in ttm_prime_dmabuf_release() local
596 struct ttm_object_device *tdev = base->tfile->tdev; in ttm_prime_dmabuf_release()
605 ttm_base_object_unref(&base); in ttm_prime_dmabuf_release()
625 struct ttm_base_object *base; in ttm_prime_fd_to_handle() local
636 base = &prime->base; in ttm_prime_fd_to_handle()
637 *handle = base->hash.key; in ttm_prime_fd_to_handle()
638 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL); in ttm_prime_fd_to_handle()
660 struct ttm_base_object *base; in ttm_prime_handle_to_fd() local
665 base = ttm_base_object_lookup(tfile, handle); in ttm_prime_handle_to_fd()
666 if (unlikely(base == NULL || in ttm_prime_handle_to_fd()
667 base->object_type != ttm_prime_type)) { in ttm_prime_handle_to_fd()
672 prime = container_of(base, struct ttm_prime_object, base); in ttm_prime_handle_to_fd()
673 if (unlikely(!base->shareable)) { in ttm_prime_handle_to_fd()
715 base = NULL; in ttm_prime_handle_to_fd()
728 if (base) in ttm_prime_handle_to_fd()
729 ttm_base_object_unref(&base); in ttm_prime_handle_to_fd()
760 return ttm_base_object_init(tfile, &prime->base, shareable, in ttm_prime_object_init()