aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMarkus Lidel <Markus.Lidel@shadowconnect.com>2005-08-09 17:30:57 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-09 20:59:52 -0400
commitdc9352a42c6de578c932313448257cf246b2b75f (patch)
treecc0a26be95e1a93e675bbe40dd7528db7ed2baa1 /drivers
parenta7df26da158ad64d56cc32934aa38a07d03a6fc9 (diff)
[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 <Markus.Lidel@shadowconnect.com> Cc: James Bottomley <James.Bottomley@SteelEye.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/message/i2o/pci.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c
index 7a60fd7be8ad..66c03e882570 100644
--- a/drivers/message/i2o/pci.c
+++ b/drivers/message/i2o/pci.c
@@ -32,6 +32,8 @@
32#include <linux/i2o.h> 32#include <linux/i2o.h>
33#include "core.h" 33#include "core.h"
34 34
35#define OSM_DESCRIPTION "I2O-subsystem"
36
35/* PCI device id table for all I2O controllers */ 37/* PCI device id table for all I2O controllers */
36static struct pci_device_id __devinitdata i2o_pci_ids[] = { 38static struct pci_device_id __devinitdata i2o_pci_ids[] = {
37 {PCI_DEVICE_CLASS(PCI_CLASS_INTELLIGENT_I2O << 8, 0xffff00)}, 39 {PCI_DEVICE_CLASS(PCI_CLASS_INTELLIGENT_I2O << 8, 0xffff00)},
@@ -66,6 +68,8 @@ static void i2o_pci_free(struct i2o_controller *c)
66 68
67 if (c->base.virt) 69 if (c->base.virt)
68 iounmap(c->base.virt); 70 iounmap(c->base.virt);
71
72 pci_release_regions(c->pdev);
69} 73}
70 74
71/** 75/**
@@ -84,6 +88,11 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c)
84 struct device *dev = &pdev->dev; 88 struct device *dev = &pdev->dev;
85 int i; 89 int i;
86 90
91 if (pci_request_regions(pdev, OSM_DESCRIPTION)) {
92 printk(KERN_ERR "%s: device already claimed\n", c->name);
93 return -ENODEV;
94 }
95
87 for (i = 0; i < 6; i++) { 96 for (i = 0; i < 6; i++) {
88 /* Skip I/O spaces */ 97 /* Skip I/O spaces */
89 if (!(pci_resource_flags(pdev, i) & IORESOURCE_IO)) { 98 if (!(pci_resource_flags(pdev, i) & IORESOURCE_IO)) {
@@ -138,6 +147,7 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c)
138 c->base.virt = ioremap_nocache(c->base.phys, c->base.len); 147 c->base.virt = ioremap_nocache(c->base.phys, c->base.len);
139 if (!c->base.virt) { 148 if (!c->base.virt) {
140 printk(KERN_ERR "%s: Unable to map controller.\n", c->name); 149 printk(KERN_ERR "%s: Unable to map controller.\n", c->name);
150 i2o_pci_free(c);
141 return -ENOMEM; 151 return -ENOMEM;
142 } 152 }
143 153