]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
drm/xe/display: move device_remove over to drmm
authorMatthew Auld <matthew.auld@intel.com>
Wed, 22 May 2024 10:22:01 +0000 (11:22 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Wed, 22 May 2024 12:22:40 +0000 (13:22 +0100)
i915 display calls this when releasing the drm_device, match this also
in xe by using drmm. intel_display_device_remove() is freeing purely
software state for the drm_device.

v2: fix build error

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240522102143.128069-36-matthew.auld@intel.com
drivers/gpu/drm/xe/display/xe_display.c
drivers/gpu/drm/xe/display/xe_display.h
drivers/gpu/drm/xe/xe_pci.c

index 406bc3912f4bf641366d87887aabaaf2886f4b51..347e625b53be87d476dc665a41a6a5bbf15f353b 100644 (file)
@@ -245,8 +245,6 @@ void xe_display_driver_remove(struct xe_device *xe)
                return;
 
        intel_display_driver_remove(xe);
-
-       intel_display_device_remove(xe);
 }
 
 /* IRQ-related functions */
@@ -388,17 +386,31 @@ void xe_display_pm_resume(struct xe_device *xe)
        intel_power_domains_enable(xe);
 }
 
-void xe_display_probe(struct xe_device *xe)
+static void display_device_remove(struct drm_device *dev, void *arg)
+{
+       struct xe_device *xe = arg;
+
+       intel_display_device_remove(xe);
+}
+
+int xe_display_probe(struct xe_device *xe)
 {
+       int err;
+
        if (!xe->info.enable_display)
                goto no_display;
 
        intel_display_device_probe(xe);
 
+       err = drmm_add_action_or_reset(&xe->drm, display_device_remove, xe);
+       if (err)
+               return err;
+
        if (has_display(xe))
-               return;
+               return 0;
 
 no_display:
        xe->info.enable_display = false;
        unset_display_features(xe);
+       return 0;
 }
index 710e56180b52d778892372dfb3b40cdd6d486944..e4085f841aa78c7e0cbd6886087e417670574161 100644 (file)
@@ -18,7 +18,7 @@ void xe_display_driver_remove(struct xe_device *xe);
 
 int xe_display_create(struct xe_device *xe);
 
-void xe_display_probe(struct xe_device *xe);
+int xe_display_probe(struct xe_device *xe);
 
 int xe_display_init_nommio(struct xe_device *xe);
 int xe_display_init_noirq(struct xe_device *xe);
@@ -47,7 +47,7 @@ static inline void xe_display_driver_remove(struct xe_device *xe) {}
 
 static inline int xe_display_create(struct xe_device *xe) { return 0; }
 
-static inline void xe_display_probe(struct xe_device *xe) { }
+static inline int xe_display_probe(struct xe_device *xe) { return 0; }
 
 static inline int xe_display_init_nommio(struct xe_device *xe) { return 0; }
 static inline int xe_display_init_noirq(struct xe_device *xe) { return 0; }
index b1c8050b7bf5446f2862b5655a5947c29d6b79f3..bd058dae2986d7e7c3eb85e041958e0017368dcc 100644 (file)
@@ -767,7 +767,9 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (err)
                return err;
 
-       xe_display_probe(xe);
+       err = xe_display_probe(xe);
+       if (err)
+               return err;
 
        drm_dbg(&xe->drm, "%s %s %04x:%04x dgfx:%d gfx:%s (%d.%02d) media:%s (%d.%02d) display:%s dma_m_s:%d tc:%d gscfi:%d",
                desc->platform_name,