summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/mvm/power.c
diff options
context:
space:
mode:
authorLuciano Coelho2014-08-08 16:12:07 +0200
committerEmmanuel Grumbach2014-09-03 21:48:57 +0200
commitb1873300e15aff44c01f7c9bc275c2c6e414f2fa (patch)
tree908dcc33afa9a47a543b0cfb9a65c5d66d7b0fef /drivers/net/wireless/iwlwifi/mvm/power.c
parentiwlwifi: mvm: clear d0i3 state on recovery (diff)
downloadkernel-qcow2-linux-b1873300e15aff44c01f7c9bc275c2c6e414f2fa.tar.gz
kernel-qcow2-linux-b1873300e15aff44c01f7c9bc275c2c6e414f2fa.tar.xz
kernel-qcow2-linux-b1873300e15aff44c01f7c9bc275c2c6e414f2fa.zip
iwlwifi: mvm: re-enable ps when monitor interfaces are removed
If a monitor interface is added and then removed, we don't reset the mvm->ps_disabled flag, so we never re-enable power saving. Fix that and rearrange the code a bit. Additionally, fix a small indentation mistake in the iwl_mvm_power_set_pm() function declaration. Signed-off-by: Luciano Coelho <luciano.coelho@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/mvm/power.c')
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/power.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/power.c b/drivers/net/wireless/iwlwifi/mvm/power.c
index 8cbe7ea01a69..754f2b3eae64 100644
--- a/drivers/net/wireless/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/iwlwifi/mvm/power.c
@@ -566,9 +566,8 @@ static void iwl_mvm_power_iterator(void *_data, u8 *mac,
}
}
-static void
-iwl_mvm_power_set_pm(struct iwl_mvm *mvm,
- struct iwl_power_vifs *vifs)
+static void iwl_mvm_power_set_pm(struct iwl_mvm *mvm,
+ struct iwl_power_vifs *vifs)
{
struct iwl_mvm_vif *bss_mvmvif = NULL;
struct iwl_mvm_vif *p2p_mvmvif = NULL;
@@ -830,7 +829,7 @@ int iwl_mvm_power_update_mac(struct iwl_mvm *mvm)
struct iwl_power_vifs vifs = {
.mvm = mvm,
};
- bool ba_enable;
+ bool ba_enable, disable_ps;
int ret;
lockdep_assert_held(&mvm->mutex);
@@ -838,16 +837,19 @@ int iwl_mvm_power_update_mac(struct iwl_mvm *mvm)
iwl_mvm_power_set_pm(mvm, &vifs);
/* disable PS if CAM */
- if (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM) {
- mvm->ps_disabled = true;
- } else {
- /* don't update device power state unless we add / remove monitor */
- if (vifs.monitor_vif) {
- if (vifs.monitor_active)
- mvm->ps_disabled = true;
- ret = iwl_mvm_power_update_device(mvm);
- if (ret)
- return ret;
+ disable_ps = (iwlmvm_mod_params.power_scheme == IWL_POWER_SCHEME_CAM);
+ /* ...or if there is an active monitor vif */
+ disable_ps |= (vifs.monitor_vif && vifs.monitor_active);
+
+ /* update device power state if it has changed */
+ if (mvm->ps_disabled != disable_ps) {
+ bool old_ps_disabled = mvm->ps_disabled;
+
+ mvm->ps_disabled = disable_ps;
+ ret = iwl_mvm_power_update_device(mvm);
+ if (ret) {
+ mvm->ps_disabled = old_ps_disabled;
+ return ret;
}
}