ide: call ide_build_sglist() prior to ->dma_setup (v2)
[pandora-kernel.git] / drivers / ide / pmac.c
index 7c481bb..904fb54 100644 (file)
@@ -955,7 +955,6 @@ static const struct ide_tp_ops pmac_tp_ops = {
        .exec_command           = pmac_exec_command,
        .read_status            = ide_read_status,
        .read_altstatus         = ide_read_altstatus,
-       .read_sff_dma_status    = ide_read_sff_dma_status,
 
        .set_irq                = pmac_set_irq,
 
@@ -1430,10 +1429,10 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq)
        pmac_ide_hwif_t *pmif =
                (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
        struct dbdma_cmd *table;
-       int i, count = 0;
        volatile struct dbdma_regs __iomem *dma = pmif->dma_regs;
        struct scatterlist *sg;
        int wr = (rq_data_dir(rq) == WRITE);
+       int i = hwif->sg_nents, count = 0;
 
        /* DMA table is already aligned */
        table = (struct dbdma_cmd *) pmif->dma_table_cpu;
@@ -1443,11 +1442,6 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq)
        while (readl(&dma->status) & RUN)
                udelay(1);
 
-       hwif->sg_nents = i = ide_build_sglist(drive, rq);
-
-       if (!i)
-               return 0;
-
        /* Build DBDMA commands list */
        sg = hwif->sg_table;
        while (i && sg_dma_len(sg)) {
@@ -1513,10 +1507,10 @@ use_pio_instead:
 static int
 pmac_ide_dma_setup(ide_drive_t *drive)
 {
-       ide_hwif_t *hwif = HWIF(drive);
+       ide_hwif_t *hwif = drive->hwif;
        pmac_ide_hwif_t *pmif =
                (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
-       struct request *rq = HWGROUP(drive)->rq;
+       struct request *rq = hwif->rq;
        u8 unit = drive->dn & 1, ata4 = (pmif->kind == controller_kl_ata4);
 
        if (!pmac_ide_build_dmatable(drive, rq)) {
@@ -1637,7 +1631,7 @@ pmac_ide_dma_test_irq (ide_drive_t *drive)
                        break;
                if (++timeout > 100) {
                        printk(KERN_WARNING "ide%d, ide_dma_test_irq \
-                       timeout flushing channel\n", HWIF(drive)->index);
+                       timeout flushing channel\n", hwif->index);
                        break;
                }
        }