[Linux-kernel-mentees] [RFC PATCH v5 23/23] PCI: Remove struct pcie_link_state

Saheed O. Bolarinwa refactormyself at gmail.com
Sat Aug 22 20:03:58 UTC 2020


 - Remove free_link_state() and all calls to it
 - Remove pci_dev.link_state
 - Remove remaining referenced to struct pcie_link_state
 - Remove struct pcie_link_state

Signed-off-by: Saheed O. Bolarinwa <refactormyself at gmail.com>
---
 drivers/pci/pcie/aspm.c | 15 +--------------
 include/linux/pci.h     |  2 --
 2 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 2fc2b958e6d2..0330b10faa29 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -41,9 +41,6 @@
 #define ASPM_STATE_ALL		(ASPM_STATE_L0S | ASPM_STATE_L1 |	\
 				 ASPM_STATE_L1SS)
 
-struct pcie_link_state {
-};
-
 static int aspm_disabled, aspm_force;
 static bool aspm_support_enabled = true;
 static DEFINE_MUTEX(aspm_lock);
@@ -722,12 +719,6 @@ static void pcie_config_aspm_path(struct pci_dev *pdev)
 	}
 }
 
-static void free_link_state(struct pci_dev *pdev)
-{
-	pdev->link_state = NULL;
-	kfree(pdev->link_state);
-}
-
 static int pcie_aspm_sanity_check(struct pci_dev *pdev)
 {
 	struct pci_dev *child;
@@ -913,8 +904,6 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
 	/* All functions are removed, so just disable ASPM for the link */
 	pcie_config_aspm_link(parent, 0);
 	list_del(&parent->sibling);
-	/* Clock PM is for endpoint device */
-	free_link_state(parent);
 
 	/* Recheck latencies and configure upstream links */
 	if (parent->parent) {
@@ -945,9 +934,7 @@ void pcie_aspm_pm_state_change(struct pci_dev *pdev)
 
 void pcie_aspm_powersave_config_link(struct pci_dev *pdev)
 {
-	struct pcie_link_state *link = pdev->link_state;
-
-	if (aspm_disabled || !link)
+	if (aspm_disabled || !pdev)
 		return;
 
 	if (aspm_policy != POLICY_POWERSAVE &&
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 1daf5fe0b913..b0742ee8ebd2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -300,7 +300,6 @@ struct pci_cap_saved_state {
 };
 
 struct irq_affinity;
-struct pcie_link_state;
 struct pci_vpd;
 struct pci_sriov;
 struct pci_p2pdma;
@@ -383,7 +382,6 @@ struct pci_dev {
 	u32		lnkcap;		/* Link Capabilities */
 
 #ifdef CONFIG_PCIEASPM
-	struct pcie_link_state	*link_state;	/* ASPM link state */
 	unsigned int	ltr_path:1;	/* Latency Tolerance Reporting
 					   supported from root to here */
 	int		l1ss_cap_ptr;	/* L1SS cap ptr, 0 if not supported */
-- 
2.18.4



More information about the Linux-kernel-mentees mailing list