Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Venkat Gopalakrishnan and committed by
Martin K. Petersen
3f0c06de f2a785ac

+8 -1
+8 -1
drivers/scsi/ufs/ufshcd.c
··· 739 739 unsigned long flags; 740 740 741 741 spin_lock_irqsave(hba->host->host_lock, flags); 742 - if (hba->clk_gating.is_suspended) { 742 + /* 743 + * In case you are here to cancel this work the gating state 744 + * would be marked as REQ_CLKS_ON. In this case save time by 745 + * skipping the gating work and exit after changing the clock 746 + * state to CLKS_ON. 747 + */ 748 + if (hba->clk_gating.is_suspended || 749 + (hba->clk_gating.state == REQ_CLKS_ON)) { 743 750 hba->clk_gating.state = CLKS_ON; 744 751 goto rel_lock; 745 752 }