[PATCH 114/117] Change the return type of scsi_test_unit_ready() into union scsi_status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Make it explicit that scsi_test_unit_ready() returns a SCSI status.

Cc: Christoph Hellwig <hch@xxxxxx>
Cc: Ming Lei <ming.lei@xxxxxxxxxx>
Cc: Hannes Reinecke <hare@xxxxxxxx>
Cc: John Garry <john.garry@xxxxxxxxxx>
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
---
 drivers/scsi/device_handler/scsi_dh_alua.c | 4 ++--
 drivers/scsi/scsi_ioctl.c                  | 2 +-
 drivers/scsi/scsi_lib.c                    | 4 ++--
 drivers/scsi/sd.c                          | 5 ++---
 drivers/scsi/sr.c                          | 6 +++---
 drivers/scsi/sr_ioctl.c                    | 3 ++-
 include/scsi/scsi_device.h                 | 4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 0de3096f9df7..476a875f6c06 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -490,14 +490,14 @@ static enum scsi_disposition alua_check_sense(struct scsi_device *sdev,
 static int alua_tur(struct scsi_device *sdev)
 {
 	struct scsi_sense_hdr sense_hdr;
-	int retval;
+	union scsi_status retval;
 
 	retval = scsi_test_unit_ready(sdev, ALUA_FAILOVER_TIMEOUT * HZ,
 				      ALUA_FAILOVER_RETRIES, &sense_hdr);
 	if (sense_hdr.sense_key == NOT_READY &&
 	    sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a)
 		return SCSI_DH_RETRY;
-	else if (retval)
+	else if (retval.combined)
 		return SCSI_DH_IO;
 	else
 		return SCSI_DH_OK;
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index b9e2f5b03c83..8b3bab5b5cb8 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -237,7 +237,7 @@ static int scsi_ioctl_common(struct scsi_device *sdev, int cmd, void __user *arg
 		return scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW);
 	case SCSI_IOCTL_TEST_UNIT_READY:
 		return scsi_test_unit_ready(sdev, IOCTL_NORMAL_TIMEOUT,
-					    NORMAL_RETRIES, &sense_hdr);
+					NORMAL_RETRIES, &sense_hdr).combined;
 	case SCSI_IOCTL_START_UNIT:
 		scsi_cmd[0] = START_STOP;
 		scsi_cmd[1] = 0;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 23750d167c47..44925839ccee 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2255,7 +2255,7 @@ EXPORT_SYMBOL(scsi_mode_sense);
  *	Returns zero if unsuccessful or an error if TUR failed.  For
  *	removable media, UNIT_ATTENTION sets ->changed flag.
  **/
-int
+union scsi_status
 scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries,
 		     struct scsi_sense_hdr *sshdr)
 {
@@ -2274,7 +2274,7 @@ scsi_test_unit_ready(struct scsi_device *sdev, int timeout, int retries,
 	} while (scsi_sense_valid(sshdr) &&
 		 sshdr->sense_key == UNIT_ATTENTION && --retries);
 
-	return result.combined;
+	return result;
 }
 EXPORT_SYMBOL(scsi_test_unit_ready);
 
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 1df895e0e619..14cf7841a0bf 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1654,9 +1654,8 @@ static unsigned int sd_check_events(struct gendisk *disk, unsigned int clearing)
 	if (scsi_block_when_processing_errors(sdp)) {
 		struct scsi_sense_hdr sshdr = { 0, };
 
-		retval.combined =
-			scsi_test_unit_ready(sdp, SD_TIMEOUT, sdkp->max_retries,
-					      &sshdr);
+		retval = scsi_test_unit_ready(sdp, SD_TIMEOUT,
+					      sdkp->max_retries, &sshdr);
 
 		/* failed to execute TUR, assume media not present */
 		if (host_byte(retval)) {
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index d745ff8a30e8..da78b402072f 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -273,8 +273,7 @@ static unsigned int sr_check_events(struct cdrom_device_info *cdi,
 do_tur:
 	/* let's see whether the media is there with TUR */
 	last_present = cd->media_present;
-	ret.combined = scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES,
-					    &sshdr);
+	ret = scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr);
 
 	/*
 	 * Media is considered to be present if TUR succeeds or fails with
@@ -508,7 +507,8 @@ static void sr_revalidate_disk(struct scsi_cd *cd)
 	struct scsi_sense_hdr sshdr;
 
 	/* if the unit is not ready, nothing more to do */
-	if (scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr))
+	if (scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr)
+	    .combined)
 		return;
 	sr_cd_check(&cd->cdi);
 	get_sectorsize(cd);
diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c
index b13612f50d6d..798a22990dc7 100644
--- a/drivers/scsi/sr_ioctl.c
+++ b/drivers/scsi/sr_ioctl.c
@@ -292,7 +292,8 @@ int sr_drive_status(struct cdrom_device_info *cdi, int slot)
 		/* we have no changer support */
 		return -EINVAL;
 	}
-	if (!scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr))
+	if (!scsi_test_unit_ready(cd->device, SR_TIMEOUT, MAX_RETRIES, &sshdr)
+	    .combined)
 		return CDS_DISC_OK;
 
 	/* SK/ASC/ASCQ of 2/4/1 means "unit is becoming ready" */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 27f3e5eb7c9a..3192610af5db 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -411,8 +411,8 @@ extern int scsi_mode_select(struct scsi_device *sdev, int pf, int sp,
 			    int timeout, int retries,
 			    struct scsi_mode_data *data,
 			    struct scsi_sense_hdr *);
-extern int scsi_test_unit_ready(struct scsi_device *sdev, int timeout,
-				int retries, struct scsi_sense_hdr *sshdr);
+extern union scsi_status scsi_test_unit_ready(struct scsi_device *sdev,
+			int timeout, int retries, struct scsi_sense_hdr *sshdr);
 extern int scsi_get_vpd_page(struct scsi_device *, u8 page, unsigned char *buf,
 			     int buf_len);
 extern int scsi_report_opcode(struct scsi_device *sdev, unsigned char *buffer,



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux