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

Unverified Commit f8f45f66 authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Michael Bestas
Browse files

scsi: ufs: atomic update for clkgating_enable



Bug: 134949663
Bug: 137150088
Bug: 149155051
Test: test with powerhint feature
Change-Id: Ie5002107a69e7d56a889138eec0e593de1bf6a61
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@google.com>
Signed-off-by: default avatarLeo Liou <leoliou@google.com>
parent 29fb462c
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -2514,19 +2514,19 @@ static ssize_t ufshcd_clkgate_enable_store(struct device *dev,
		return -EINVAL;

	value = !!value;

	spin_lock_irqsave(hba->host->host_lock, flags);
	if (value == hba->clk_gating.is_enabled)
		goto out;

	if (value) {
		ufshcd_release(hba, false);
	} else {
		spin_lock_irqsave(hba->host->host_lock, flags);
	if (value)
		hba->clk_gating.active_reqs--;
	else
		hba->clk_gating.active_reqs++;
		spin_unlock_irqrestore(hba->host->host_lock, flags);
	}

	hba->clk_gating.is_enabled = value;
out:
	spin_unlock_irqrestore(hba->host->host_lock, flags);
	return count;
}