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: bfe1d56091c1 ("dmaengine: idxd: Init and probe for Intel data accelerators")
Cc: stable@vger.kernel.org
Suggested-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
Reviewed-by: Fenghua Yu <fenghuay@nvidia.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/20250404120217.48772-10-xueshuai@linux.alibaba.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by Shuai Xue and committed by Vinod Koul a409e919 d5449ff1

+2 -12
+2 -12
drivers/dma/idxd/init.c
··· 1308 1308 static void idxd_remove(struct pci_dev *pdev) 1309 1309 { 1310 1310 struct idxd_device *idxd = pci_get_drvdata(pdev); 1311 - struct idxd_irq_entry *irq_entry; 1312 1311 1313 1312 idxd_unregister_devices(idxd); 1314 1313 /* ··· 1320 1321 get_device(idxd_confdev(idxd)); 1321 1322 device_unregister(idxd_confdev(idxd)); 1322 1323 idxd_shutdown(pdev); 1323 - if (device_pasid_enabled(idxd)) 1324 - idxd_disable_system_pasid(idxd); 1325 1324 idxd_device_remove_debugfs(idxd); 1326 - 1327 - irq_entry = idxd_get_ie(idxd, 0); 1328 - free_irq(irq_entry->vector, irq_entry); 1329 - pci_free_irq_vectors(pdev); 1325 + idxd_cleanup(idxd); 1330 1326 pci_iounmap(pdev, idxd->reg_base); 1331 - if (device_user_pasid_enabled(idxd)) 1332 - idxd_disable_sva(pdev); 1333 - pci_disable_device(pdev); 1334 - destroy_workqueue(idxd->wq); 1335 - perfmon_pmu_remove(idxd); 1336 1327 put_device(idxd_confdev(idxd)); 1337 1328 idxd_free(idxd); 1329 + pci_disable_device(pdev); 1338 1330 } 1339 1331 1340 1332 static struct pci_driver idxd_pci_driver = {