From: Lucas De Marchi Date: Thu, 23 Feb 2023 05:00:35 +0000 (-0800) Subject: drm/xe: Fix kunit integration due to missing prototypes X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=353dfaaa31648c4e6f7f3fee5001f047ebf3ed67;p=linux.git drm/xe: Fix kunit integration due to missing prototypes In order to avoid -Werror=missing-prototypes, add the prototypes in a separate tests/_test.h file that is included by both the implementation (tests/xe_.c, injected in xe.ko) and the kunit module (tests/xe__test.c -> xe--test.ko). v2: Add header and don't add ifdef to files that are already not built when not using kunit (Matt Auld) Signed-off-by: Lucas De Marchi Reviewed-by: Matthew Auld Signed-off-by: Rodrigo Vivi --- diff --git a/drivers/gpu/drm/xe/tests/xe_bo.c b/drivers/gpu/drm/xe/tests/xe_bo.c index 87ac21cc8ca93..f03fb907b59a6 100644 --- a/drivers/gpu/drm/xe/tests/xe_bo.c +++ b/drivers/gpu/drm/xe/tests/xe_bo.c @@ -5,6 +5,8 @@ #include +#include "tests/xe_bo_test.h" + #include "xe_bo_evict.h" #include "xe_pci.h" diff --git a/drivers/gpu/drm/xe/tests/xe_bo_test.c b/drivers/gpu/drm/xe/tests/xe_bo_test.c index c8fa29b0b3b23..92dda4fca21b9 100644 --- a/drivers/gpu/drm/xe/tests/xe_bo_test.c +++ b/drivers/gpu/drm/xe/tests/xe_bo_test.c @@ -3,10 +3,9 @@ * Copyright © 2022 Intel Corporation */ -#include +#include "xe_bo_test.h" -void xe_ccs_migrate_kunit(struct kunit *test); -void xe_bo_evict_kunit(struct kunit *test); +#include static struct kunit_case xe_bo_tests[] = { KUNIT_CASE(xe_ccs_migrate_kunit), diff --git a/drivers/gpu/drm/xe/tests/xe_bo_test.h b/drivers/gpu/drm/xe/tests/xe_bo_test.h new file mode 100644 index 0000000000000..d751a618c0c8f --- /dev/null +++ b/drivers/gpu/drm/xe/tests/xe_bo_test.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 AND MIT */ +/* + * Copyright © 2023 Intel Corporation + */ + +#ifndef __XE_BO_TEST_H__ +#define __XE_BO_TEST_H__ + +struct kunit; + +void xe_ccs_migrate_kunit(struct kunit *test); +void xe_bo_evict_kunit(struct kunit *test); + +#endif diff --git a/drivers/gpu/drm/xe/tests/xe_dma_buf.c b/drivers/gpu/drm/xe/tests/xe_dma_buf.c index 615d22e3f7318..e66a8361ae1f0 100644 --- a/drivers/gpu/drm/xe/tests/xe_dma_buf.c +++ b/drivers/gpu/drm/xe/tests/xe_dma_buf.c @@ -5,6 +5,8 @@ #include +#include "tests/xe_dma_buf_test.h" + #include "xe_pci.h" static bool p2p_enabled(struct dma_buf_test_params *params) diff --git a/drivers/gpu/drm/xe/tests/xe_dma_buf_test.c b/drivers/gpu/drm/xe/tests/xe_dma_buf_test.c index 7bb292da11936..a1adfd1e1605e 100644 --- a/drivers/gpu/drm/xe/tests/xe_dma_buf_test.c +++ b/drivers/gpu/drm/xe/tests/xe_dma_buf_test.c @@ -3,9 +3,9 @@ * Copyright © 2022 Intel Corporation */ -#include +#include "xe_dma_buf_test.h" -void xe_dma_buf_kunit(struct kunit *test); +#include static struct kunit_case xe_dma_buf_tests[] = { KUNIT_CASE(xe_dma_buf_kunit), diff --git a/drivers/gpu/drm/xe/tests/xe_dma_buf_test.h b/drivers/gpu/drm/xe/tests/xe_dma_buf_test.h new file mode 100644 index 0000000000000..4e9a8bef57518 --- /dev/null +++ b/drivers/gpu/drm/xe/tests/xe_dma_buf_test.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 AND MIT */ +/* + * Copyright © 2023 Intel Corporation + */ + +#ifndef __XE_DMA_BUF_TEST_H__ +#define __XE_DMA_BUF_TEST_H__ + +struct kunit; + +void xe_dma_buf_kunit(struct kunit *test); + +#endif diff --git a/drivers/gpu/drm/xe/tests/xe_migrate.c b/drivers/gpu/drm/xe/tests/xe_migrate.c index 03a60d5b42f1d..0de17e90aba9c 100644 --- a/drivers/gpu/drm/xe/tests/xe_migrate.c +++ b/drivers/gpu/drm/xe/tests/xe_migrate.c @@ -5,6 +5,8 @@ #include +#include "tests/xe_migrate_test.h" + #include "xe_pci.h" static bool sanity_fence_failed(struct xe_device *xe, struct dma_fence *fence, diff --git a/drivers/gpu/drm/xe/tests/xe_migrate_test.c b/drivers/gpu/drm/xe/tests/xe_migrate_test.c index ad779e2bd0717..d6be360c3b6d1 100644 --- a/drivers/gpu/drm/xe/tests/xe_migrate_test.c +++ b/drivers/gpu/drm/xe/tests/xe_migrate_test.c @@ -3,9 +3,9 @@ * Copyright © 2022 Intel Corporation */ -#include +#include "xe_migrate_test.h" -void xe_migrate_sanity_kunit(struct kunit *test); +#include static struct kunit_case xe_migrate_tests[] = { KUNIT_CASE(xe_migrate_sanity_kunit), diff --git a/drivers/gpu/drm/xe/tests/xe_migrate_test.h b/drivers/gpu/drm/xe/tests/xe_migrate_test.h new file mode 100644 index 0000000000000..db1f8ef035bba --- /dev/null +++ b/drivers/gpu/drm/xe/tests/xe_migrate_test.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 AND MIT */ +/* + * Copyright © 2023 Intel Corporation + */ + +#ifndef __XE_MIGRATE_TEST_H__ +#define __XE_MIGRATE_TEST_H__ + +struct kunit; + +void xe_migrate_sanity_kunit(struct kunit *test); + +#endif