From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 6.18.y 2/8] PCI: Change pci_dev variable from 'bridge' to 'dev'
Date: Tue, 14 Jul 2026 16:02:30 -0400 [thread overview]
Message-ID: <20260714200236.3153778-2-sashal@kernel.org> (raw)
In-Reply-To: <20260714200236.3153778-1-sashal@kernel.org>
From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
[ Upstream commit 34c702ea0497e092a487eacdf28a037f43e3e39f ]
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 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>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Alex Bennée <alex.bennee@linaro.org> # AVA, AMD GPU
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Link: https://patch.msgid.link/20251113162628.5946-4-ilpo.jarvinen@linux.intel.com
Stable-dep-of: ee7471fe968d ("PCI: Skip Resizable BAR restore on read error")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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 522e25d725bad9..ae72a34b09c562 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -2431,12 +2431,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);
@@ -2452,19 +2453,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.53.0
next prev parent reply other threads:[~2026-07-14 20:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 13:23 FAILED: patch "[PATCH] PCI: Skip Resizable BAR restore on read error" failed to apply to 6.18-stable tree gregkh
2026-07-14 20:02 ` [PATCH 6.18.y 1/8] PCI/IOV: Adjust ->barsz[] when changing BAR size Sasha Levin
2026-07-14 20:02 ` Sasha Levin [this message]
2026-07-14 20:02 ` [PATCH 6.18.y 3/8] PCI: Try BAR resize even when no window was released Sasha Levin
2026-07-14 20:02 ` [PATCH 6.18.y 4/8] PCI: Free saved list without holding pci_bus_sem Sasha Levin
2026-07-14 20:02 ` [PATCH 6.18.y 5/8] PCI: Fix restoring BARs on BAR resize rollback path Sasha Levin
2026-07-14 20:02 ` [PATCH 6.18.y 6/8] PCI: Add kerneldoc for pci_resize_resource() Sasha Levin
2026-07-14 20:02 ` [PATCH 6.18.y 7/8] PCI: Move Resizable BAR code to rebar.c Sasha Levin
2026-07-14 20:02 ` [PATCH 6.18.y 8/8] PCI: Skip Resizable BAR restore on read error Sasha Levin
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=20260714200236.3153778-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=alex.bennee@linaro.org \
--cc=bhelgaas@google.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=stable@vger.kernel.org \
/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