Signed-off-by: Andrew Morton --- drivers/pci/probe.c | 15 +++++++++++++++ include/linux/pci.h | 2 ++ 2 files changed, 17 insertions(+) diff -puN drivers/pci/probe.c~gregkh-pci-pci-create-alloc_pci_dev-the-one-true-way-to-create-a-struct-pci_dev drivers/pci/probe.c --- a/drivers/pci/probe.c~gregkh-pci-pci-create-alloc_pci_dev-the-one-true-way-to-create-a-struct-pci_dev +++ a/drivers/pci/probe.c @@ -865,6 +865,21 @@ static void pci_release_bus_bridge_dev(s kfree(dev); } +struct pci_dev *alloc_pci_dev(void) +{ + struct pci_dev *dev; + + dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); + if (!dev) + return NULL; + + INIT_LIST_HEAD(&dev->global_list); + INIT_LIST_HEAD(&dev->bus_list); + + return dev; +} +EXPORT_SYMBOL(alloc_pci_dev); + /* * Read the config data for a PCI device, sanity-check it * and fill in the dev structure... diff -puN include/linux/pci.h~gregkh-pci-pci-create-alloc_pci_dev-the-one-true-way-to-create-a-struct-pci_dev include/linux/pci.h --- a/include/linux/pci.h~gregkh-pci-pci-create-alloc_pci_dev-the-one-true-way-to-create-a-struct-pci_dev +++ a/include/linux/pci.h @@ -198,6 +198,8 @@ struct pci_dev { #endif }; +extern struct pci_dev *alloc_pci_dev(void); + #define pci_dev_g(n) list_entry(n, struct pci_dev, global_list) #define pci_dev_b(n) list_entry(n, struct pci_dev, bus_list) #define to_pci_dev(n) container_of(n, struct pci_dev, dev) _