From: Christoph Hellwig <hch@lst.de>
Date: Sat, 11 Oct 2014 13:59:39 +0000 (+0200)
Subject: st: call scsi_set_medium_removal directly
X-Git-Tag: firefly_0821_release~176^2~2603^2^2~153
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=dccfa688ca7ffba0996bd5d9cd0e01b01002748e;p=firefly-linux-kernel-4.4.55.git

st: call scsi_set_medium_removal directly

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
---

diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 7d2e036c75c1..e46e02b24ba4 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -861,17 +861,16 @@ static int set_mode_densblk(struct scsi_tape * STp, struct st_modedef * STm)
 /* Lock or unlock the drive door. Don't use when st_request allocated. */
 static int do_door_lock(struct scsi_tape * STp, int do_lock)
 {
-	int retval, cmd;
+	int retval;
 
-	cmd = do_lock ? SCSI_IOCTL_DOORLOCK : SCSI_IOCTL_DOORUNLOCK;
 	DEBC_printk(STp, "%socking drive door.\n", do_lock ? "L" : "Unl");
-	retval = scsi_ioctl(STp->device, cmd, NULL);
-	if (!retval) {
+
+	retval = scsi_set_medium_removal(STp->device,
+			do_lock ? SCSI_REMOVAL_PREVENT : SCSI_REMOVAL_ALLOW);
+	if (!retval)
 		STp->door_locked = do_lock ? ST_LOCKED_EXPLICIT : ST_UNLOCKED;
-	}
-	else {
+	else
 		STp->door_locked = ST_LOCK_FAILS;
-	}
 	return retval;
 }