root PCI bridge registration updates [5/9]
RFC PATCH 1/1 root PCI bridge registration updates [5/9]
This patch updates pci_scan_bus_parented() and also has some important fixes to the PCI bus class.
Signed-off-by Adam Belay <[email protected]>
drivers/pci/bus/bus.c +8 -6
@@ -81,7 +81,7 @@ bus->class_dev.class = &pcibus_class;sprintf (bus->class_dev.class_id,"%04x:%02x" ,pci_domain_nr (bus), - bus->primary); + bus->number); ret =class_device_register (&bus->class_dev);if (ret)
@@ -89,13 +89,15 @@class_device_create_file (&bus->class_dev, &class_device_attr_cpuaffinity); -if (bus->self) +if (bus->bridge)sysfs_create_link (&bus->class_dev.kobj, - &bus->self->dev.kobj,"bridge" ); + &bus->bridge->kobj,"bridge" ); -spin_lock (&pci_bus_lock); -list_add_tail (&bus->node, &bus->parent->children); -spin_unlock (&pci_bus_lock); +if (bus->parent) { +spin_lock (&pci_bus_lock); +list_add_tail (&bus->node, &bus->parent->children); +spin_unlock (&pci_bus_lock); + }pci_proc_attach_bus (bus);
drivers/pci/bus/probe.c +7 -20
@@ -427,37 +427,24 @@ error =device_register (dev);if (error) goto dev_reg_err; + b->bridge =get_device (dev); + b->number = b->secondary = bus; + b->resource[0 ] = &ioport_resource; + b->resource[1 ] = &iomem_resource; - b->class_dev.class = &pcibus_class; -sprintf (b->class_dev.class_id,"%04x:%02x" ,pci_domain_nr (b), bus); - error =class_device_register (&b->class_dev); -if (error) - goto class_dev_reg_err; - error =class_device_create_file (&b->class_dev, &class_device_attr_cpuaffinity); + error =pci_add_bus (b);if (error) - goto class_dev_create_file_err; + goto bus_class_reg_err;/* Create legacy_io and legacy_mem files for this bus */ pci_create_legacy_files (b); - error =sysfs_create_link (&b->class_dev.kobj, &b->bridge->kobj,"bridge" ); -if (error) - goto sys_create_link_err; - - b->number = b->secondary = bus; - b->resource[0 ] = &ioport_resource; - b->resource[1 ] = &iomem_resource; - b->subordinate =pci_scan_child_bus (b);return b; -sys_create_link_err: -class_device_remove_file (&b->class_dev, &class_device_attr_cpuaffinity); -class_dev_create_file_err: -class_device_unregister (&b->class_dev); -class_dev_reg_err: +bus_class_reg_err:device_unregister (dev); dev_reg_err:spin_lock (&pci_bus_lock);