Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Yu Zhao and committed by
Jesse Barnes
3789fa8a 0b400c7e

+6 -2
+6 -2
drivers/pci/probe.c
··· 398 398 if (!child) 399 399 return NULL; 400 400 401 - child->self = bridge; 402 401 child->parent = parent; 403 402 child->ops = parent->ops; 404 403 child->sysdata = parent->sysdata; 405 404 child->bus_flags = parent->bus_flags; 406 - child->bridge = get_device(&bridge->dev); 407 405 408 406 /* initialize some portions of the bus device, but don't register it 409 407 * now as the parent is not properly set up yet. This device will get ··· 417 419 child->number = child->secondary = busnr; 418 420 child->primary = parent->secondary; 419 421 child->subordinate = 0xff; 422 + 423 + if (!bridge) 424 + return child; 425 + 426 + child->self = bridge; 427 + child->bridge = get_device(&bridge->dev); 420 428 421 429 /* Set up default resource pointers and names.. */ 422 430 for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; i++) {