Commit b323e1df authored by John Rose's avatar John Rose Committed by Linus Torvalds

[PATCH] PCI: Allow pci hotplug drivers to initialize individual devices.

This lets the PPC pci hotplug driver initialize single devices, not just
entire slots.
parent 66f070ba
......@@ -580,32 +580,16 @@ pci_scan_device(struct pci_bus *bus, int devfn)
return dev;
}
/**
* pci_scan_slot - scan a PCI slot on a bus for devices.
* @bus: PCI bus to scan
* @devfn: slot number to scan (must have zero function.)
*
* Scan a PCI slot on the specified PCI bus for devices, adding
* discovered devices to the @bus->devices list. New devices
* will have an empty dev->global_list head.
*/
int __devinit pci_scan_slot(struct pci_bus *bus, int devfn)
struct pci_dev * __devinit
pci_scan_single_device(struct pci_bus *bus, int devfn)
{
int func, nr = 0;
for (func = 0; func < 8; func++, devfn++) {
struct pci_dev *dev;
dev = pci_scan_device(bus, devfn);
pci_scan_msi_device(dev);
if (func == 0) {
if (!dev)
break;
} else {
if (!dev)
continue;
dev->multifunction = 1;
}
return NULL;
/* Fix up broken headers */
pci_fixup_device(PCI_FIXUP_HEADER, dev);
......@@ -616,6 +600,28 @@ int __devinit pci_scan_slot(struct pci_bus *bus, int devfn)
*/
INIT_LIST_HEAD(&dev->global_list);
list_add_tail(&dev->bus_list, &bus->devices);
return dev;
}
/**
* pci_scan_slot - scan a PCI slot on a bus for devices.
* @bus: PCI bus to scan
* @devfn: slot number to scan (must have zero function.)
*
* Scan a PCI slot on the specified PCI bus for devices, adding
* discovered devices to the @bus->devices list. New devices
* will have an empty dev->global_list head.
*/
int __devinit pci_scan_slot(struct pci_bus *bus, int devfn)
{
int func, nr = 0;
for (func = 0; func < 8; func++, devfn++) {
struct pci_dev *dev;
dev = pci_scan_single_device(bus, devfn);
if (dev) {
nr++;
/*
......@@ -623,7 +629,14 @@ int __devinit pci_scan_slot(struct pci_bus *bus, int devfn)
* don't scan past the first function.
*/
if (!dev->multifunction)
if (func > 0)
dev->multifunction = 1;
else
break;
} else {
if (func == 0)
break;
}
}
return nr;
}
......@@ -734,4 +747,5 @@ EXPORT_SYMBOL(pci_add_new_bus);
EXPORT_SYMBOL(pci_do_scan_bus);
EXPORT_SYMBOL(pci_scan_slot);
EXPORT_SYMBOL(pci_scan_bridge);
EXPORT_SYMBOL(pci_scan_single_device);
#endif
......@@ -587,6 +587,7 @@ static inline struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, void *s
return pci_scan_bus_parented(NULL, bus, ops, sysdata);
}
int pci_scan_slot(struct pci_bus *bus, int devfn);
struct pci_dev * pci_scan_single_device(struct pci_bus *bus, int devfn);
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