Commit 37256d28 authored by Ivan Kokshaysky's avatar Ivan Kokshaysky Committed by Linus Torvalds

[PATCH] PCI setup: misc cleanups and fixes

- Use PCI_BUS_NUM_RESOURCES instead of hardcoded `4' in
  pci_find_parent_resource;
- clean up pci_claim_resource() and make it a bit more informative
  on errors;
- pdev_sort_resources() must be __devinit, as it's called from
  pbus_assign_resources_sorted(), which is __devinit now;
- fix one remaining dev->name in debugging printk.
parent d613ff0a
......@@ -182,7 +182,7 @@ pci_find_parent_resource(const struct pci_dev *dev, struct resource *res)
int i;
struct resource *best = NULL;
for(i=0; i<4; i++) {
for(i = 0; i < PCI_BUS_NUM_RESOURCES; i++) {
struct resource *r = bus->resource[i];
if (!r)
continue;
......
......@@ -38,19 +38,18 @@ pci_claim_resource(struct pci_dev *dev, int resource)
{
struct resource *res = &dev->resource[resource];
struct resource *root = pci_find_parent_resource(dev, res);
char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
int err;
err = -EINVAL;
if (root != NULL) {
if (root != NULL)
err = request_resource(root, res);
if (err) {
printk(KERN_ERR "PCI: Address space collision on "
"region %d of device %s [%lx:%lx]\n",
resource, dev->dev.name, res->start, res->end);
}
} else {
printk(KERN_ERR "PCI: No parent found for region %d "
"of device %s\n", resource, dev->dev.name);
printk(KERN_ERR "PCI: %s region %d of %s %s [%lx:%lx]\n",
root ? "Address space collision on" :
"No parent found for",
resource, dtype, dev->slot_name, res->start, res->end);
}
return err;
......@@ -131,13 +130,13 @@ pci_assign_resource(struct pci_dev *dev, int i)
}
DBGC((KERN_ERR " got res[%lx:%lx] for resource %d of %s\n", res->start,
res->end, i, dev->name));
res->end, i, dev->dev.name));
return 0;
}
/* Sort resources by alignment */
void __init
void __devinit
pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
{
int i;
......
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