Lines Matching refs:res

100 static inline void kunit_get_resource(struct kunit_resource *res)  in kunit_get_resource()  argument
102 kref_get(&res->refcount); in kunit_get_resource()
111 struct kunit_resource *res = container_of(kref, struct kunit_resource, in kunit_release_resource() local
114 if (res->free) in kunit_release_resource()
115 res->free(res); in kunit_release_resource()
120 if (res->should_kfree) in kunit_release_resource()
121 kfree(res); in kunit_release_resource()
136 static inline void kunit_put_resource(struct kunit_resource *res) in kunit_put_resource() argument
138 kref_put(&res->refcount, kunit_release_resource); in kunit_put_resource()
156 struct kunit_resource *res,
172 struct kunit_resource *res, in kunit_add_resource() argument
175 res->should_kfree = false; in kunit_add_resource()
176 return __kunit_add_resource(test, init, free, res, data); in kunit_add_resource()
194 struct kunit_resource *res, in kunit_add_named_resource() argument
209 res->name = name; in kunit_add_named_resource()
210 res->should_kfree = false; in kunit_add_named_resource()
212 return __kunit_add_resource(test, init, free, res, data); in kunit_add_named_resource()
243 struct kunit_resource *res; in kunit_alloc_and_get_resource() local
246 res = kzalloc(sizeof(*res), internal_gfp); in kunit_alloc_and_get_resource()
247 if (!res) in kunit_alloc_and_get_resource()
250 res->should_kfree = true; in kunit_alloc_and_get_resource()
252 ret = __kunit_add_resource(test, init, free, res, context); in kunit_alloc_and_get_resource()
258 kunit_get_resource(res); in kunit_alloc_and_get_resource()
259 return res; in kunit_alloc_and_get_resource()
286 struct kunit_resource *res; in kunit_alloc_resource() local
288 res = kzalloc(sizeof(*res), internal_gfp); in kunit_alloc_resource()
289 if (!res) in kunit_alloc_resource()
292 res->should_kfree = true; in kunit_alloc_resource()
293 if (!__kunit_add_resource(test, init, free, res, context)) in kunit_alloc_resource()
294 return res->data; in kunit_alloc_resource()
300 struct kunit_resource *res,
310 struct kunit_resource *res, in kunit_resource_name_match() argument
313 return res->name && strcmp(res->name, match_name) == 0; in kunit_resource_name_match()
327 struct kunit_resource *res, *found = NULL; in kunit_find_resource() local
332 list_for_each_entry_reverse(res, &test->resources, node) { in kunit_find_resource()
333 if (match(test, res, (void *)match_data)) { in kunit_find_resource()
334 found = res; in kunit_find_resource()
388 void kunit_remove_resource(struct kunit *test, struct kunit_resource *res);