aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/setup-pci.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:30 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:30 -0500
commit1ebf74936b1fccb5b65940f99ccddd74ec4d1fef (patch)
tree97a45ac3da440fbd0b3ed8f1585e3709f198f1bb /drivers/ide/setup-pci.c
parentbf77c5317168eb73894bcc9a455429c4589a179d (diff)
ide: separate PCI specific init from generic init in ide_pci_setup_ports()
* Setup ->mate and ->channel in ide_pci_setup_ports() instead of in ide_hwif_configure(). * Make 'port' parameter for ide_hwif_configure() 'unsigned int'. * Separate PCI specific init from generic init in ide_pci_setup_ports(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/setup-pci.c')
-rw-r--r--drivers/ide/setup-pci.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c
index acef85d1c581..53d9979edc72 100644
--- a/drivers/ide/setup-pci.c
+++ b/drivers/ide/setup-pci.c
@@ -339,7 +339,8 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *
339 * ide_hwif_configure - configure an IDE interface 339 * ide_hwif_configure - configure an IDE interface
340 * @dev: PCI device holding interface 340 * @dev: PCI device holding interface
341 * @d: IDE port info 341 * @d: IDE port info
342 * @mate: Paired interface if any 342 * @port: port number
343 * @irq: PCI IRQ
343 * 344 *
344 * Perform the initial set up for the hardware interface structure. This 345 * Perform the initial set up for the hardware interface structure. This
345 * is done per interface port rather than per PCI device. There may be 346 * is done per interface port rather than per PCI device. There may be
@@ -348,7 +349,9 @@ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *
348 * Returns the new hardware interface structure, or NULL on a failure 349 * Returns the new hardware interface structure, or NULL on a failure
349 */ 350 */
350 351
351static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port_info *d, ide_hwif_t *mate, int port, int irq) 352static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev,
353 const struct ide_port_info *d,
354 unsigned int port, int irq)
352{ 355{
353 unsigned long ctl = 0, base = 0; 356 unsigned long ctl = 0, base = 0;
354 ide_hwif_t *hwif; 357 ide_hwif_t *hwif;
@@ -394,12 +397,7 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port
394 397
395 hwif->dev = &dev->dev; 398 hwif->dev = &dev->dev;
396 hwif->cds = d; 399 hwif->cds = d;
397 hwif->channel = port;
398 400
399 if (mate) {
400 hwif->mate = mate;
401 mate->mate = hwif;
402 }
403 return hwif; 401 return hwif;
404} 402}
405 403
@@ -527,10 +525,25 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int
527 continue; /* port not enabled */ 525 continue; /* port not enabled */
528 } 526 }
529 527
530 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) 528 hwif = ide_hwif_configure(dev, d, port, pciirq);
529 if (hwif == NULL)
531 continue; 530 continue;
532 531
533 *(idx + port) = hwif->index; 532 *(idx + port) = hwif->index;
533 }
534
535 for (port = 0; port < channels; ++port) {
536 if (*(idx + port) == 0xff)
537 continue;
538
539 hwif = &ide_hwifs[*(idx + port)];
540
541 if (mate) {
542 hwif->mate = mate;
543 mate->mate = hwif;
544 }
545
546 hwif->channel = port;
534 547
535 if (d->init_iops) 548 if (d->init_iops)
536 d->init_iops(hwif); 549 d->init_iops(hwif);