scsi: ufs: fix another race between clock scaling and gating
Commit 4f98a9564b745f3b0b1bea02d351c9f8f2f17d39 (scsi: ufs: fix race between clock gating and scaling work) tried to fix the race condition between clock gating and scaling work but it didn't fixed the race in all possible states. This change fixes the race condition by making sure that we hold the clock reference even if clocks are ON when we entered into clock scaling work. Change-Id: Ic3cf9224f5afb2900fe2553ce8c302cc8b20e623 Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
This commit is contained in:
parent
5d37480381
commit
30fd811fb7
1 changed files with 9 additions and 7 deletions
|
@ -8484,16 +8484,18 @@ static int ufshcd_devfreq_target(struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (ufshcd_is_clkgating_allowed(hba) &&
|
||||
(hba->clk_gating.state != CLKS_ON)) {
|
||||
if (cancel_delayed_work(&hba->clk_gating.gate_work)) {
|
||||
if (ufshcd_is_clkgating_allowed(hba)) {
|
||||
if (cancel_delayed_work(&hba->clk_gating.gate_work) ||
|
||||
(hba->clk_gating.state == CLKS_ON)) {
|
||||
/* hold the vote until the scaling work is completed */
|
||||
hba->clk_gating.active_reqs++;
|
||||
release_clk_hold = true;
|
||||
hba->clk_gating.state = CLKS_ON;
|
||||
trace_ufshcd_clk_gating(dev_name(hba->dev),
|
||||
ufschd_clk_gating_state_to_string(
|
||||
hba->clk_gating.state));
|
||||
if (hba->clk_gating.state != CLKS_ON) {
|
||||
hba->clk_gating.state = CLKS_ON;
|
||||
trace_ufshcd_clk_gating(dev_name(hba->dev),
|
||||
ufschd_clk_gating_state_to_string(
|
||||
hba->clk_gating.state));
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* Clock gating work seems to be running in parallel
|
||||
|
|
Loading…
Add table
Reference in a new issue