]> err.no Git - linux-2.6/blobdiff - drivers/ide/ide-tape.c
ide-tape: remove superfluous error message from idetape_pc_intr()
[linux-2.6] / drivers / ide / ide-tape.c
index 29870c415110ad0bc3cf2d4bf76791ebfe0d5763..92fadd5a5f8a54decad895885c25b605be1b0ebe 100644 (file)
@@ -395,13 +395,13 @@ static void idetape_input_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
                if (bh == NULL) {
                        printk(KERN_ERR "ide-tape: bh == NULL in "
                                "idetape_input_buffers\n");
-                       ide_atapi_discard_data(drive, bcount);
+                       ide_pad_transfer(drive, 0, bcount);
                        return;
                }
                count = min(
                        (unsigned int)(bh->b_size - atomic_read(&bh->b_count)),
                        bcount);
-               HWIF(drive)->atapi_input_bytes(drive, bh->b_data +
+               drive->hwif->input_data(drive, NULL, bh->b_data +
                                        atomic_read(&bh->b_count), count);
                bcount -= count;
                atomic_add(count, &bh->b_count);
@@ -427,7 +427,7 @@ static void idetape_output_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
                        return;
                }
                count = min((unsigned int)pc->b_count, (unsigned int)bcount);
-               HWIF(drive)->atapi_output_bytes(drive, pc->b_data, count);
+               drive->hwif->output_data(drive, NULL, pc->b_data, count);
                bcount -= count;
                pc->b_data += count;
                pc->b_count -= count;
@@ -538,7 +538,7 @@ static void idetape_analyze_error(ide_drive_t *drive, u8 *sense)
        if (pc->flags & PC_FLAG_DMA_ERROR) {
                pc->xferred = pc->req_xfer -
                        tape->blk_size *
-                       be32_to_cpu(get_unaligned((u32 *)&sense[3]));
+                       get_unaligned_be32(&sense[3]);
                idetape_update_buffers(pc);
        }
 
@@ -662,7 +662,7 @@ static void idetape_create_request_sense_cmd(struct ide_atapi_pc *pc)
 
 static void idetape_init_rq(struct request *rq, u8 cmd)
 {
-       memset(rq, 0, sizeof(*rq));
+       blk_rq_init(NULL, rq);
        rq->cmd_type = REQ_TYPE_SPECIAL;
        rq->cmd[0] = cmd;
 }
@@ -688,9 +688,10 @@ static void idetape_queue_pc_head(ide_drive_t *drive, struct ide_atapi_pc *pc,
        struct ide_tape_obj *tape = drive->driver_data;
 
        idetape_init_rq(rq, REQ_IDETAPE_PC1);
+       rq->cmd_flags |= REQ_PREEMPT;
        rq->buffer = (char *) pc;
        rq->rq_disk = tape->disk;
-       (void) ide_do_drive_cmd(drive, rq, ide_preempt);
+       ide_do_drive_cmd(drive, rq);
 }
 
 /*
@@ -793,7 +794,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
                                " transferred\n", pc->xferred);
 
                pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
-               local_irq_enable();
+               local_irq_enable_in_hardirq();
 
 #if SIMULATE_ERRORS
                if ((pc->c[0] == WRITE_6 || pc->c[0] == READ_6) &&
@@ -841,7 +842,6 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
                pc->flags &= ~PC_FLAG_DMA_IN_PROGRESS;
                printk(KERN_ERR "ide-tape: The tape wants to issue more "
                                "interrupts in DMA mode\n");
-               printk(KERN_ERR "ide-tape: DMA disabled, reverting to PIO\n");
                ide_dma_off(drive);
                return ide_do_reset(drive);
        }
@@ -871,7 +871,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
                                printk(KERN_ERR "ide-tape: The tape wants to "
                                        "send us more data than expected "
                                        "- discarding data\n");
-                               ide_atapi_discard_data(drive, bcount);
+                               ide_pad_transfer(drive, 0, bcount);
                                ide_set_handler(drive, &idetape_pc_intr,
                                                IDETAPE_WAIT_CMD, NULL);
                                return ide_started;
@@ -880,16 +880,16 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
                                "data than expected - allowing transfer\n");
                }
                iobuf = &idetape_input_buffers;
-               xferfunc = hwif->atapi_input_bytes;
+               xferfunc = hwif->input_data;
        } else {
                iobuf = &idetape_output_buffers;
-               xferfunc = hwif->atapi_output_bytes;
+               xferfunc = hwif->output_data;
        }
 
        if (pc->bh)
                iobuf(drive, pc, bcount);
        else
-               xferfunc(drive, pc->cur_pos, bcount);
+               xferfunc(drive, NULL, pc->cur_pos, bcount);
 
        /* Update the current position */
        pc->xferred += bcount;
@@ -979,7 +979,8 @@ static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
                hwif->dma_ops->dma_start(drive);
 #endif
        /* Send the actual packet */
-       HWIF(drive)->atapi_output_bytes(drive, pc->c, 12);
+       hwif->output_data(drive, NULL, pc->c, 12);
+
        return ide_started;
 }
 
@@ -1044,8 +1045,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
        if ((pc->flags & PC_FLAG_DMA_RECOMMENDED) && drive->using_dma)
                dma_ok = !hwif->dma_ops->dma_setup(drive);
 
-       ide_pktcmd_tf_load(drive, IDE_TFLAG_NO_SELECT_MASK |
-                          IDE_TFLAG_OUT_DEVICE, bcount, dma_ok);
+       ide_pktcmd_tf_load(drive, IDE_TFLAG_OUT_DEVICE, bcount, dma_ok);
 
        if (dma_ok)
                /* Will begin DMA later */
@@ -1055,7 +1055,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
                                    IDETAPE_WAIT_CMD, NULL);
                return ide_started;
        } else {
-               hwif->OUTB(WIN_PACKETCMD, hwif->io_ports.command_addr);
+               ide_execute_pkt_cmd(drive);
                return idetape_transfer_pc(drive);
        }
 }
@@ -1517,12 +1517,16 @@ static void idetape_create_test_unit_ready_cmd(struct ide_atapi_pc *pc)
 static int idetape_queue_pc_tail(ide_drive_t *drive, struct ide_atapi_pc *pc)
 {
        struct ide_tape_obj *tape = drive->driver_data;
-       struct request rq;
+       struct request *rq;
+       int error;
 
-       idetape_init_rq(&rq, REQ_IDETAPE_PC1);
-       rq.buffer = (char *) pc;
-       rq.rq_disk = tape->disk;
-       return ide_do_drive_cmd(drive, &rq, ide_wait);
+       rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
+       rq->cmd_type = REQ_TYPE_SPECIAL;
+       rq->cmd[0] = REQ_IDETAPE_PC1;
+       rq->buffer = (char *)pc;
+       error = blk_execute_rq(drive->queue, tape->disk, rq, 0);
+       blk_put_request(rq);
+       return error;
 }
 
 static void idetape_create_load_unload_cmd(ide_drive_t *drive,
@@ -1699,26 +1703,33 @@ static int idetape_queue_rw_tail(ide_drive_t *drive, int cmd, int blocks,
                                 struct idetape_bh *bh)
 {
        idetape_tape_t *tape = drive->driver_data;
-       struct request rq;
+       struct request *rq;
+       int ret, errors;
 
        debug_log(DBG_SENSE, "%s: cmd=%d\n", __func__, cmd);
 
-       idetape_init_rq(&rq, cmd);
-       rq.rq_disk = tape->disk;
-       rq.special = (void *)bh;
-       rq.sector = tape->first_frame;
-       rq.nr_sectors           = blocks;
-       rq.current_nr_sectors   = blocks;
-       (void) ide_do_drive_cmd(drive, &rq, ide_wait);
+       rq = blk_get_request(drive->queue, READ, __GFP_WAIT);
+       rq->cmd_type = REQ_TYPE_SPECIAL;
+       rq->cmd[0] = cmd;
+       rq->rq_disk = tape->disk;
+       rq->special = (void *)bh;
+       rq->sector = tape->first_frame;
+       rq->nr_sectors = blocks;
+       rq->current_nr_sectors = blocks;
+       blk_execute_rq(drive->queue, tape->disk, rq, 0);
+
+       errors = rq->errors;
+       ret = tape->blk_size * (blocks - rq->current_nr_sectors);
+       blk_put_request(rq);
 
        if ((cmd & (REQ_IDETAPE_READ | REQ_IDETAPE_WRITE)) == 0)
                return 0;
 
        if (tape->merge_bh)
                idetape_init_merge_buffer(tape);
-       if (rq.errors == IDETAPE_ERROR_GENERAL)
+       if (errors == IDETAPE_ERROR_GENERAL)
                return -EIO;
-       return (tape->blk_size * (blocks-rq.current_nr_sectors));
+       return ret;
 }
 
 static void idetape_create_inquiry_cmd(struct ide_atapi_pc *pc)
@@ -2745,9 +2756,8 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
         * Ensure that the number we got makes sense; limit it within
         * IDETAPE_DSC_RW_MIN and IDETAPE_DSC_RW_MAX.
         */
-       tape->best_dsc_rw_freq = max_t(unsigned long,
-                               min_t(unsigned long, t, IDETAPE_DSC_RW_MAX),
-                               IDETAPE_DSC_RW_MIN);
+       tape->best_dsc_rw_freq = clamp_t(unsigned long, t, IDETAPE_DSC_RW_MIN,
+                                        IDETAPE_DSC_RW_MAX);
        printk(KERN_INFO "ide-tape: %s <-> %s: %dKBps, %d*%dkB buffer, "
                "%lums tDSC%s\n",
                drive->name, tape->name, *(u16 *)&tape->caps[14],