Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/ttm/tests: Use an init function from the helpers lib

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

authored by

Karolina Stolarek and committed by
Arunpravin Paneer Selvam
f7ed0a7e dc501656

+16 -14
+14
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
··· 158 158 } 159 159 EXPORT_SYMBOL_GPL(ttm_test_devices_init); 160 160 161 + int ttm_test_devices_all_init(struct kunit *test) 162 + { 163 + struct ttm_test_devices *priv; 164 + 165 + priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL); 166 + KUNIT_ASSERT_NOT_NULL(test, priv); 167 + 168 + priv = ttm_test_devices_all(test); 169 + test->priv = priv; 170 + 171 + return 0; 172 + } 173 + EXPORT_SYMBOL_GPL(ttm_test_devices_all_init); 174 + 161 175 void ttm_test_devices_fini(struct kunit *test) 162 176 { 163 177 ttm_test_devices_put(test, test->priv);
+1
drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h
··· 40 40 41 41 /* Generic init/fini for tests that only need DRM/TTM devices */ 42 42 int ttm_test_devices_init(struct kunit *test); 43 + int ttm_test_devices_all_init(struct kunit *test); 43 44 void ttm_test_devices_fini(struct kunit *test); 44 45 45 46 #endif // TTM_KUNIT_HELPERS_H
+1 -14
drivers/gpu/drm/ttm/tests/ttm_tt_test.c
··· 15 15 uint32_t extra_pages_num; 16 16 }; 17 17 18 - static int ttm_tt_test_init(struct kunit *test) 19 - { 20 - struct ttm_test_devices *priv; 21 - 22 - priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL); 23 - KUNIT_ASSERT_NOT_NULL(test, priv); 24 - 25 - priv = ttm_test_devices_all(test); 26 - test->priv = priv; 27 - 28 - return 0; 29 - } 30 - 31 18 static const struct ttm_tt_test_case ttm_tt_init_basic_cases[] = { 32 19 { 33 20 .description = "Page-aligned size", ··· 272 285 273 286 static struct kunit_suite ttm_tt_test_suite = { 274 287 .name = "ttm_tt", 275 - .init = ttm_tt_test_init, 288 + .init = ttm_test_devices_all_init, 276 289 .exit = ttm_test_devices_fini, 277 290 .test_cases = ttm_tt_test_cases, 278 291 };