aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/wcn36xx
diff options
context:
space:
mode:
authorPontus Fuchs <pontus.fuchs@gmail.com>2016-04-19 01:00:44 -0400
committerKalle Valo <kvalo@qca.qualcomm.com>2016-04-25 13:37:04 -0400
commita92e4696292199714d47d8e52c4bf0318324f77f (patch)
tree963e5433a226798730b45ba61574870fd6497b1e /drivers/net/wireless/ath/wcn36xx
parent90023c034fefe51cf67c719065434b0e43e9baf9 (diff)
wcn36xx: Add helper macros to cast sta to priv
While poking at this I also change two related things. I rename one variable to make the names consistent. I also move one assignment of priv_sta to the declaration to save a few lines. Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Diffstat (limited to 'drivers/net/wireless/ath/wcn36xx')
-rw-r--r--drivers/net/wireless/ath/wcn36xx/main.c14
-rw-r--r--drivers/net/wireless/ath/wcn36xx/smd.c12
-rw-r--r--drivers/net/wireless/ath/wcn36xx/wcn36xx.h6
3 files changed, 18 insertions, 14 deletions
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index 4781b5e8deb3..30f015d3a9e6 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -373,7 +373,7 @@ static void wcn36xx_tx(struct ieee80211_hw *hw,
373 struct wcn36xx_sta *sta_priv = NULL; 373 struct wcn36xx_sta *sta_priv = NULL;
374 374
375 if (control->sta) 375 if (control->sta)
376 sta_priv = (struct wcn36xx_sta *)control->sta->drv_priv; 376 sta_priv = wcn36xx_sta_to_priv(control->sta);
377 377
378 if (wcn36xx_start_tx(wcn, sta_priv, skb)) 378 if (wcn36xx_start_tx(wcn, sta_priv, skb))
379 ieee80211_free_txskb(wcn->hw, skb); 379 ieee80211_free_txskb(wcn->hw, skb);
@@ -518,7 +518,7 @@ static void wcn36xx_update_allowed_rates(struct ieee80211_sta *sta,
518{ 518{
519 int i, size; 519 int i, size;
520 u16 *rates_table; 520 u16 *rates_table;
521 struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv; 521 struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
522 u32 rates = sta->supp_rates[band]; 522 u32 rates = sta->supp_rates[band];
523 523
524 memset(&sta_priv->supported_rates, 0, 524 memset(&sta_priv->supported_rates, 0,
@@ -661,7 +661,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
661 rcu_read_unlock(); 661 rcu_read_unlock();
662 goto out; 662 goto out;
663 } 663 }
664 sta_priv = (struct wcn36xx_sta *)sta->drv_priv; 664 sta_priv = wcn36xx_sta_to_priv(sta);
665 665
666 wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn)); 666 wcn36xx_update_allowed_rates(sta, WCN36XX_BAND(wcn));
667 667
@@ -791,7 +791,7 @@ static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
791{ 791{
792 struct wcn36xx *wcn = hw->priv; 792 struct wcn36xx *wcn = hw->priv;
793 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); 793 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
794 struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv; 794 struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
795 wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta add vif %p sta %pM\n", 795 wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta add vif %p sta %pM\n",
796 vif, sta->addr); 796 vif, sta->addr);
797 797
@@ -816,7 +816,7 @@ static int wcn36xx_sta_remove(struct ieee80211_hw *hw,
816{ 816{
817 struct wcn36xx *wcn = hw->priv; 817 struct wcn36xx *wcn = hw->priv;
818 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); 818 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
819 struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv; 819 struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
820 820
821 wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta remove vif %p sta %pM index %d\n", 821 wcn36xx_dbg(WCN36XX_DBG_MAC, "mac sta remove vif %p sta %pM index %d\n",
822 vif, sta->addr, sta_priv->sta_index); 822 vif, sta->addr, sta_priv->sta_index);
@@ -858,7 +858,7 @@ static int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
858 struct ieee80211_ampdu_params *params) 858 struct ieee80211_ampdu_params *params)
859{ 859{
860 struct wcn36xx *wcn = hw->priv; 860 struct wcn36xx *wcn = hw->priv;
861 struct wcn36xx_sta *sta_priv = NULL; 861 struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(params->sta);
862 struct ieee80211_sta *sta = params->sta; 862 struct ieee80211_sta *sta = params->sta;
863 enum ieee80211_ampdu_mlme_action action = params->action; 863 enum ieee80211_ampdu_mlme_action action = params->action;
864 u16 tid = params->tid; 864 u16 tid = params->tid;
@@ -867,8 +867,6 @@ static int wcn36xx_ampdu_action(struct ieee80211_hw *hw,
867 wcn36xx_dbg(WCN36XX_DBG_MAC, "mac ampdu action action %d tid %d\n", 867 wcn36xx_dbg(WCN36XX_DBG_MAC, "mac ampdu action action %d tid %d\n",
868 action, tid); 868 action, tid);
869 869
870 sta_priv = (struct wcn36xx_sta *)sta->drv_priv;
871
872 switch (action) { 870 switch (action) {
873 case IEEE80211_AMPDU_RX_START: 871 case IEEE80211_AMPDU_RX_START:
874 sta_priv->tid = tid; 872 sta_priv->tid = tid;
diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c
index 6d4aa9250ca8..ff56138528b6 100644
--- a/drivers/net/wireless/ath/wcn36xx/smd.c
+++ b/drivers/net/wireless/ath/wcn36xx/smd.c
@@ -192,7 +192,7 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
192 struct wcn36xx_hal_config_sta_params *sta_params) 192 struct wcn36xx_hal_config_sta_params *sta_params)
193{ 193{
194 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif); 194 struct wcn36xx_vif *vif_priv = wcn36xx_vif_to_priv(vif);
195 struct wcn36xx_sta *priv_sta = NULL; 195 struct wcn36xx_sta *sta_priv = NULL;
196 if (vif->type == NL80211_IFTYPE_ADHOC || 196 if (vif->type == NL80211_IFTYPE_ADHOC ||
197 vif->type == NL80211_IFTYPE_AP || 197 vif->type == NL80211_IFTYPE_AP ||
198 vif->type == NL80211_IFTYPE_MESH_POINT) { 198 vif->type == NL80211_IFTYPE_MESH_POINT) {
@@ -228,17 +228,17 @@ static void wcn36xx_smd_set_sta_params(struct wcn36xx *wcn,
228 sta_params->p2p = 0; 228 sta_params->p2p = 0;
229 229
230 if (sta) { 230 if (sta) {
231 priv_sta = (struct wcn36xx_sta *)sta->drv_priv; 231 sta_priv = wcn36xx_sta_to_priv(sta);
232 if (NL80211_IFTYPE_STATION == vif->type) 232 if (NL80211_IFTYPE_STATION == vif->type)
233 memcpy(&sta_params->bssid, sta->addr, ETH_ALEN); 233 memcpy(&sta_params->bssid, sta->addr, ETH_ALEN);
234 else 234 else
235 memcpy(&sta_params->mac, sta->addr, ETH_ALEN); 235 memcpy(&sta_params->mac, sta->addr, ETH_ALEN);
236 sta_params->wmm_enabled = sta->wme; 236 sta_params->wmm_enabled = sta->wme;
237 sta_params->max_sp_len = sta->max_sp; 237 sta_params->max_sp_len = sta->max_sp;
238 sta_params->aid = priv_sta->aid; 238 sta_params->aid = sta_priv->aid;
239 wcn36xx_smd_set_sta_ht_params(sta, sta_params); 239 wcn36xx_smd_set_sta_ht_params(sta, sta_params);
240 memcpy(&sta_params->supported_rates, &priv_sta->supported_rates, 240 memcpy(&sta_params->supported_rates, &sta_priv->supported_rates,
241 sizeof(priv_sta->supported_rates)); 241 sizeof(sta_priv->supported_rates));
242 } else { 242 } else {
243 wcn36xx_set_default_rates(&sta_params->supported_rates); 243 wcn36xx_set_default_rates(&sta_params->supported_rates);
244 wcn36xx_smd_set_sta_default_ht_params(sta_params); 244 wcn36xx_smd_set_sta_default_ht_params(sta_params);
@@ -969,7 +969,7 @@ static int wcn36xx_smd_config_sta_rsp(struct wcn36xx *wcn,
969{ 969{
970 struct wcn36xx_hal_config_sta_rsp_msg *rsp; 970 struct wcn36xx_hal_config_sta_rsp_msg *rsp;
971 struct config_sta_rsp_params *params; 971 struct config_sta_rsp_params *params;
972 struct wcn36xx_sta *sta_priv = (struct wcn36xx_sta *)sta->drv_priv; 972 struct wcn36xx_sta *sta_priv = wcn36xx_sta_to_priv(sta);
973 973
974 if (len < sizeof(*rsp)) 974 if (len < sizeof(*rsp))
975 return -EINVAL; 975 return -EINVAL;
diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
index c3ba07ed1db5..c368a34c8de7 100644
--- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
+++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h
@@ -275,4 +275,10 @@ struct ieee80211_vif *wcn36xx_priv_to_vif(struct wcn36xx_vif *vif_priv)
275 return container_of((void *) vif_priv, struct ieee80211_vif, drv_priv); 275 return container_of((void *) vif_priv, struct ieee80211_vif, drv_priv);
276} 276}
277 277
278static inline
279struct wcn36xx_sta *wcn36xx_sta_to_priv(struct ieee80211_sta *sta)
280{
281 return (struct wcn36xx_sta *)sta->drv_priv;
282}
283
278#endif /* _WCN36XX_H_ */ 284#endif /* _WCN36XX_H_ */