diff options
-rw-r--r-- | drivers/message/i2o/pci.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c index d698d7709c31..e2e3fc79c78a 100644 --- a/drivers/message/i2o/pci.c +++ b/drivers/message/i2o/pci.c | |||
@@ -88,6 +88,11 @@ static int __devinit i2o_pci_alloc(struct i2o_controller *c) | |||
88 | struct device *dev = &pdev->dev; | 88 | struct device *dev = &pdev->dev; |
89 | int i; | 89 | int i; |
90 | 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 | |||
91 | for (i = 0; i < 6; i++) { | 96 | for (i = 0; i < 6; i++) { |
92 | /* Skip I/O spaces */ | 97 | /* Skip I/O spaces */ |
93 | if (!(pci_resource_flags(pdev, i) & IORESOURCE_IO)) { | 98 | if (!(pci_resource_flags(pdev, i) & IORESOURCE_IO)) { |
@@ -298,7 +303,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, | |||
298 | struct i2o_controller *c; | 303 | struct i2o_controller *c; |
299 | int rc; | 304 | int rc; |
300 | struct pci_dev *i960 = NULL; | 305 | struct pci_dev *i960 = NULL; |
301 | int pci_dev_busy = 0; | 306 | int enabled = pdev->is_enabled; |
302 | 307 | ||
303 | printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n"); | 308 | printk(KERN_INFO "i2o: Checking for PCI I2O controllers...\n"); |
304 | 309 | ||
@@ -308,16 +313,12 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, | |||
308 | return -ENODEV; | 313 | return -ENODEV; |
309 | } | 314 | } |
310 | 315 | ||
311 | if ((rc = pci_enable_device(pdev))) { | 316 | if (!enabled) |
312 | printk(KERN_WARNING "i2o: couldn't enable device %s\n", | 317 | if ((rc = pci_enable_device(pdev))) { |
313 | pci_name(pdev)); | 318 | printk(KERN_WARNING "i2o: couldn't enable device %s\n", |
314 | return rc; | 319 | pci_name(pdev)); |
315 | } | 320 | return rc; |
316 | 321 | } | |
317 | if (pci_request_regions(pdev, OSM_DESCRIPTION)) { | ||
318 | printk(KERN_ERR "i2o: device already claimed\n"); | ||
319 | return -ENODEV; | ||
320 | } | ||
321 | 322 | ||
322 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { | 323 | if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { |
323 | printk(KERN_WARNING "i2o: no suitable DMA found for %s\n", | 324 | 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 | 396 | ||
396 | if ((rc = i2o_pci_alloc(c))) { | 397 | if ((rc = i2o_pci_alloc(c))) { |
397 | printk(KERN_ERR "%s: DMA / IO allocation for I2O controller " | 398 | printk(KERN_ERR "%s: DMA / IO allocation for I2O controller " |
398 | " failed\n", c->name); | 399 | "failed\n", c->name); |
399 | if (rc == -ENODEV) | ||
400 | pci_dev_busy = 1; | ||
401 | goto free_controller; | 400 | goto free_controller; |
402 | } | 401 | } |
403 | 402 | ||
@@ -425,7 +424,7 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, | |||
425 | i2o_iop_free(c); | 424 | i2o_iop_free(c); |
426 | 425 | ||
427 | disable: | 426 | disable: |
428 | if (!pci_dev_busy) | 427 | if (!enabled) |
429 | pci_disable_device(pdev); | 428 | pci_disable_device(pdev); |
430 | 429 | ||
431 | return rc; | 430 | return rc; |