[PATCH v14 05/19] scsi: Add an argument to scsi_eh_flush_done_q()

Bart Van Assche
2023-10-23T21:57:06Z

This patch prepares for using the host pointer directly in
scsi_eh_flush_done_q() in a later patch.

Cc: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
drivers/ata/libata-eh.c | 2 +-
drivers/scsi/libsas/sas_scsi_host.c | 2 +-
drivers/scsi/scsi_error.c | 5 +++--
include/scsi/scsi_eh.h | 3 ++-
4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 4cf4f57e57b8..9a1a06a8e5db 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -738,7 +738,7 @@ void ata_scsi_port_error_handler(struct Scsi_Host *host, struct ata_port *ap)
spin_unlock_irqrestore(ap->lock, flags);
ata_eh_release(ap);

- scsi_eh_flush_done_q(&ap->eh_done_q);
+ scsi_eh_flush_done_q(host, &ap->eh_done_q);

/* clean up */
spin_lock_irqsave(ap->lock, flags);
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 9047cfcd1072..dd4fb97fdc4b 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -730,7 +730,7 @@ void sas_scsi_recover_host(struct Scsi_Host *shost)
/* now link into libata eh --- if we have any ata devices */
sas_ata_strategy_handler(shost);

- scsi_eh_flush_done_q(&ha->eh_done_q);
+ scsi_eh_flush_done_q(shost, &ha->eh_done_q);

/* check if any new eh work was scheduled during the last run */
spin_lock_irq(&ha->lock);
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index c67cdcdc3ba8..7390131e7f0a 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -2188,9 +2188,10 @@ EXPORT_SYMBOL_GPL(scsi_eh_ready_devs);

/**
* scsi_eh_flush_done_q - finish processed commands or retry them.
+ * @shost: SCSI host pointer.
* @done_q: list_head of processed commands.
*/
-void scsi_eh_flush_done_q(struct list_head *done_q)
+void scsi_eh_flush_done_q(struct Scsi_Host *shost, struct list_head *done_q)
{
struct scsi_cmnd *scmd, *next;

@@ -2265,7 +2266,7 @@ static void scsi_unjam_host(struct Scsi_Host *shost)
if (shost->eh_deadline != -1)
shost->last_reset = 0;
spin_unlock_irqrestore(shost->host_lock, flags);
- scsi_eh_flush_done_q(&eh_done_q);
+ scsi_eh_flush_done_q(shost, &eh_done_q);
}

/**
diff --git a/include/scsi/scsi_eh.h b/include/scsi/scsi_eh.h
index 1ae08e81339f..d2807d799fda 100644
--- a/include/scsi/scsi_eh.h
+++ b/include/scsi/scsi_eh.h
@@ -11,7 +11,8 @@ struct Scsi_Host;

extern void scsi_eh_finish_cmd(struct scsi_cmnd *scmd,
struct list_head *done_q);
-extern void scsi_eh_flush_done_q(struct list_head *done_q);
+extern void scsi_eh_flush_done_q(struct Scsi_Host *shost,
+ struct list_head *done_q);
extern void scsi_report_bus_reset(struct Scsi_Host *, int);
extern void scsi_report_device_reset(struct Scsi_Host *, int, int);
extern int scsi_block_when_processing_errors(struct scsi_device *);