tree cc0a26be95e1a93e675bbe40dd7528db7ed2baa1
parent a7df26da158ad64d56cc32934aa38a07d03a6fc9
author Markus Lidel <[EMAIL PROTECTED]> Wed, 10 Aug 2005 04:30:57 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Wed, 10 Aug 2005 07:59:52 -0700

[PATCH] I2O: added pci_request_regions() before using the controller

Added pci_request_regions() before using the controller to avoid duplicate
usage of the I2O controller when the dpt_i2o driver and I2O subsystem is
loaded at the same time.

Signed-off-by: Markus Lidel <[EMAIL PROTECTED]>
Cc: James Bottomley <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 drivers/message/i2o/pci.c |   10 ++++++++++
 1 files changed, 10 insertions(+)

diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c
--- a/drivers/message/i2o/pci.c
+++ b/drivers/message/i2o/pci.c
@@ -32,6 +32,8 @@
 #include <linux/i2o.h>
 #include "core.h"
 
+#define OSM_DESCRIPTION        "I2O-subsystem"
+
 /* PCI device id table for all I2O controllers */
 static struct pci_device_id __devinitdata i2o_pci_ids[] = {
        {PCI_DEVICE_CLASS(PCI_CLASS_INTELLIGENT_I2O << 8, 0xffff00)},
@@ -66,6 +68,8 @@ static void i2o_pci_free(struct i2o_cont
 
        if (c->base.virt)
                iounmap(c->base.virt);
+
+       pci_release_regions(c->pdev);
 }
 
 /**
@@ -84,6 +88,11 @@ static int __devinit i2o_pci_alloc(struc
        struct device *dev = &pdev->dev;
        int i;
 
+       if (pci_request_regions(pdev, OSM_DESCRIPTION)) {
+               printk(KERN_ERR "%s: device already claimed\n", c->name);
+               return -ENODEV;
+       }
+
        for (i = 0; i < 6; i++) {
                /* Skip I/O spaces */
                if (!(pci_resource_flags(pdev, i) & IORESOURCE_IO)) {
@@ -138,6 +147,7 @@ static int __devinit i2o_pci_alloc(struc
        c->base.virt = ioremap_nocache(c->base.phys, c->base.len);
        if (!c->base.virt) {
                printk(KERN_ERR "%s: Unable to map controller.\n", c->name);
+               i2o_pci_free(c);
                return -ENOMEM;
        }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to