wl1251: disable power saving in monitor mode
authorDavid Gnedt <david.gnedt@davizone.at>
Tue, 7 Jan 2014 12:09:06 +0000 (13:09 +0100)
committerGrazvydas Ignotas <notasas@gmail.com>
Fri, 18 Apr 2014 23:44:35 +0000 (02:44 +0300)
Force power saving off while monitor interface is present.

Signed-off-by: David Gnedt <david.gnedt@davizone.at>
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/wl1251/main.c

index 3a3f19c..7bcedad 100644 (file)
@@ -675,6 +675,11 @@ out:
        mutex_unlock(&wl->mutex);
 }
 
        mutex_unlock(&wl->mutex);
 }
 
+static bool wl1251_can_do_pm(struct ieee80211_conf *conf, struct wl1251 *wl)
+{
+       return (conf->flags & IEEE80211_CONF_PS) && !wl->monitor_present;
+}
+
 static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct wl1251 *wl = hw->priv;
 static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
 {
        struct wl1251 *wl = hw->priv;
@@ -721,7 +726,7 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
                        goto out_sleep;
        }
 
                        goto out_sleep;
        }
 
-       if (conf->flags & IEEE80211_CONF_PS && !wl->psm_requested) {
+       if (wl1251_can_do_pm(conf, wl) && !wl->psm_requested) {
                wl1251_debug(DEBUG_PSM, "psm enabled");
 
                wl->psm_requested = true;
                wl1251_debug(DEBUG_PSM, "psm enabled");
 
                wl->psm_requested = true;
@@ -729,8 +734,7 @@ static int wl1251_op_config(struct ieee80211_hw *hw, u32 changed)
                wl->dtim_period = conf->ps_dtim_period;
 
                ieee80211_queue_delayed_work(wl->hw, &wl->ps_work, 0);
                wl->dtim_period = conf->ps_dtim_period;
 
                ieee80211_queue_delayed_work(wl->hw, &wl->ps_work, 0);
-       } else if (!(conf->flags & IEEE80211_CONF_PS) &&
-                  wl->psm_requested) {
+       } else if (!wl1251_can_do_pm(conf, wl) && wl->psm_requested) {
                wl1251_debug(DEBUG_PSM, "psm disabled");
 
                wl->psm_requested = false;
                wl1251_debug(DEBUG_PSM, "psm disabled");
 
                wl->psm_requested = false;