[Intel-xe] [PATCH 2/2] drm/xe/device: Let display init in a common block
Matt Roper
matthew.d.roper at intel.com
Mon Feb 27 23:03:51 UTC 2023
On Fri, Feb 24, 2023 at 04:21:38PM -0800, Lucas De Marchi wrote:
> Move mem_access.lock initialization up and display.hotplug.dp_wq down so
> all the display initializations are in a common block that can be moved
> elsewhere later.
>
> Also, the `goto err` is not correct as it misses the drm_dev_put() to
> correctly unwind the actions.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
Reviewed-by: Matt Roper <matthew.d.roper at intel.com>
> ---
> drivers/gpu/drm/xe/xe_device.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 5e2f5d93f2ce..1e7fa507c123 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -206,12 +206,15 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
> INIT_LIST_HEAD(&xe->pinned.external_vram);
> INIT_LIST_HEAD(&xe->pinned.evicted);
>
> + drmm_mutex_init(&xe->drm, &xe->mem_access.lock);
> +
> xe->ordered_wq = alloc_ordered_workqueue("xe-ordered-wq", 0);
> - xe->display.hotplug.dp_wq = alloc_ordered_workqueue("xe-dp", 0);
>
> /* Initialize display parts here.. */
> spin_lock_init(&xe->display.fb_tracking.lock);
>
> + xe->display.hotplug.dp_wq = alloc_ordered_workqueue("xe-dp", 0);
> +
> drmm_mutex_init(&xe->drm, &xe->sb_lock);
> drmm_mutex_init(&xe->drm, &xe->display.backlight.lock);
> drmm_mutex_init(&xe->drm, &xe->display.audio.mutex);
> @@ -233,15 +236,13 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
>
> err = drmm_add_action_or_reset(&xe->drm, xe_device_destroy, NULL);
> if (err)
> - goto err;
> -
> - drmm_mutex_init(&xe->drm, &xe->mem_access.lock);
> + goto err_put;
>
> return xe;
>
> err_put:
> drm_dev_put(&xe->drm);
> -err:
> +
> return ERR_PTR(err);
> }
>
> --
> 2.39.0
>
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
More information about the Intel-xe
mailing list