diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-26 14:13:08 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-01-26 14:13:08 -0500 |
commit | 79127c37aa5d959c9ace40a869386f712b55ac6d (patch) | |
tree | 7de0d451e8b57abb246b9501c536011e7c317f15 | |
parent | 6828fc9a919b06723599192300053ddf6f638c95 (diff) |
ide: use ide_init_port_hw() in setup-pci.c
* Move setting hwif->gendev.parent from ide_pci_setup_ports()
to ide_hwif_configure().
* Always set hwif->io_ports in ide_hwif_configure().
* Use ide_init_port_hw() in ide_hwif_configure().
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r-- | drivers/ide/setup-pci.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/ide/setup-pci.c b/drivers/ide/setup-pci.c index caa4a6a32711..be9ae5a38cc7 100644 --- a/drivers/ide/setup-pci.c +++ b/drivers/ide/setup-pci.c | |||
@@ -363,6 +363,8 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port | |||
363 | unsigned long ctl = 0, base = 0; | 363 | unsigned long ctl = 0, base = 0; |
364 | ide_hwif_t *hwif; | 364 | ide_hwif_t *hwif; |
365 | u8 bootable = (d->host_flags & IDE_HFLAG_BOOTABLE) ? 1 : 0; | 365 | u8 bootable = (d->host_flags & IDE_HFLAG_BOOTABLE) ? 1 : 0; |
366 | u8 oldnoprobe = 0; | ||
367 | struct hw_regs_s hw; | ||
366 | 368 | ||
367 | if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { | 369 | if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { |
368 | /* Possibly we should fail if these checks report true */ | 370 | /* Possibly we should fail if these checks report true */ |
@@ -385,22 +387,25 @@ static ide_hwif_t *ide_hwif_configure(struct pci_dev *dev, const struct ide_port | |||
385 | } | 387 | } |
386 | if ((hwif = ide_match_hwif(base, bootable, d->name)) == NULL) | 388 | if ((hwif = ide_match_hwif(base, bootable, d->name)) == NULL) |
387 | return NULL; /* no room in ide_hwifs[] */ | 389 | return NULL; /* no room in ide_hwifs[] */ |
388 | if (hwif->io_ports[IDE_DATA_OFFSET] != base || | 390 | |
389 | hwif->io_ports[IDE_CONTROL_OFFSET] != (ctl | 2)) { | 391 | memset(&hw, 0, sizeof(hw)); |
390 | hw_regs_t hw; | 392 | hw.irq = hwif->irq ? hwif->irq : irq; |
391 | 393 | hw.dev = &dev->dev; | |
392 | memset(&hw, 0, sizeof(hw)); | 394 | hw.chipset = d->chipset ? d->chipset : ide_pci; |
393 | ide_std_init_ports(&hw, base, ctl | 2); | 395 | ide_std_init_ports(&hw, base, ctl | 2); |
394 | memcpy(hwif->io_ports, hw.io_ports, sizeof(hwif->io_ports)); | 396 | |
395 | hwif->noprobe = 0; | 397 | if (hwif->io_ports[IDE_DATA_OFFSET] == base && |
396 | } | 398 | hwif->io_ports[IDE_CONTROL_OFFSET] == (ctl | 2)) |
397 | hwif->chipset = d->chipset ? d->chipset : ide_pci; | 399 | oldnoprobe = hwif->noprobe; |
400 | |||
401 | ide_init_port_hw(hwif, &hw); | ||
402 | |||
403 | hwif->noprobe = oldnoprobe; | ||
404 | |||
398 | hwif->pci_dev = dev; | 405 | hwif->pci_dev = dev; |
399 | hwif->cds = d; | 406 | hwif->cds = d; |
400 | hwif->channel = port; | 407 | hwif->channel = port; |
401 | 408 | ||
402 | if (!hwif->irq) | ||
403 | hwif->irq = irq; | ||
404 | if (mate) { | 409 | if (mate) { |
405 | hwif->mate = mate; | 410 | hwif->mate = mate; |
406 | mate->mate = hwif; | 411 | mate->mate = hwif; |
@@ -535,12 +540,8 @@ void ide_pci_setup_ports(struct pci_dev *dev, const struct ide_port_info *d, int | |||
535 | if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) | 540 | if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) |
536 | continue; | 541 | continue; |
537 | 542 | ||
538 | /* setup proper ancestral information */ | ||
539 | hwif->gendev.parent = &dev->dev; | ||
540 | |||
541 | *(idx + port) = hwif->index; | 543 | *(idx + port) = hwif->index; |
542 | 544 | ||
543 | |||
544 | if (d->init_iops) | 545 | if (d->init_iops) |
545 | d->init_iops(hwif); | 546 | d->init_iops(hwif); |
546 | 547 | ||