diff options
-rw-r--r-- | drivers/scsi/cxlflash/main.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/scsi/cxlflash/main.c b/drivers/scsi/cxlflash/main.c index 35a32024f1c0..ac39856a74b4 100644 --- a/drivers/scsi/cxlflash/main.c +++ b/drivers/scsi/cxlflash/main.c | |||
@@ -632,15 +632,30 @@ static void free_mem(struct cxlflash_cfg *cfg) | |||
632 | * @cfg: Internal structure associated with the host. | 632 | * @cfg: Internal structure associated with the host. |
633 | * | 633 | * |
634 | * Safe to call with AFU in a partially allocated/initialized state. | 634 | * Safe to call with AFU in a partially allocated/initialized state. |
635 | * | ||
636 | * Cleans up all state associated with the command queue, and unmaps | ||
637 | * the MMIO space. | ||
638 | * | ||
639 | * - complete() will take care of commands we initiated (they'll be checked | ||
640 | * in as part of the cleanup that occurs after the completion) | ||
641 | * | ||
642 | * - cmd_checkin() will take care of entries that we did not initiate and that | ||
643 | * have not (and will not) complete because they are sitting on a [now stale] | ||
644 | * hardware queue | ||
635 | */ | 645 | */ |
636 | static void stop_afu(struct cxlflash_cfg *cfg) | 646 | static void stop_afu(struct cxlflash_cfg *cfg) |
637 | { | 647 | { |
638 | int i; | 648 | int i; |
639 | struct afu *afu = cfg->afu; | 649 | struct afu *afu = cfg->afu; |
650 | struct afu_cmd *cmd; | ||
640 | 651 | ||
641 | if (likely(afu)) { | 652 | if (likely(afu)) { |
642 | for (i = 0; i < CXLFLASH_NUM_CMDS; i++) | 653 | for (i = 0; i < CXLFLASH_NUM_CMDS; i++) { |
643 | complete(&afu->cmd[i].cevent); | 654 | cmd = &afu->cmd[i]; |
655 | complete(&cmd->cevent); | ||
656 | if (!atomic_read(&cmd->free)) | ||
657 | cmd_checkin(cmd); | ||
658 | } | ||
644 | 659 | ||
645 | if (likely(afu->afu_map)) { | 660 | if (likely(afu->afu_map)) { |
646 | cxl_psa_unmap((void __iomem *)afu->afu_map); | 661 | cxl_psa_unmap((void __iomem *)afu->afu_map); |