Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9615a0a7 authored by Can Guo's avatar Can Guo
Browse files

scsi: ufs: fix clock ungate checks for AH8 error in err handler



Change 71cae0a3
('scsi: ufs: fix a race condition between err handler and clock gate work')
fixes a race condition but it makes err_handler skip ufshcd_hold for auto
hibern8 error scenarios. This change fixes it by setting eh_in_progress
flags in link recovery path before it starts err_handler, so that when
err_handler tries to ungate clocks, ufshcd_hold only increases the clock
usage counter without actually flushing the gate work.

Change-Id: I599c5f15de32e1c2601d8589324b6b858a1ac747
Signed-off-by: default avatarCan Guo <cang@codeaurora.org>
parent 5431ddf1
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -5228,6 +5228,7 @@ static int ufshcd_link_recovery(struct ufs_hba *hba)
	 */
	hba->ufshcd_state = UFSHCD_STATE_ERROR;
	hba->force_host_reset = true;
	ufshcd_set_eh_in_progress(hba);
	schedule_work(&hba->eh_work);

	/* wait for the reset work to finish */
@@ -6982,8 +6983,6 @@ static void ufshcd_err_handler(struct work_struct *work)
	 * process of gating when the err handler runs.
	 */
	if (unlikely((hba->clk_gating.state != CLKS_ON) &&
	    (hba->clk_gating.state == REQ_CLKS_OFF &&
	     ufshcd_is_link_hibern8(hba)) &&
	    ufshcd_is_auto_hibern8_supported(hba) &&
	    hba->hibern8_on_idle.is_enabled)) {
		spin_unlock_irqrestore(hba->host->host_lock, flags);