diff options
| author | Venkat Gopalakrishnan <venkatg@codeaurora.org> | 2016-08-12 18:09:58 -0700 |
|---|---|---|
| committer | Venkat Gopalakrishnan <venkatg@codeaurora.org> | 2016-08-16 10:49:53 -0700 |
| commit | 4ec56cf5dd8ccdd338931be4aa2615b188ce722d (patch) | |
| tree | 166a14e5794da8f487a25e991f20637b35fcc706 | |
| parent | 2e45ea728118fa88ba245a0a755d0a3844d9f54e (diff) | |
scsi: ufs: optimize clock gate work
In a case where gate work is called as part of cancel work
from ungate path the clk state would be marked as REQ_CLKS_ON.
There is no point gating the clocks and then end up turning
them ON immediately in ungate work, save time by skipping the
gate work and change the clk state to CLKS_ON as they are not
turned off yet.
Change-Id: I3e8edf979c94a8e0954fd77e0b158bec8902b4e9
Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
| -rw-r--r-- | drivers/scsi/ufs/ufshcd.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 4d406c51d884..d8c7ae3205c8 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -1283,7 +1283,14 @@ static void ufshcd_gate_work(struct work_struct *work) unsigned long flags; spin_lock_irqsave(hba->host->host_lock, flags); - if (hba->clk_gating.is_suspended) { + /* + * In case you are here to cancel this work the gating state + * would be marked as REQ_CLKS_ON. In this case save time by + * skipping the gating work and exit after changing the clock + * state to CLKS_ON. + */ + if (hba->clk_gating.is_suspended || + (hba->clk_gating.state == REQ_CLKS_ON)) { hba->clk_gating.state = CLKS_ON; trace_ufshcd_clk_gating(dev_name(hba->dev), hba->clk_gating.state); |
