ide: add ide_set_media_lock() helper

* Set IDE_AFLAG_NO_DOORLOCK in idetape_get_mode_sense_result(), check it
  in ide_tape_set_media_lock() and cleanup idetape_create_prevent_cmd().

* Set IDE_AFLAG_NO_DOORLOCK in ide_floppy_create_read_capacity_cmd() and
  check it instead of IDE_AFLAG_CLIK_DRIVE in ide_floppy_set_media_lock().

* Add ide_set_media_lock() helper and convert ide-{floppy,tape}.c to use it.

* Remove no longer used ide*_create_prevent_cmd()/ide*_set_media_lock().

* Update comment in <linux/ide.h> accordingly.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index f82ddfb..c647a40 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -162,6 +162,21 @@
 }
 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,