drm/xe: add kdev_to_xe_device() helper and use it
authorJani Nikula <jani.nikula@intel.com>
Mon, 12 Aug 2024 10:30:21 +0000 (13:30 +0300)
committerJani Nikula <jani.nikula@intel.com>
Tue, 13 Aug 2024 09:11:49 +0000 (12:11 +0300)
There are enough users for kernel device to xe device conversion, add a
helper for it.

Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/38c80846e70c7e410850530426384e17cff9d031.1723458544.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/xe/xe_device.h
drivers/gpu/drm/xe/xe_gsc_proxy.c

index db6cc8d0d6b874756d543eb91394774fa998cf6b..2c96f1b2aafd3f65128a244999470d25b4ee79de 100644 (file)
@@ -15,6 +15,11 @@ static inline struct xe_device *to_xe_device(const struct drm_device *dev)
        return container_of(dev, struct xe_device, drm);
 }
 
+static inline struct xe_device *kdev_to_xe_device(struct device *kdev)
+{
+       return dev_get_drvdata(kdev);
+}
+
 static inline struct xe_device *pdev_to_xe_device(struct pci_dev *pdev)
 {
        return pci_get_drvdata(pdev);
index aa812a2bc3edb135bfb74dcff819e3fde0ee5e30..28e6a7a1d2822c60a98aadb25feefe37b3b76506 100644 (file)
@@ -62,11 +62,6 @@ gsc_to_gt(struct xe_gsc *gsc)
        return container_of(gsc, struct xe_gt, uc.gsc);
 }
 
-static inline struct xe_device *kdev_to_xe(struct device *kdev)
-{
-       return dev_get_drvdata(kdev);
-}
-
 bool xe_gsc_proxy_init_done(struct xe_gsc *gsc)
 {
        struct xe_gt *gt = gsc_to_gt(gsc);
@@ -345,7 +340,7 @@ void xe_gsc_proxy_irq_handler(struct xe_gsc *gsc, u32 iir)
 static int xe_gsc_proxy_component_bind(struct device *xe_kdev,
                                       struct device *mei_kdev, void *data)
 {
-       struct xe_device *xe = kdev_to_xe(xe_kdev);
+       struct xe_device *xe = kdev_to_xe_device(xe_kdev);
        struct xe_gt *gt = xe->tiles[0].media_gt;
        struct xe_gsc *gsc = &gt->uc.gsc;
 
@@ -360,7 +355,7 @@ static int xe_gsc_proxy_component_bind(struct device *xe_kdev,
 static void xe_gsc_proxy_component_unbind(struct device *xe_kdev,
                                          struct device *mei_kdev, void *data)
 {
-       struct xe_device *xe = kdev_to_xe(xe_kdev);
+       struct xe_device *xe = kdev_to_xe_device(xe_kdev);
        struct xe_gt *gt = xe->tiles[0].media_gt;
        struct xe_gsc *gsc = &gt->uc.gsc;