Skip to contentSkip to conversation

PCI 2/3: misc fixes

PATCH In review Ivan Kokshaysky 2 participants 2 messages Nov 6, 2002 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI 2/3: misc fixes

- 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.

drivers/pci/pci.c +1 -1
@@ -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;
drivers/pci/setup-res.c +9 -10
@@ -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;
#1 lore raw
Quoted 4 lines · Ivan Kokshaysky

- 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.

My apologies about pdev_sort_resources, I completely missed it when I was pushing __devinit down from pbus_assign_resources.

Scott

Signature · 4 lines
Scott Murray
SOMA Networks, Inc.
Toronto, Ontario
e-mail: [email protected]