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

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


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

Signed-off-by: Saheed O. Bolarinwa <refactormyself at gmail.com>
---
 drivers/pci/pcie/aspm.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 244b28534e7f..dd21c17296d7 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -43,7 +43,6 @@
 
 struct pcie_link_state {
 	struct pci_dev *pdev;		/* Upstream component of the Link */
-	struct pci_dev *downstream;	/* Downstream component, function 0 */
 };
 
 static int aspm_disabled, aspm_force;
@@ -419,7 +418,7 @@ static void aspm_calc_l1ss_ctl_values(struct pci_dev *pdev,
 	struct pcie_link_state *link = pdev->link_state;
 	u32 val1, val2, scale1, scale2;
 	u32 t_common_mode, t_power_on, l1_2_threshold, scale, value;
-	struct pci_dev *dw_pdev = link->downstream;
+	struct pci_dev *dw_pdev = link->pdev->downstream;
 	struct pci_dev *up_pdev = link->pdev;
 
 	if (!(link->pdev->aspm_support & ASPM_STATE_L1_2_MASK))
@@ -471,7 +470,7 @@ static u32 get_aspm_enable(struct pci_dev *pdev)
 static void pcie_aspm_cap_init(struct pci_dev *pdev, int blacklist)
 {
 	struct pcie_link_state *link = pdev->link_state;
-	struct pci_dev *child = link->downstream, *parent = link->pdev;
+	struct pci_dev *child = link->pdev->downstream, *parent = link->pdev;
 	struct pci_bus *linkbus = parent->subordinate;
 	u32 up_l1ss_ctl1, dw_l1ss_ctl1;
 
@@ -595,7 +594,7 @@ static void pcie_config_aspm_l1ss(struct pci_dev *pdev, u32 state)
 {
 	struct pcie_link_state *link = pdev->link_state;
 	u32 val, enable_req, ctl1, ctl2;
-	struct pci_dev *child = link->downstream, *parent = link->pdev;
+	struct pci_dev *child = link->pdev->downstream, *parent = link->pdev;
 	int up_cap_ptr = parent->l1ss_cap_ptr;
 	int dw_cap_ptr = child->l1ss_cap_ptr;
 
@@ -679,7 +678,7 @@ static void pcie_config_aspm_link(struct pci_dev *pdev, u32 state)
 {
 	struct pcie_link_state *link = pdev->link_state;
 	u32 upstream = 0, dwstream = 0;
-	struct pci_dev *child = link->downstream, *parent = link->pdev;
+	struct pci_dev *child = link->pdev->downstream, *parent = link->pdev;
 	struct pci_bus *linkbus = parent->subordinate;
 
 	/* Enable only the states that were not explicitly disabled */
@@ -786,7 +785,6 @@ static int alloc_pcie_link_state(struct pci_dev *pdev)
 
 	INIT_LIST_HEAD(&pdev->sibling);
 	link->pdev = pdev;
-	link->downstream = pci_function_0(pdev->subordinate);
 	pdev->downstream = pci_function_0(pdev->subordinate);
 
 	/*
-- 
2.18.4



More information about the Linux-kernel-mentees mailing list