Skip to content

Commit

Permalink
drm/xe/display: move device_remove over to drmm
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Andrzej Hajda <[email protected]>
Cc: Rodrigo Vivi <[email protected]>
Reviewed-by: Andrzej Hajda <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
matt-auld committed May 22, 2024
1 parent 48d74a0 commit dc51c68
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
20 changes: 16 additions & 4 deletions drivers/gpu/drm/xe/display/xe_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions drivers/gpu/drm/xe/display/xe_display.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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; }
Expand Down
4 changes: 3 additions & 1 deletion drivers/gpu/drm/xe/xe_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit dc51c68

Please sign in to comment.