[2/3] Use insert_resource in pci_claim_resource

From: Matthew Wilcox
Date: Thu Mar 18 2004 - 19:01:42 EST



On ia64, the parent resources are not necessarily PCI resources and
so won't get found by pci_find_parent_resource. Use the shiny new
insert_resource() function instead, which I think we would have used
here had it been available at the time.

Index: drivers/pci/setup-res.c
===================================================================
RCS file: /var/cvs/linux-2.6/drivers/pci/setup-res.c,v
retrieving revision 1.7
diff -u -p -r1.7 setup-res.c
--- a/drivers/pci/setup-res.c 10 Mar 2004 02:27:48 -0000 1.7
+++ b/drivers/pci/setup-res.c 18 Mar 2004 23:40:56 -0000
@@ -94,13 +94,18 @@ int __init
pci_claim_resource(struct pci_dev *dev, int resource)
{
struct resource *res = &dev->resource[resource];
- struct resource *root = pci_find_parent_resource(dev, res);
+ struct resource *root = NULL;
char *dtype = resource < PCI_BRIDGE_RESOURCES ? "device" : "bridge";
int err;

+ if (res->flags & IORESOURCE_IO)
+ root = &ioport_resource;
+ if (res->flags & IORESOURCE_MEM)
+ root = &iomem_resource;
+
err = -EINVAL;
if (root != NULL)
- err = request_resource(root, res);
+ err = insert_resource(root, res);

if (err) {
printk(KERN_ERR "PCI: %s region %d of %s %s [%lx:%lx]\n",

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/