aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/probe.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2020-08-20 21:53:41 -0600
committerLorenzo Pieralisi <lorenzo.pieralisi@arm.com>2020-09-07 10:30:38 +0100
commit07e292950b9368518c659c4d5f1dca4bf55779bd (patch)
tree7ac4745e9af29398deaa967c2e1fa9cf885895f6 /drivers/pci/probe.c
parentPCI: designware-ep: Fix the Header Type check (diff)
downloadlinux-dev-07e292950b9368518c659c4d5f1dca4bf55779bd.tar.xz
linux-dev-07e292950b9368518c659c4d5f1dca4bf55779bd.zip
PCI: Allow root and child buses to have different pci_ops
PCI host bridges often have different ways to access the root and child bus config spaces. The host bridge drivers have invented their own abstractions to handle this. Let's support having different root and child bus pci_ops so these per driver abstractions can be removed. Link: https://lore.kernel.org/r/20200821035420.380495-2-robh@kernel.org Signed-off-by: Rob Herring <robh@kernel.org> Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r--drivers/pci/probe.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 03d37128a24f..0c9ebc72532e 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1036,6 +1036,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
struct pci_dev *bridge, int busnr)
{
struct pci_bus *child;
+ struct pci_host_bridge *host;
int i;
int ret;
@@ -1045,11 +1046,16 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
return NULL;
child->parent = parent;
- child->ops = parent->ops;
child->msi = parent->msi;
child->sysdata = parent->sysdata;
child->bus_flags = parent->bus_flags;
+ host = pci_find_host_bridge(parent);
+ if (host->child_ops)
+ child->ops = host->child_ops;
+ else
+ child->ops = parent->ops;
+
/*
* Initialize some portions of the bus device, but don't register
* it now as the parent is not properly set up yet.