]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-floppy.c
ide: add ->pc_{update,io}_buffers methods
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-floppy.c
index d36f155470a49dfcafef2ee19dbb9a3835475c9b..378a22ca55c1dcde362c8f41457dda630c5a05e2 100644 (file)
@@ -156,10 +156,10 @@ static void idefloppy_update_buffers(ide_drive_t *drive,
                idefloppy_end_request(drive, 1, 0);
 }
 
-static void ide_floppy_callback(ide_drive_t *drive)
+static void ide_floppy_callback(ide_drive_t *drive, int dsc)
 {
        idefloppy_floppy_t *floppy = drive->driver_data;
-       struct ide_atapi_pc *pc = floppy->pc;
+       struct ide_atapi_pc *pc = drive->pc;
        int uptodate = pc->error ? 0 : 1;
 
        debug_log("Reached %s\n", __func__);
@@ -171,7 +171,7 @@ static void ide_floppy_callback(ide_drive_t *drive)
            (pc->rq && blk_pc_request(pc->rq)))
                uptodate = 1; /* FIXME */
        else if (pc->c[0] == GPCMD_REQUEST_SENSE) {
-               u8 *buf = floppy->pc->buf;
+               u8 *buf = pc->buf;
 
                if (!pc->error) {
                        floppy->sense_key = buf[2] & 0x0F;
@@ -193,37 +193,10 @@ static void ide_floppy_callback(ide_drive_t *drive)
        idefloppy_end_request(drive, uptodate, 0);
 }
 
-void ide_floppy_create_request_sense_cmd(struct ide_atapi_pc *pc)
-{
-       ide_init_pc(pc);
-       pc->c[0] = GPCMD_REQUEST_SENSE;
-       pc->c[4] = 255;
-       pc->req_xfer = 18;
-}
-
-/*
- * 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 idefloppy_retry_pc(ide_drive_t *drive)
-{
-       struct ide_floppy_obj *floppy = drive->driver_data;
-       struct request *rq = &floppy->request_sense_rq;
-       struct ide_atapi_pc *pc = &floppy->request_sense_pc;
-
-       (void)ide_read_error(drive);
-       ide_floppy_create_request_sense_cmd(pc);
-       ide_queue_pc_head(drive, floppy->disk, pc, rq);
-}
-
 /* The usual interrupt handler called during a packet command. */
 static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
 {
-       idefloppy_floppy_t *floppy = drive->driver_data;
-
-       return ide_pc_intr(drive, floppy->pc, idefloppy_pc_intr,
-                          WAIT_FLOPPY_CMD, NULL, idefloppy_update_buffers,
-                          idefloppy_retry_pc, NULL, ide_io_buffers);
+       return ide_pc_intr(drive, idefloppy_pc_intr);
 }
 
 /*
@@ -234,10 +207,8 @@ static ide_startstop_t idefloppy_pc_intr(ide_drive_t *drive)
  */
 static int idefloppy_transfer_pc(ide_drive_t *drive)
 {
-       idefloppy_floppy_t *floppy = drive->driver_data;
-
        /* Send the actual packet */
-       drive->hwif->tp_ops->output_data(drive, NULL, floppy->pc->c, 12);
+       drive->hwif->tp_ops->output_data(drive, NULL, drive->pc->c, 12);
 
        /* Timeout for the packet command */
        return WAIT_FLOPPY_CMD;
@@ -251,7 +222,6 @@ static int idefloppy_transfer_pc(ide_drive_t *drive)
 static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive)
 {
        idefloppy_floppy_t *floppy = drive->driver_data;
-       struct ide_atapi_pc *pc = floppy->pc;
        ide_expiry_t *expiry;
        unsigned int timeout;
 
@@ -271,7 +241,7 @@ static ide_startstop_t idefloppy_start_pc_transfer(ide_drive_t *drive)
                expiry = NULL;
        }
 
-       return ide_transfer_pc(drive, pc, idefloppy_pc_intr, timeout, expiry);
+       return ide_transfer_pc(drive, idefloppy_pc_intr, timeout, expiry);
 }
 
 static void ide_floppy_report_error(idefloppy_floppy_t *floppy,
@@ -298,8 +268,9 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
        if (floppy->failed_pc == NULL &&
            pc->c[0] != GPCMD_REQUEST_SENSE)
                floppy->failed_pc = pc;
+
        /* Set the current packet command */
-       floppy->pc = pc;
+       drive->pc = pc;
 
        if (pc->retries > IDEFLOPPY_MAX_PC_RETRIES) {
                if (!(pc->flags & PC_FLAG_SUPPRESS_ERROR))
@@ -308,7 +279,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
                pc->error = IDEFLOPPY_ERROR_GENERAL;
 
                floppy->failed_pc = NULL;
-               drive->pc_callback(drive);
+               drive->pc_callback(drive, 0);
                return ide_stopped;
        }
 
@@ -316,7 +287,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
 
        pc->retries++;
 
-       return ide_issue_pc(drive, pc, idefloppy_start_pc_transfer,
+       return ide_issue_pc(drive, idefloppy_start_pc_transfer,
                            WAIT_FLOPPY_CMD, NULL);
 }
 
@@ -664,7 +635,9 @@ static void idefloppy_setup(ide_drive_t *drive, idefloppy_floppy_t *floppy)
 
        *((u16 *)&gcw) = id[ATA_ID_CONFIG];
 
-       drive->pc_callback = ide_floppy_callback;
+       drive->pc_callback       = ide_floppy_callback;
+       drive->pc_update_buffers = idefloppy_update_buffers;
+       drive->pc_io_buffers     = ide_io_buffers;
 
        if (((gcw[0] & 0x60) >> 5) == 1)
                drive->atapi_flags |= IDE_AFLAG_DRQ_INTERRUPT;