Skip to content

Commit d01bdc0

Browse files
committed
drm/xe: Drop remove callback support
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> Link: https://patchwork.freedesktop.org/patch/msgid/20250222001051.3012936-7-lucas.demarchi@intel.com Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
1 parent 01b1ace commit d01bdc0

File tree

4 files changed

+1
-88
lines changed

4 files changed

+1
-88
lines changed

drivers/gpu/drm/xe/xe_device.c

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,6 @@
6565

6666
#include <generated/xe_wa_oob.h>
6767

68-
struct xe_device_remove_action {
69-
struct list_head node;
70-
void (*action)(void *);
71-
void *data;
72-
};
73-
7468
static int xe_file_open(struct drm_device *dev, struct drm_file *file)
7569
{
7670
struct xe_device *xe = to_xe_device(dev);
@@ -752,9 +746,6 @@ int xe_device_probe(struct xe_device *xe)
752746
int err;
753747
u8 id;
754748

755-
xe->probing = true;
756-
INIT_LIST_HEAD(&xe->remove_action_list);
757-
758749
xe_pat_init_early(xe);
759750

760751
err = xe_sriov_init(xe);
@@ -904,8 +895,6 @@ int xe_device_probe(struct xe_device *xe)
904895

905896
xe_vsec_init(xe);
906897

907-
xe->probing = false;
908-
909898
return devm_add_action_or_reset(xe->drm.dev, xe_device_sanitize, xe);
910899

911900
err_unregister_display:
@@ -916,61 +905,6 @@ int xe_device_probe(struct xe_device *xe)
916905
return err;
917906
}
918907

919-
/**
920-
* xe_device_call_remove_actions - Call the remove actions
921-
* @xe: xe device instance
922-
*
923-
* This is only to be used by xe_pci and xe_device to call the remove actions
924-
* while removing the driver or handling probe failures.
925-
*/
926-
void xe_device_call_remove_actions(struct xe_device *xe)
927-
{
928-
struct xe_device_remove_action *ra, *tmp;
929-
930-
list_for_each_entry_safe(ra, tmp, &xe->remove_action_list, node) {
931-
ra->action(ra->data);
932-
list_del(&ra->node);
933-
kfree(ra);
934-
}
935-
936-
xe->probing = false;
937-
}
938-
939-
/**
940-
* xe_device_add_action_or_reset - Add an action to run on driver removal
941-
* @xe: xe device instance
942-
* @action: Function that should be called on device remove
943-
* @data: Pointer to data passed to @action implementation
944-
*
945-
* This adds a custom action to the list of remove callbacks executed on device
946-
* remove, before any dev or drm managed resources are removed. This is only
947-
* needed if the action leads to component_del()/component_master_del() since
948-
* that is not compatible with devres cleanup.
949-
*
950-
* Returns: 0 on success or a negative error code on failure, in which case
951-
* @action is already called.
952-
*/
953-
int xe_device_add_action_or_reset(struct xe_device *xe,
954-
void (*action)(void *), void *data)
955-
{
956-
struct xe_device_remove_action *ra;
957-
958-
drm_WARN_ON(&xe->drm, !xe->probing);
959-
960-
ra = kmalloc(sizeof(*ra), GFP_KERNEL);
961-
if (!ra) {
962-
action(data);
963-
return -ENOMEM;
964-
}
965-
966-
INIT_LIST_HEAD(&ra->node);
967-
ra->action = action;
968-
ra->data = data;
969-
list_add(&ra->node, &xe->remove_action_list);
970-
971-
return 0;
972-
}
973-
974908
void xe_device_remove(struct xe_device *xe)
975909
{
976910
xe_display_unregister(xe);
@@ -980,8 +914,6 @@ void xe_device_remove(struct xe_device *xe)
980914
xe_display_driver_remove(xe);
981915

982916
xe_heci_gsc_fini(xe);
983-
984-
xe_device_call_remove_actions(xe);
985917
}
986918

987919
void xe_device_shutdown(struct xe_device *xe)

drivers/gpu/drm/xe/xe_device.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ struct xe_device *xe_device_create(struct pci_dev *pdev,
4545
const struct pci_device_id *ent);
4646
int xe_device_probe_early(struct xe_device *xe);
4747
int xe_device_probe(struct xe_device *xe);
48-
int xe_device_add_action_or_reset(struct xe_device *xe,
49-
void (*action)(void *), void *data);
50-
void xe_device_call_remove_actions(struct xe_device *xe);
5148
void xe_device_remove(struct xe_device *xe);
5249
void xe_device_shutdown(struct xe_device *xe);
5350

drivers/gpu/drm/xe/xe_device_types.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -428,20 +428,6 @@ struct xe_device {
428428
/** @tiles: device tiles */
429429
struct xe_tile tiles[XE_MAX_TILES_PER_DEVICE];
430430

431-
/**
432-
* @remove_action_list: list of actions to execute on device remove.
433-
* Use xe_device_add_remove_action() for that. Actions can only be added
434-
* during probe and are executed during the call from PCI subsystem to
435-
* remove the driver from the device.
436-
*/
437-
struct list_head remove_action_list;
438-
439-
/**
440-
* @probing: cover the section in which @remove_action_list can be used
441-
* to post cleaning actions
442-
*/
443-
bool probing;
444-
445431
/**
446432
* @mem_access: keep track of memory access in the device, possibly
447433
* triggering additional actions when they occur.

drivers/gpu/drm/xe/xe_pci.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,10 +895,8 @@ static int xe_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
895895
return err;
896896

897897
err = xe_device_probe(xe);
898-
if (err) {
899-
xe_device_call_remove_actions(xe);
898+
if (err)
900899
return err;
901-
}
902900

903901
err = xe_pm_init(xe);
904902
if (err)

0 commit comments

Comments
 (0)