]> err.no Git - linux-2.6/blobdiff - drivers/ide/ide-taskfile.c
ide-tape: pass packet command in rq->cmd
[linux-2.6] / drivers / ide / ide-taskfile.c
index fc2b3957afac293a2e9b89340166fa4c90079efc..aeddbbd69e862e6526ee25d7a83e6143e1c5468f 100644 (file)
@@ -64,6 +64,7 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
        ide_hwif_t *hwif        = HWIF(drive);
        struct ide_taskfile *tf = &task->tf;
        ide_handler_t *handler = NULL;
+       const struct ide_tp_ops *tp_ops = hwif->tp_ops;
        const struct ide_dma_ops *dma_ops = hwif->dma_ops;
 
        if (task->data_phase == TASKFILE_MULTI_IN ||
@@ -80,15 +81,15 @@ ide_startstop_t do_rw_taskfile (ide_drive_t *drive, ide_task_t *task)
 
        if ((task->tf_flags & IDE_TFLAG_DMA_PIO_FALLBACK) == 0) {
                ide_tf_dump(drive->name, tf);
-               ide_set_irq(drive, 1);
+               tp_ops->set_irq(hwif, 1);
                SELECT_MASK(drive, 0);
-               hwif->tf_load(drive, task);
+               tp_ops->tf_load(drive, task);
        }
 
        switch (task->data_phase) {
        case TASKFILE_MULTI_OUT:
        case TASKFILE_OUT:
-               hwif->exec_command(hwif, tf->command);
+               tp_ops->exec_command(hwif, tf->command);
                ndelay(400);    /* FIXME */
                return pre_task_out_intr(drive, task->rq);
        case TASKFILE_MULTI_IN:
@@ -125,7 +126,7 @@ EXPORT_SYMBOL_GPL(do_rw_taskfile);
 static ide_startstop_t set_multmode_intr(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
-       u8 stat = hwif->read_status(hwif);
+       u8 stat = hwif->tp_ops->read_status(hwif);
 
        if (OK_STAT(stat, READY_STAT, BAD_STAT))
                drive->mult_count = drive->mult_req;
@@ -146,8 +147,12 @@ static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
        int retries = 5;
        u8 stat;
 
-       while (((stat = hwif->read_status(hwif)) & BUSY_STAT) && retries--)
+       while (1) {
+               stat = hwif->tp_ops->read_status(hwif);
+               if ((stat & BUSY_STAT) == 0 || retries-- == 0)
+                       break;
                udelay(10);
+       };
 
        if (OK_STAT(stat, READY_STAT, BAD_STAT))
                return ide_stopped;
@@ -165,7 +170,7 @@ static ide_startstop_t set_geometry_intr(ide_drive_t *drive)
 static ide_startstop_t recal_intr(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
-       u8 stat = hwif->read_status(hwif);
+       u8 stat = hwif->tp_ops->read_status(hwif);
 
        if (!OK_STAT(stat, READY_STAT, BAD_STAT))
                return ide_error(drive, "recal_intr", stat);
@@ -182,7 +187,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
        u8 stat;
 
        local_irq_enable_in_hardirq();
-       stat = hwif->read_status(hwif);
+       stat = hwif->tp_ops->read_status(hwif);
 
        if (!OK_STAT(stat, READY_STAT, BAD_STAT))
                return ide_error(drive, "task_no_data_intr", stat);
@@ -205,7 +210,7 @@ static u8 wait_drive_not_busy(ide_drive_t *drive)
         * take up to 6 ms on some ATAPI devices, so we will wait max 10 ms.
         */
        for (retries = 0; retries < 1000; retries++) {
-               stat = hwif->read_status(hwif);
+               stat = hwif->tp_ops->read_status(hwif);
 
                if (stat & BUSY_STAT)
                        udelay(10);
@@ -260,9 +265,9 @@ static void ide_pio_sector(ide_drive_t *drive, struct request *rq,
 
        /* do the actual data transfer */
        if (write)
-               hwif->output_data(drive, rq, buf, SECTOR_SIZE);
+               hwif->tp_ops->output_data(drive, rq, buf, SECTOR_SIZE);
        else
-               hwif->input_data(drive, rq, buf, SECTOR_SIZE);
+               hwif->tp_ops->input_data(drive, rq, buf, SECTOR_SIZE);
 
        kunmap_atomic(buf, KM_BIO_SRC_IRQ);
 #ifdef CONFIG_HIGHMEM
@@ -389,7 +394,7 @@ static ide_startstop_t task_in_intr(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
        struct request *rq = hwif->hwgroup->rq;
-       u8 stat = hwif->read_status(hwif);
+       u8 stat = hwif->tp_ops->read_status(hwif);
 
        /* Error? */
        if (stat & ERR_STAT)
@@ -423,7 +428,7 @@ static ide_startstop_t task_out_intr (ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
        struct request *rq = HWGROUP(drive)->rq;
-       u8 stat = hwif->read_status(hwif);
+       u8 stat = hwif->tp_ops->read_status(hwif);
 
        if (!OK_STAT(stat, DRIVE_READY, drive->bad_wstat))
                return task_error(drive, rq, __func__, stat);