scsi: core: Call scsi_done directly
authorBart Van Assche <bvanassche@acm.org>
Thu, 7 Oct 2021 20:46:11 +0000 (13:46 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sun, 17 Oct 2021 01:31:43 +0000 (21:31 -0400)
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly. Since this patch removes the last user of the
scsi_done member, also remove that data structure member.

Link: https://lore.kernel.org/r/20211007204618.2196847-11-bvanassche@acm.org
Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/hosts.c
drivers/scsi/scsi_lib.c
include/scsi/scsi_cmnd.h
include/scsi/scsi_host.h

index b8362700a9de94455c44fd9aefca20c531acb5a5..d78cec70259641bad1789264ae46821f2dd23ad9 100644 (file)
@@ -667,7 +667,7 @@ static bool complete_all_cmds_iter(struct request *rq, void *data, bool rsvd)
        scsi_dma_unmap(scmd);
        scmd->result = 0;
        set_host_byte(scmd, status);
-       scmd->scsi_done(scmd);
+       scsi_done(scmd);
        return true;
 }
 
index f690a2da21ea91eb209ef1fe7c30922fbd356024..d0b7c6dc74f88f15a577e504f54519f514f31ce0 100644 (file)
@@ -1520,7 +1520,7 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
 
        return rtn;
  done:
-       cmd->scsi_done(cmd);
+       scsi_done(cmd);
        return 0;
 }
 
@@ -1694,7 +1694,6 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx,
        scsi_set_resid(cmd, 0);
        memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
        cmd->submitter = SUBMITTED_BY_BLOCK_LAYER;
-       cmd->scsi_done = scsi_done;
 
        blk_mq_start_request(req);
        reason = scsi_dispatch_cmd(cmd);
index 4edaadc293a7699b6dc2bb8cdf2ca175057ca9af..7958a604f979dd91e879434d033dafb8dceebb03 100644 (file)
@@ -123,10 +123,6 @@ struct scsi_cmnd {
                                 * command (auto-sense). Length must be
                                 * SCSI_SENSE_BUFFERSIZE bytes. */
 
-       /* Low-level done function - can be used by low-level driver to point
-        *        to completion function.  Not used by mid/upper level code. */
-       void (*scsi_done) (struct scsi_cmnd *);
-
        /*
         * The following fields can be written to by the host specific code. 
         * Everything else should be left alone. 
index bc9c45ced1458e37949de3dba2ee38bd661aba1a..04e9b821c0c7b5f2342a60d6240760688dbcaa71 100644 (file)
@@ -516,7 +516,7 @@ struct scsi_host_template {
                unsigned long irq_flags;                                \
                int rc;                                                 \
                spin_lock_irqsave(shost->host_lock, irq_flags);         \
-               rc = func_name##_lck (cmd, cmd->scsi_done);                     \
+               rc = func_name##_lck(cmd, scsi_done);                   \
                spin_unlock_irqrestore(shost->host_lock, irq_flags);    \
                return rc;                                              \
        }