aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/main.c
diff options
context:
space:
mode:
authorEliad Peller <eliad@wizery.com>2011-06-06 05:21:52 -0400
committerLuciano Coelho <coelho@ti.com>2011-06-27 06:29:21 -0400
commit4a859df85a7855b15f5e1bf4b0869a16757a3e43 (patch)
tree4902a78ecaeb694635b2fcd51a61959a3a19814c /drivers/net/wireless/wl12xx/main.c
parent0c005048aa3cd3ac7bfdd3c6fcc20ea4f0ab667d (diff)
wl12xx: don't check wow param on suspend/resume
Since mac80211 calls suspend/resume only when wowlan triggers exist, there is no need to check for triggers existance in the callbacks as well. Add a WARN_ON() to verify it. Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/main.c')
-rw-r--r--drivers/net/wireless/wl12xx/main.c87
1 files changed, 43 insertions, 44 deletions
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 1b55803de88..8256f247004 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -1551,69 +1551,68 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
1551 struct cfg80211_wowlan *wow) 1551 struct cfg80211_wowlan *wow)
1552{ 1552{
1553 struct wl1271 *wl = hw->priv; 1553 struct wl1271 *wl = hw->priv;
1554 int ret;
1555
1554 wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow); 1556 wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow);
1555 wl->wow_enabled = !!wow; 1557 WARN_ON(!wow || !wow->any);
1556 if (wl->wow_enabled) {
1557 int ret;
1558 ret = wl1271_configure_suspend(wl);
1559 if (ret < 0) {
1560 wl1271_warning("couldn't prepare device to suspend");
1561 return ret;
1562 }
1563 /* flush any remaining work */
1564 wl1271_debug(DEBUG_MAC80211, "flushing remaining works");
1565 flush_delayed_work(&wl->scan_complete_work);
1566 1558
1567 /* 1559 wl->wow_enabled = true;
1568 * disable and re-enable interrupts in order to flush 1560 ret = wl1271_configure_suspend(wl);
1569 * the threaded_irq 1561 if (ret < 0) {
1570 */ 1562 wl1271_warning("couldn't prepare device to suspend");
1571 wl1271_disable_interrupts(wl); 1563 return ret;
1564 }
1565 /* flush any remaining work */
1566 wl1271_debug(DEBUG_MAC80211, "flushing remaining works");
1567 flush_delayed_work(&wl->scan_complete_work);
1572 1568
1573 /* 1569 /*
1574 * set suspended flag to avoid triggering a new threaded_irq 1570 * disable and re-enable interrupts in order to flush
1575 * work. no need for spinlock as interrupts are disabled. 1571 * the threaded_irq
1576 */ 1572 */
1577 set_bit(WL1271_FLAG_SUSPENDED, &wl->flags); 1573 wl1271_disable_interrupts(wl);
1574
1575 /*
1576 * set suspended flag to avoid triggering a new threaded_irq
1577 * work. no need for spinlock as interrupts are disabled.
1578 */
1579 set_bit(WL1271_FLAG_SUSPENDED, &wl->flags);
1580
1581 wl1271_enable_interrupts(wl);
1582 flush_work(&wl->tx_work);
1583 flush_delayed_work(&wl->pspoll_work);
1584 flush_delayed_work(&wl->elp_work);
1578 1585
1579 wl1271_enable_interrupts(wl);
1580 flush_work(&wl->tx_work);
1581 flush_delayed_work(&wl->pspoll_work);
1582 flush_delayed_work(&wl->elp_work);
1583 }
1584 return 0; 1586 return 0;
1585} 1587}
1586 1588
1587static int wl1271_op_resume(struct ieee80211_hw *hw) 1589static int wl1271_op_resume(struct ieee80211_hw *hw)
1588{ 1590{
1589 struct wl1271 *wl = hw->priv; 1591 struct wl1271 *wl = hw->priv;
1592 unsigned long flags;
1593 bool run_irq_work = false;
1594
1590 wl1271_debug(DEBUG_MAC80211, "mac80211 resume wow=%d", 1595 wl1271_debug(DEBUG_MAC80211, "mac80211 resume wow=%d",
1591 wl->wow_enabled); 1596 wl->wow_enabled);
1597 WARN_ON(!wl->wow_enabled);
1592 1598
1593 /* 1599 /*
1594 * re-enable irq_work enqueuing, and call irq_work directly if 1600 * re-enable irq_work enqueuing, and call irq_work directly if
1595 * there is a pending work. 1601 * there is a pending work.
1596 */ 1602 */
1597 if (wl->wow_enabled) { 1603 spin_lock_irqsave(&wl->wl_lock, flags);
1598 struct wl1271 *wl = hw->priv; 1604 clear_bit(WL1271_FLAG_SUSPENDED, &wl->flags);
1599 unsigned long flags; 1605 if (test_and_clear_bit(WL1271_FLAG_PENDING_WORK, &wl->flags))
1600 bool run_irq_work = false; 1606 run_irq_work = true;
1601 1607 spin_unlock_irqrestore(&wl->wl_lock, flags);
1602 spin_lock_irqsave(&wl->wl_lock, flags);
1603 clear_bit(WL1271_FLAG_SUSPENDED, &wl->flags);
1604 if (test_and_clear_bit(WL1271_FLAG_PENDING_WORK, &wl->flags))
1605 run_irq_work = true;
1606 spin_unlock_irqrestore(&wl->wl_lock, flags);
1607
1608 if (run_irq_work) {
1609 wl1271_debug(DEBUG_MAC80211,
1610 "run postponed irq_work directly");
1611 wl1271_irq(0, wl);
1612 wl1271_enable_interrupts(wl);
1613 }
1614 1608
1615 wl1271_configure_resume(wl); 1609 if (run_irq_work) {
1610 wl1271_debug(DEBUG_MAC80211,
1611 "run postponed irq_work directly");
1612 wl1271_irq(0, wl);
1613 wl1271_enable_interrupts(wl);
1616 } 1614 }
1615 wl1271_configure_resume(wl);
1617 1616
1618 return 0; 1617 return 0;
1619} 1618}