Lines Matching defs:tfile
135 struct ttm_object_file *tfile;
141 ttm_object_file_ref(struct ttm_object_file *tfile)
143 kref_get(&tfile->refcount);
144 return tfile;
149 struct ttm_object_file *tfile =
152 kfree(tfile);
158 struct ttm_object_file *tfile = *p_tfile;
161 kref_put(&tfile->refcount, ttm_object_file_destroy);
165 int ttm_base_object_init(struct ttm_object_file *tfile,
173 struct ttm_object_device *tdev = tfile->tdev;
177 base->tfile = ttm_object_file_ref(tfile);
191 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false);
209 struct ttm_object_device *tdev = base->tfile->tdev;
221 ttm_object_file_unref(&base->tfile);
237 * @tfile: The struct ttm_object_file the object is registered with.
252 ttm_base_object_noref_lookup(struct ttm_object_file *tfile, uint32_t key)
255 struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE];
270 struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
275 struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE];
310 * @tfile: Pointer to a struct ttm_object_file identifying the caller.
313 * Checks wether the caller identified by @tfile has put a valid USAGE
316 bool ttm_ref_object_exists(struct ttm_object_file *tfile,
319 struct drm_open_hash *ht = &tfile->ref_hash[TTM_REF_USAGE];
351 int ttm_ref_object_add(struct ttm_object_file *tfile,
356 struct drm_open_hash *ht = &tfile->ref_hash[ref_type];
359 struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
366 if (base->tfile != tfile && !base->shareable)
400 ref->tfile = tfile;
404 spin_lock(&tfile->lock);
408 list_add_tail(&ref->head, &tfile->ref_list);
410 spin_unlock(&tfile->lock);
416 spin_unlock(&tfile->lock);
426 static void __releases(tfile->lock) __acquires(tfile->lock)
432 struct ttm_object_file *tfile = ref->tfile;
434 struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
436 ht = &tfile->ref_hash[ref->ref_type];
439 spin_unlock(&tfile->lock);
447 spin_lock(&tfile->lock);
450 int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
453 struct drm_open_hash *ht = &tfile->ref_hash[ref_type];
458 spin_lock(&tfile->lock);
461 spin_unlock(&tfile->lock);
466 spin_unlock(&tfile->lock);
475 struct ttm_object_file *tfile = *p_tfile;
478 spin_lock(&tfile->lock);
485 while (!list_empty(&tfile->ref_list)) {
486 list = tfile->ref_list.next;
491 spin_unlock(&tfile->lock);
493 drm_ht_remove(&tfile->ref_hash[i]);
495 ttm_object_file_unref(&tfile);
501 struct ttm_object_file *tfile = kmalloc(sizeof(*tfile), GFP_KERNEL);
506 if (unlikely(tfile == NULL))
509 spin_lock_init(&tfile->lock);
510 tfile->tdev = tdev;
511 kref_init(&tfile->refcount);
512 INIT_LIST_HEAD(&tfile->ref_list);
515 ret = drm_ht_create(&tfile->ref_hash[i], hash_order);
522 return tfile;
525 drm_ht_remove(&tfile->ref_hash[i]);
527 kfree(tfile);
644 struct ttm_object_device *tdev = base->tfile->tdev;
659 * @tfile: A struct ttm_object_file identifying the caller.
667 int ttm_prime_fd_to_handle(struct ttm_object_file *tfile,
670 struct ttm_object_device *tdev = tfile->tdev;
686 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL, false);
696 * @tfile: Struct ttm_object_file identifying the caller.
702 int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
706 struct ttm_object_device *tdev = tfile->tdev;
712 base = ttm_base_object_lookup(tfile, handle);
786 * @tfile: struct ttm_object_file identifying the caller
797 int ttm_prime_object_init(struct ttm_object_file *tfile, size_t size,
809 return ttm_base_object_init(tfile, &prime->base, shareable,