2021-11-06 21:37:34

by Saheed O. Bolarinwa

[permalink] [raw]
Subject: [RFC PATCH v2 0/3] Remove struct pcie_link_state.clkpm_*

These series removes the Clock PM members of the
struct pcie_link_state. Another member is introduced to mark
devices that the kernel has disbled.

VERSION CHANGES:
- v2:
- clkpm_default and clkpm_disable are now left out.
- improve pcie_is_clkpm_capable() based on review.
- replace pcie_get_clkpm_state() with pcie_clkpm_enabled().

MERGE NOTICE:
These series are based on
ยป 'commit e4e737bb5c17 ("Linux 5.15-rc2")'

Saheed O. Bolarinwa (3):
PCI/ASPM: Merge pcie_set_clkpm_nocheck() into pcie_set_clkpm()
PCI/ASPM: Remove struct pcie_link_state.clkpm_capable
PCI/ASPM: Remove struct pcie_link_state.clkpm_enabled

drivers/pci/pcie/aspm.c | 82 +++++++++++++++++++++--------------------
1 file changed, 42 insertions(+), 40 deletions(-)

--
2.20.1


2021-11-06 21:39:24

by Saheed O. Bolarinwa

[permalink] [raw]
Subject: [RFC PATCH v2 1/3] PCI/ASPM: Merge pcie_set_clkpm_nocheck() into pcie_set_clkpm()

pcie_set_clkpm_nocheck() is only called from pcie_set_clkpm().

Merge the two functions

Signed-off-by: Saheed O. Bolarinwa <[email protected]>
---
drivers/pci/pcie/aspm.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 013a47f587ce..e5202cc16ef0 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -139,21 +139,12 @@ static int policy_to_clkpm_state(struct pcie_link_state *link)
return 0;
}

-static void pcie_set_clkpm_nocheck(struct pcie_link_state *link, int enable)
+static void pcie_set_clkpm(struct pcie_link_state *link, int enable)
{
+ u32 val;
struct pci_dev *child;
struct pci_bus *linkbus = link->pdev->subordinate;
- u32 val = enable ? PCI_EXP_LNKCTL_CLKREQ_EN : 0;
-
- list_for_each_entry(child, &linkbus->devices, bus_list)
- 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)
-{
/*
* Don't enable Clock PM if the link is not Clock PM capable
* or Clock PM is disabled
@@ -163,7 +154,14 @@ static void pcie_set_clkpm(struct pcie_link_state *link, int enable)
/* Need nothing if the specified equals to current state */
if (link->clkpm_enabled == enable)
return;
- pcie_set_clkpm_nocheck(link, enable);
+
+ val = enable ? PCI_EXP_LNKCTL_CLKREQ_EN : 0;
+ list_for_each_entry(child, &linkbus->devices, bus_list)
+ pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL,
+ PCI_EXP_LNKCTL_CLKREQ_EN,
+ val);
+
+ link->clkpm_enabled = !!enable;
}

static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist)
--
2.20.1