Commit 4f23f206 authored by Sara Sharon's avatar Sara Sharon Committed by Luca Coelho

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: default avatarSara Sharon <sara.sharon@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent 6574dc94
...@@ -713,7 +713,6 @@ struct iwl_error_resp { ...@@ -713,7 +713,6 @@ struct iwl_error_resp {
#define MAX_MACS_IN_BINDING (3) #define MAX_MACS_IN_BINDING (3)
#define MAX_BINDINGS (4) #define MAX_BINDINGS (4)
#define AUX_BINDING_INDEX (3) #define AUX_BINDING_INDEX (3)
#define MAX_PHYS (4)
/* Used to extract ID and color from the context dword */ /* Used to extract ID and color from the context dword */
#define FW_CTXT_ID_POS (0) #define FW_CTXT_ID_POS (0)
......
...@@ -599,8 +599,7 @@ static void iwl_mvm_power_ps_disabled_iterator(void *_data, u8* mac, ...@@ -599,8 +599,7 @@ static void iwl_mvm_power_ps_disabled_iterator(void *_data, u8* mac,
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
bool *disable_ps = _data; bool *disable_ps = _data;
if (mvmvif->phy_ctxt) if (mvmvif->phy_ctxt && mvmvif->phy_ctxt->id < NUM_PHY_CTX)
if (mvmvif->phy_ctxt->id < MAX_PHYS)
*disable_ps |= mvmvif->ps_disabled; *disable_ps |= mvmvif->ps_disabled;
} }
...@@ -609,6 +608,7 @@ static 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,
{ {
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
struct iwl_power_vifs *power_iterator = _data; struct iwl_power_vifs *power_iterator = _data;
bool active = mvmvif->phy_ctxt && mvmvif->phy_ctxt->id < NUM_PHY_CTX;
switch (ieee80211_vif_type_p2p(vif)) { switch (ieee80211_vif_type_p2p(vif)) {
case NL80211_IFTYPE_P2P_DEVICE: case NL80211_IFTYPE_P2P_DEVICE:
...@@ -619,8 +619,7 @@ static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac, ...@@ -619,8 +619,7 @@ static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac,
/* only a single MAC of the same type */ /* only a single MAC of the same type */
WARN_ON(power_iterator->ap_vif); WARN_ON(power_iterator->ap_vif);
power_iterator->ap_vif = vif; power_iterator->ap_vif = vif;
if (mvmvif->phy_ctxt) if (active)
if (mvmvif->phy_ctxt->id < MAX_PHYS)
power_iterator->ap_active = true; power_iterator->ap_active = true;
break; break;
...@@ -628,8 +627,7 @@ static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac, ...@@ -628,8 +627,7 @@ static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac,
/* only a single MAC of the same type */ /* only a single MAC of the same type */
WARN_ON(power_iterator->monitor_vif); WARN_ON(power_iterator->monitor_vif);
power_iterator->monitor_vif = vif; power_iterator->monitor_vif = vif;
if (mvmvif->phy_ctxt) if (active)
if (mvmvif->phy_ctxt->id < MAX_PHYS)
power_iterator->monitor_active = true; power_iterator->monitor_active = true;
break; break;
...@@ -637,15 +635,13 @@ static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac, ...@@ -637,15 +635,13 @@ static void iwl_mvm_power_get_vifs_iterator(void *_data, u8 *mac,
/* only a single MAC of the same type */ /* only a single MAC of the same type */
WARN_ON(power_iterator->p2p_vif); WARN_ON(power_iterator->p2p_vif);
power_iterator->p2p_vif = vif; power_iterator->p2p_vif = vif;
if (mvmvif->phy_ctxt) if (active)
if (mvmvif->phy_ctxt->id < MAX_PHYS)
power_iterator->p2p_active = true; power_iterator->p2p_active = true;
break; break;
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
power_iterator->bss_vif = vif; power_iterator->bss_vif = vif;
if (mvmvif->phy_ctxt) if (active)
if (mvmvif->phy_ctxt->id < MAX_PHYS)
power_iterator->bss_active = true; power_iterator->bss_active = true;
break; break;
......
...@@ -197,7 +197,7 @@ static void iwl_mvm_scan_condition_iterator(void *data, u8 *mac, ...@@ -197,7 +197,7 @@ static void iwl_mvm_scan_condition_iterator(void *data, u8 *mac,
int *global_cnt = data; int *global_cnt = data;
if (vif->type != NL80211_IFTYPE_P2P_DEVICE && mvmvif->phy_ctxt && if (vif->type != NL80211_IFTYPE_P2P_DEVICE && mvmvif->phy_ctxt &&
mvmvif->phy_ctxt->id < MAX_PHYS) mvmvif->phy_ctxt->id < NUM_PHY_CTX)
*global_cnt += 1; *global_cnt += 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment