diff mbox series

[090/117] scsi_debug: Convert to the scsi_status union

Message ID 20210420000845.25873-91-bvanassche@acm.org
State New
Headers show
Series Make better use of static type checking | expand

Commit Message

Bart Van Assche April 20, 2021, 12:08 a.m. UTC
An explanation of the purpose of this patch is available in the patch
"scsi: Introduce the scsi_status union".

Cc: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/scsi/scsi_debug.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 70165be10f00..819d872ee8ea 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -5458,24 +5458,24 @@  static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
 		ns_from_boot = ktime_get_boottime_ns();
 
 	/* one of the resp_*() response functions is called here */
-	cmnd->result = pfp ? pfp(cmnd, devip) : 0;
-	if (cmnd->result & SDEG_RES_IMMED_MASK) {
-		cmnd->result &= ~SDEG_RES_IMMED_MASK;
+	cmnd->status.combined = pfp ? pfp(cmnd, devip) : 0;
+	if (cmnd->status.combined & SDEG_RES_IMMED_MASK) {
+		cmnd->status.combined &= ~SDEG_RES_IMMED_MASK;
 		delta_jiff = ndelay = 0;
 	}
-	if (cmnd->result == 0 && scsi_result != 0)
-		cmnd->result = scsi_result;
-	if (cmnd->result == 0 && unlikely(sdebug_opts & SDEBUG_OPT_TRANSPORT_ERR)) {
+	if (cmnd->status.combined == 0 && scsi_result != 0)
+		cmnd->status.combined = scsi_result;
+	if (cmnd->status.combined == 0 && unlikely(sdebug_opts & SDEBUG_OPT_TRANSPORT_ERR)) {
 		if (atomic_read(&sdeb_inject_pending)) {
 			mk_sense_buffer(cmnd, ABORTED_COMMAND, TRANSPORT_PROBLEM, ACK_NAK_TO);
 			atomic_set(&sdeb_inject_pending, 0);
-			cmnd->result = check_condition_result;
+			cmnd->status.combined = check_condition_result;
 		}
 	}
 
-	if (unlikely(sdebug_verbose && cmnd->result))
+	if (unlikely(sdebug_verbose && cmnd->status.combined))
 		sdev_printk(KERN_INFO, sdp, "%s: non-zero result=0x%x\n",
-			    __func__, cmnd->result);
+			    __func__, cmnd->status.combined);
 
 	if (delta_jiff > 0 || ndelay > 0) {
 		ktime_t kt;
@@ -5582,10 +5582,10 @@  static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,
 	return 0;
 
 respond_in_thread:	/* call back to mid-layer using invocation thread */
-	cmnd->result = pfp != NULL ? pfp(cmnd, devip) : 0;
-	cmnd->result &= ~SDEG_RES_IMMED_MASK;
-	if (cmnd->result == 0 && scsi_result != 0)
-		cmnd->result = scsi_result;
+	cmnd->status.combined = pfp != NULL ? pfp(cmnd, devip) : 0;
+	cmnd->status.combined &= ~SDEG_RES_IMMED_MASK;
+	if (cmnd->status.combined == 0 && scsi_result != 0)
+		cmnd->status.combined = scsi_result;
 	cmnd->scsi_done(cmnd);
 	return 0;
 }