aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel/iwlwifi/mvm/power.c
diff options
context:
space:
mode:
authorSara Sharon <sara.sharon@intel.com>2016-11-20 06:50:39 -0500
committerLuca Coelho <luciano.coelho@intel.com>2017-02-03 09:26:39 -0500
commit4f23f206ddce85a92b1acdebe0f4e9ed01b1d3f4 (patch)
tree4000e95e42dc516caddd313db30a5936ce42eb28 /drivers/net/wireless/intel/iwlwifi/mvm/power.c
parent6574dc943fc32a2fce69fab14891abca7eecb67c (diff)
iwlwifi: mvm: cleanup incorrect and redundant define
Currently we have up to 3 phy contexts - defined by NUM_PHY_CTX. However - some code paths validate the ID by using MAX_PHYS define which is set to 4. While there is no harm it is incorrect - since the maximum is 3. Remove the define and use the correct one. Cleanup the code a bit while at it. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mvm/power.c')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/power.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/power.c b/drivers/net/wireless/intel/iwlwifi/mvm/power.c
index 3a8e9379da2f..e684811f8e8b 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/power.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/power.c
@@ -599,9 +599,8 @@ static void iwl_mvm_power_ps_disabled_iterator(void *_data, u8* mac,
599 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 599 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
600 bool *disable_ps = _data; 600 bool *disable_ps = _data;
601 601
602 if (mvmvif->phy_ctxt) 602 if (mvmvif->phy_ctxt && mvmvif->phy_ctxt->id < NUM_PHY_CTX)
603 if (mvmvif->phy_ctxt->id < MAX_PHYS) 603 *disable_ps |= mvmvif->ps_disabled;
604 *disable_ps |= mvmvif->ps_disabled;
605} 604}
606 605
607static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac, 606static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac,
@@ -609,6 +608,7 @@ static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac,
609{ 608{
610 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 609 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
611 struct iwl_power_vifs *power_iterator = _data; 610 struct iwl_power_vifs *power_iterator = _data;
611 bool active = mvmvif->phy_ctxt && mvmvif->phy_ctxt->id < NUM_PHY_CTX;
612 612
613 switch (ieee80211_vif_type_p2p(vif)) { 613 switch (ieee80211_vif_type_p2p(vif)) {
614 case NL80211_IFTYPE_P2P_DEVICE: 614 case NL80211_IFTYPE_P2P_DEVICE:
@@ -619,34 +619,30 @@ static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac,
619 /* only a single MAC of the same type */ 619 /* only a single MAC of the same type */
620 WARN_ON(power_iterator->ap_vif); 620 WARN_ON(power_iterator->ap_vif);
621 power_iterator->ap_vif = vif; 621 power_iterator->ap_vif = vif;
622 if (mvmvif->phy_ctxt) 622 if (active)
623 if (mvmvif->phy_ctxt->id < MAX_PHYS) 623 power_iterator->ap_active = true;
624 power_iterator->ap_active = true;
625 break; 624 break;
626 625
627 case NL80211_IFTYPE_MONITOR: 626 case NL80211_IFTYPE_MONITOR:
628 /* only a single MAC of the same type */ 627 /* only a single MAC of the same type */
629 WARN_ON(power_iterator->monitor_vif); 628 WARN_ON(power_iterator->monitor_vif);
630 power_iterator->monitor_vif = vif; 629 power_iterator->monitor_vif = vif;
631 if (mvmvif->phy_ctxt) 630 if (active)
632 if (mvmvif->phy_ctxt->id < MAX_PHYS) 631 power_iterator->monitor_active = true;
633 power_iterator->monitor_active = true;
634 break; 632 break;
635 633
636 case NL80211_IFTYPE_P2P_CLIENT: 634 case NL80211_IFTYPE_P2P_CLIENT:
637 /* only a single MAC of the same type */ 635 /* only a single MAC of the same type */
638 WARN_ON(power_iterator->p2p_vif); 636 WARN_ON(power_iterator->p2p_vif);
639 power_iterator->p2p_vif = vif; 637 power_iterator->p2p_vif = vif;
640 if (mvmvif->phy_ctxt) 638 if (active)
641 if (mvmvif->phy_ctxt->id < MAX_PHYS) 639 power_iterator->p2p_active = true;
642 power_iterator->p2p_active = true;
643 break; 640 break;
644 641
645 case NL80211_IFTYPE_STATION: 642 case NL80211_IFTYPE_STATION:
646 power_iterator->bss_vif = vif; 643 power_iterator->bss_vif = vif;
647 if (mvmvif->phy_ctxt) 644 if (active)
648 if (mvmvif->phy_ctxt->id < MAX_PHYS) 645 power_iterator->bss_active = true;
649 power_iterator->bss_active = true;
650 break; 646 break;
651 647
652 default: 648 default: