}
host->iomap = pcim_iomap_table(pdev);
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
void __iomem *bmdma = host->iomap[4] + 8 * i;
legacy_dr = devres_find(host->dev, ata_legacy_release, NULL, NULL);
BUG_ON(!legacy_dr);
- for (i = 0; i < 2; i++) {
+ for (i = 0; i < host->n_ports; i++) {
unsigned int irq;
/* FIXME: ATA_*_IRQ() should take generic device not pci_dev */
BUG_ON(n_ports < 1 || n_ports > 2);
port[0] = port_info[0];
- if (n_ports > 1)
- port[1] = port_info[1];
- else
- port[1] = port[0];
+ port[1] = (n_ports > 1) ? port_info[1] : NULL;
/* FIXME: Really for ATA it isn't safe because the device may be
multi-purpose and we want to leave it alone if it was already
}
/* alloc and init host */
- host = ata_host_alloc_pinfo(dev, port, 2);
+ host = ata_host_alloc_pinfo(dev, port, n_ports);
if (!host) {
dev_printk(KERN_ERR, &pdev->dev,
"failed to allocate ATA host\n");