summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilad Broner <gbroner@codeaurora.org>2014-11-24 13:32:03 +0200
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-22 10:58:13 -0700
commit86f3ac8635ef7002cc4abbfc45fbdffd24079634 (patch)
treea67f85abce7330f65a0d552d8f38e98b74538277
parentebfaba8c84bfee1594c77b8ed42c78e9d8663528 (diff)
scsi: ufs: fix locking in __ufshcd_pm_qos_hold
The function is called with locked spinlock and disabled interrupts which is done in a wrapper function ufshcd_pm_qos_hold(). Before flushing the PM QoS voting work spinlock must be released and interrupts must be restored. As the interrupts flags state is saved in the wrapper function, we cannot restore the state. Moving the locking to the internal function fixes this, which makes the wrapper function redundant so it is deleted. Change-Id: I167292305a25d2b8c3524dcddb51f5a7109444aa Signed-off-by: Gilad Broner <gbroner@codeaurora.org> Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
-rw-r--r--drivers/scsi/ufs/ufshcd.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 014aee99fa44..325f66facfb1 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1603,14 +1603,15 @@ static void ufshcd_exit_hibern8_on_idle(struct ufs_hba *hba)
#ifdef CONFIG_SMP
/* Host lock is assumed to be held by caller */
-static int __ufshcd_pm_qos_hold(struct ufs_hba *hba, bool async)
+static int ufshcd_pm_qos_hold(struct ufs_hba *hba, bool async)
{
int ret = 0;
unsigned long flags;
if (!hba->pm_qos.cpu_dma_latency_us)
- goto out;
+ return 0;
+ spin_lock_irqsave(hba->host->host_lock, flags);
hba->pm_qos.active_reqs++;
if (hba->pm_qos.is_suspended)
goto out;
@@ -1646,18 +1647,7 @@ start:
break;
}
out:
- return ret;
-}
-
-static int ufshcd_pm_qos_hold(struct ufs_hba *hba, bool async)
-{
- unsigned long flags;
- int ret;
-
- spin_lock_irqsave(hba->host->host_lock, flags);
- ret = __ufshcd_pm_qos_hold(hba, async);
spin_unlock_irqrestore(hba->host->host_lock, flags);
-
return ret;
}