]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-atapi.c
ide: drop dsc_handle argument from ide_pc_intr()
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-atapi.c
index f82ddfb9a44e8e610fbbfe382238bebcc1658883..fb27c94aeb0d4aff98032fac065a8449b61caaf7 100644 (file)
@@ -162,11 +162,52 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
 }
 EXPORT_SYMBOL_GPL(ide_queue_pc_tail);
 
+int ide_do_test_unit_ready(ide_drive_t *drive, struct gendisk *disk)
+{
+       struct ide_atapi_pc pc;
+
+       ide_init_pc(&pc);
+       pc.c[0] = TEST_UNIT_READY;
+
+       return ide_queue_pc_tail(drive, disk, &pc);
+}
+EXPORT_SYMBOL_GPL(ide_do_test_unit_ready);
+
+int ide_do_start_stop(ide_drive_t *drive, struct gendisk *disk, int start)
+{
+       struct ide_atapi_pc pc;
+
+       ide_init_pc(&pc);
+       pc.c[0] = START_STOP;
+       pc.c[4] = start;
+
+       if (drive->media == ide_tape)
+               pc.flags |= PC_FLAG_WAIT_FOR_DSC;
+
+       return ide_queue_pc_tail(drive, disk, &pc);
+}
+EXPORT_SYMBOL_GPL(ide_do_start_stop);
+
+int ide_set_media_lock(ide_drive_t *drive, struct gendisk *disk, int on)
+{
+       struct ide_atapi_pc pc;
+
+       if (drive->atapi_flags & IDE_AFLAG_NO_DOORLOCK)
+               return 0;
+
+       ide_init_pc(&pc);
+       pc.c[0] = ALLOW_MEDIUM_REMOVAL;
+       pc.c[4] = on;
+
+       return ide_queue_pc_tail(drive, disk, &pc);
+}
+EXPORT_SYMBOL_GPL(ide_set_media_lock);
+
 /* TODO: unify the code thus making some arguments go away */
 ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
        ide_handler_t *handler, unsigned int timeout, ide_expiry_t *expiry,
        void (*update_buffers)(ide_drive_t *, struct ide_atapi_pc *),
-       void (*retry_pc)(ide_drive_t *), void (*dsc_handle)(ide_drive_t *),
+       void (*retry_pc)(ide_drive_t *),
        int (*io_buffers)(ide_drive_t *, struct ide_atapi_pc *, unsigned, int))
 {
        ide_hwif_t *hwif = drive->hwif;
@@ -175,12 +216,12 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
        xfer_func_t *xferfunc;
        unsigned int temp;
        u16 bcount;
-       u8 stat, ireason, scsi = drive->scsi;
+       u8 stat, ireason, scsi = drive->scsi, dsc = 0;
 
        debug_log("Enter %s - interrupt handler\n", __func__);
 
        if (pc->flags & PC_FLAG_TIMEDOUT) {
-               drive->pc_callback(drive);
+               drive->pc_callback(drive, 0);
                return ide_stopped;
        }
 
@@ -242,14 +283,12 @@ ide_startstop_t ide_pc_intr(ide_drive_t *drive, struct ide_atapi_pc *pc,
                }
 cmd_finished:
                pc->error = 0;
-               if ((pc->flags & PC_FLAG_WAIT_FOR_DSC) &&
-                   (stat & ATA_DSC) == 0) {
-                       dsc_handle(drive);
-                       return ide_stopped;
-               }
+
+               if ((pc->flags & PC_FLAG_WAIT_FOR_DSC) && (stat & ATA_DSC) == 0)
+                       dsc = 1;
 
                /* Command finished - Call the callback function */
-               drive->pc_callback(drive);
+               drive->pc_callback(drive, dsc);
 
                return ide_stopped;
        }