Lines Matching defs:tfile
130 struct ttm_object_file *tfile;
136 ttm_object_file_ref(struct ttm_object_file *tfile)
138 kref_get(&tfile->refcount);
139 return tfile;
142 static int ttm_tfile_find_ref_rcu(struct ttm_object_file *tfile,
148 hash_for_each_possible_rcu(tfile->ref_hash, hash, head, key) {
157 static int ttm_tfile_find_ref(struct ttm_object_file *tfile,
163 hash_for_each_possible(tfile->ref_hash, hash, head, key) {
174 struct ttm_object_file *tfile =
177 kfree(tfile);
183 struct ttm_object_file *tfile = *p_tfile;
186 kref_put(&tfile->refcount, ttm_object_file_destroy);
190 int ttm_base_object_init(struct ttm_object_file *tfile,
196 struct ttm_object_device *tdev = tfile->tdev;
200 base->tfile = ttm_object_file_ref(tfile);
213 ret = ttm_ref_object_add(tfile, base, NULL, false);
231 struct ttm_object_device *tdev = base->tfile->tdev;
243 ttm_object_file_unref(&base->tfile);
257 struct ttm_base_object *ttm_base_object_lookup(struct ttm_object_file *tfile,
264 spin_lock(&tfile->lock);
265 ret = ttm_tfile_find_ref(tfile, key, &hash);
272 spin_unlock(&tfile->lock);
293 int ttm_ref_object_add(struct ttm_object_file *tfile,
302 if (base->tfile != tfile && !base->shareable)
310 ret = ttm_tfile_find_ref_rcu(tfile, base->handle, &hash);
331 ref->tfile = tfile;
334 spin_lock(&tfile->lock);
335 hash_add_rcu(tfile->ref_hash, &ref->hash.head, ref->hash.key);
338 list_add_tail(&ref->head, &tfile->ref_list);
340 spin_unlock(&tfile->lock);
348 static void __releases(tfile->lock) __acquires(tfile->lock)
353 struct ttm_object_file *tfile = ref->tfile;
357 spin_unlock(&tfile->lock);
361 spin_lock(&tfile->lock);
364 int ttm_ref_object_base_unref(struct ttm_object_file *tfile,
371 spin_lock(&tfile->lock);
372 ret = ttm_tfile_find_ref(tfile, key, &hash);
374 spin_unlock(&tfile->lock);
379 spin_unlock(&tfile->lock);
387 struct ttm_object_file *tfile = *p_tfile;
390 spin_lock(&tfile->lock);
397 while (!list_empty(&tfile->ref_list)) {
398 list = tfile->ref_list.next;
403 spin_unlock(&tfile->lock);
405 ttm_object_file_unref(&tfile);
410 struct ttm_object_file *tfile = kmalloc(sizeof(*tfile), GFP_KERNEL);
412 if (unlikely(tfile == NULL))
415 spin_lock_init(&tfile->lock);
416 tfile->tdev = tdev;
417 kref_init(&tfile->refcount);
418 INIT_LIST_HEAD(&tfile->ref_list);
420 hash_init(tfile->ref_hash);
422 return tfile;
519 struct ttm_object_device *tdev = base->tfile->tdev;
533 * @tfile: A struct ttm_object_file identifying the caller.
541 int ttm_prime_fd_to_handle(struct ttm_object_file *tfile,
544 struct ttm_object_device *tdev = tfile->tdev;
560 ret = ttm_ref_object_add(tfile, base, NULL, false);
570 * @tfile: Struct ttm_object_file identifying the caller.
576 int ttm_prime_handle_to_fd(struct ttm_object_file *tfile,
580 struct ttm_object_device *tdev = tfile->tdev;
586 base = ttm_base_object_lookup(tfile, handle);
648 * @tfile: struct ttm_object_file identifying the caller
658 int ttm_prime_object_init(struct ttm_object_file *tfile, size_t size,
668 return ttm_base_object_init(tfile, &prime->base, shareable,