[DO NOT RELEASE][COMMON] scsi: ufs: exynos: Block the abnomal IO
authorhgchu <hg.chu@samsung.com>
Fri, 12 Jan 2018 07:53:11 +0000 (16:53 +0900)
committerJaeHun Jung <jh0801.jung@samsung.com>
Tue, 8 May 2018 08:20:44 +0000 (17:20 +0900)
Change-Id: I83f3df56369a0b642e61557cde4fe73a45e36533
Signed-off-by: hgchu <hg.chu@samsung.com>
drivers/scsi/ufs/ufshcd.c

index 40402ac5dfb863b26635c5601125c0d41e0d173c..c08eda7be543c70894acbdd25a18a7370d93c4c1 100644 (file)
                _ret;                                                   \
        })
 
+static int ufs_shutdown_state = 0;
+
 #define ufshcd_hex_dump(prefix_str, buf, len) \
 print_hex_dump(KERN_ERR, prefix_str, DUMP_PREFIX_OFFSET, 16, 4, buf, len, false)
 
@@ -2446,6 +2448,10 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 
        if (!down_read_trylock(&hba->clk_scaling_lock))
                return SCSI_MLQUEUE_HOST_BUSY;
+       if ((ufs_shutdown_state == 1) && (cmd->cmnd[0] == START_STOP)) {
+               scsi_block_requests(hba->host);
+               cancel_work_sync(&hba->clk_gating.ungate_work);
+       }
 
        spin_lock_irqsave(hba->host->host_lock, flags);
        switch (hba->ufshcd_state) {
@@ -7998,6 +8004,9 @@ static int ufshcd_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
                }
        }
 
+       if (ufshcd_is_shutdown_pm(pm_op))
+               ufs_shutdown_state = 1;
+
        if ((req_dev_pwr_mode != hba->curr_dev_pwr_mode) &&
             ((ufshcd_is_runtime_pm(pm_op) && !hba->auto_bkops_enabled) ||
               !ufshcd_is_runtime_pm(pm_op))) {