]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/ide/ide-atapi.c
ide: add ide_set_media_lock() helper
[linux-2.6-omap-h63xx.git] / drivers / ide / ide-atapi.c
index f82ddfb9a44e8e610fbbfe382238bebcc1658883..c647a40c0d338da707c7ac4d7e9641b356746031 100644 (file)
@@ -162,6 +162,21 @@ int ide_queue_pc_tail(ide_drive_t *drive, struct gendisk *disk,
 }
 EXPORT_SYMBOL_GPL(ide_queue_pc_tail);
 
+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,