Lines Matching refs:res
22 struct kunit_resource *res, in __kunit_add_resource() argument
28 res->free = free; in __kunit_add_resource()
29 kref_init(&res->refcount); in __kunit_add_resource()
32 ret = init(res, data); in __kunit_add_resource()
36 res->data = data; in __kunit_add_resource()
40 list_add_tail(&res->node, &test->resources); in __kunit_add_resource()
48 void kunit_remove_resource(struct kunit *test, struct kunit_resource *res) in kunit_remove_resource() argument
54 was_linked = !list_empty(&res->node); in kunit_remove_resource()
55 list_del_init(&res->node); in kunit_remove_resource()
59 kunit_put_resource(res); in kunit_remove_resource()
66 struct kunit_resource *res = kunit_find_resource(test, match, in kunit_destroy_resource() local
69 if (!res) in kunit_destroy_resource()
72 kunit_remove_resource(test, res); in kunit_destroy_resource()
75 kunit_put_resource(res); in kunit_destroy_resource()
82 struct kunit_resource res; member
87 static void __kunit_action_free(struct kunit_resource *res) in __kunit_action_free() argument
89 struct kunit_action_ctx *action_ctx = container_of(res, struct kunit_action_ctx, res); in __kunit_action_free()
108 action_ctx->res.should_kfree = true; in kunit_add_action()
110 __kunit_add_resource(test, NULL, __kunit_action_free, &action_ctx->res, action_ctx); in kunit_add_action()
119 int res = kunit_add_action(test, action, ctx); in kunit_add_action_or_reset() local
121 if (res) in kunit_add_action_or_reset()
123 return res; in kunit_add_action_or_reset()
128 struct kunit_resource *res, void *match_data) in __kunit_action_match() argument
131 struct kunit_action_ctx *res_ctx = container_of(res, struct kunit_action_ctx, res); in __kunit_action_match()
134 if (res->free != __kunit_action_free) in __kunit_action_match()
146 struct kunit_resource *res; in kunit_remove_action() local
151 res = kunit_find_resource(test, __kunit_action_match, &match_ctx); in kunit_remove_action()
152 if (res) { in kunit_remove_action()
154 res->free = NULL; in kunit_remove_action()
155 kunit_remove_resource(test, res); in kunit_remove_action()
156 kunit_put_resource(res); in kunit_remove_action()
166 struct kunit_resource *res; in kunit_release_action() local
171 res = kunit_find_resource(test, __kunit_action_match, &match_ctx); in kunit_release_action()
172 if (res) { in kunit_release_action()
173 kunit_remove_resource(test, res); in kunit_release_action()
175 kunit_put_resource(res); in kunit_release_action()