Skip to content

Commit a409e91

Browse files
axiqiavinodkoul
authored andcommitted
dmaengine: idxd: Refactor remove call with idxd_cleanup() helper
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]>
1 parent d5449ff commit a409e91

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
@@ -1308,7 +1308,6 @@ static void idxd_shutdown(struct pci_dev *pdev)
13081308
static void idxd_remove(struct pci_dev *pdev)
13091309
{
13101310
struct idxd_device *idxd = pci_get_drvdata(pdev);
1311-
struct idxd_irq_entry *irq_entry;
13121311

13131312
idxd_unregister_devices(idxd);
13141313
/*
@@ -1321,21 +1320,12 @@ static void idxd_remove(struct pci_dev *pdev)
13211320
get_device(idxd_confdev(idxd));
13221321
device_unregister(idxd_confdev(idxd));
13231322
idxd_shutdown(pdev);
1324-
if (device_pasid_enabled(idxd))
1325-
idxd_disable_system_pasid(idxd);
13261323
idxd_device_remove_debugfs(idxd);
1327-
1328-
irq_entry = idxd_get_ie(idxd, 0);
1329-
free_irq(irq_entry->vector, irq_entry);
1330-
pci_free_irq_vectors(pdev);
1324+
idxd_cleanup(idxd);
13311325
pci_iounmap(pdev, idxd->reg_base);
1332-
if (device_user_pasid_enabled(idxd))
1333-
idxd_disable_sva(pdev);
1334-
pci_disable_device(pdev);
1335-
destroy_workqueue(idxd->wq);
1336-
perfmon_pmu_remove(idxd);
13371326
put_device(idxd_confdev(idxd));
13381327
idxd_free(idxd);
1328+
pci_disable_device(pdev);
13391329
}
13401330

13411331
static struct pci_driver idxd_pci_driver = {

0 commit comments

Comments
 (0)