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

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


 - Remove initiations of pcie_link_state.parent
 - Replace all access to pcie_link_state.parent with pci_pdev.parent
 - Remove pcie_link_state.parent

Signed-off-by: Saheed O. Bolarinwa <refactormyself at gmail.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 8d5a38081753..14b9da0a4efd 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -45,7 +45,6 @@ struct pcie_link_state {
 	struct pci_dev *pdev;		/* Upstream component of the Link */
 	struct pci_dev *downstream;	/* Downstream component, function 0 */
 	struct pcie_link_state *root;	/* pointer to the root port link */
-	struct pcie_link_state *parent;	/* pointer to the parent Link state */
 };
 
 static int aspm_disabled, aspm_force;
@@ -396,7 +395,6 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint)
 
 		l1_switch_latency += 1000;
 
-		link = link->parent;
 		pdev = pdev->parent;
 	}
 }
@@ -813,8 +811,7 @@ static int alloc_pcie_link_state(struct pci_dev *pdev)
 			return -1;
 		}
 
-		link->parent = parent;
-		link->root = link->parent->root;
+		link->root = link->pdev->parent->link_state->root;
 		pdev->parent = pdev->bus->parent->self;
 		pdev->root = pdev->parent->root;
 	}
@@ -948,7 +945,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
 
 	link = parent->link_state;
 	root = link->root;
-	parent_link = link->parent;
+	parent_link = link->pdev->parent->link_state;
 
 	/* All functions are removed, so just disable ASPM for the link */
 	pcie_config_aspm_link(parent, 0);
-- 
2.18.4



More information about the Linux-kernel-mentees mailing list