[Intel-xe] [PATCH 3/6] drm/xe: Fix kunit integration due to missing prototypes
Lucas De Marchi
lucas.demarchi at intel.com
Tue Feb 21 23:33:45 UTC 2023
In order to avoid -Werror=missing-prototypes, add the prototypes and
move the functions to the end of the file, surrounded by
`#if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST)`.
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
drivers/gpu/drm/xe/tests/xe_bo.c | 54 +++++++++++++++------------
drivers/gpu/drm/xe/tests/xe_dma_buf.c | 2 +
drivers/gpu/drm/xe/tests/xe_migrate.c | 6 +++
3 files changed, 39 insertions(+), 23 deletions(-)
diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c b/drivers/gpu/drm/xe/tests/xe_bo.c
index 87ac21cc8ca9..2c94ddaacda6 100644
--- a/drivers/gpu/drm/xe/tests/xe_bo.c
+++ b/drivers/gpu/drm/xe/tests/xe_bo.c
@@ -141,29 +141,6 @@ static void ccs_test_run_gt(struct xe_device *xe, struct xe_gt *gt,
xe_bo_put(bo);
}
-static int ccs_test_run_device(struct xe_device *xe)
-{
- struct kunit *test = xe_cur_kunit();
- struct xe_gt *gt;
- int id;
-
- if (!xe_device_has_flat_ccs(xe)) {
- kunit_info(test, "Skipping non-flat-ccs device.\n");
- return 0;
- }
-
- for_each_gt(gt, xe, id)
- ccs_test_run_gt(xe, gt, test);
-
- return 0;
-}
-
-void xe_ccs_migrate_kunit(struct kunit *test)
-{
- xe_call_for_each_device(ccs_test_run_device);
-}
-EXPORT_SYMBOL(xe_ccs_migrate_kunit);
-
static int evict_test_run_gt(struct xe_device *xe, struct xe_gt *gt, struct kunit *test)
{
struct xe_bo *bo, *external;
@@ -278,6 +255,8 @@ static int evict_test_run_gt(struct xe_device *xe, struct xe_gt *gt, struct kuni
return 0;
}
+#if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST)
+
static int evict_test_run_device(struct xe_device *xe)
{
struct kunit *test = xe_cur_kunit();
@@ -296,8 +275,37 @@ static int evict_test_run_device(struct xe_device *xe)
return 0;
}
+void xe_bo_evict_kunit(struct kunit *test);
+
void xe_bo_evict_kunit(struct kunit *test)
{
xe_call_for_each_device(evict_test_run_device);
}
EXPORT_SYMBOL(xe_bo_evict_kunit);
+
+static int ccs_test_run_device(struct xe_device *xe)
+{
+ struct kunit *test = xe_cur_kunit();
+ struct xe_gt *gt;
+ int id;
+
+ if (!xe_device_has_flat_ccs(xe)) {
+ kunit_info(test, "Skipping non-flat-ccs device.\n");
+ return 0;
+ }
+
+ for_each_gt(gt, xe, id)
+ ccs_test_run_gt(xe, gt, test);
+
+ return 0;
+}
+
+void xe_ccs_migrate_kunit(struct kunit *test);
+
+void xe_ccs_migrate_kunit(struct kunit *test)
+{
+ xe_call_for_each_device(ccs_test_run_device);
+}
+EXPORT_SYMBOL(xe_ccs_migrate_kunit);
+
+#endif
diff --git a/drivers/gpu/drm/xe/tests/xe_dma_buf.c b/drivers/gpu/drm/xe/tests/xe_dma_buf.c
index 615d22e3f731..d8ad135d0e04 100644
--- a/drivers/gpu/drm/xe/tests/xe_dma_buf.c
+++ b/drivers/gpu/drm/xe/tests/xe_dma_buf.c
@@ -252,6 +252,8 @@ static int dma_buf_run_device(struct xe_device *xe)
return 0;
}
+void xe_dma_buf_kunit(struct kunit *test);
+
void xe_dma_buf_kunit(struct kunit *test)
{
xe_call_for_each_device(dma_buf_run_device);
diff --git a/drivers/gpu/drm/xe/tests/xe_migrate.c b/drivers/gpu/drm/xe/tests/xe_migrate.c
index 03a60d5b42f1..7be0c2543916 100644
--- a/drivers/gpu/drm/xe/tests/xe_migrate.c
+++ b/drivers/gpu/drm/xe/tests/xe_migrate.c
@@ -352,6 +352,8 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
xe_bo_vunmap(m->pt_bo);
}
+#if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST)
+
static int migrate_test_run_device(struct xe_device *xe)
{
struct kunit *test = xe_cur_kunit();
@@ -371,8 +373,12 @@ static int migrate_test_run_device(struct xe_device *xe)
return 0;
}
+void xe_migrate_sanity_kunit(struct kunit *test);
+
void xe_migrate_sanity_kunit(struct kunit *test)
{
xe_call_for_each_device(migrate_test_run_device);
}
EXPORT_SYMBOL(xe_migrate_sanity_kunit);
+
+#endif
--
2.39.0
More information about the Intel-xe
mailing list