[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251028173551.22578-4-ilpo.jarvinen@linux.intel.com>
Date: Tue, 28 Oct 2025 19:35:45 +0200
From: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
To: Alex Bennée <alex.bennee@...aro.org>,
Simon Richter <Simon.Richter@...yros.de>,
Lucas De Marchi <lucas.demarchi@...el.com>,
Alex Deucher <alexander.deucher@....com>,
amd-gfx@...ts.freedesktop.org,
Bjorn Helgaas <bhelgaas@...gle.com>,
David Airlie <airlied@...il.com>,
dri-devel@...ts.freedesktop.org,
intel-gfx@...ts.freedesktop.org,
intel-xe@...ts.freedesktop.org,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
linux-pci@...r.kernel.org,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Simona Vetter <simona@...ll.ch>,
Tvrtko Ursulin <tursulin@...ulin.net>,
Christian König <christian.koenig@....com>,
Thomas Hellström <thomas.hellstrom@...ux.intel.com>,
Michał Winiarski <michal.winiarski@...el.com>,
linux-kernel@...r.kernel.org
Cc: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Subject: [PATCH 3/9] PCI: Change pci_dev variable from 'bridge' to 'dev'
Upcoming fix to BAR resize will store also device BAR resource into the
saved list. Change the pci_dev variable in the loop from 'bridge' to
'dev' as the former would be misleading with non-bridges in the list.
This is in a separate change to reduce churn in the upcoming BAR resize
fix.
While it appears that the logic in the loop doing pci_setup_bridge() is
altered as 'bridge' variable is no longer updated, a bridge should
never appear more than once in the saved list so the if check can only
match to the first entry. As such, the code with two distinct pci_dev
variables better represent the intention of the check compared with the
old code where bridge variable was reused for different purpose.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
---
drivers/pci/setup-bus.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index e6984bb530ae..d58f025aeaff 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -2479,12 +2479,13 @@ int pbus_reassign_bridge_resources(struct pci_bus *bus, struct resource *res)
}
list_for_each_entry(dev_res, &saved, list) {
+ struct pci_dev *dev = dev_res->dev;
+
/* Skip the bridge we just assigned resources for */
- if (bridge == dev_res->dev)
+ if (bridge == dev)
continue;
- bridge = dev_res->dev;
- pci_setup_bridge(bridge->subordinate);
+ pci_setup_bridge(dev->subordinate);
}
free_list(&saved);
@@ -2500,19 +2501,19 @@ int pbus_reassign_bridge_resources(struct pci_bus *bus, struct resource *res)
/* Revert to the old configuration */
list_for_each_entry(dev_res, &saved, list) {
struct resource *res = dev_res->res;
+ struct pci_dev *dev = dev_res->dev;
- bridge = dev_res->dev;
- i = pci_resource_num(bridge, res);
+ i = pci_resource_num(dev, res);
if (res->parent) {
release_child_resources(res);
- pci_release_resource(bridge, i);
+ pci_release_resource(dev, i);
}
restore_dev_resource(dev_res);
- pci_claim_resource(bridge, i);
- pci_setup_bridge(bridge->subordinate);
+ pci_claim_resource(dev, i);
+ pci_setup_bridge(dev->subordinate);
}
free_list(&saved);
up_read(&pci_bus_sem);
--
2.39.5
Powered by blists - more mailing lists