lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1593709517-108857-6-git-send-email-kan.liang@linux.intel.com>
Date:   Thu,  2 Jul 2020 10:05:15 -0700
From:   kan.liang@...ux.intel.com
To:     peterz@...radead.org, bhelgaas@...gle.com, mingo@...hat.com,
        linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org
Cc:     jeffrey.t.kirsher@...el.com, olof@...om.net,
        dan.j.williams@...el.com, ak@...ux.intel.com,
        Kan Liang <kan.liang@...ux.intel.com>
Subject: [PATCH 5/7] perf/x86/intel/uncore: Factor out uncore_pci_pmu_unregister()

From: Kan Liang <kan.liang@...ux.intel.com>

The PMU unregistration of a platform device is similar as a PCI device.

Factor out the codes of unregister a PCI PMU into a separate function. The
function will be used later.

There is no functional change.

Signed-off-by: Kan Liang <kan.liang@...ux.intel.com>
---
 arch/x86/events/intel/uncore.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index ccc90b0..b702dc3 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -1118,6 +1118,16 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id
 	return ret;
 }
 
+static void uncore_pci_pmu_unregister(struct intel_uncore_pmu *pmu,
+				      struct intel_uncore_box *box)
+{
+	pmu->boxes[box->dieid] = NULL;
+	if (atomic_dec_return(&pmu->activeboxes) == 0)
+		uncore_pmu_unregister(pmu);
+	uncore_box_exit(box);
+	kfree(box);
+}
+
 static void uncore_pci_remove(struct pci_dev *pdev)
 {
 	struct intel_uncore_box *box;
@@ -1145,11 +1155,8 @@ static void uncore_pci_remove(struct pci_dev *pdev)
 		return;
 
 	pci_set_drvdata(pdev, NULL);
-	pmu->boxes[box->dieid] = NULL;
-	if (atomic_dec_return(&pmu->activeboxes) == 0)
-		uncore_pmu_unregister(pmu);
-	uncore_box_exit(box);
-	kfree(box);
+
+	uncore_pci_pmu_unregister(pmu, box);
 }
 
 static int __init uncore_pci_init(void)
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ