Commit f322f273 authored by Jan Dittmer's avatar Jan Dittmer Committed by Greg Kroah-Hartman

[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: default avatarJan Dittmer <jdittmer@ppp0.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 3c80c502
......@@ -68,6 +68,25 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
return ret;
}
/**
* 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);
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment