Skip to content

Commit 23dc14c

Browse files
axiqiagregkh
authored andcommitted
dmaengine: idxd: Refactor remove call with idxd_cleanup() helper
commit a409e91 upstream. The idxd_cleanup() helper cleans up perfmon, interrupts, internals and so on. Refactor remove call with the idxd_cleanup() helper to avoid code duplication. Note, this also fixes the missing put_device() for idxd groups, enginces and wqs. Fixes: bfe1d56 ("dmaengine: idxd: Init and probe for Intel data accelerators") Cc: [email protected] Suggested-by: Vinicius Costa Gomes <[email protected]> Signed-off-by: Shuai Xue <[email protected]> Reviewed-by: Fenghua Yu <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 017d401 commit 23dc14c

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

drivers/dma/idxd/init.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,6 @@ static void idxd_shutdown(struct pci_dev *pdev)
905905
static void idxd_remove(struct pci_dev *pdev)
906906
{
907907
struct idxd_device *idxd = pci_get_drvdata(pdev);
908-
struct idxd_irq_entry *irq_entry;
909908

910909
idxd_unregister_devices(idxd);
911910
/*
@@ -918,21 +917,12 @@ static void idxd_remove(struct pci_dev *pdev)
918917
get_device(idxd_confdev(idxd));
919918
device_unregister(idxd_confdev(idxd));
920919
idxd_shutdown(pdev);
921-
if (device_pasid_enabled(idxd))
922-
idxd_disable_system_pasid(idxd);
923920
idxd_device_remove_debugfs(idxd);
924-
925-
irq_entry = idxd_get_ie(idxd, 0);
926-
free_irq(irq_entry->vector, irq_entry);
927-
pci_free_irq_vectors(pdev);
921+
idxd_cleanup(idxd);
928922
pci_iounmap(pdev, idxd->reg_base);
929-
if (device_user_pasid_enabled(idxd))
930-
idxd_disable_sva(pdev);
931-
pci_disable_device(pdev);
932-
destroy_workqueue(idxd->wq);
933-
perfmon_pmu_remove(idxd);
934923
put_device(idxd_confdev(idxd));
935924
idxd_free(idxd);
925+
pci_disable_device(pdev);
936926
}
937927

938928
static struct pci_driver idxd_pci_driver = {

0 commit comments

Comments
 (0)