Commit 71eb559f authored by Jeff Garzik's avatar Jeff Garzik

[libata] do not call pci_disable_device() for certain errors

If PCI request regions fails, then someone else is using the
hardware we wish to use.  For that one case, calling pci_disable_device()
is rather rude.
parent 327f7fd0
...@@ -940,6 +940,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -940,6 +940,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
unsigned long base; unsigned long base;
void *mmio_base; void *mmio_base;
unsigned int board_idx = (unsigned int) ent->driver_data; unsigned int board_idx = (unsigned int) ent->driver_data;
int pci_dev_busy = 0;
int rc; int rc;
VPRINTK("ENTER\n"); VPRINTK("ENTER\n");
...@@ -952,8 +953,10 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -952,8 +953,10 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
return rc; return rc;
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
pci_dev_busy = 1;
goto err_out; goto err_out;
}
pci_enable_intx(pdev); pci_enable_intx(pdev);
...@@ -1015,7 +1018,8 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1015,7 +1018,8 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_regions: err_out_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
pci_disable_device(pdev); if (!pci_dev_busy)
pci_disable_device(pdev);
return rc; return rc;
} }
......
...@@ -3656,6 +3656,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, ...@@ -3656,6 +3656,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
struct ata_port_info *port[2]; struct ata_port_info *port[2];
u8 tmp8, mask; u8 tmp8, mask;
unsigned int legacy_mode = 0; unsigned int legacy_mode = 0;
int disable_dev_on_err = 1;
int rc; int rc;
DPRINTK("ENTER\n"); DPRINTK("ENTER\n");
...@@ -3686,8 +3687,10 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, ...@@ -3686,8 +3687,10 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
return rc; return rc;
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
disable_dev_on_err = 0;
goto err_out; goto err_out;
}
if (legacy_mode) { if (legacy_mode) {
if (!request_region(0x1f0, 8, "libata")) { if (!request_region(0x1f0, 8, "libata")) {
...@@ -3697,8 +3700,10 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, ...@@ -3697,8 +3700,10 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
conflict = ____request_resource(&ioport_resource, &res); conflict = ____request_resource(&ioport_resource, &res);
if (!strcmp(conflict->name, "libata")) if (!strcmp(conflict->name, "libata"))
legacy_mode |= (1 << 0); legacy_mode |= (1 << 0);
else else {
disable_dev_on_err = 0;
printk(KERN_WARNING "ata: 0x1f0 IDE port busy\n"); printk(KERN_WARNING "ata: 0x1f0 IDE port busy\n");
}
} else } else
legacy_mode |= (1 << 0); legacy_mode |= (1 << 0);
...@@ -3709,8 +3714,10 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, ...@@ -3709,8 +3714,10 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
conflict = ____request_resource(&ioport_resource, &res); conflict = ____request_resource(&ioport_resource, &res);
if (!strcmp(conflict->name, "libata")) if (!strcmp(conflict->name, "libata"))
legacy_mode |= (1 << 1); legacy_mode |= (1 << 1);
else else {
disable_dev_on_err = 0;
printk(KERN_WARNING "ata: 0x170 IDE port busy\n"); printk(KERN_WARNING "ata: 0x170 IDE port busy\n");
}
} else } else
legacy_mode |= (1 << 1); legacy_mode |= (1 << 1);
} }
...@@ -3763,7 +3770,8 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, ...@@ -3763,7 +3770,8 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info,
release_region(0x170, 8); release_region(0x170, 8);
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
pci_disable_device(pdev); if (disable_dev_on_err)
pci_disable_device(pdev);
return rc; return rc;
} }
......
...@@ -332,6 +332,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -332,6 +332,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
struct nv_host *host; struct nv_host *host;
struct ata_port_info *ppi; struct ata_port_info *ppi;
struct ata_probe_ent *probe_ent; struct ata_probe_ent *probe_ent;
int pci_dev_busy = 0;
int rc; int rc;
u32 bar; u32 bar;
...@@ -350,8 +351,10 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -350,8 +351,10 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_out; goto err_out;
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
pci_dev_busy = 1;
goto err_out_disable; goto err_out_disable;
}
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
if (rc) if (rc)
...@@ -427,7 +430,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -427,7 +430,8 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_regions: err_out_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out_disable: err_out_disable:
pci_disable_device(pdev); if (!pci_dev_busy)
pci_disable_device(pdev);
err_out: err_out:
return rc; return rc;
} }
......
...@@ -556,6 +556,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -556,6 +556,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
unsigned long base; unsigned long base;
void *mmio_base; void *mmio_base;
unsigned int board_idx = (unsigned int) ent->driver_data; unsigned int board_idx = (unsigned int) ent->driver_data;
int pci_dev_busy = 0;
int rc; int rc;
if (!printed_version++) if (!printed_version++)
...@@ -570,8 +571,10 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -570,8 +571,10 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
return rc; return rc;
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
pci_dev_busy = 1;
goto err_out; goto err_out;
}
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
if (rc) if (rc)
...@@ -650,7 +653,8 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -650,7 +653,8 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
err_out_regions: err_out_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
pci_disable_device(pdev); if (!pci_dev_busy)
pci_disable_device(pdev);
return rc; return rc;
} }
......
...@@ -336,6 +336,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -336,6 +336,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
void *mmio_base; void *mmio_base;
int rc; int rc;
unsigned int i; unsigned int i;
int pci_dev_busy = 0;
u32 tmp, irq_mask; u32 tmp, irq_mask;
if (!printed_version++) if (!printed_version++)
...@@ -350,8 +351,10 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -350,8 +351,10 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
return rc; return rc;
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
pci_dev_busy = 1;
goto err_out; goto err_out;
}
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
if (rc) if (rc)
...@@ -438,7 +441,8 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -438,7 +441,8 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_regions: err_out_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
pci_disable_device(pdev); if (!pci_dev_busy)
pci_disable_device(pdev);
return rc; return rc;
} }
......
...@@ -200,14 +200,17 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -200,14 +200,17 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
int rc; int rc;
u32 genctl; u32 genctl;
struct ata_port_info *ppi; struct ata_port_info *ppi;
int pci_dev_busy = 0;
rc = pci_enable_device(pdev); rc = pci_enable_device(pdev);
if (rc) if (rc)
return rc; return rc;
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
pci_dev_busy = 1;
goto err_out; goto err_out;
}
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
if (rc) if (rc)
...@@ -259,7 +262,8 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -259,7 +262,8 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
pci_disable_device(pdev); if (!pci_dev_busy)
pci_disable_device(pdev);
return rc; return rc;
} }
......
...@@ -338,6 +338,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -338,6 +338,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
struct ata_probe_ent *probe_ent = NULL; struct ata_probe_ent *probe_ent = NULL;
unsigned long base; unsigned long base;
void *mmio_base; void *mmio_base;
int pci_dev_busy = 0;
int rc; int rc;
if (!printed_version++) if (!printed_version++)
...@@ -359,8 +360,10 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -359,8 +360,10 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
/* Request PCI regions */ /* Request PCI regions */
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
pci_dev_busy = 1;
goto err_out; goto err_out;
}
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
if (rc) if (rc)
...@@ -433,7 +436,8 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e ...@@ -433,7 +436,8 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
err_out_regions: err_out_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
pci_disable_device(pdev); if (!pci_dev_busy)
pci_disable_device(pdev);
return rc; return rc;
} }
......
...@@ -1366,6 +1366,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * ...@@ -1366,6 +1366,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
void *mmio_base, *dimm_mmio = NULL; void *mmio_base, *dimm_mmio = NULL;
struct pdc_host_priv *hpriv = NULL; struct pdc_host_priv *hpriv = NULL;
unsigned int board_idx = (unsigned int) ent->driver_data; unsigned int board_idx = (unsigned int) ent->driver_data;
int pci_dev_busy = 0;
int rc; int rc;
if (!printed_version++) if (!printed_version++)
...@@ -1380,8 +1381,10 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * ...@@ -1380,8 +1381,10 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
return rc; return rc;
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
pci_dev_busy = 1;
goto err_out; goto err_out;
}
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
if (rc) if (rc)
...@@ -1471,7 +1474,8 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id * ...@@ -1471,7 +1474,8 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
err_out_regions: err_out_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
pci_disable_device(pdev); if (!pci_dev_busy)
pci_disable_device(pdev);
return rc; return rc;
} }
......
...@@ -185,14 +185,17 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -185,14 +185,17 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
struct ata_port_info *ppi; struct ata_port_info *ppi;
int rc; int rc;
unsigned int board_idx = (unsigned int) ent->driver_data; unsigned int board_idx = (unsigned int) ent->driver_data;
int pci_dev_busy = 0;
rc = pci_enable_device(pdev); rc = pci_enable_device(pdev);
if (rc) if (rc)
return rc; return rc;
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
pci_dev_busy = 1;
goto err_out; goto err_out;
}
rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
if (rc) if (rc)
...@@ -260,7 +263,8 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -260,7 +263,8 @@ static int uli_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
pci_disable_device(pdev); if (!pci_dev_busy)
pci_disable_device(pdev);
return rc; return rc;
} }
......
...@@ -290,6 +290,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -290,6 +290,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
struct ata_probe_ent *probe_ent; struct ata_probe_ent *probe_ent;
int board_id = (int) ent->driver_data; int board_id = (int) ent->driver_data;
const int *bar_sizes; const int *bar_sizes;
int pci_dev_busy = 0;
u8 tmp8; u8 tmp8;
if (!printed_version++) if (!printed_version++)
...@@ -300,8 +301,10 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -300,8 +301,10 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
return rc; return rc;
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
pci_dev_busy = 1;
goto err_out; goto err_out;
}
if (board_id == vt6420) { if (board_id == vt6420) {
pci_read_config_byte(pdev, SATA_PATA_SHARING, &tmp8); pci_read_config_byte(pdev, SATA_PATA_SHARING, &tmp8);
...@@ -360,7 +363,8 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -360,7 +363,8 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_regions: err_out_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
pci_disable_device(pdev); if (!pci_dev_busy)
pci_disable_device(pdev);
return rc; return rc;
} }
......
...@@ -255,6 +255,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d ...@@ -255,6 +255,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
static int printed_version; static int printed_version;
struct ata_probe_ent *probe_ent = NULL; struct ata_probe_ent *probe_ent = NULL;
unsigned long base; unsigned long base;
int pci_dev_busy = 0;
void *mmio_base; void *mmio_base;
int rc; int rc;
...@@ -274,8 +275,10 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d ...@@ -274,8 +275,10 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
} }
rc = pci_request_regions(pdev, DRV_NAME); rc = pci_request_regions(pdev, DRV_NAME);
if (rc) if (rc) {
pci_dev_busy = 1;
goto err_out; goto err_out;
}
/* /*
* Use 32 bit DMA mask, because 64 bit address support is poor. * Use 32 bit DMA mask, because 64 bit address support is poor.
...@@ -352,7 +355,8 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d ...@@ -352,7 +355,8 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
err_out_regions: err_out_regions:
pci_release_regions(pdev); pci_release_regions(pdev);
err_out: err_out:
pci_disable_device(pdev); if (!pci_dev_busy)
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