Skip to content

Commit

Permalink
scsi: aacraid: replace aac_flush_ios() with midlayer helper
Browse files Browse the repository at this point in the history
Use the midlayer helper scsi_host_complete_all_commands() to flush all
outstanding commands.

Link: https://lore.kernel.org/r/20200228075318.91255-7-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Acked-by: Balsundar P <balsundar.p@microchip.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Hannes Reinecke authored and Martin K. Petersen committed Feb 29, 2020
1 parent a1855f6 commit b64f239
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions drivers/scsi/aacraid/linit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit b64f239

Please sign in to comment.