From: Lucas De Marchi <lucas.demarchi@intel.com>
To: <intel-xe@lists.freedesktop.org>
Subject: [PATCH v2 06/11] drm/xe: Drop remove callback support
Date: Fri, 21 Feb 2025 16:10:46 -0800 [thread overview]
Message-ID: <20250222001051.3012936-7-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20250222001051.3012936-1-lucas.demarchi@intel.com>
Now that devres supports component driver cleanup during driver removal
cleanup, the xe custom support for removal callbacks is not needed
anymore. Drop it.
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
drivers/gpu/drm/xe/xe_device.c | 68 ----------------------------
drivers/gpu/drm/xe/xe_device.h | 3 --
drivers/gpu/drm/xe/xe_device_types.h | 14 ------
drivers/gpu/drm/xe/xe_pci.c | 4 +-
4 files changed, 1 insertion(+), 88 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 64d3a26ad4a3e..e76d233025a69 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -65,12 +65,6 @@
#include <generated/xe_wa_oob.h>
-struct xe_device_remove_action {
- struct list_head node;
- void (*action)(void *);
- void *data;
-};
-
static int xe_file_open(struct drm_device *dev, struct drm_file *file)
{
struct xe_device *xe = to_xe_device(dev);
@@ -752,9 +746,6 @@ int xe_device_probe(struct xe_device *xe)
int err;
u8 id;
- xe->probing = true;
- INIT_LIST_HEAD(&xe->remove_action_list);
-
xe_pat_init_early(xe);
err = xe_sriov_init(xe);
@@ -904,8 +895,6 @@ int xe_device_probe(struct xe_device *xe)
xe_vsec_init(xe);
- xe->probing = false;
-
return devm_add_action_or_reset(xe->drm.dev, xe_device_sanitize, xe);
err_unregister_display:
@@ -916,61 +905,6 @@ int xe_device_probe(struct xe_device *xe)
return err;
}
-/**
- * xe_device_call_remove_actions - Call the remove actions
- * @xe: xe device instance
- *
- * This is only to be used by xe_pci and xe_device to call the remove actions
- * while removing the driver or handling probe failures.
- */
-void xe_device_call_remove_actions(struct xe_device *xe)
-{
- struct xe_device_remove_action *ra, *tmp;
-
- list_for_each_entry_safe(ra, tmp, &xe->remove_action_list, node) {
- ra->action(ra->data);
- list_del(&ra->node);
- kfree(ra);
- }
-
- xe->probing = false;
-}
-
-/**
- * xe_device_add_action_or_reset - Add an action to run on driver removal
- * @xe: xe device instance
- * @action: Function that should be called on device remove
- * @data: Pointer to data passed to @action implementation
- *
- * This adds a custom action to the list of remove callbacks executed on device
- * remove, before any dev or drm managed resources are removed. This is only
- * needed if the action leads to component_del()/component_master_del() since
- * that is not compatible with devres cleanup.
- *
- * Returns: 0 on success or a negative error code on failure, in which case
- * @action is already called.
- */
-int xe_device_add_action_or_reset(struct xe_device *xe,
- void (*action)(void *), void *data)
-{
- struct xe_device_remove_action *ra;
-
- drm_WARN_ON(&xe->drm, !xe->probing);
-
- ra = kmalloc(sizeof(*ra), GFP_KERNEL);
- if (!ra) {
- action(data);
- return -ENOMEM;
- }
-
- INIT_LIST_HEAD(&ra->node);
- ra->action = action;
- ra->data = data;
- list_add(&ra->node, &xe->remove_action_list);
-
- return 0;
-}
-
void xe_device_remove(struct xe_device *xe)
{
xe_display_unregister(xe);
@@ -980,8 +914,6 @@ void xe_device_remove(struct xe_device *xe)
xe_display_driver_remove(xe);
xe_heci_gsc_fini(xe);
-
- xe_device_call_remove_actions(xe);
}
void xe_device_shutdown(struct xe_device *xe)
diff --git a/drivers/gpu/drm/xe/xe_device.h b/drivers/gpu/drm/xe/xe_device.h
index 079dad32a6f53..0bc3bc8e68030 100644
--- a/drivers/gpu/drm/xe/xe_device.h
+++ b/drivers/gpu/drm/xe/xe_device.h
@@ -45,9 +45,6 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
const struct pci_device_id *ent);
int xe_device_probe_early(struct xe_device *xe);
int xe_device_probe(struct xe_device *xe);
-int xe_device_add_action_or_reset(struct xe_device *xe,
- void (*action)(void *), void *data);
-void xe_device_call_remove_actions(struct xe_device *xe);
void xe_device_remove(struct xe_device *xe);
void xe_device_shutdown(struct xe_device *xe);
diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
index 4656305dd45a6..833c29fed3a37 100644
--- a/drivers/gpu/drm/xe/xe_device_types.h
+++ b/drivers/gpu/drm/xe/xe_device_types.h
@@ -428,20 +428,6 @@ struct xe_device {
/** @tiles: device tiles */
struct xe_tile tiles[XE_MAX_TILES_PER_DEVICE];
- /**
- * @remove_action_list: list of actions to execute on device remove.
- * Use xe_device_add_remove_action() for that. Actions can only be added
- * during probe and are executed during the call from PCI subsystem to
- * remove the driver from the device.
- */
- struct list_head remove_action_list;
-
- /**
- * @probing: cover the section in which @remove_action_list can be used
- * to post cleaning actions
- */
- bool probing;
-
/**
* @mem_access: keep track of memory access in the device, possibly
* triggering additional actions when they occur.
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 41ec6825b9bcc..447eacb355d7c 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -900,10 +900,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
return err;
err = xe_device_probe(xe);
- if (err) {
- xe_device_call_remove_actions(xe);
+ if (err)
return err;
- }
err = xe_pm_init(xe);
if (err)
--
2.48.1
next prev parent reply other threads:[~2025-02-22 0:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-22 0:10 [PATCH v2 00/11] Cleanup error handling on probe, batch 2 Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 01/11] drivers: base: devres: Allow to release group on device release Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 02/11] drivers: base: devres: Fix find_group() documentation Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 03/11] drivers: base: component: Add debug message for unbind Lucas De Marchi
2025-02-22 7:19 ` Upadhyay, Tejas
2025-02-22 0:10 ` [PATCH v2 04/11] drm/xe: Stop setting drvdata to NULL Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 05/11] drm/xe: Switch from xe to devm actions Lucas De Marchi
2025-02-22 0:10 ` Lucas De Marchi [this message]
2025-02-22 0:10 ` [PATCH v2 07/11] drm/xe/display: Drop xe_display_driver_remove() Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 08/11] drm/xe: Move survivability entirely to xe_pci Lucas De Marchi
2025-02-24 4:40 ` Riana Tauro
2025-02-22 0:10 ` [PATCH v2 09/11] drm/xe: Stop ignoring errors from xe_heci_gsc_init() Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 10/11] drm/xe: Rename update_device_info() after sriov Lucas De Marchi
2025-02-22 0:10 ` [PATCH v2 11/11] drm/xe: Stop ignoring errors from xe_ttm_sys_mgr_init() Lucas De Marchi
2025-02-22 0:16 ` ✓ CI.Patch_applied: success for Cleanup error handling on probe, batch 2 (rev2) Patchwork
2025-02-22 0:17 ` ✗ CI.checkpatch: warning " Patchwork
2025-02-22 0:18 ` ✓ CI.KUnit: success " Patchwork
2025-02-22 0:34 ` ✓ CI.Build: " Patchwork
2025-02-22 0:37 ` ✓ CI.Hooks: " Patchwork
2025-02-22 0:38 ` ✓ CI.checksparse: " Patchwork
2025-02-22 1:04 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-22 14:19 ` ✗ Xe.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250222001051.3012936-7-lucas.demarchi@intel.com \
--to=lucas.demarchi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox