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

Commit ed36ca56 authored by Sahitya Tummala's avatar Sahitya Tummala
Browse files

scsi: ufs: fix issue with clock gating



In a case where clocks are gated and to ungate them ufshcd_hold()
is called with async flag set to false, clocks would be enabled
within the same context. There is a bug in the current code where
the active_reqs counter is getting incremented twice. This would
further prevent clock gating from happening.  Fix this issue by
updating the active_reqs correctly.

Change-Id: I70bdae8d1ccc189db9bd2e9fee66678c571933f6
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
parent 46f3602a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -747,10 +747,10 @@ int ufshcd_hold(struct ufs_hba *hba, bool async)

	if (!ufshcd_is_clkgating_allowed(hba))
		goto out;
start:
	spin_lock_irqsave(hba->host->host_lock, flags);
	hba->clk_gating.active_reqs++;

start:
	switch (hba->clk_gating.state) {
	case CLKS_ON:
		break;
@@ -787,6 +787,7 @@ start:
			spin_unlock_irqrestore(hba->host->host_lock, flags);
			flush_work(&hba->clk_gating.ungate_work);
			/* Make sure state is CLKS_ON before returning */
			spin_lock_irqsave(hba->host->host_lock, flags);
			goto start;
		}
	default: