# HG changeset patch # User Yu Zhao # Date 1236909605 14400 # Node ID b9b4e811af229682d7c6a70aabffd5ade5876c91 # Parent fe864af8b34bb03cdfe51dae05e2e3bcce2c5d69 Backport: PCI: allow pci_alloc_child_bus() to handle a NULL bridge commit 3789fa8a2e534523c896a32a9f27f78d52ad7d82 Author: Yu Zhao Date: Sat Nov 22 02:41:07 2008 +0800 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 Signed-off-by: Jesse Barnes Signed-off-by: Yu Zhao diff -r fe864af8b34b -r b9b4e811af22 drivers/pci/probe.c --- a/drivers/pci/probe.c Thu Mar 12 21:59:15 2009 -0400 +++ b/drivers/pci/probe.c Thu Mar 12 22:00:05 2009 -0400 @@ -392,12 +392,10 @@ if (!child) return NULL; - child->self = bridge; child->parent = parent; child->ops = parent->ops; child->sysdata = parent->sysdata; child->bus_flags = parent->bus_flags; - child->bridge = get_device(&bridge->dev); child->class_dev.class = &pcibus_class; sprintf(child->class_dev.class_id, "%04x:%02x", pci_domain_nr(child), busnr); @@ -411,6 +409,12 @@ child->number = child->secondary = busnr; child->primary = parent->secondary; child->subordinate = 0xff; + + if (!bridge) + return child; + + child->self = bridge; + child->bridge = get_device(&bridge->dev); /* Set up default resource pointers and names.. */ for (i = 0; i < 4; i++) {