All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karolina Stolarek <karolina.stolarek@intel.com>
To: dri-devel@lists.freedesktop.org
Cc: "Christian König" <christian.koenig@amd.com>,
	"Amaranath Somalapuram" <Amaranath.Somalapuram@amd.com>,
	"Andi Shyti" <andi.shyti@linux.intel.com>,
	"Karolina Stolarek" <karolina.stolarek@intel.com>
Subject: [PATCH v10 2/9] drm/ttm/tests: Use an init function from the helpers lib
Date: Fri, 22 Mar 2024 15:29:51 +0100	[thread overview]
Message-ID: <422541615a890df92140a6d3328b01a1bac1e691.1711117249.git.karolina.stolarek@intel.com> (raw)
In-Reply-To: <cover.1711117249.git.karolina.stolarek@intel.com>

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>
---
 drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 14 ++++++++++++++
 drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h |  1 +
 drivers/gpu/drm/ttm/tests/ttm_tt_test.c       | 15 +--------------
 3 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
index cb1cd676f8ae..2fe0c66f31a9 100644
--- a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
+++ b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c
@@ -153,6 +153,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);
diff --git a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h
index 2f51c833a536..53bb5834939f 100644
--- a/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h
+++ b/drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h
@@ -39,6 +39,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
diff --git a/drivers/gpu/drm/ttm/tests/ttm_tt_test.c b/drivers/gpu/drm/ttm/tests/ttm_tt_test.c
index fd4502c18de6..a33a426a814d 100644
--- a/drivers/gpu/drm/ttm/tests/ttm_tt_test.c
+++ b/drivers/gpu/drm/ttm/tests/ttm_tt_test.c
@@ -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,
 };
-- 
2.34.1


  parent reply	other threads:[~2024-03-22 14:30 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-22 14:29 [PATCH v10 0/9] Improve test coverage of TTM Karolina Stolarek
2024-03-22 14:29 ` [PATCH v10 1/9] drm/ttm/tests: Set DMA mask in KUnit device Karolina Stolarek
2024-03-22 14:29 ` Karolina Stolarek [this message]
2024-04-10 13:06   ` [PATCH v10 2/9] drm/ttm/tests: Use an init function from the helpers lib Matthew Auld
2024-04-16 12:18   ` Somalapuram, Amaranath
2024-03-22 14:29 ` [PATCH v10 3/9] drm/ttm/tests: Test simple BO creation and validation Karolina Stolarek
2024-04-10 14:01   ` Matthew Auld
2024-04-11 12:20     ` Karolina Stolarek
2024-04-16 12:20   ` Somalapuram, Amaranath
2024-03-22 14:29 ` [PATCH v10 4/9] drm/ttm/tests: Add tests with mock resource managers Karolina Stolarek
2024-04-10 14:24   ` Matthew Auld
2024-04-11 12:30     ` Karolina Stolarek
2024-04-15 12:10   ` Somalapuram, Amaranath
2024-04-17  7:55     ` Karolina Stolarek
2024-03-22 14:29 ` [PATCH v10 5/9] drm/ttm/tests: Add test cases dependent on fence signaling Karolina Stolarek
2024-04-16 12:21   ` Somalapuram, Amaranath
2024-03-22 14:29 ` [PATCH v10 6/9] drm/ttm/tests: Add eviction testing Karolina Stolarek
2024-04-16 12:22   ` Somalapuram, Amaranath
2024-03-22 14:29 ` [PATCH v10 7/9] drm/ttm/tests: Add tests for ttm_tt_populate Karolina Stolarek
2024-04-16 12:23   ` Somalapuram, Amaranath
2024-03-22 14:29 ` [PATCH v10 8/9] drm/ttm/tests: Add TODO file Karolina Stolarek
2024-03-22 14:29 ` [PATCH v10 9/9] drm/ttm/tests: Fix a warning in ttm_bo_unreserve_bulk Karolina Stolarek
2024-04-02 13:35 ` [PATCH v10 0/9] Improve test coverage of TTM Somalapuram, Amaranath
2024-04-03  8:17   ` Karolina Stolarek
2024-04-10  5:12     ` Somalapuram, Amaranath

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=422541615a890df92140a6d3328b01a1bac1e691.1711117249.git.karolina.stolarek@intel.com \
    --to=karolina.stolarek@intel.com \
    --cc=Amaranath.Somalapuram@amd.com \
    --cc=andi.shyti@linux.intel.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.