diff options
Diffstat (limited to 'drivers/ide/pci/scc_pata.c')
-rw-r--r-- | drivers/ide/pci/scc_pata.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c index 5b1a0e950dfd..d5e2ba6bacd6 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 | ide_hwif_t *hwif; /* for removing port from system */ | 68 | struct ide_host *host; /* 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 */ |
@@ -586,15 +586,10 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev, | |||
586 | const struct ide_port_info *d) | 586 | const struct ide_port_info *d) |
587 | { | 587 | { |
588 | struct scc_ports *ports = pci_get_drvdata(dev); | 588 | struct scc_ports *ports = pci_get_drvdata(dev); |
589 | ide_hwif_t *hwif = NULL; | 589 | struct ide_host *host; |
590 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; | 590 | hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL }; |
591 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | ||
592 | int i; | 591 | int i; |
593 | 592 | ||
594 | hwif = ide_find_port_slot(d); | ||
595 | if (hwif == NULL) | ||
596 | return -ENOMEM; | ||
597 | |||
598 | memset(&hw, 0, sizeof(hw)); | 593 | memset(&hw, 0, sizeof(hw)); |
599 | for (i = 0; i <= 8; i++) | 594 | for (i = 0; i <= 8; i++) |
600 | hw.io_ports_array[i] = ports->dma + 0x20 + i * 4; | 595 | hw.io_ports_array[i] = ports->dma + 0x20 + i * 4; |
@@ -602,9 +597,13 @@ static int scc_ide_setup_pci_device(struct pci_dev *dev, | |||
602 | hw.dev = &dev->dev; | 597 | hw.dev = &dev->dev; |
603 | hw.chipset = ide_pci; | 598 | hw.chipset = ide_pci; |
604 | 599 | ||
605 | idx[0] = hwif->index; | 600 | host = ide_host_alloc(d, hws); |
601 | if (host == NULL) | ||
602 | return -ENOMEM; | ||
606 | 603 | ||
607 | ide_device_add(idx, d, hws); | 604 | ide_host_register(host, d, hws); |
605 | |||
606 | ports->host = host; | ||
608 | 607 | ||
609 | return 0; | 608 | return 0; |
610 | } | 609 | } |
@@ -848,8 +847,6 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif) | |||
848 | { | 847 | { |
849 | struct scc_ports *ports = ide_get_hwifdata(hwif); | 848 | struct scc_ports *ports = ide_get_hwifdata(hwif); |
850 | 849 | ||
851 | ports->hwif = hwif; | ||
852 | |||
853 | /* PTERADD */ | 850 | /* PTERADD */ |
854 | out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma); | 851 | out_be32((void __iomem *)(hwif->dma_base + 0x018), hwif->dmatable_dma); |
855 | 852 | ||
@@ -932,7 +929,8 @@ static int __devinit scc_init_one(struct pci_dev *dev, const struct pci_device_i | |||
932 | static void __devexit scc_remove(struct pci_dev *dev) | 929 | static void __devexit scc_remove(struct pci_dev *dev) |
933 | { | 930 | { |
934 | struct scc_ports *ports = pci_get_drvdata(dev); | 931 | struct scc_ports *ports = pci_get_drvdata(dev); |
935 | ide_hwif_t *hwif = ports->hwif; | 932 | struct ide_host *host = ports->host; |
933 | ide_hwif_t *hwif = host->ports[0]; | ||
936 | 934 | ||
937 | if (hwif->dmatable_cpu) { | 935 | if (hwif->dmatable_cpu) { |
938 | pci_free_consistent(dev, PRD_ENTRIES * PRD_BYTES, | 936 | pci_free_consistent(dev, PRD_ENTRIES * PRD_BYTES, |
@@ -940,7 +938,7 @@ static void __devexit scc_remove(struct pci_dev *dev) | |||
940 | hwif->dmatable_cpu = NULL; | 938 | hwif->dmatable_cpu = NULL; |
941 | } | 939 | } |
942 | 940 | ||
943 | ide_unregister(hwif); | 941 | ide_host_remove(host); |
944 | 942 | ||
945 | iounmap((void*)ports->dma); | 943 | iounmap((void*)ports->dma); |
946 | iounmap((void*)ports->ctl); | 944 | iounmap((void*)ports->ctl); |