From aaf2173b5cc3cf5a45b548e5fc62f155417778a1 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 7 Oct 2021 13:28:45 -0700 Subject: scsi: mesh: Call scsi_done() directly Conditional statements are faster than indirect calls. Hence call scsi_done() directly. Link: https://lore.kernel.org/r/20211007202923.2174984-51-bvanassche@acm.org Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/mesh.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'drivers/scsi/mesh.c') diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index 78b72bcf58fe..73a3e85802ad 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c @@ -342,15 +342,6 @@ static inline void mesh_flush_io(volatile struct mesh_regs __iomem *mr) } -/* - * Complete a SCSI command - */ -static void mesh_completed(struct mesh_state *ms, struct scsi_cmnd *cmd) -{ - (*cmd->scsi_done)(cmd); -} - - /* Called with meshinterrupt disabled, initialize the chipset * and eventually do the initial bus reset. The lock must not be * held since we can schedule. @@ -613,7 +604,7 @@ static void mesh_done(struct mesh_state *ms, int start_next) #endif } cmd->SCp.this_residual -= ms->data_ptr; - mesh_completed(ms, cmd); + scsi_done(cmd); } if (start_next) { out_8(&ms->mesh->sequence, SEQ_ENBRESEL); @@ -996,7 +987,7 @@ static void handle_reset(struct mesh_state *ms) if ((cmd = tp->current_req) != NULL) { set_host_byte(cmd, DID_RESET); tp->current_req = NULL; - mesh_completed(ms, cmd); + scsi_done(cmd); } ms->tgts[tgt].sdtr_state = do_sdtr; ms->tgts[tgt].sync_params = ASYNC_PARAMS; @@ -1005,7 +996,7 @@ static void handle_reset(struct mesh_state *ms) while ((cmd = ms->request_q) != NULL) { ms->request_q = (struct scsi_cmnd *) cmd->host_scribble; set_host_byte(cmd, DID_RESET); - mesh_completed(ms, cmd); + scsi_done(cmd); } ms->phase = idle; ms->msgphase = msg_none; @@ -1634,7 +1625,6 @@ static int mesh_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd * { struct mesh_state *ms; - cmd->scsi_done = done; cmd->host_scribble = NULL; ms = (struct mesh_state *) cmd->device->host->hostdata; -- cgit From af049dfd0b105bab32170d1c68826a4cd8424efd Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 7 Oct 2021 13:46:14 -0700 Subject: scsi: core: Remove the 'done' argument from SCSI queuecommand_lck functions The DEF_SCSI_QCMD() macro passes the addresses of the SCSI host lock and also that of the scsi_done function to the queuecommand_lck() function implementations. Remove the 'scsi_done' argument since its address is now a constant and instead call 'scsi_done' directly from inside the queuecommand_lck() functions. Link: https://lore.kernel.org/r/20211007204618.2196847-14-bvanassche@acm.org Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen --- drivers/scsi/mesh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/scsi/mesh.c') diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index 73a3e85802ad..ca133e0a140a 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c @@ -1621,7 +1621,7 @@ static void cmd_complete(struct mesh_state *ms) * Called by midlayer with host locked to queue a new * request */ -static int mesh_queue_lck(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *)) +static int mesh_queue_lck(struct scsi_cmnd *cmd) { struct mesh_state *ms; -- cgit