aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ufs/ufshcd.c
diff options
context:
space:
mode:
authorVenkat Gopalakrishnan <venkatg@codeaurora.org>2016-10-17 17:11:07 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2016-11-08 17:29:58 -0500
commit3f0c06de80d3898e68adcaba83a2b7ac51cf23d8 (patch)
tree76f38afb7404959124f0ef06e6938b4d9a9ea469 /drivers/scsi/ufs/ufshcd.c
parentscsi: ufshcd: Fix race between clk scaling and ungate work (diff)
downloadlinux-dev-3f0c06de80d3898e68adcaba83a2b7ac51cf23d8.tar.xz
linux-dev-3f0c06de80d3898e68adcaba83a2b7ac51cf23d8.zip
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. 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>
Diffstat (limited to 'drivers/scsi/ufs/ufshcd.c')
-rw-r--r--drivers/scsi/ufs/ufshcd.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 5ad4480afd01..304adce3bdbe 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -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;
}