Lines Matching refs:res
600 struct kunit_resource *res, in kunit_add_resource() argument
606 res->free = free; in kunit_add_resource()
607 kref_init(&res->refcount); in kunit_add_resource()
610 ret = init(res, data); in kunit_add_resource()
614 res->data = data; in kunit_add_resource()
618 list_add_tail(&res->node, &test->resources); in kunit_add_resource()
629 struct kunit_resource *res, in kunit_add_named_resource() argument
644 res->name = name; in kunit_add_named_resource()
646 return kunit_add_resource(test, init, free, res, data); in kunit_add_named_resource()
656 struct kunit_resource *res; in kunit_alloc_and_get_resource() local
659 res = kzalloc(sizeof(*res), internal_gfp); in kunit_alloc_and_get_resource()
660 if (!res) in kunit_alloc_and_get_resource()
663 ret = kunit_add_resource(test, init, free, res, data); in kunit_alloc_and_get_resource()
669 kunit_get_resource(res); in kunit_alloc_and_get_resource()
670 return res; in kunit_alloc_and_get_resource()
676 void kunit_remove_resource(struct kunit *test, struct kunit_resource *res) in kunit_remove_resource() argument
681 list_del(&res->node); in kunit_remove_resource()
683 kunit_put_resource(res); in kunit_remove_resource()
690 struct kunit_resource *res = kunit_find_resource(test, match, in kunit_destroy_resource() local
693 if (!res) in kunit_destroy_resource()
696 kunit_remove_resource(test, res); in kunit_destroy_resource()
699 kunit_put_resource(res); in kunit_destroy_resource()
711 static int kunit_kmalloc_array_init(struct kunit_resource *res, void *context) in kunit_kmalloc_array_init() argument
715 res->data = kmalloc_array(params->n, params->size, params->gfp); in kunit_kmalloc_array_init()
716 if (!res->data) in kunit_kmalloc_array_init()
722 static void kunit_kmalloc_array_free(struct kunit_resource *res) in kunit_kmalloc_array_free() argument
724 kfree(res->data); in kunit_kmalloc_array_free()
745 struct kunit_resource *res; in kunit_kfree() local
747 res = kunit_find_resource(test, kunit_resource_instance_match, in kunit_kfree()
754 kunit_remove_resource(test, res); in kunit_kfree()
756 kunit_put_resource(res); in kunit_kfree()
763 struct kunit_resource *res; in kunit_cleanup() local
781 res = list_last_entry(&test->resources, in kunit_cleanup()
790 kunit_remove_resource(test, res); in kunit_cleanup()