drm/xe: Use symbol namespace for kunit tests
Instead of simply using EXPORT_SYMBOL() to export the functions needed in xe.ko to be be called across modules, use EXPORT_SYMBOL_IF_KUNIT() which will export the symbol under the EXPORTED_FOR_KUNIT_TESTING namespace. This avoids accidentally "leaking" these functions and letting them be called from outside the kunit tests. If these functiosn are accidentally called from another module, they receive a modpost error like below: ERROR: modpost: module XXXXXXX uses symbol xe_ccs_migrate_kunit from namespace EXPORTED_FOR_KUNIT_TESTING, but does not import it. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org> Link: https://lore.kernel.org/r/20230401085151.1786204-4-lucas.demarchi@intel.com Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
parent
af049be5a3
commit
60d5c6abc2
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include <kunit/test.h>
|
||||
#include <kunit/visibility.h>
|
||||
|
||||
#include "tests/xe_bo_test.h"
|
||||
#include "tests/xe_pci_test.h"
|
||||
@ -166,7 +167,7 @@ void xe_ccs_migrate_kunit(struct kunit *test)
|
||||
{
|
||||
xe_call_for_each_device(ccs_test_run_device);
|
||||
}
|
||||
EXPORT_SYMBOL(xe_ccs_migrate_kunit);
|
||||
EXPORT_SYMBOL_IF_KUNIT(xe_ccs_migrate_kunit);
|
||||
|
||||
static int evict_test_run_gt(struct xe_device *xe, struct xe_gt *gt, struct kunit *test)
|
||||
{
|
||||
@ -304,4 +305,4 @@ void xe_bo_evict_kunit(struct kunit *test)
|
||||
{
|
||||
xe_call_for_each_device(evict_test_run_device);
|
||||
}
|
||||
EXPORT_SYMBOL(xe_bo_evict_kunit);
|
||||
EXPORT_SYMBOL_IF_KUNIT(xe_bo_evict_kunit);
|
||||
|
@ -22,3 +22,4 @@ kunit_test_suite(xe_bo_test_suite);
|
||||
|
||||
MODULE_AUTHOR("Intel Corporation");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING);
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include <kunit/test.h>
|
||||
#include <kunit/visibility.h>
|
||||
|
||||
#include "tests/xe_dma_buf_test.h"
|
||||
#include "tests/xe_pci_test.h"
|
||||
@ -259,4 +260,4 @@ void xe_dma_buf_kunit(struct kunit *test)
|
||||
{
|
||||
xe_call_for_each_device(dma_buf_run_device);
|
||||
}
|
||||
EXPORT_SYMBOL(xe_dma_buf_kunit);
|
||||
EXPORT_SYMBOL_IF_KUNIT(xe_dma_buf_kunit);
|
||||
|
@ -21,3 +21,4 @@ kunit_test_suite(xe_dma_buf_test_suite);
|
||||
|
||||
MODULE_AUTHOR("Intel Corporation");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING);
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
#include <kunit/test.h>
|
||||
#include <kunit/visibility.h>
|
||||
|
||||
#include "tests/xe_migrate_test.h"
|
||||
#include "tests/xe_pci_test.h"
|
||||
@ -409,4 +410,4 @@ void xe_migrate_sanity_kunit(struct kunit *test)
|
||||
{
|
||||
xe_call_for_each_device(migrate_test_run_device);
|
||||
}
|
||||
EXPORT_SYMBOL(xe_migrate_sanity_kunit);
|
||||
EXPORT_SYMBOL_IF_KUNIT(xe_migrate_sanity_kunit);
|
||||
|
@ -21,3 +21,4 @@ kunit_test_suite(xe_migrate_test_suite);
|
||||
|
||||
MODULE_AUTHOR("Intel Corporation");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_IMPORT_NS(EXPORTED_FOR_KUNIT_TESTING);
|
||||
|
Loading…
x
Reference in New Issue
Block a user