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: <20210929004400.25717-4-refactormyself@gmail.com>
Date:   Wed, 29 Sep 2021 02:43:59 +0200
From:   "Saheed O. Bolarinwa" <refactormyself@...il.com>
To:     helgaas@...nel.org
Cc:     "Bolarinwa O. Saheed" <refactormyself@...il.com>,
        linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [RFC PATCH v1 3/4] PCI/ASPM: Remove struct pcie_link_state.clkpm_enabled

From: "Bolarinwa O. Saheed" <refactormyself@...il.com>

The clkpm_enabled member of the struct pcie_link_state stores the
current Clock PM state for the device. However, when the state changes
it is persisted and can be retrieve by calling pcie_get_clkpm_state()
introduced in patch [1/3] in this series.

This patch:
   - removes clkpm_enabled from the struct pcie_link_state
   - removes all instance where clkpm_enable is set
   - replaces references to clkpm_enabled with a call to
     pcie_get_clkpm_state()

Signed-off-by: Bolarinwa O. Saheed <refactormyself@...il.com>
---
 drivers/pci/pcie/aspm.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 9e65da9a22dd..368828cd427d 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -61,7 +61,6 @@ struct pcie_link_state {
 	u32 aspm_disable:7;		/* Disabled ASPM state */
 
 	/* Clock PM state */
-	u32 clkpm_enabled:1;		/* Current Clock PM state */
 	u32 clkpm_disable:1;		/* Clock PM disabled */
 
 	/* Exit latencies */
@@ -190,7 +189,6 @@ static void pcie_set_clkpm_nocheck(struct pcie_link_state *link, int enable)
 		pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL,
 						   PCI_EXP_LNKCTL_CLKREQ_EN,
 						   val);
-	link->clkpm_enabled = !!enable;
 }
 
 static void pcie_set_clkpm(struct pcie_link_state *link, int enable)
@@ -203,14 +201,13 @@ static void pcie_set_clkpm(struct pcie_link_state *link, int enable)
 	if (!capable || link->clkpm_disable)
 		enable = 0;
 	/* Need nothing if the specified equals to current state */
-	if (link->clkpm_enabled == enable)
+	if (pcie_get_clkpm_state(link->pdev) == enable)
 		return;
 	pcie_set_clkpm_nocheck(link, enable);
 }
 
 static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist)
 {
-	link->clkpm_enabled = pcie_get_clkpm_state(link->pdev);
 	link->clkpm_disable = blacklist ? 1 : 0;
 }
 
@@ -1287,7 +1284,7 @@ static ssize_t clkpm_show(struct device *dev,
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct pcie_link_state *link = pcie_aspm_get_link(pdev);
 
-	return sysfs_emit(buf, "%d\n", link->clkpm_enabled);
+	return sysfs_emit(buf, "%d\n", pcie_get_clkpm_state(link->pdev));
 }
 
 static ssize_t clkpm_store(struct device *dev,
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ