From patchwork Sat Feb 15 05:44:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuai Xue X-Patchwork-Id: 13975954 Received: from out30-119.freemail.mail.aliyun.com (out30-119.freemail.mail.aliyun.com [115.124.30.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4342F1885B8; Sat, 15 Feb 2025 05:44:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.119 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739598283; cv=none; b=QkyxA9CMi25OU1+5DHvWmZ8wUBl+0pOLG38bpME7SMEBeavda7ZeRnmYwLnnDZLxtrEWIkEdYnlHvSsTrCbBi+YlKYMLBSqvRCBGjo62AoJIcgK998OVrhW6CCyY3xhUZr9V5XbGdPnfLvDVRkTE6lu65ZZAotNL+t6EiUYYXhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739598283; c=relaxed/simple; bh=cJA4KfJMcaxH+0TnGhLHjE1Vg4xal9BE0r8mnGst23Y=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rPF39FHX/z/wnmLoSHrbw3p9xcvoS945A6ZCZjqGMquKv++hGF6nFrKLJSU/PjzuNvtxGPlU6XkEH6Y9x1RTr7k54JhV5la91iCjGdEVsfRd2sCEsZC6N1DXc/iUqAZCDPCdXGfrSvU2jeCSXjm/D9Mgtps2iIRp3cxfQ/fiaho= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=YPcFI704; arc=none smtp.client-ip=115.124.30.119 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="YPcFI704" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1739598277; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=v12LeWPu6e0WL/LjRIaAjzQvV7k89DRLKSi3Y5y47eU=; b=YPcFI704tFD+2lpggMKaRd71IaPlPzjEBgGd6eb20HaCFJZTaz0HlCHYxc12jjFvKi02z/S3HdmT4IB3JooqMxRVcSBzryMTEEH8JJ1W964rUa9tzRZdXUngi6NEtG8WLy4Z/FHSBDTS4vHzzLGPtuI2imJ6uHd3wfyOdQgv5Fk= Received: from localhost.localdomain(mailfrom:xueshuai@linux.alibaba.com fp:SMTPD_---0WPSysOT_1739598276 cluster:ay36) by smtp.aliyun-inc.com; Sat, 15 Feb 2025 13:44:37 +0800 From: Shuai Xue To: vinicius.gomes@intel.com, dave.jiang@intel.com, vkoul@kernel.org Cc: nikhil.rao@intel.com, xueshuai@linux.alibaba.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 7/7] dmaengine: idxd: Refactor remove call with idxd_cleanup() helper Date: Sat, 15 Feb 2025 13:44:31 +0800 Message-ID: <20250215054431.55747-8-xueshuai@linux.alibaba.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250215054431.55747-1-xueshuai@linux.alibaba.com> References: <20250215054431.55747-1-xueshuai@linux.alibaba.com> Precedence: bulk X-Mailing-List: dmaengine@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The idxd_cleanup() helper clean up perfmon, interrupts, internals and so on. Refactor remove call with 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") Suggested-by: Vinicius Costa Gomes Signed-off-by: Shuai Xue --- drivers/dma/idxd/init.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c index f40f1c44a302..0fbfbe024c29 100644 --- a/drivers/dma/idxd/init.c +++ b/drivers/dma/idxd/init.c @@ -1282,20 +1282,11 @@ static void idxd_remove(struct pci_dev *pdev) get_device(idxd_confdev(idxd)); device_unregister(idxd_confdev(idxd)); idxd_shutdown(pdev); - if (device_pasid_enabled(idxd)) - idxd_disable_system_pasid(idxd); idxd_device_remove_debugfs(idxd); - - irq_entry = idxd_get_ie(idxd, 0); - free_irq(irq_entry->vector, irq_entry); - pci_free_irq_vectors(pdev); + idxd_cleanup(idxd); pci_iounmap(pdev, idxd->reg_base); - if (device_user_pasid_enabled(idxd)) - idxd_disable_sva(pdev); - pci_disable_device(pdev); - destroy_workqueue(idxd->wq); - perfmon_pmu_remove(idxd); idxd_free(idxd); + pci_disable_device(pdev); } static struct pci_driver idxd_pci_driver = {