From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Alex Bennée" <alex.bennee@linaro.org>,
"Simon Richter" <Simon.Richter@hogyros.de>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"Alex Deucher" <alexander.deucher@amd.com>,
amd-gfx@lists.freedesktop.org,
"Bjorn Helgaas" <bhelgaas@google.com>,
"David Airlie" <airlied@gmail.com>,
dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
intel-xe@lists.freedesktop.org,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
linux-pci@vger.kernel.org,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Tvrtko Ursulin" <tursulin@ursulin.net>,
"Christian König" <christian.koenig@amd.com>,
"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Michał Winiarski" <michal.winiarski@intel.com>,
linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH v2 03/11] PCI: Change pci_dev variable from 'bridge' to 'dev'
Date: Thu, 13 Nov 2025 18:26:20 +0200 [thread overview]
Message-ID: <20251113162628.5946-4-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20251113162628.5946-1-ilpo.jarvinen@linux.intel.com>
Upcoming fix to BAR resize will store also device BAR resource in 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 represents the intention of the check compared with the
old code where bridge variable was reused for a different purpose.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.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
next prev parent reply other threads:[~2025-11-13 16:27 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-13 16:26 [PATCH v2 00/11] PCI: BAR resizing fix/rework Ilpo Järvinen
2025-11-13 16:26 ` [PATCH v2 01/11] PCI: Prevent resource tree corruption when BAR resize fails Ilpo Järvinen
2025-11-13 16:26 ` [PATCH v2 02/11] PCI/IOV: Adjust ->barsz[] when changing BAR size Ilpo Järvinen
2025-11-13 16:26 ` Ilpo Järvinen [this message]
2025-11-14 14:35 ` [PATCH v2 03/11] PCI: Change pci_dev variable from 'bridge' to 'dev' Alex Bennée
2025-11-13 16:26 ` [PATCH v2 04/11] PCI: Try BAR resize even when no window was released Ilpo Järvinen
2025-11-13 16:26 ` [PATCH v2 05/11] PCI: Freeing saved list does not require holding pci_bus_sem Ilpo Järvinen
2025-11-13 16:26 ` [PATCH v2 06/11] PCI: Fix restoring BARs on BAR resize rollback path Ilpo Järvinen
2025-11-13 16:46 ` Ilpo Järvinen
2025-11-13 21:01 ` Bjorn Helgaas
2025-11-14 9:34 ` Christian König
2026-01-20 21:17 ` Ville Syrjälä
2026-01-21 10:02 ` Ilpo Järvinen
2025-11-13 16:26 ` [PATCH v2 07/11] PCI: Add kerneldoc for pci_resize_resource() Ilpo Järvinen
2025-11-13 16:26 ` [PATCH v2 08/11] drm/xe: Remove driver side BAR release before resize Ilpo Järvinen
2025-11-14 13:10 ` Alex Bennée
2025-11-14 13:16 ` Ilpo Järvinen
2025-11-14 15:58 ` Lucas De Marchi
2025-11-13 16:26 ` [PATCH v2 09/11] drm/i915: " Ilpo Järvinen
2025-11-14 15:55 ` Lucas De Marchi
2025-11-13 16:26 ` [PATCH v2 10/11] drm/amdgpu: " Ilpo Järvinen
2025-11-13 16:26 ` [PATCH v2 11/11] PCI: Prevent restoring assigned resources Ilpo Järvinen
2025-11-13 17:16 ` [PATCH v2 00/11] PCI: BAR resizing fix/rework Bjorn Helgaas
2025-11-14 9:30 ` Alex Bennée
2025-11-14 18:27 ` Bjorn Helgaas
2025-11-14 12:06 ` Alex Bennée
2025-11-14 12:48 ` Ilpo Järvinen
2025-11-14 14:08 ` Alex Bennée
2025-11-14 18:35 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251113162628.5946-4-ilpo.jarvinen@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=Simon.Richter@hogyros.de \
--cc=airlied@gmail.com \
--cc=alex.bennee@linaro.org \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=michal.winiarski@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--cc=thomas.hellstrom@linux.intel.com \
--cc=tursulin@ursulin.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox