aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-12-23 10:02:40 -0500
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>2014-12-28 13:04:34 -0500
commit9d8ce6afe19e8b5fea175ece550ec1f9d1024f8d (patch)
tree1efdbe88a60f789f5854e378c53a0e4c71d0ee0f
parent5b530e95a95d17f004702cd829e42e171179f529 (diff)
iwlwifi: mvm: use iwl_mvm_sta_from_mac80211() consistently
A number of places (still) use a direct operation, use iwl_mvm_sta_from_mac80211() consistently. In one place also move it into the variable initializer. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/d3.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/ops.c2
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rs.c13
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/sta.c12
6 files changed, 17 insertions, 20 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/d3.c b/drivers/net/wireless/iwlwifi/mvm/d3.c
index 4b5849eaac61..14e8fd661889 100644
--- a/drivers/net/wireless/iwlwifi/mvm/d3.c
+++ b/drivers/net/wireless/iwlwifi/mvm/d3.c
@@ -793,7 +793,7 @@ iwl_mvm_get_wowlan_config(struct iwl_mvm *mvm,
793 struct ieee80211_sta *ap_sta) 793 struct ieee80211_sta *ap_sta)
794{ 794{
795 int ret; 795 int ret;
796 struct iwl_mvm_sta *mvm_ap_sta = (struct iwl_mvm_sta *)ap_sta->drv_priv; 796 struct iwl_mvm_sta *mvm_ap_sta = iwl_mvm_sta_from_mac80211(ap_sta);
797 797
798 /* TODO: wowlan_config_cmd->wowlan_ba_teardown_tids */ 798 /* TODO: wowlan_config_cmd->wowlan_ba_teardown_tids */
799 799
@@ -1657,7 +1657,7 @@ static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm,
1657 if (IS_ERR_OR_NULL(ap_sta)) 1657 if (IS_ERR_OR_NULL(ap_sta))
1658 goto out_free; 1658 goto out_free;
1659 1659
1660 mvm_ap_sta = (struct iwl_mvm_sta *)ap_sta->drv_priv; 1660 mvm_ap_sta = iwl_mvm_sta_from_mac80211(ap_sta);
1661 for (i = 0; i < IWL_MAX_TID_COUNT; i++) { 1661 for (i = 0; i < IWL_MAX_TID_COUNT; i++) {
1662 u16 seq = status.qos_seq_ctr[i]; 1662 u16 seq = status.qos_seq_ctr[i];
1663 /* firmware stores last-used value, we store next value */ 1663 /* firmware stores last-used value, we store next value */
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
index 9aa2311a776c..8dc3ca9f4904 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c
@@ -268,7 +268,7 @@ static ssize_t iwl_dbgfs_mac_params_read(struct file *file,
268 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[ap_sta_id], 268 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[ap_sta_id],
269 lockdep_is_held(&mvm->mutex)); 269 lockdep_is_held(&mvm->mutex));
270 if (!IS_ERR_OR_NULL(sta)) { 270 if (!IS_ERR_OR_NULL(sta)) {
271 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 271 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
272 272
273 pos += scnprintf(buf+pos, bufsz-pos, 273 pos += scnprintf(buf+pos, bufsz-pos,
274 "ap_sta_id %d - reduced Tx power %d\n", 274 "ap_sta_id %d - reduced Tx power %d\n",
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 084689b9b93c..c4552b5f5c19 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -2137,7 +2137,7 @@ static void iwl_mvm_sta_pre_rcu_remove(struct ieee80211_hw *hw,
2137 struct ieee80211_sta *sta) 2137 struct ieee80211_sta *sta)
2138{ 2138{
2139 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 2139 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
2140 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 2140 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
2141 2141
2142 /* 2142 /*
2143 * This is called before mac80211 does RCU synchronisation, 2143 * This is called before mac80211 does RCU synchronisation,
@@ -3152,7 +3152,7 @@ static int iwl_mvm_set_tim(struct ieee80211_hw *hw,
3152 bool set) 3152 bool set)
3153{ 3153{
3154 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 3154 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
3155 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 3155 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
3156 3156
3157 if (!mvm_sta || !mvm_sta->vif) { 3157 if (!mvm_sta || !mvm_sta->vif) {
3158 IWL_ERR(mvm, "Station is not associated to a vif\n"); 3158 IWL_ERR(mvm, "Station is not associated to a vif\n");
diff --git a/drivers/net/wireless/iwlwifi/mvm/ops.c b/drivers/net/wireless/iwlwifi/mvm/ops.c
index 17f58ca4bcba..6bb6546a734b 100644
--- a/drivers/net/wireless/iwlwifi/mvm/ops.c
+++ b/drivers/net/wireless/iwlwifi/mvm/ops.c
@@ -1146,7 +1146,7 @@ void iwl_mvm_d0i3_enable_tx(struct iwl_mvm *mvm, __le16 *qos_seq)
1146 1146
1147 if (mvm->d0i3_offloading && qos_seq) { 1147 if (mvm->d0i3_offloading && qos_seq) {
1148 /* update qos seq numbers if offloading was enabled */ 1148 /* update qos seq numbers if offloading was enabled */
1149 mvm_ap_sta = (struct iwl_mvm_sta *)sta->drv_priv; 1149 mvm_ap_sta = iwl_mvm_sta_from_mac80211(sta);
1150 for (i = 0; i < IWL_MAX_TID_COUNT; i++) { 1150 for (i = 0; i < IWL_MAX_TID_COUNT; i++) {
1151 u16 seq = le16_to_cpu(qos_seq[i]); 1151 u16 seq = le16_to_cpu(qos_seq[i]);
1152 /* firmware stores last-used one, we store next one */ 1152 /* firmware stores last-used one, we store next one */
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index 999efc33b9da..568829db2119 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -1946,7 +1946,7 @@ static bool rs_tpc_perform(struct iwl_mvm *mvm,
1946 struct iwl_lq_sta *lq_sta, 1946 struct iwl_lq_sta *lq_sta,
1947 struct iwl_scale_tbl_info *tbl) 1947 struct iwl_scale_tbl_info *tbl)
1948{ 1948{
1949 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 1949 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
1950 struct ieee80211_vif *vif = mvm_sta->vif; 1950 struct ieee80211_vif *vif = mvm_sta->vif;
1951 struct ieee80211_chanctx_conf *chanctx_conf; 1951 struct ieee80211_chanctx_conf *chanctx_conf;
1952 enum ieee80211_band band; 1952 enum ieee80211_band band;
@@ -2055,7 +2055,7 @@ static void rs_rate_scale_perform(struct iwl_mvm *mvm,
2055 u16 high_low; 2055 u16 high_low;
2056 s32 sr; 2056 s32 sr;
2057 u8 prev_agg = lq_sta->is_agg; 2057 u8 prev_agg = lq_sta->is_agg;
2058 struct iwl_mvm_sta *sta_priv = (void *)sta->drv_priv; 2058 struct iwl_mvm_sta *sta_priv = iwl_mvm_sta_from_mac80211(sta);
2059 struct iwl_mvm_tid_data *tid_data; 2059 struct iwl_mvm_tid_data *tid_data;
2060 struct rs_rate *rate; 2060 struct rs_rate *rate;
2061 2061
@@ -2541,7 +2541,7 @@ static void rs_get_rate(void *mvm_r, struct ieee80211_sta *sta, void *mvm_sta,
2541static void *rs_alloc_sta(void *mvm_rate, struct ieee80211_sta *sta, 2541static void *rs_alloc_sta(void *mvm_rate, struct ieee80211_sta *sta,
2542 gfp_t gfp) 2542 gfp_t gfp)
2543{ 2543{
2544 struct iwl_mvm_sta *sta_priv = (struct iwl_mvm_sta *)sta->drv_priv; 2544 struct iwl_mvm_sta *sta_priv = iwl_mvm_sta_from_mac80211(sta);
2545 struct iwl_op_mode *op_mode = (struct iwl_op_mode *)mvm_rate; 2545 struct iwl_op_mode *op_mode = (struct iwl_op_mode *)mvm_rate;
2546 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); 2546 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);
2547 struct iwl_lq_sta *lq_sta = &sta_priv->lq_sta; 2547 struct iwl_lq_sta *lq_sta = &sta_priv->lq_sta;
@@ -2694,14 +2694,11 @@ void iwl_mvm_rs_rate_init(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
2694 struct ieee80211_hw *hw = mvm->hw; 2694 struct ieee80211_hw *hw = mvm->hw;
2695 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap; 2695 struct ieee80211_sta_ht_cap *ht_cap = &sta->ht_cap;
2696 struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap; 2696 struct ieee80211_sta_vht_cap *vht_cap = &sta->vht_cap;
2697 struct iwl_mvm_sta *sta_priv; 2697 struct iwl_mvm_sta *sta_priv = iwl_mvm_sta_from_mac80211(sta);
2698 struct iwl_lq_sta *lq_sta; 2698 struct iwl_lq_sta *lq_sta = &sta_priv->lq_sta;
2699 struct ieee80211_supported_band *sband; 2699 struct ieee80211_supported_band *sband;
2700 unsigned long supp; /* must be unsigned long for for_each_set_bit */ 2700 unsigned long supp; /* must be unsigned long for for_each_set_bit */
2701 2701
2702 sta_priv = (struct iwl_mvm_sta *)sta->drv_priv;
2703 lq_sta = &sta_priv->lq_sta;
2704
2705 /* clear all non-persistent lq data */ 2702 /* clear all non-persistent lq data */
2706 memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers)); 2703 memset(lq_sta, 0, offsetof(typeof(*lq_sta), pers));
2707 2704
diff --git a/drivers/net/wireless/iwlwifi/mvm/sta.c b/drivers/net/wireless/iwlwifi/mvm/sta.c
index 9eaa96ec6bad..ad327984b099 100644
--- a/drivers/net/wireless/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/iwlwifi/mvm/sta.c
@@ -99,7 +99,7 @@ static int iwl_mvm_find_free_sta_id(struct iwl_mvm *mvm,
99int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 99int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
100 bool update) 100 bool update)
101{ 101{
102 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 102 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
103 struct iwl_mvm_add_sta_cmd add_sta_cmd = { 103 struct iwl_mvm_add_sta_cmd add_sta_cmd = {
104 .sta_id = mvm_sta->sta_id, 104 .sta_id = mvm_sta->sta_id,
105 .mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color), 105 .mac_id_n_color = cpu_to_le32(mvm_sta->mac_id_n_color),
@@ -259,7 +259,7 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm,
259 struct ieee80211_sta *sta) 259 struct ieee80211_sta *sta)
260{ 260{
261 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 261 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
262 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 262 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
263 int i, ret, sta_id; 263 int i, ret, sta_id;
264 264
265 lockdep_assert_held(&mvm->mutex); 265 lockdep_assert_held(&mvm->mutex);
@@ -481,7 +481,7 @@ int iwl_mvm_rm_sta(struct iwl_mvm *mvm,
481 struct ieee80211_sta *sta) 481 struct ieee80211_sta *sta)
482{ 482{
483 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 483 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
484 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 484 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
485 int ret; 485 int ret;
486 486
487 lockdep_assert_held(&mvm->mutex); 487 lockdep_assert_held(&mvm->mutex);
@@ -774,7 +774,7 @@ int iwl_mvm_rm_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
774int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 774int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
775 int tid, u16 ssn, bool start) 775 int tid, u16 ssn, bool start)
776{ 776{
777 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 777 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
778 struct iwl_mvm_add_sta_cmd cmd = {}; 778 struct iwl_mvm_add_sta_cmd cmd = {};
779 int ret; 779 int ret;
780 u32 status; 780 u32 status;
@@ -834,7 +834,7 @@ int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
834static int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, 834static int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
835 int tid, u8 queue, bool start) 835 int tid, u8 queue, bool start)
836{ 836{
837 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 837 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
838 struct iwl_mvm_add_sta_cmd cmd = {}; 838 struct iwl_mvm_add_sta_cmd cmd = {};
839 int ret; 839 int ret;
840 u32 status; 840 u32 status;
@@ -1147,7 +1147,7 @@ static u8 iwl_mvm_get_key_sta_id(struct ieee80211_vif *vif,
1147 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 1147 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
1148 1148
1149 if (sta) { 1149 if (sta) {
1150 struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv; 1150 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta);
1151 1151
1152 return mvm_sta->sta_id; 1152 return mvm_sta->sta_id;
1153 } 1153 }