aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/setup-pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide/setup-pci.c')
-rw-r--r--drivers/ide/setup-pci.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index c88d33225cf9..bfe1f4e59597 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -407,7 +407,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, ide_pci_device_t *d,
407 unsigned long ctl = 0, base = 0; 407 unsigned long ctl = 0, base = 0;
408 ide_hwif_t *hwif; 408 ide_hwif_t *hwif;
409 409
410 if ((d->flags & IDEPCI_FLAG_ISA_PORTS) == 0) { 410 if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) {
411 /* Possibly we should fail if these checks report true */ 411 /* Possibly we should fail if these checks report true */
412 ide_pci_check_iomem(dev, d, 2*port); 412 ide_pci_check_iomem(dev, d, 2*port);
413 ide_pci_check_iomem(dev, d, 2*port+1); 413 ide_pci_check_iomem(dev, d, 2*port+1);
@@ -571,7 +571,7 @@ out:
571 571
572void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) 572void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index)
573{ 573{
574 int port; 574 int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port;
575 int at_least_one_hwif_enabled = 0; 575 int at_least_one_hwif_enabled = 0;
576 ide_hwif_t *hwif, *mate = NULL; 576 ide_hwif_t *hwif, *mate = NULL;
577 u8 tmp; 577 u8 tmp;
@@ -582,16 +582,13 @@ void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, a
582 * Set up the IDE ports 582 * Set up the IDE ports
583 */ 583 */
584 584
585 for (port = 0; port <= 1; ++port) { 585 for (port = 0; port < channels; ++port) {
586 ide_pci_enablebit_t *e = &(d->enablebits[port]); 586 ide_pci_enablebit_t *e = &(d->enablebits[port]);
587 587
588 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 588 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) ||
589 (tmp & e->mask) != e->val)) 589 (tmp & e->mask) != e->val))
590 continue; /* port not enabled */ 590 continue; /* port not enabled */
591 591
592 if (d->channels <= port)
593 break;
594
595 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) 592 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL)
596 continue; 593 continue;
597 594