EHCI: HSIC: Prevent disabling wakeup irq twice
If PM resume and Wakeup irq happen at same time
its possible to disable wakeup irq twice. Prevent
the same by protecting with spinlock
CRs-Fixed: 396895
Change-Id: I3320478d6c770787bc571964f4a38dce6927af63
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
(cherry picked from commit d343c01025fc3bb597fbb60c8fc4369cc17cbf5d)
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
diff --git a/drivers/usb/host/ehci-msm-hsic.c b/drivers/usb/host/ehci-msm-hsic.c
index 48e5b82..188d562 100644
--- a/drivers/usb/host/ehci-msm-hsic.c
+++ b/drivers/usb/host/ehci-msm-hsic.c
@@ -67,6 +67,7 @@
struct msm_hsic_hcd {
struct ehci_hcd ehci;
+ spinlock_t wakeup_lock;
struct device *dev;
struct clk *ahb_clk;
struct clk *core_clk;
@@ -733,17 +734,20 @@
int cnt = 0, ret;
unsigned temp;
int min_vol, max_vol;
+ unsigned long flags;
if (!atomic_read(&mehci->in_lpm)) {
dev_dbg(mehci->dev, "%s called in !in_lpm\n", __func__);
return 0;
}
+ spin_lock_irqsave(&mehci->wakeup_lock, flags);
if (mehci->wakeup_irq_enabled) {
disable_irq_wake(mehci->wakeup_irq);
disable_irq_nosync(mehci->wakeup_irq);
mehci->wakeup_irq_enabled = 0;
}
+ spin_unlock_irqrestore(&mehci->wakeup_lock, flags);
wake_lock(&mehci->wlock);
@@ -1271,11 +1275,13 @@
wake_lock(&mehci->wlock);
+ spin_lock(&mehci->wakeup_lock);
if (mehci->wakeup_irq_enabled) {
mehci->wakeup_irq_enabled = 0;
disable_irq_wake(irq);
disable_irq_nosync(irq);
}
+ spin_unlock(&mehci->wakeup_lock);
if (!atomic_read(&mehci->pm_usage_cnt)) {
atomic_set(&mehci->pm_usage_cnt, 1);
@@ -1533,6 +1539,8 @@
mehci->dev = &pdev->dev;
pdata = mehci->dev->platform_data;
+ spin_lock_init(&mehci->wakeup_lock);
+
mehci->ehci.susp_sof_bug = 1;
mehci->ehci.reset_sof_bug = 1;