diff options
Diffstat (limited to 'drivers/ide/pci/scc_pata.c')
-rw-r--r-- | drivers/ide/pci/scc_pata.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index ef07c7a8b97a..52145796f12f 100644 --- a/drivers/ide/pci/scc_pata.c +++ b/drivers/ide/pci/scc_pata.c | |||
@@ -65,7 +65,7 @@ | |||
65 | 65 | ||
66 | static struct scc_ports { | 66 | static struct scc_ports { |
67 | unsigned long ctl, dma; | 67 | unsigned long ctl, dma; |
68 | unsigned char hwif_id; /* for removing hwif from system */ | 68 | ide_hwif_t *hwif; /* for removing port from system */ |
69 | } scc_ports[MAX_HWIFS]; | 69 | } scc_ports[MAX_HWIFS]; |
70 | 70 | ||
71 | /* PIO transfer mode table */ | 71 | /* PIO transfer mode table */ |
@@ -534,12 +534,8 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev, | |||
534 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 534 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
535 | int i; | 535 | int i; |
536 | 536 | ||
537 | for (i = 0; i < MAX_HWIFS; i++) { | 537 | hwif = ide_find_port(); |
538 | hwif = &ide_hwifs[i]; | 538 | if (hwif == NULL) { |
539 | if (hwif->chipset == ide_unknown) | ||
540 | break; /* pick an unused entry */ | ||
541 | } | ||
542 | if (i == MAX_HWIFS) { | ||
543 | printk(KERN_ERR "%s: too many IDE interfaces, " | 539 | printk(KERN_ERR "%s: too many IDE interfaces, " |
544 | "no room in table\n", SCC_PATA_NAME); | 540 | "no room in table\n", SCC_PATA_NAME); |
545 | return -ENOMEM; | 541 | return -ENOMEM; |
@@ -696,7 +692,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) | |||
696 | { | 692 | { |
697 | struct scc_ports *ports = ide_get_hwifdata(hwif); | 693 | struct scc_ports *ports = ide_get_hwifdata(hwif); |
698 | 694 | ||
699 | ports->hwif_id = hwif->index; | 695 | ports->hwif = hwif; |
700 | 696 | ||
701 | hwif->dma_command = hwif->dma_base; | 697 | hwif->dma_command = hwif->dma_base; |
702 | hwif->dma_status = hwif->dma_base + 0x04; | 698 | hwif->dma_status = hwif->dma_base + 0x04; |
@@ -725,8 +721,7 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) | |||
725 | .name = name_str, \ | 721 | .name = name_str, \ |
726 | .init_iops = init_iops_scc, \ | 722 | .init_iops = init_iops_scc, \ |
727 | .init_hwif = init_hwif_scc, \ | 723 | .init_hwif = init_hwif_scc, \ |
728 | .host_flags = IDE_HFLAG_SINGLE | \ | 724 | .host_flags = IDE_HFLAG_SINGLE, \ |
729 | IDE_HFLAG_BOOTABLE, \ | ||
730 | .pio_mask = ATA_PIO4, \ | 725 | .pio_mask = ATA_PIO4, \ |
731 | } | 726 | } |
732 | 727 | ||
@@ -758,7 +753,7 @@ static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_i | |||
758 | static void __devexit scc_remove(struct pci_dev *dev) | 753 | static void __devexit scc_remove(struct pci_dev *dev) |
759 | { | 754 | { |
760 | struct scc_ports *ports = pci_get_drvdata(dev); | 755 | struct scc_ports *ports = pci_get_drvdata(dev); |
761 | ide_hwif_t *hwif = &ide_hwifs[ports->hwif_id]; | 756 | ide_hwif_t *hwif = ports->hwif; |
762 | unsigned long ctl_base = pci_resource_start(dev, 0); | 757 | unsigned long ctl_base = pci_resource_start(dev, 0); |
763 | unsigned long dma_base = pci_resource_start(dev, 1); | 758 | unsigned long dma_base = pci_resource_start(dev, 1); |
764 | unsigned long ctl_size = pci_resource_len(dev, 0); | 759 | unsigned long ctl_size = pci_resource_len(dev, 0); |