Lines Matching refs:res
117 static int fake_resource_init(struct kunit_resource *res, void *context) in fake_resource_init() argument
121 res->data = &ctx->is_resource_initialized; in fake_resource_init()
126 static void fake_resource_free(struct kunit_resource *res) in fake_resource_free() argument
128 bool *is_resource_initialized = res->data; in fake_resource_free()
145 struct kunit_resource *res; in kunit_resource_test_alloc_resource() local
148 res = kunit_alloc_and_get_resource(&ctx->test, in kunit_resource_test_alloc_resource()
154 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, res); in kunit_resource_test_alloc_resource()
157 (bool *)res->data); in kunit_resource_test_alloc_resource()
158 KUNIT_EXPECT_TRUE(test, list_is_last(&res->node, &ctx->test.resources)); in kunit_resource_test_alloc_resource()
159 KUNIT_EXPECT_PTR_EQ(test, free, res->free); in kunit_resource_test_alloc_resource()
161 kunit_put_resource(res); in kunit_resource_test_alloc_resource()
175 struct kunit_resource *res = kunit_alloc_and_get_resource( in kunit_resource_test_destroy_resource() local
182 kunit_put_resource(res); in kunit_resource_test_destroy_resource()
187 res->data)); in kunit_resource_test_destroy_resource()
230 static int fake_resource_2_init(struct kunit_resource *res, void *context) in fake_resource_2_init() argument
236 res->data = ctx; in fake_resource_2_init()
241 static void fake_resource_2_free(struct kunit_resource *res) in fake_resource_2_free() argument
243 struct kunit_test_resource_context *ctx = res->data; in fake_resource_2_free()
248 static int fake_resource_1_init(struct kunit_resource *res, void *context) in fake_resource_1_init() argument
261 res->data = ctx; in fake_resource_1_init()
268 static void fake_resource_1_free(struct kunit_resource *res) in fake_resource_1_free() argument
270 struct kunit_test_resource_context *ctx = res->data; in fake_resource_1_free()
283 struct kunit_resource *res; in kunit_resource_test_proper_free_ordering() local
286 res = kunit_alloc_and_get_resource(&ctx->test, in kunit_resource_test_proper_free_ordering()
300 kunit_put_resource(res); in kunit_resource_test_proper_free_ordering()
316 struct kunit_resource res; in kunit_resource_test_static() local
318 KUNIT_EXPECT_EQ(test, kunit_add_resource(test, NULL, NULL, &res, &ctx), in kunit_resource_test_static()
321 KUNIT_EXPECT_PTR_EQ(test, res.data, (void *)&ctx); in kunit_resource_test_static()