[patch 2.5-bk] PCI 2/3: misc fixes

From: Ivan Kokshaysky (ink@jurassic.park.msu.ru)
Date: Wed Nov 06 2002 - 13:07:47 EST


- Use PCI_BUS_NUM_RESOURCES instead on `4' in pci_find_parent_resource;
- clean up pci_claim_resource() and make it a bit more informative;
- pdev_sort_resources() must be __devinit, as it's called from
  pbus_assign_resources_sorted(), which is __devinit now.

Ivan.

--- 2.5-bk/drivers/pci/pci.c Wed Nov 6 17:38:46 2002
+++ linux/drivers/pci/pci.c Wed Nov 6 19:54:01 2002
@@ -182,7 +182,7 @@ pci_find_parent_resource(const struct pc
         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;
--- 2.5-bk/drivers/pci/setup-res.c Tue Nov 5 01:30:49 2002
+++ linux/drivers/pci/setup-res.c Wed Nov 6 17:26:47 2002
@@ -38,19 +38,18 @@ pci_claim_resource(struct pci_dev *dev,
 {
         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->name, res->start, res->end);
- }
- } else {
- printk(KERN_ERR "PCI: No parent found for region %d "
- "of device %s\n", resource, dev->name);
+
+ if (err) {
+ 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;
@@ -137,7 +136,7 @@ pci_assign_resource(struct pci_dev *dev,
 }
 
 /* Sort resources by alignment */
-void __init
+void __devinit
 pdev_sort_resources(struct pci_dev *dev, struct resource_list *head)
 {
         int i;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Nov 07 2002 - 22:00:44 EST