wl1251: Prepare for idle mode support
[pandora-wifi.git] / drivers / net / wireless / wl12xx / wl1251_main.c
index 8b3e78e..8ca7901 100644 (file)
 #include "wl1251_debugfs.h"
 #include "wl1251_boot.h"
 
+/* HACK */
+#ifndef FIF_PROBE_REQ
+#define FIF_PROBE_REQ 0
+#endif
+
 void wl1251_enable_interrupts(struct wl1251 *wl)
 {
        wl->if_ops->enable_irq(wl);
@@ -323,6 +328,25 @@ out:
        mutex_unlock(&wl->mutex);
 }
 
+/* Atomic irq handler */
+void wl1251_irq(struct wl1251 *wl)
+{
+       unsigned long flags;
+
+       wl1251_debug(DEBUG_IRQ, "IRQ");
+
+       /* complete the ELP completion */
+       spin_lock_irqsave(&wl->wl_lock, flags);
+       if (wl->elp_compl) {
+               complete(wl->elp_compl);
+               wl->elp_compl = NULL;
+       }
+       spin_unlock_irqrestore(&wl->wl_lock, flags);
+
+       ieee80211_queue_work(wl->hw, &wl->irq_work);
+}
+EXPORT_SYMBOL_GPL(wl1251_irq);
+
 static void wl1251_convert_filters(struct wl1251 *wl,
                                  unsigned int mac80211_filters)
 {
@@ -516,7 +540,7 @@ static void wl1251_op_stop(struct ieee80211_hw *hw)
        wl->rx_last_id = 0;
        wl->next_tx_complete = 0;
        wl->elp = false;
-       wl->psm = 0;
+       wl->station_mode = STATION_ACTIVE_MODE;
        wl->tx_queue_stopped = false;
        wl->power_level = WL1251_DEFAULT_POWER_LEVEL;
        wl->channel = WL1251_DEFAULT_CHANNEL;
@@ -661,7 +685,7 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
 
                wl->psm_requested = false;
 
-               if (wl->psm) {
+               if (wl->station_mode != STATION_ACTIVE_MODE) {
                        ret = wl1251_ps_set_mode(wl, STATION_ACTIVE_MODE);
                        if (ret < 0)
                                goto out_sleep;
@@ -1374,7 +1398,7 @@ struct ieee80211_hw *wl1251_alloc_hw(void)
        wl->rx_config = WL1251_DEFAULT_RX_CONFIG;
        wl->rx_filter = WL1251_DEFAULT_RX_FILTER;
        wl->elp = false;
-       wl->psm = 0;
+       wl->station_mode = STATION_ACTIVE_MODE;
        wl->psm_requested = false;
        wl->tx_queue_stopped = false;
        wl->power_level = WL1251_DEFAULT_POWER_LEVEL;