]> err.no Git - linux-2.6/blobdiff - drivers/ide/pci/sgiioc4.c
Merge branch 'header-move' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemo...
[linux-2.6] / drivers / ide / pci / sgiioc4.c
index 86f7c4901837ebb524c9cccf9f211f9f2805a382..42eef19a18f14f7c46611ffb2a7073e8d8cce6d4 100644 (file)
@@ -550,6 +550,21 @@ static int sgiioc4_dma_setup(ide_drive_t *drive)
        return 0;
 }
 
+static const struct ide_tp_ops sgiioc4_tp_ops = {
+       .exec_command           = ide_exec_command,
+       .read_status            = sgiioc4_read_status,
+       .read_altstatus         = ide_read_altstatus,
+       .read_sff_dma_status    = ide_read_sff_dma_status,
+
+       .set_irq                = ide_set_irq,
+
+       .tf_load                = ide_tf_load,
+       .tf_read                = ide_tf_read,
+
+       .input_data             = ide_input_data,
+       .output_data            = ide_output_data,
+};
+
 static const struct ide_port_ops sgiioc4_port_ops = {
        .set_dma_mode           = sgiioc4_set_dma_mode,
        /* reset DMA engine, clear IRQs */
@@ -572,6 +587,7 @@ static const struct ide_port_info sgiioc4_port_info __devinitdata = {
        .name                   = DRV_NAME,
        .chipset                = ide_pci,
        .init_dma               = ide_dma_sgiioc4,
+       .tp_ops                 = &sgiioc4_tp_ops,
        .port_ops               = &sgiioc4_port_ops,
        .dma_ops                = &sgiioc4_dma_ops,
        .host_flags             = IDE_HFLAG_MMIO,
@@ -584,10 +600,10 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
        unsigned long cmd_base, irqport;
        unsigned long bar0, cmd_phys_base, ctl;
        void __iomem *virt_base;
-       ide_hwif_t *hwif;
+       struct ide_host *host;
        hw_regs_t hw, *hws[] = { &hw, NULL, NULL, NULL };
-       u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
        struct ide_port_info d = sgiioc4_port_info;
+       int rc;
 
        /*  Get the CmdBlk and CtrlBlk Base Registers */
        bar0 = pci_resource_start(dev, 0);
@@ -619,25 +635,26 @@ sgiioc4_ide_setup_pci_device(struct pci_dev *dev)
        hw.chipset = ide_pci;
        hw.dev = &dev->dev;
 
-       hwif = ide_find_port_slot(&d);
-       if (hwif == NULL)
-               goto err;
-
        /* Initializing chipset IRQ Registers */
        writel(0x03, (void __iomem *)(irqport + IOC4_INTR_SET * 4));
 
-       hwif->read_status = sgiioc4_read_status;
-
-       idx[0] = hwif->index;
+       host = ide_host_alloc(&d, hws);
+       if (host == NULL) {
+               rc = -ENOMEM;
+               goto err;
+       }
 
-       if (ide_device_add(idx, &d, hws))
-               return -EIO;
+       rc = ide_host_register(host, &d, hws);
+       if (rc)
+               goto err_free;
 
        return 0;
+err_free:
+       ide_host_free(host);
 err:
        release_mem_region(cmd_phys_base, IOC4_CMD_CTL_BLK_SIZE);
        iounmap(virt_base);
-       return -ENOMEM;
+       return rc;
 }
 
 static unsigned int __devinit