scsi: megaraid: Call scsi_done() directly
authorBart Van Assche <bvanassche@acm.org>
Thu, 7 Oct 2021 20:28:44 +0000 (13:28 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Sun, 17 Oct 2021 01:29:15 +0000 (21:29 -0400)
Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.

Link: https://lore.kernel.org/r/20211007202923.2174984-50-bvanassche@acm.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/megaraid.c

index 56910e9..c4ea833 100644 (file)
@@ -380,9 +380,6 @@ megaraid_queue_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
 
        adapter = (adapter_t *)scmd->device->host->hostdata;
 
-       scmd->scsi_done = done;
-
-
        /*
         * Allocate and build a SCB request
         * busy flag will be set if mega_build_cmd() command could not
@@ -586,7 +583,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
                /* have just LUN 0 for each target on virtual channels */
                if (cmd->device->lun) {
                        cmd->result = (DID_BAD_TARGET << 16);
-                       cmd->scsi_done(cmd);
+                       scsi_done(cmd);
                        return NULL;
                }
 
@@ -605,7 +602,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 
                if(ldrv_num > max_ldrv_num ) {
                        cmd->result = (DID_BAD_TARGET << 16);
-                       cmd->scsi_done(cmd);
+                       scsi_done(cmd);
                        return NULL;
                }
 
@@ -617,7 +614,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
                         * devices
                         */
                        cmd->result = (DID_BAD_TARGET << 16);
-                       cmd->scsi_done(cmd);
+                       scsi_done(cmd);
                        return NULL;
                }
        }
@@ -637,7 +634,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
                         */
                        if( !adapter->has_cluster ) {
                                cmd->result = (DID_OK << 16);
-                               cmd->scsi_done(cmd);
+                               scsi_done(cmd);
                                return NULL;
                        }
 
@@ -655,7 +652,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
                        return scb;
 #else
                        cmd->result = (DID_OK << 16);
-                       cmd->scsi_done(cmd);
+                       scsi_done(cmd);
                        return NULL;
 #endif
 
@@ -670,7 +667,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
                        kunmap_atomic(buf - sg->offset);
 
                        cmd->result = (DID_OK << 16);
-                       cmd->scsi_done(cmd);
+                       scsi_done(cmd);
                        return NULL;
                }
 
@@ -866,7 +863,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
                        if( ! adapter->has_cluster ) {
 
                                cmd->result = (DID_BAD_TARGET << 16);
-                               cmd->scsi_done(cmd);
+                               scsi_done(cmd);
                                return NULL;
                        }
 
@@ -889,7 +886,7 @@ mega_build_cmd(adapter_t *adapter, struct scsi_cmnd *cmd, int *busy)
 
                default:
                        cmd->result = (DID_BAD_TARGET << 16);
-                       cmd->scsi_done(cmd);
+                       scsi_done(cmd);
                        return NULL;
                }
        }
@@ -1654,7 +1651,7 @@ mega_rundoneq (adapter_t *adapter)
                struct scsi_pointer* spos = (struct scsi_pointer *)pos;
 
                cmd = list_entry(spos, struct scsi_cmnd, SCp);
-               cmd->scsi_done(cmd);
+               scsi_done(cmd);
        }
 
        INIT_LIST_HEAD(&adapter->completed_list);