@@ -189,7 +189,7 @@ int pci_bus_add_child(struct pci_bus *bus)
if (bus->bridge)
bus->dev.parent = bus->bridge;
- retval = device_register(&bus->dev);
+ retval = device_add(&bus->dev);
if (retval)
return retval;
@@ -639,6 +639,7 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,
*/
child->dev.class = &pcibus_class;
dev_set_name(&child->dev, "%04x:%02x", pci_domain_nr(child), busnr);
+ device_initialize(&child->dev);
/*
* Set up the primary, secondary and subordinate
@@ -1672,7 +1673,8 @@ struct pci_bus *pci_create_root_bus(struct device *parent, int bus,
b->dev.class = &pcibus_class;
b->dev.parent = b->bridge;
dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus);
- error = device_register(&b->dev);
+ device_initialize(&b->dev);
+ error = device_add(&b->dev);
if (error)
goto class_dev_reg_err;
@@ -48,11 +48,11 @@ void pci_remove_bus(struct pci_bus *bus)
list_del(&bus->node);
pci_bus_release_busn_res(bus);
up_write(&pci_bus_sem);
- if (!bus->is_added)
- return;
-
- pci_remove_legacy_files(bus);
- device_unregister(&bus->dev);
+ if (bus->is_added) {
+ pci_remove_legacy_files(bus);
+ device_del(&bus->dev);
+ }
+ put_device(&bus->dev);
}
EXPORT_SYMBOL(pci_remove_bus);