]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-tape.c
ide: make ide_pc_intr() static
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-tape.c
index f8c84df4a0bcf5e743cc2b341973488786602f29..a148de623af01236a8820fde12c2cbf1ed81bc54 100644 (file)
@@ -172,23 +172,16 @@ typedef struct ide_tape_obj {
        struct kref     kref;
 
        /*
-        *      pc points to the current processed packet command.
-        *
         *      failed_pc points to the last failed packet command, or contains
         *      NULL if we do not need to retry any packet command. This is
         *      required since an additional packet command is needed before the
         *      retry, to get detailed information on what went wrong.
         */
-       /* Current packet command */
-       struct ide_atapi_pc *pc;
        /* Last failed packet command */
        struct ide_atapi_pc *failed_pc;
        /* used by REQ_IDETAPE_{READ,WRITE} requests */
        struct ide_atapi_pc queued_pc;
 
-       struct ide_atapi_pc request_sense_pc;
-       struct request request_sense_rq;
-
        /*
         * DSC polling variables.
         *
@@ -522,14 +515,19 @@ static int idetape_end_request(ide_drive_t *drive, int uptodate, int nr_sects)
        return 0;
 }
 
-static void ide_tape_callback(ide_drive_t *drive)
+static void ide_tape_handle_dsc(ide_drive_t *);
+
+static void ide_tape_callback(ide_drive_t *drive, int dsc)
 {
        idetape_tape_t *tape = drive->driver_data;
-       struct ide_atapi_pc *pc = tape->pc;
+       struct ide_atapi_pc *pc = drive->pc;
        int uptodate = pc->error ? 0 : 1;
 
        debug_log(DBG_PROCS, "Enter %s\n", __func__);
 
+       if (dsc)
+               ide_tape_handle_dsc(drive);
+
        if (tape->failed_pc == pc)
                tape->failed_pc = NULL;
 
@@ -558,7 +556,7 @@ static void ide_tape_callback(ide_drive_t *drive)
                if (pc->error)
                        uptodate = pc->error;
        } else if (pc->c[0] == READ_POSITION && uptodate) {
-               u8 *readpos = tape->pc->buf;
+               u8 *readpos = pc->buf;
 
                debug_log(DBG_SENSE, "BOP - %s\n",
                                (readpos[0] & 0x80) ? "Yes" : "No");
@@ -583,31 +581,6 @@ static void ide_tape_callback(ide_drive_t *drive)
        idetape_end_request(drive, uptodate, 0);
 }
 
-static void idetape_create_request_sense_cmd(struct ide_atapi_pc *pc)
-{
-       ide_init_pc(pc);
-       pc->c[0] = REQUEST_SENSE;
-       pc->c[4] = 20;
-       pc->req_xfer = 20;
-}
-
-/*
- *     idetape_retry_pc is called when an error was detected during the
- *     last packet command. We queue a request sense packet command in
- *     the head of the request list.
- */
-static void idetape_retry_pc(ide_drive_t *drive)
-{
-       struct ide_tape_obj *tape = drive->driver_data;
-       struct request *rq = &tape->request_sense_rq;
-       struct ide_atapi_pc *pc = &tape->request_sense_pc;
-
-       (void)ide_read_error(drive);
-       idetape_create_request_sense_cmd(pc);
-       set_bit(IDE_AFLAG_IGNORE_DSC, &drive->atapi_flags);
-       ide_queue_pc_head(drive, tape->disk, pc, rq);
-}
-
 /*
  * Postpone the current request so that ide.c will be able to service requests
  * from another device on the same hwgroup while we are polling for DSC.
@@ -645,35 +618,19 @@ static int ide_tape_io_buffers(ide_drive_t *drive, struct ide_atapi_pc *pc,
        return bcount;
 }
 
-/*
- * This is the usual interrupt handler which will be called during a packet
- * command. We will transfer some of the data (as requested by the drive) and
- * will re-point interrupt handler to us. When data transfer is finished, we
- * will act according to the algorithm described before
- * idetape_issue_pc.
- */
-static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
-{
-       idetape_tape_t *tape = drive->driver_data;
-
-       return ide_pc_intr(drive, tape->pc, idetape_pc_intr, WAIT_TAPE_CMD,
-                          NULL, idetape_update_buffers, idetape_retry_pc,
-                          ide_tape_handle_dsc, ide_tape_io_buffers);
-}
-
 /*
  * Packet Command Interface
  *
- * The current Packet Command is available in tape->pc, and will not change
+ * The current Packet Command is available in drive->pc, and will not change
  * until we finish handling it. Each packet command is associated with a
  * callback function that will be called when the command is finished.
  *
  * The handling will be done in three stages:
  *
  * 1. idetape_issue_pc will send the packet command to the drive, and will set
- * the interrupt handler to idetape_pc_intr.
+ * the interrupt handler to ide_pc_intr.
  *
- * 2. On each interrupt, idetape_pc_intr will be called. This step will be
+ * 2. On each interrupt, ide_pc_intr will be called. This step will be
  * repeated until the device signals us that no more interrupts will be issued.
  *
  * 3. ATAPI Tape media access commands have immediate status with a delayed
@@ -699,10 +656,7 @@ static ide_startstop_t idetape_pc_intr(ide_drive_t *drive)
  */
 static ide_startstop_t idetape_transfer_pc(ide_drive_t *drive)
 {
-       idetape_tape_t *tape = drive->driver_data;
-
-       return ide_transfer_pc(drive, tape->pc, idetape_pc_intr,
-                              WAIT_TAPE_CMD, NULL);
+       return ide_transfer_pc(drive, WAIT_TAPE_CMD, NULL);
 }
 
 static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
@@ -710,7 +664,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
 {
        idetape_tape_t *tape = drive->driver_data;
 
-       if (tape->pc->c[0] == REQUEST_SENSE &&
+       if (drive->pc->c[0] == REQUEST_SENSE &&
            pc->c[0] == REQUEST_SENSE) {
                printk(KERN_ERR "ide-tape: possible ide-tape.c bug - "
                        "Two request sense in serial were issued\n");
@@ -718,8 +672,9 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
 
        if (tape->failed_pc == NULL && pc->c[0] != REQUEST_SENSE)
                tape->failed_pc = pc;
+
        /* Set the current packet command */
-       tape->pc = pc;
+       drive->pc = pc;
 
        if (pc->retries > IDETAPE_MAX_PC_RETRIES ||
                (pc->flags & PC_FLAG_ABORT)) {
@@ -743,15 +698,14 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
                        pc->error = IDETAPE_ERROR_GENERAL;
                }
                tape->failed_pc = NULL;
-               drive->pc_callback(drive);
+               drive->pc_callback(drive, 0);
                return ide_stopped;
        }
        debug_log(DBG_SENSE, "Retry #%d, cmd = %02X\n", pc->retries, pc->c[0]);
 
        pc->retries++;
 
-       return ide_issue_pc(drive, pc, idetape_transfer_pc,
-                           WAIT_TAPE_CMD, NULL);
+       return ide_issue_pc(drive, idetape_transfer_pc, WAIT_TAPE_CMD, NULL);
 }
 
 /* A mode sense command is used to "sense" tape parameters. */
@@ -785,7 +739,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
 {
        ide_hwif_t *hwif = drive->hwif;
        idetape_tape_t *tape = drive->driver_data;
-       struct ide_atapi_pc *pc = tape->pc;
+       struct ide_atapi_pc *pc = drive->pc;
        u8 stat;
 
        stat = hwif->tp_ops->read_status(hwif);
@@ -797,7 +751,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
                                printk(KERN_ERR "ide-tape: %s: I/O error, ",
                                                tape->name);
                        /* Retry operation */
-                       idetape_retry_pc(drive);
+                       ide_retry_pc(drive, tape->disk);
                        return ide_stopped;
                }
                pc->error = 0;
@@ -805,7 +759,7 @@ static ide_startstop_t idetape_media_access_finished(ide_drive_t *drive)
                pc->error = IDETAPE_ERROR_GENERAL;
                tape->failed_pc = NULL;
        }
-       drive->pc_callback(drive);
+       drive->pc_callback(drive, 0);
        return ide_stopped;
 }
 
@@ -862,7 +816,7 @@ static ide_startstop_t idetape_do_request(ide_drive_t *drive,
        }
 
        /* Retry a failed packet command */
-       if (tape->failed_pc && tape->pc->c[0] == REQUEST_SENSE) {
+       if (tape->failed_pc && drive->pc->c[0] == REQUEST_SENSE) {
                pc = tape->failed_pc;
                goto out;
        }
@@ -2244,7 +2198,9 @@ static void idetape_setup(ide_drive_t *drive, idetape_tape_t *tape, int minor)
        u8 gcw[2];
        u16 *ctl = (u16 *)&tape->caps[12];
 
-       drive->pc_callback = ide_tape_callback;
+       drive->pc_callback       = ide_tape_callback;
+       drive->pc_update_buffers = idetape_update_buffers;
+       drive->pc_io_buffers     = ide_tape_io_buffers;
 
        spin_lock_init(&tape->lock);
        drive->dsc_overlap = 1;