[PATCH 03/10] drm/xe/tests: fix drvdata usage

Jani Nikula jani.nikula at intel.com
Mon Jul 29 14:30:04 UTC 2024


The test code seems to assume struct drm_device * is stored in
drvdata. This is (currently) not the case. Use the proper helper to get
at the xe device.

This has not been an issue, because struct drm_device is embedded in
struct xe_device at offset 0.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 drivers/gpu/drm/xe/tests/xe_pci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/xe/tests/xe_pci.c b/drivers/gpu/drm/xe/tests/xe_pci.c
index 577ee7d14381..2046789f62bd 100644
--- a/drivers/gpu/drm/xe/tests/xe_pci.c
+++ b/drivers/gpu/drm/xe/tests/xe_pci.c
@@ -20,15 +20,15 @@ struct kunit_test_data {
 static int dev_to_xe_device_fn(struct device *dev, void *__data)
 
 {
-	struct drm_device *drm = dev_get_drvdata(dev);
+	struct xe_device *xe = kdev_to_xe_device(dev);
 	struct kunit_test_data *data = __data;
 	int ret = 0;
 	int idx;
 
 	data->ndevs++;
 
-	if (drm_dev_enter(drm, &idx))
-		ret = data->xe_fn(to_xe_device(dev_get_drvdata(dev)));
+	if (drm_dev_enter(&xe->drm, &idx))
+		ret = data->xe_fn(xe);
 	drm_dev_exit(idx);
 
 	return ret;
-- 
2.39.2



More information about the Intel-gfx mailing list