From: Bart Van Assche <bvanassche@acm.org>
Date: Thu, 7 Oct 2021 13:27:57 -0700
Subject: scsi: core: Rename scsi_mq_done() into scsi_done() and export it
Git-commit: a710eacb9d13cb5d9eb5341ebc6fc8f7b96f8c6f
Patch-mainline: v5.16-rc1
References: jsc#PED-1561
Since the removal of the legacy block layer there is only one completion
function left in the SCSI core, namely scsi_mq_done(). Rename it into
scsi_done(). Export that function to allow SCSI LLDs to call it directly.
[lduncan: refreshed to apply cleanly.]
Link: https://lore.kernel.org/r/20211007202923.2174984-3-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>
Acked-by: Lee Duncan <lduncan@suse.com>
---
drivers/scsi/scsi_lib.c | 5 +++--
include/scsi/scsi_cmnd.h | 2 ++
2 files changed, 5 insertions(+), 2 deletions(-)
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1570,7 +1570,7 @@ static blk_status_t scsi_prepare_cmd(str
return scsi_cmd_to_driver(cmd)->init_command(cmd);
}
-static void scsi_mq_done(struct scsi_cmnd *cmd)
+void scsi_done(struct scsi_cmnd *cmd)
{
switch (cmd->submitter) {
case SUBMITTED_BY_BLOCK_LAYER:
@@ -1588,6 +1588,7 @@ static void scsi_mq_done(struct scsi_cmn
trace_scsi_dispatch_cmd_done(cmd);
blk_mq_complete_request(scsi_cmd_to_rq(cmd));
}
+EXPORT_SYMBOL(scsi_done);
static void scsi_mq_put_budget(struct request_queue *q, int budget_token)
{
@@ -1688,7 +1689,7 @@ static blk_status_t scsi_queue_rq(struct
scsi_set_resid(cmd, 0);
memset(cmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
cmd->submitter = SUBMITTED_BY_BLOCK_LAYER;
- cmd->scsi_done = scsi_mq_done;
+ cmd->scsi_done = scsi_done;
blk_mq_start_request(req);
reason = scsi_dispatch_cmd(cmd);
--- a/include/scsi/scsi_cmnd.h
+++ b/include/scsi/scsi_cmnd.h
@@ -174,6 +174,8 @@ static inline struct scsi_driver *scsi_c
return *(struct scsi_driver **)rq->rq_disk->private_data;
}
+void scsi_done(struct scsi_cmnd *cmd);
+
extern void scsi_finish_command(struct scsi_cmnd *cmd);
extern void *scsi_kmap_atomic_sg(struct scatterlist *sg, int sg_count,