Skip to contentSkip to conversation

PCI/ASPM: Simplify pcie_capability_clear_and_set_word() to ..._clear_word()

PATCH In review Ilpo Järvinen 2 participants 3 messages Oct 26, 2023 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 PCI/ASPM: Simplify pcie_capability_clear_and_set_word() to ..._clear_word()

When set parameter is 0, pcie_capability_clear_and_set_word() can be turned into pcie_capability_clear_word() which makes the intent of the code slightly more obvious.

---
 drivers/pci/pcie/aspm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/pcie/aspm.c +4 -4
index 1bf630059264..3b0508b47472 100644
@@ -689,10 +689,10 @@ static void pcie_config_aspm_l1ss(struct pcie_link_state *link, u32 state)
 	 * in pcie_config_aspm_link().
 	 */
 	if (enable_req & (ASPM_STATE_L1_1 | ASPM_STATE_L1_2)) {
-		pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL,
-						   PCI_EXP_LNKCTL_ASPM_L1, 0);
-		pcie_capability_clear_and_set_word(parent, PCI_EXP_LNKCTL,
-						   PCI_EXP_LNKCTL_ASPM_L1, 0);
+		pcie_capability_clear_word(child, PCI_EXP_LNKCTL,
+					   PCI_EXP_LNKCTL_ASPM_L1);
+		pcie_capability_clear_word(parent, PCI_EXP_LNKCTL,
+					   PCI_EXP_LNKCTL_ASPM_L1);
 	}
 
 	val = 0;
Signature · 1 line
2.30.2
#1 lore raw

PATCH 2/2 PCI: Simplify pcie_capability_clear_and_set_word() to ..._clear_word()

When set parameter is 0, pcie_capability_clear_and_set_word() can be turned into pcie_capability_clear_word() which makes the intent of the code slightly more obvious.

---
 drivers/pci/quirks.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/quirks.c +3 -3
index eeec1d6f9023..180d01141e50 100644
@@ -4553,9 +4553,9 @@ static void quirk_disable_root_port_attributes(struct pci_dev *pdev)
 
 	pci_info(root_port, "Disabling No Snoop/Relaxed Ordering Attributes to avoid PCIe Completion erratum in %s\n",
 		 dev_name(&pdev->dev));
-	pcie_capability_clear_and_set_word(root_port, PCI_EXP_DEVCTL,
-					   PCI_EXP_DEVCTL_RELAX_EN |
-					   PCI_EXP_DEVCTL_NOSNOOP_EN, 0);
+	pcie_capability_clear_word(root_port, PCI_EXP_DEVCTL,
+				   PCI_EXP_DEVCTL_RELAX_EN |
+				   PCI_EXP_DEVCTL_NOSNOOP_EN);
 }
 
 /*
Signature · 1 line
2.30.2
#2 lore raw
In reply to Ilpo Järvinen
Quoted 5 lines · Ilpo Järvinen

When set parameter is 0, pcie_capability_clear_and_set_word() can be turned into pcie_capability_clear_word() which makes the intent of the code slightly more obvious.

Squashed and applied to pci/misc for v6.7, thanks!

Quoted 26 lines
---
 drivers/pci/pcie/aspm.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/pci/pcie/aspm.c +4 -4
index 1bf630059264..3b0508b47472 100644
@@ -689,10 +689,10 @@ static void pcie_config_aspm_l1ss(struct pcie_link_state *link, u32 state)
 	 * in pcie_config_aspm_link().
 	 */
 	if (enable_req & (ASPM_STATE_L1_1 | ASPM_STATE_L1_2)) {
-		pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL,
-						   PCI_EXP_LNKCTL_ASPM_L1, 0);
-		pcie_capability_clear_and_set_word(parent, PCI_EXP_LNKCTL,
-						   PCI_EXP_LNKCTL_ASPM_L1, 0);
+		pcie_capability_clear_word(child, PCI_EXP_LNKCTL,
+					   PCI_EXP_LNKCTL_ASPM_L1);
+		pcie_capability_clear_word(parent, PCI_EXP_LNKCTL,
+					   PCI_EXP_LNKCTL_ASPM_L1);
 	}
 
 	val = 0;
Signature · 1 line
2.30.2