diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2007-04-05 03:19:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-05-02 22:02:37 -0400 |
commit | 65891215e6b822c368fb3f36abf129ed48af8be0 (patch) | |
tree | 6cc1de94ca66a8f627775d1ddff3600ee8236ed3 /drivers/pci/probe.c | |
parent | c9953a73e92df11edd812d863ff741877ea9e58c (diff) |
PCI: Create alloc_pci_dev(), the one true way to create a struct pci_dev
There are currently several places in the kernel where we kmalloc()
a struct pci_dev and start initialising it. It'd be preferable to
have an allocator so we can ensure the pci_dev is correctly initialised
in one place.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/probe.c')
-rw-r--r-- | drivers/pci/probe.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 629edf39a07d..70d37bbf09bb 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -846,6 +846,21 @@ static void pci_release_bus_bridge_dev(struct device *dev) | |||
846 | kfree(dev); | 846 | kfree(dev); |
847 | } | 847 | } |
848 | 848 | ||
849 | struct pci_dev *alloc_pci_dev(void) | ||
850 | { | ||
851 | struct pci_dev *dev; | ||
852 | |||
853 | dev = kzalloc(sizeof(struct pci_dev), GFP_KERNEL); | ||
854 | if (!dev) | ||
855 | return NULL; | ||
856 | |||
857 | INIT_LIST_HEAD(&dev->global_list); | ||
858 | INIT_LIST_HEAD(&dev->bus_list); | ||
859 | |||
860 | return dev; | ||
861 | } | ||
862 | EXPORT_SYMBOL(alloc_pci_dev); | ||
863 | |||
849 | /* | 864 | /* |
850 | * Read the config data for a PCI device, sanity-check it | 865 | * Read the config data for a PCI device, sanity-check it |
851 | * and fill in the dev structure... | 866 | * and fill in the dev structure... |