]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/ttm/tests: Use an init function from the helpers lib
authorKarolina Stolarek <karolina.stolarek@intel.com>
Wed, 12 Jun 2024 12:02:58 +0000 (14:02 +0200)
committerArunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Mon, 24 Jun 2024 10:31:14 +0000 (16:01 +0530)
Add a new helper function that also initializes the device. Use it in
ttm_tt test suite and delete the local definition.

Signed-off-by: Karolina Stolarek <karolina.stolarek@intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Somalapuram, Amaranath <asomalap@amd.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/235f110c1bdd2da7fac62ec03d177a5160dba1d5.1718192625.git.karolina.stolarek@intel.com
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h
drivers/gpu/drm/ttm/tests/ttm_tt_test.c

index c9ee7fe7c36dfaaf6c0c8aa25471b2f95b44c91a..f25bd7951b743dcd93f5d755cdff08df2ca85fec 100644 (file)
@@ -158,6 +158,20 @@ int ttm_test_devices_init(struct kunit *test)
 }
 EXPORT_SYMBOL_GPL(ttm_test_devices_init);
 
+int ttm_test_devices_all_init(struct kunit *test)
+{
+       struct ttm_test_devices *priv;
+
+       priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
+       KUNIT_ASSERT_NOT_NULL(test, priv);
+
+       priv = ttm_test_devices_all(test);
+       test->priv = priv;
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(ttm_test_devices_all_init);
+
 void ttm_test_devices_fini(struct kunit *test)
 {
        ttm_test_devices_put(test, test->priv);
index c83d31b23c9aaf4b43395a2ac93d7e3e7c3faddb..3dbf404e22a8766a88ab4b897428575a17c6ce16 100644 (file)
@@ -40,6 +40,7 @@ void ttm_test_devices_put(struct kunit *test, struct ttm_test_devices *devs);
 
 /* Generic init/fini for tests that only need DRM/TTM devices */
 int ttm_test_devices_init(struct kunit *test);
+int ttm_test_devices_all_init(struct kunit *test);
 void ttm_test_devices_fini(struct kunit *test);
 
 #endif // TTM_KUNIT_HELPERS_H
index 67bf51723c92ff5b6335fd4bff683d673aacf533..17988fa99fa6aafd7901d2bfc9d8b3d3d8cfaacb 100644 (file)
@@ -15,19 +15,6 @@ struct ttm_tt_test_case {
        uint32_t extra_pages_num;
 };
 
-static int ttm_tt_test_init(struct kunit *test)
-{
-       struct ttm_test_devices *priv;
-
-       priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL);
-       KUNIT_ASSERT_NOT_NULL(test, priv);
-
-       priv = ttm_test_devices_all(test);
-       test->priv = priv;
-
-       return 0;
-}
-
 static const struct ttm_tt_test_case ttm_tt_init_basic_cases[] = {
        {
                .description = "Page-aligned size",
@@ -285,7 +272,7 @@ static struct kunit_case ttm_tt_test_cases[] = {
 
 static struct kunit_suite ttm_tt_test_suite = {
        .name = "ttm_tt",
-       .init = ttm_tt_test_init,
+       .init = ttm_test_devices_all_init,
        .exit = ttm_test_devices_fini,
        .test_cases = ttm_tt_test_cases,
 };