Commit bd85e00f authored by Michal Wajdeczko's avatar Michal Wajdeczko

drm/xe/kunit: Kill xe_cur_kunit()

We shouldn't use custom helper if there is a official one.
Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240705191057.1110-2-michal.wajdeczko@intel.com
parent f6ca930d
...@@ -154,7 +154,7 @@ static void ccs_test_run_tile(struct xe_device *xe, struct xe_tile *tile, ...@@ -154,7 +154,7 @@ static void ccs_test_run_tile(struct xe_device *xe, struct xe_tile *tile,
static int ccs_test_run_device(struct xe_device *xe) static int ccs_test_run_device(struct xe_device *xe)
{ {
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
struct xe_tile *tile; struct xe_tile *tile;
int id; int id;
...@@ -325,7 +325,7 @@ static int evict_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struc ...@@ -325,7 +325,7 @@ static int evict_test_run_tile(struct xe_device *xe, struct xe_tile *tile, struc
static int evict_test_run_device(struct xe_device *xe) static int evict_test_run_device(struct xe_device *xe)
{ {
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
struct xe_tile *tile; struct xe_tile *tile;
int id; int id;
......
...@@ -107,7 +107,7 @@ static void check_residency(struct kunit *test, struct xe_bo *exported, ...@@ -107,7 +107,7 @@ static void check_residency(struct kunit *test, struct xe_bo *exported,
static void xe_test_dmabuf_import_same_driver(struct xe_device *xe) static void xe_test_dmabuf_import_same_driver(struct xe_device *xe)
{ {
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
struct dma_buf_test_params *params = to_dma_buf_test_params(test->priv); struct dma_buf_test_params *params = to_dma_buf_test_params(test->priv);
struct drm_gem_object *import; struct drm_gem_object *import;
struct dma_buf *dmabuf; struct dma_buf *dmabuf;
...@@ -258,7 +258,7 @@ static const struct dma_buf_test_params test_params[] = { ...@@ -258,7 +258,7 @@ static const struct dma_buf_test_params test_params[] = {
static int dma_buf_run_device(struct xe_device *xe) static int dma_buf_run_device(struct xe_device *xe)
{ {
const struct dma_buf_test_params *params; const struct dma_buf_test_params *params;
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
xe_pm_runtime_get(xe); xe_pm_runtime_get(xe);
for (params = test_params; params->mem_mask; ++params) { for (params = test_params; params->mem_mask; ++params) {
......
...@@ -334,7 +334,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test) ...@@ -334,7 +334,7 @@ static void xe_migrate_sanity_test(struct xe_migrate *m, struct kunit *test)
static int migrate_test_run_device(struct xe_device *xe) static int migrate_test_run_device(struct xe_device *xe)
{ {
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
struct xe_tile *tile; struct xe_tile *tile;
int id; int id;
......
...@@ -23,7 +23,7 @@ struct live_mocs { ...@@ -23,7 +23,7 @@ struct live_mocs {
static int live_mocs_init(struct live_mocs *arg, struct xe_gt *gt) static int live_mocs_init(struct live_mocs *arg, struct xe_gt *gt)
{ {
unsigned int flags; unsigned int flags;
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
memset(arg, 0, sizeof(*arg)); memset(arg, 0, sizeof(*arg));
...@@ -41,7 +41,7 @@ static int live_mocs_init(struct live_mocs *arg, struct xe_gt *gt) ...@@ -41,7 +41,7 @@ static int live_mocs_init(struct live_mocs *arg, struct xe_gt *gt)
static void read_l3cc_table(struct xe_gt *gt, static void read_l3cc_table(struct xe_gt *gt,
const struct xe_mocs_info *info) const struct xe_mocs_info *info)
{ {
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
u32 l3cc, l3cc_expected; u32 l3cc, l3cc_expected;
unsigned int i; unsigned int i;
u32 reg_val; u32 reg_val;
...@@ -78,7 +78,7 @@ static void read_l3cc_table(struct xe_gt *gt, ...@@ -78,7 +78,7 @@ static void read_l3cc_table(struct xe_gt *gt,
static void read_mocs_table(struct xe_gt *gt, static void read_mocs_table(struct xe_gt *gt,
const struct xe_mocs_info *info) const struct xe_mocs_info *info)
{ {
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
u32 mocs, mocs_expected; u32 mocs, mocs_expected;
unsigned int i; unsigned int i;
u32 reg_val; u32 reg_val;
...@@ -148,7 +148,7 @@ static int mocs_reset_test_run_device(struct xe_device *xe) ...@@ -148,7 +148,7 @@ static int mocs_reset_test_run_device(struct xe_device *xe)
struct xe_gt *gt; struct xe_gt *gt;
unsigned int flags; unsigned int flags;
int id; int id;
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
xe_pm_runtime_get(xe); xe_pm_runtime_get(xe);
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
static void check_graphics_ip(const struct xe_graphics_desc *graphics) static void check_graphics_ip(const struct xe_graphics_desc *graphics)
{ {
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
u64 mask = graphics->hw_engine_mask; u64 mask = graphics->hw_engine_mask;
/* RCS, CCS, and BCS engines are allowed on the graphics IP */ /* RCS, CCS, and BCS engines are allowed on the graphics IP */
...@@ -30,7 +30,7 @@ static void check_graphics_ip(const struct xe_graphics_desc *graphics) ...@@ -30,7 +30,7 @@ static void check_graphics_ip(const struct xe_graphics_desc *graphics)
static void check_media_ip(const struct xe_media_desc *media) static void check_media_ip(const struct xe_media_desc *media)
{ {
struct kunit *test = xe_cur_kunit(); struct kunit *test = kunit_get_current_test();
u64 mask = media->hw_engine_mask; u64 mask = media->hw_engine_mask;
/* VCS, VECS and GSCCS engines are allowed on the media IP */ /* VCS, VECS and GSCCS engines are allowed on the media IP */
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include <linux/types.h> #include <linux/types.h>
#if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST) #if IS_ENABLED(CONFIG_DRM_XE_KUNIT_TEST)
#include <linux/sched.h>
#include <kunit/test.h> #include <kunit/test.h>
#include <kunit/test-bug.h>
/* /*
* Each test that provides a kunit private test structure, place a test id * Each test that provides a kunit private test structure, place a test id
...@@ -32,7 +32,6 @@ struct xe_test_priv { ...@@ -32,7 +32,6 @@ struct xe_test_priv {
#define XE_TEST_DECLARE(x) x #define XE_TEST_DECLARE(x) x
#define XE_TEST_ONLY(x) unlikely(x) #define XE_TEST_ONLY(x) unlikely(x)
#define XE_TEST_EXPORT #define XE_TEST_EXPORT
#define xe_cur_kunit() current->kunit_test
/** /**
* xe_cur_kunit_priv - Obtain the struct xe_test_priv pointed to by * xe_cur_kunit_priv - Obtain the struct xe_test_priv pointed to by
...@@ -48,10 +47,10 @@ xe_cur_kunit_priv(enum xe_test_priv_id id) ...@@ -48,10 +47,10 @@ xe_cur_kunit_priv(enum xe_test_priv_id id)
{ {
struct xe_test_priv *priv; struct xe_test_priv *priv;
if (!xe_cur_kunit()) if (!kunit_get_current_test())
return NULL; return NULL;
priv = xe_cur_kunit()->priv; priv = kunit_get_current_test()->priv;
return priv->id == id ? priv : NULL; return priv->id == id ? priv : NULL;
} }
...@@ -60,7 +59,6 @@ xe_cur_kunit_priv(enum xe_test_priv_id id) ...@@ -60,7 +59,6 @@ xe_cur_kunit_priv(enum xe_test_priv_id id)
#define XE_TEST_DECLARE(x) #define XE_TEST_DECLARE(x)
#define XE_TEST_ONLY(x) 0 #define XE_TEST_ONLY(x) 0
#define XE_TEST_EXPORT static #define XE_TEST_EXPORT static
#define xe_cur_kunit() NULL
#define xe_cur_kunit_priv(_id) NULL #define xe_cur_kunit_priv(_id) NULL
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment