From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-pci@vger.kernel.org, "Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"David Matlack" <dmatlack@google.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>, stable@vger.kernel.org
Subject: [PATCH v3 07/17] PCI: Make pci_find_host_bridge() take a const bus
Date: Thu, 26 Nov 2026 01:09:06 +0200 [thread overview]
Message-ID: <20261125230925.2441-8-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20261125230925.2441-1-ilpo.jarvinen@linux.intel.com>
pci_find_host_bridge() only reads the bus hierarchy to find the root
bus. Make it and find_pci_root_bus() take a const struct pci_bus so it
can be used where only a const bus is available.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Cc: stable@vger.kernel.org
---
drivers/pci/host-bridge.c | 8 ++++----
include/linux/pci.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/host-bridge.c b/drivers/pci/host-bridge.c
index be5ef6516cff..33cc7fc3fc88 100644
--- a/drivers/pci/host-bridge.c
+++ b/drivers/pci/host-bridge.c
@@ -9,7 +9,7 @@
#include "pci.h"
-static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
+static const struct pci_bus *find_pci_root_bus(const struct pci_bus *bus)
{
while (bus->parent)
bus = bus->parent;
@@ -17,9 +17,9 @@ static struct pci_bus *find_pci_root_bus(struct pci_bus *bus)
return bus;
}
-struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus)
+struct pci_host_bridge *pci_find_host_bridge(const struct pci_bus *bus)
{
- struct pci_bus *root_bus = find_pci_root_bus(bus);
+ const struct pci_bus *root_bus = find_pci_root_bus(bus);
return to_pci_host_bridge(root_bus->bridge);
}
@@ -27,7 +27,7 @@ EXPORT_SYMBOL_GPL(pci_find_host_bridge);
struct device *pci_get_host_bridge_device(struct pci_dev *dev)
{
- struct pci_bus *root_bus = find_pci_root_bus(dev->bus);
+ const struct pci_bus *root_bus = find_pci_root_bus(dev->bus);
struct device *bridge = root_bus->bridge;
kobject_get(&bridge->kobj);
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d89aeb7c9ff7..d03a2e277013 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -700,7 +700,7 @@ struct pci_host_bridge *devm_pci_alloc_host_bridge(struct device *dev,
size_t priv);
void pci_free_host_bridge(struct pci_host_bridge *bridge);
struct device *pci_get_host_bridge_device(struct pci_dev *dev);
-struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus);
+struct pci_host_bridge *pci_find_host_bridge(const struct pci_bus *bus);
void pci_set_host_bridge_release(struct pci_host_bridge *bridge,
void (*release_fn)(struct pci_host_bridge *),
--
2.47.3
next prev parent reply other threads:[~2026-11-25 23:10 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 23:08 [PATCH v3 00/17] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 01/17] PCI: Add pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 02/17] alpha/PCI: Convert to pci_bus_size_and_assign_resources() Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 03/17] PCI: Use guard() for pci_bus_sem in pci_do_resource_release_and_resize() Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 04/17] PCI: Add pci_assign_unassigned_slot_resources() Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 05/17] PCI: acpiphp: Use pci_assign_unassigned_slot_resources() Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 06/17] PCI: Hold pci_bus_sem across sizing and assignment entrypoints Ilpo Järvinen
2026-11-25 23:09 ` Ilpo Järvinen [this message]
2026-11-25 23:09 ` [PATCH v3 08/17] PCI: Serialize bridge window sizing and resource assignment Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 09/17] PCI: Make internal sizing and assignment functions static Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 10/17] EDAC/i82875p: Convert to pci_assign_unassigned_bus_resources() Ilpo Järvinen
2026-11-26 0:32 ` Borislav Petkov
2026-11-25 23:09 ` [PATCH v3 11/17] platform/x86: asus-wmi: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 12/17] platform/x86: eeepc-laptop: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 13/17] parisc/PCI: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 14/17] PCI: octep_hp: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 15/17] PCI: ftpci100: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 16/17] PCI: hv: " Ilpo Järvinen
2026-11-25 23:09 ` [PATCH v3 17/17] PCI: Remove pci_bus_assign_resources() Ilpo Järvinen
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=20261125230925.2441-8-ilpo.jarvinen@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=dmatlack@google.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--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
all inboxes | Powered by JetHome®