diff options
author | Yu Zhao <yu.zhao@intel.com> | 2008-11-21 13:41:07 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-01-07 14:13:03 -0500 |
commit | 3789fa8a2e534523c896a32a9f27f78d52ad7d82 (patch) | |
tree | 1bed5285a1188bf2455554118616403a8f929637 /drivers/pci | |
parent | 0b400c7ed4d027e02f6231afa39852a2d48e6f25 (diff) |
PCI: allow pci_alloc_child_bus() to handle a NULL bridge
Allow pci_alloc_child_bus() to allocate buses without bridge devices.
Some SR-IOV devices can occupy more than one bus number, but there is no
explicit bridges because that have internal routing mechanism.
Signed-off-by: Yu Zhao <yu.zhao@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/probe.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 5372d3699e08..2ee00962734b 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -398,12 +398,10 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, | |||
398 | if (!child) | 398 | if (!child) |
399 | return NULL; | 399 | return NULL; |
400 | 400 | ||
401 | child->self = bridge; | ||
402 | child->parent = parent; | 401 | child->parent = parent; |
403 | child->ops = parent->ops; | 402 | child->ops = parent->ops; |
404 | child->sysdata = parent->sysdata; | 403 | child->sysdata = parent->sysdata; |
405 | child->bus_flags = parent->bus_flags; | 404 | child->bus_flags = parent->bus_flags; |
406 | child->bridge = get_device(&bridge->dev); | ||
407 | 405 | ||
408 | /* initialize some portions of the bus device, but don't register it | 406 | /* initialize some portions of the bus device, but don't register it |
409 | * now as the parent is not properly set up yet. This device will get | 407 | * now as the parent is not properly set up yet. This device will get |
@@ -420,6 +418,12 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent, | |||
420 | child->primary = parent->secondary; | 418 | child->primary = parent->secondary; |
421 | child->subordinate = 0xff; | 419 | child->subordinate = 0xff; |
422 | 420 | ||
421 | if (!bridge) | ||
422 | return child; | ||
423 | |||
424 | child->self = bridge; | ||
425 | child->bridge = get_device(&bridge->dev); | ||
426 | |||
423 | /* Set up default resource pointers and names.. */ | 427 | /* Set up default resource pointers and names.. */ |
424 | for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) { | 428 | for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) { |
425 | child->resource[i] = &bridge->resource[PCI_BRIDGE_RESOURCES+i]; | 429 | child->resource[i] = &bridge->resource[PCI_BRIDGE_RESOURCES+i]; |