scsi: ufs: atomic update for clkgating_enable

Bug: 134949663
Bug: 137150088
Bug: 149155051
Test: test with powerhint feature
Change-Id: Ie5002107a69e7d56a889138eec0e593de1bf6a61
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Signed-off-by: Leo Liou <leoliou@google.com>
[dereference23: Apply to msm-4.14]
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
fourteen
Jaegeuk Kim 6 years ago committed by Jenna
parent 8f679f6311
commit fa06b20e43
  1. 12
      drivers/scsi/ufs/ufshcd.c

@ -2929,19 +2929,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;
}

Loading…
Cancel
Save