diff options
| author | Jan Dittmer <jdittmer@ppp0.net> | 2004-11-11 00:32:25 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2004-11-11 00:32:25 -0800 |
| commit | f322f273c27c327551ea978b4a070abb3bd0d2f9 (patch) | |
| tree | 2dc5c8f7a5defda6831f21f4cfe161a37c5e23b9 | |
| parent | 3c80c5028e1ed60edcc5136205fae14b7b3ad28b (diff) | |
[PATCH] fakephp: introduce pci_bus_add_device
fakephp needs to add newly discovered devices to the global pci list.
Therefore seperate out the appropriate chunk from pci_bus_add_devices
to pci_bus_add_device to add a single device to sysfs, procfs
and the global device list.
Signed-off-by: Jan Dittmer <jdittmer@ppp0.net>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
| -rw-r--r-- | drivers/pci/bus.c | 31 | ||||
| -rw-r--r-- | include/linux/pci.h | 1 |
2 files changed, 22 insertions, 10 deletions
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index e94a854c40f1..dbd33605cc10 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -69,6 +69,25 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, } /** + * add a single device + * @dev: device to add + * + * This adds a single pci device to the global + * device list and adds sysfs and procfs entries + */ +void __devinit pci_bus_add_device(struct pci_dev *dev) +{ + device_add(&dev->dev); + + spin_lock(&pci_bus_lock); + list_add_tail(&dev->global_list, &pci_devices); + spin_unlock(&pci_bus_lock); + + pci_proc_attach_device(dev); + pci_create_sysfs_dev_files(dev); +} + +/** * pci_bus_add_devices - insert newly discovered PCI devices * @bus: bus to check for new devices * @@ -91,16 +110,7 @@ void __devinit pci_bus_add_devices(struct pci_bus *bus) */ if (!list_empty(&dev->global_list)) continue; - - device_add(&dev->dev); - - spin_lock(&pci_bus_lock); - list_add_tail(&dev->global_list, &pci_devices); - spin_unlock(&pci_bus_lock); - - pci_proc_attach_device(dev); - pci_create_sysfs_dev_files(dev); - + pci_bus_add_device(dev); } list_for_each_entry(dev, &bus->devices, bus_list) { @@ -136,5 +146,6 @@ void pci_enable_bridges(struct pci_bus *bus) } EXPORT_SYMBOL(pci_bus_alloc_resource); +EXPORT_SYMBOL_GPL(pci_bus_add_device); EXPORT_SYMBOL(pci_bus_add_devices); EXPORT_SYMBOL(pci_enable_bridges); diff --git a/include/linux/pci.h b/include/linux/pci.h index 75a5e93cfe8c..6e0973f334b1 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -715,6 +715,7 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s int pci_scan_slot(struct pci_bus *bus, int devfn); struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn); unsigned int pci_scan_child_bus(struct pci_bus *bus); +void pci_bus_add_device(struct pci_dev *dev); void pci_bus_add_devices(struct pci_bus *bus); void pci_name_device(struct pci_dev *dev); char *pci_class_name(u32 class); |
