diff mbox series

[06/13] aacraid: replace aac_flush_ios() with midlayer helper

Message ID 20191204145918.143134-7-hare@suse.de (mailing list archive)
State Deferred
Headers show
Series scsi: remove legacy cmd_list implementation | expand

Commit Message

Hannes Reinecke Dec. 4, 2019, 2:59 p.m. UTC
Use the midlayer helper scsi_host_complete_all_commands() to flush all
outstanding commands.

Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Balsundar P <balsundar.p@microchip.com>
---
 drivers/scsi/aacraid/linit.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

Comments

Balsundar.P@microchip.com Dec. 10, 2019, 4:59 a.m. UTC | #1
Acked-by: Balsundar P < Balsundar.P@microchip.com>

-----Original Message-----
From: Hannes Reinecke <hare@suse.de> 
Sent: Wednesday, December 4, 2019 20:29
To: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>; Bart van Assche <bvanassche@acm.org>; Balsundar P - I31211 <Balsundar.P@microchip.com>; James Bottomley <james.bottomley@hansenpartnership.com>; linux-scsi@vger.kernel.org; Hannes Reinecke <hare@suse.de>; Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Subject: [PATCH 06/13] aacraid: replace aac_flush_ios() with midlayer helper

EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe

Use the midlayer helper scsi_host_complete_all_commands() to flush all outstanding commands.

Cc: Adaptec OEM Raid Solutions <aacraid@microsemi.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Balsundar P <balsundar.p@microchip.com>
---
 drivers/scsi/aacraid/linit.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index ee6bc2f9b80a..4d5b34e0d3a9 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1977,26 +1977,6 @@ static void aac_remove_one(struct pci_dev *pdev)
        }
 }

-static void aac_flush_ios(struct aac_dev *aac) -{
-       int i;
-       struct scsi_cmnd *cmd;
-
-       for (i = 0; i < aac->scsi_host_ptr->can_queue; i++) {
-               cmd = (struct scsi_cmnd *)aac->fibs[i].callback_data;
-               if (cmd && (cmd->SCp.phase == AAC_OWNER_FIRMWARE)) {
-                       scsi_dma_unmap(cmd);
-
-                       if (aac->handle_pci_error)
-                               cmd->result = DID_NO_CONNECT << 16;
-                       else
-                               cmd->result = DID_RESET << 16;
-
-                       cmd->scsi_done(cmd);
-               }
-       }
-}
-
 static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
                                        enum pci_channel_state error)  { @@ -2013,7 +1993,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,

                scsi_block_requests(aac->scsi_host_ptr);
                aac_cancel_rescan_worker(aac);
-               aac_flush_ios(aac);
+               scsi_host_complete_all_commands(shost, DID_NO_CONNECT);
                aac_release_resources(aac);

                pci_disable_pcie_error_reporting(pdev);
@@ -2023,7 +2003,7 @@ static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
        case pci_channel_io_perm_failure:
                aac->handle_pci_error = 1;

-               aac_flush_ios(aac);
+               scsi_host_complete_all_commands(shost, DID_NO_CONNECT);
                return PCI_ERS_RESULT_DISCONNECT;
        }

--
2.16.4
diff mbox series

Patch

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index ee6bc2f9b80a..4d5b34e0d3a9 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1977,26 +1977,6 @@  static void aac_remove_one(struct pci_dev *pdev)
 	}
 }
 
-static void aac_flush_ios(struct aac_dev *aac)
-{
-	int i;
-	struct scsi_cmnd *cmd;
-
-	for (i = 0; i < aac->scsi_host_ptr->can_queue; i++) {
-		cmd = (struct scsi_cmnd *)aac->fibs[i].callback_data;
-		if (cmd && (cmd->SCp.phase == AAC_OWNER_FIRMWARE)) {
-			scsi_dma_unmap(cmd);
-
-			if (aac->handle_pci_error)
-				cmd->result = DID_NO_CONNECT << 16;
-			else
-				cmd->result = DID_RESET << 16;
-
-			cmd->scsi_done(cmd);
-		}
-	}
-}
-
 static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
 					enum pci_channel_state error)
 {
@@ -2013,7 +1993,7 @@  static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
 
 		scsi_block_requests(aac->scsi_host_ptr);
 		aac_cancel_rescan_worker(aac);
-		aac_flush_ios(aac);
+		scsi_host_complete_all_commands(shost, DID_NO_CONNECT);
 		aac_release_resources(aac);
 
 		pci_disable_pcie_error_reporting(pdev);
@@ -2023,7 +2003,7 @@  static pci_ers_result_t aac_pci_error_detected(struct pci_dev *pdev,
 	case pci_channel_io_perm_failure:
 		aac->handle_pci_error = 1;
 
-		aac_flush_ios(aac);
+		scsi_host_complete_all_commands(shost, DID_NO_CONNECT);
 		return PCI_ERS_RESULT_DISCONNECT;
 	}