Commit 1a30fd18 authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

scsi: mpi3mr: Call scsi_done() directly

Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.

Link: https://lore.kernel.org/r/20211007202923.2174984-52-bvanassche@acm.orgSigned-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent aaf2173b
...@@ -409,7 +409,7 @@ static bool mpi3mr_flush_scmd(struct request *rq, ...@@ -409,7 +409,7 @@ static bool mpi3mr_flush_scmd(struct request *rq,
scsi_dma_unmap(scmd); scsi_dma_unmap(scmd);
scmd->result = DID_RESET << 16; scmd->result = DID_RESET << 16;
scsi_print_command(scmd); scsi_print_command(scmd);
scmd->scsi_done(scmd); scsi_done(scmd);
mrioc->flush_io_count++; mrioc->flush_io_count++;
} }
...@@ -2312,7 +2312,7 @@ void mpi3mr_process_op_reply_desc(struct mpi3mr_ioc *mrioc, ...@@ -2312,7 +2312,7 @@ void mpi3mr_process_op_reply_desc(struct mpi3mr_ioc *mrioc,
} }
mpi3mr_clear_scmd_priv(mrioc, scmd); mpi3mr_clear_scmd_priv(mrioc, scmd);
scsi_dma_unmap(scmd); scsi_dma_unmap(scmd);
scmd->scsi_done(scmd); scsi_done(scmd);
out: out:
if (sense_buf) if (sense_buf)
mpi3mr_repost_sense_buf(mrioc, mpi3mr_repost_sense_buf(mrioc,
...@@ -3322,7 +3322,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, ...@@ -3322,7 +3322,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc,
__func__); __func__);
scsi_print_command(scmd); scsi_print_command(scmd);
scmd->result = DID_OK << 16; scmd->result = DID_OK << 16;
scmd->scsi_done(scmd); scsi_done(scmd);
return true; return true;
} }
...@@ -3334,7 +3334,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, ...@@ -3334,7 +3334,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc,
scmd->result = SAM_STAT_CHECK_CONDITION; scmd->result = SAM_STAT_CHECK_CONDITION;
scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST,
0x1A, 0); 0x1A, 0);
scmd->scsi_done(scmd); scsi_done(scmd);
return true; return true;
} }
if (param_len != scsi_bufflen(scmd)) { if (param_len != scsi_bufflen(scmd)) {
...@@ -3345,7 +3345,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, ...@@ -3345,7 +3345,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc,
scmd->result = SAM_STAT_CHECK_CONDITION; scmd->result = SAM_STAT_CHECK_CONDITION;
scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST,
0x1A, 0); 0x1A, 0);
scmd->scsi_done(scmd); scsi_done(scmd);
return true; return true;
} }
buf = kzalloc(scsi_bufflen(scmd), GFP_ATOMIC); buf = kzalloc(scsi_bufflen(scmd), GFP_ATOMIC);
...@@ -3354,7 +3354,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, ...@@ -3354,7 +3354,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc,
scmd->result = SAM_STAT_CHECK_CONDITION; scmd->result = SAM_STAT_CHECK_CONDITION;
scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST,
0x55, 0x03); 0x55, 0x03);
scmd->scsi_done(scmd); scsi_done(scmd);
return true; return true;
} }
scsi_sg_copy_to_buffer(scmd, buf, scsi_bufflen(scmd)); scsi_sg_copy_to_buffer(scmd, buf, scsi_bufflen(scmd));
...@@ -3368,7 +3368,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc, ...@@ -3368,7 +3368,7 @@ static bool mpi3mr_check_return_unmap(struct mpi3mr_ioc *mrioc,
scmd->result = SAM_STAT_CHECK_CONDITION; scmd->result = SAM_STAT_CHECK_CONDITION;
scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST, scsi_build_sense_buffer(0, scmd->sense_buffer, ILLEGAL_REQUEST,
0x26, 0); 0x26, 0);
scmd->scsi_done(scmd); scsi_done(scmd);
kfree(buf); kfree(buf);
return true; return true;
} }
...@@ -3438,14 +3438,14 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, ...@@ -3438,14 +3438,14 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost,
sdev_priv_data = scmd->device->hostdata; sdev_priv_data = scmd->device->hostdata;
if (!sdev_priv_data || !sdev_priv_data->tgt_priv_data) { if (!sdev_priv_data || !sdev_priv_data->tgt_priv_data) {
scmd->result = DID_NO_CONNECT << 16; scmd->result = DID_NO_CONNECT << 16;
scmd->scsi_done(scmd); scsi_done(scmd);
goto out; goto out;
} }
if (mrioc->stop_drv_processing && if (mrioc->stop_drv_processing &&
!(mpi3mr_allow_scmd_to_fw(scmd))) { !(mpi3mr_allow_scmd_to_fw(scmd))) {
scmd->result = DID_NO_CONNECT << 16; scmd->result = DID_NO_CONNECT << 16;
scmd->scsi_done(scmd); scsi_done(scmd);
goto out; goto out;
} }
...@@ -3459,19 +3459,19 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, ...@@ -3459,19 +3459,19 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost,
dev_handle = stgt_priv_data->dev_handle; dev_handle = stgt_priv_data->dev_handle;
if (dev_handle == MPI3MR_INVALID_DEV_HANDLE) { if (dev_handle == MPI3MR_INVALID_DEV_HANDLE) {
scmd->result = DID_NO_CONNECT << 16; scmd->result = DID_NO_CONNECT << 16;
scmd->scsi_done(scmd); scsi_done(scmd);
goto out; goto out;
} }
if (stgt_priv_data->dev_removed) { if (stgt_priv_data->dev_removed) {
scmd->result = DID_NO_CONNECT << 16; scmd->result = DID_NO_CONNECT << 16;
scmd->scsi_done(scmd); scsi_done(scmd);
goto out; goto out;
} }
if (atomic_read(&stgt_priv_data->block_io)) { if (atomic_read(&stgt_priv_data->block_io)) {
if (mrioc->stop_drv_processing) { if (mrioc->stop_drv_processing) {
scmd->result = DID_NO_CONNECT << 16; scmd->result = DID_NO_CONNECT << 16;
scmd->scsi_done(scmd); scsi_done(scmd);
goto out; goto out;
} }
retval = SCSI_MLQUEUE_DEVICE_BUSY; retval = SCSI_MLQUEUE_DEVICE_BUSY;
...@@ -3486,7 +3486,7 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, ...@@ -3486,7 +3486,7 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost,
host_tag = mpi3mr_host_tag_for_scmd(mrioc, scmd); host_tag = mpi3mr_host_tag_for_scmd(mrioc, scmd);
if (host_tag == MPI3MR_HOSTTAG_INVALID) { if (host_tag == MPI3MR_HOSTTAG_INVALID) {
scmd->result = DID_ERROR << 16; scmd->result = DID_ERROR << 16;
scmd->scsi_done(scmd); scsi_done(scmd);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment