Skip to content

Commit

Permalink
scsi: ufs: optimize clock gate work
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Venkat Gopalakrishnan <venkatg@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Venkat Gopalakrishnan authored and Martin K. Petersen committed Nov 8, 2016
1 parent f2a785a commit 3f0c06d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/scsi/ufs/ufshcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,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;
goto rel_lock;
}
Expand Down

0 comments on commit 3f0c06d

Please sign in to comment.