start:
switch (hba->clk_gating.state) {
+ case __CLKS_ON:
+ rc = -EAGAIN;
+ if (async)
+ hba->clk_gating.active_reqs--;
case CLKS_ON:
/*
* Wait for the ungate work to complete if in progress.
spin_unlock_irqrestore(hba->host->host_lock, flags);
hba->clk_gating.is_suspended = true;
ufshcd_reset_and_restore(hba);
+ spin_lock_irqsave(hba->host->host_lock, flags);
hba->clk_gating.state = CLKS_ON;
+ spin_unlock_irqrestore(hba->host->host_lock, flags);
hba->clk_gating.is_suspended = false;
trace_ufshcd_clk_gating(dev_name(hba->dev),
hba->clk_gating.state);
if (!ret)
ufshcd_set_link_hibern8(hba);
else {
+ unsigned long flags;
+ bool saved_is_suspended = hba->clk_gating.is_suspended;
+
+ spin_lock_irqsave(hba->host->host_lock, flags);
+ hba->clk_gating.state = __CLKS_ON;
+ spin_unlock_irqrestore(hba->host->host_lock, flags);
+
+ hba->clk_gating.is_suspended = true;
ufshcd_host_reset_and_restore(hba);
+ spin_lock_irqsave(hba->host->host_lock, flags);
+ hba->clk_gating.state = CLKS_ON;
+ spin_unlock_irqrestore(hba->host->host_lock, flags);
+ hba->clk_gating.is_suspended = saved_is_suspended;
+
goto out;
}
/*