aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2012-06-21 11:10:52 -0400
committerLuciano Coelho <coelho@ti.com>2012-06-23 02:32:33 -0400
commit725b82775e7901dc92afaddfa45683934e75c33e (patch)
tree183dd3e6357b63df0e0a1d804d66e4f2299615b9
parentb5b45b3cbd56162d9612dd76529d7ad9f6be9a56 (diff)
wlcore: prevent recovery in the middle of resume
Take the mutex early in the resume handler and use the locked version of the IRQ routine. This ensures any recoveries queued will only take place after resume has fully completed. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
-rw-r--r--drivers/net/wireless/ti/wlcore/main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index 0c1e0751ecaa..372ccf277b1e 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -1723,6 +1723,7 @@ static int wl1271_op_resume(struct ieee80211_hw *hw)
1723 struct wl12xx_vif *wlvif; 1723 struct wl12xx_vif *wlvif;
1724 unsigned long flags; 1724 unsigned long flags;
1725 bool run_irq_work = false, pending_recovery; 1725 bool run_irq_work = false, pending_recovery;
1726 int ret;
1726 1727
1727 wl1271_debug(DEBUG_MAC80211, "mac80211 resume wow=%d", 1728 wl1271_debug(DEBUG_MAC80211, "mac80211 resume wow=%d",
1728 wl->wow_enabled); 1729 wl->wow_enabled);
@@ -1738,6 +1739,8 @@ static int wl1271_op_resume(struct ieee80211_hw *hw)
1738 run_irq_work = true; 1739 run_irq_work = true;
1739 spin_unlock_irqrestore(&wl->wl_lock, flags); 1740 spin_unlock_irqrestore(&wl->wl_lock, flags);
1740 1741
1742 mutex_lock(&wl->mutex);
1743
1741 /* test the recovery flag before calling any SDIO functions */ 1744 /* test the recovery flag before calling any SDIO functions */
1742 pending_recovery = test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, 1745 pending_recovery = test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS,
1743 &wl->flags); 1746 &wl->flags);
@@ -1747,13 +1750,15 @@ static int wl1271_op_resume(struct ieee80211_hw *hw)
1747 "run postponed irq_work directly"); 1750 "run postponed irq_work directly");
1748 1751
1749 /* don't talk to the HW if recovery is pending */ 1752 /* don't talk to the HW if recovery is pending */
1750 if (!pending_recovery) 1753 if (!pending_recovery) {
1751 wlcore_irq(0, wl); 1754 ret = wlcore_irq_locked(wl);
1755 if (ret)
1756 wl12xx_queue_recovery_work(wl);
1757 }
1752 1758
1753 wlcore_enable_interrupts(wl); 1759 wlcore_enable_interrupts(wl);
1754 } 1760 }
1755 1761
1756 mutex_lock(&wl->mutex);
1757 if (pending_recovery) { 1762 if (pending_recovery) {
1758 wl1271_warning("queuing forgotten recovery on resume"); 1763 wl1271_warning("queuing forgotten recovery on resume");
1759 ieee80211_queue_work(wl->hw, &wl->recovery_work); 1764 ieee80211_queue_work(wl->hw, &wl->recovery_work);