Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=65891215e6b822c368fb3f36abf129ed48af8be0
Commit:     65891215e6b822c368fb3f36abf129ed48af8be0
Parent:     c9953a73e92df11edd812d863ff741877ea9e58c
Author:     Michael Ellerman <[EMAIL PROTECTED]>
AuthorDate: Thu Apr 5 17:19:08 2007 +1000
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Wed May 2 19:02:37 2007 -0700

    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 <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/pci/probe.c |   15 +++++++++++++++
 include/linux/pci.h |    2 ++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 629edf3..70d37bb 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)
        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 --git a/include/linux/pci.h b/include/linux/pci.h
index 99d4575..c020747 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -193,6 +193,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)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to