Commit 15d8ec7d authored by Markus Lidel's avatar Markus Lidel Committed by Linus Torvalds

[PATCH] I2O: don't disable PCI device if it is enabled before probing

If PCI device is enabled before probing, it will not be disabled at exit.
Signed-off-by: default avatarMarkus Lidel <Markus.Lidel@shadowconnect.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 35dc8161
...@@ -88,6 +88,11 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c) ...@@ -88,6 +88,11 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
int i; 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++) { for (i = 0; i < 6; i++) {
/* Skip I/O spaces */ /* Skip I/O spaces */
if (!(pci_resource_flags(pdev, i) & IORESOURCE_IO)) { if (!(pci_resource_flags(pdev, i) & IORESOURCE_IO)) {
...@@ -298,7 +303,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, ...@@ -298,7 +303,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
struct i2o_controller *c; struct i2o_controller *c;
int rc; int rc;
struct pci_dev *i960 = NULL; struct pci_dev *i960 = NULL;
int pci_dev_busy = 0; int enabled = pdev->is_enabled;
printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n"); printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n");
...@@ -308,16 +313,12 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, ...@@ -308,16 +313,12 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
return -ENODEV; return -ENODEV;
} }
if ((rc = pci_enable_device(pdev))) { if (!enabled)
printk(KERN_WARNING "i2o: couldn't enable device %s\n", if ((rc = pci_enable_device(pdev))) {
pci_name(pdev)); printk(KERN_WARNING "i2o: couldn't enable device %s\n",
return rc; pci_name(pdev));
} return rc;
}
if (pci_request_regions(pdev, OSM_DESCRIPTION)) {
printk(KERN_ERR "i2o: device already claimed\n");
return -ENODEV;
}
if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
printk(KERN_WARNING "i2o: no suitable DMA found for %s\n", printk(KERN_WARNING "i2o: no suitable DMA found for %s\n",
...@@ -395,9 +396,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, ...@@ -395,9 +396,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
if ((rc = i2o_pci_alloc(c))) { if ((rc = i2o_pci_alloc(c))) {
printk(KERN_ERR "%s: DMA / IO allocation for I2O controller " printk(KERN_ERR "%s: DMA / IO allocation for I2O controller "
" failed\n", c->name); "failed\n", c->name);
if (rc == -ENODEV)
pci_dev_busy = 1;
goto free_controller; goto free_controller;
} }
...@@ -425,7 +424,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, ...@@ -425,7 +424,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
i2o_iop_free(c); i2o_iop_free(c);
disable: disable:
if (!pci_dev_busy) if (!enabled)
pci_disable_device(pdev); pci_disable_device(pdev);
return rc; return rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment