[PATCH 1/6] Remove wcn->iftype variable

Olof Johansson dev at skyshaper.net
Tue Jul 9 05:19:59 EDT 2013


This member is known all the time when we need it from the vif struct.
No need in keeping it again as a global.
---
 main.c    |  8 +++-----
 smd.c     | 14 +++++++-------
 smd.h     |  2 +-
 wcn36xx.h |  2 +-
 4 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/main.c b/main.c
index 98e6ef2..12534f0 100644
--- a/main.c
+++ b/main.c
@@ -562,7 +562,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 			wcn36xx_smd_config_bss(wcn, NL80211_IFTYPE_STATION,
 					       bss_conf->bssid,
 					       true, wcn->beacon_interval);
-			wcn36xx_smd_config_sta(wcn, bss_conf->bssid, vif->addr);
+			wcn36xx_smd_config_sta(wcn, bss_conf->bssid, vif->addr, vif->type);
 
 		} else {
 			wcn36xx_dbg(WCN36XX_DBG_MAC,
@@ -597,7 +597,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 
 		if (bss_conf->enable_beacon) {
 			wcn->beacon_enable = true;
-			wcn36xx_smd_config_bss(wcn, wcn->iftype,
+			wcn36xx_smd_config_bss(wcn, vif->type,
 					       wcn->addresses[0].addr, false,
 					       wcn->beacon_interval);
 			skb = ieee80211_beacon_get_tim(hw, vif, &tim_off,
@@ -665,8 +665,6 @@ static int wcn36xx_add_interface(struct ieee80211_hw *hw,
 		return -EOPNOTSUPP;
 	}
 
-	wcn->iftype = vif->type;
-
 	return 0;
 }
 
@@ -683,7 +681,7 @@ static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	    vif->type == NL80211_IFTYPE_MESH_POINT) {
 		wcn->aid = sta->aid;
 		wcn36xx_smd_config_sta(wcn, wcn->addresses[0].addr,
-				       sta->addr);
+				       sta->addr, vif->type);
 	}
 	return 0;
 }
diff --git a/smd.c b/smd.c
index 9fa2f0f..c9b5e9e 100644
--- a/smd.c
+++ b/smd.c
@@ -490,7 +490,7 @@ static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
 }
 
 int wcn36xx_smd_config_sta(struct wcn36xx *wcn, const u8 *bssid,
-			   const u8 *sta_mac)
+			   const u8 *sta_mac, enum nl80211_iftype iftype)
 {
 	struct wcn36xx_hal_config_sta_req_msg msg;
 	struct wcn36xx_hal_config_sta_params *sta;
@@ -503,9 +503,9 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, const u8 *bssid,
 
 	sta->aid = wcn->aid;
 
-	if (wcn->iftype == NL80211_IFTYPE_ADHOC ||
-	    wcn->iftype == NL80211_IFTYPE_AP ||
-	    wcn->iftype == NL80211_IFTYPE_MESH_POINT)
+	if (iftype == NL80211_IFTYPE_ADHOC ||
+	    iftype == NL80211_IFTYPE_AP ||
+	    iftype == NL80211_IFTYPE_MESH_POINT)
 		sta->type = 1;
 	else
 		sta->type = 0;
@@ -538,9 +538,9 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, const u8 *bssid,
 	sta->delayed_ba_support = 0;
 	sta->max_ampdu_duration = 0;
 	sta->dsss_cck_mode_40mhz = 0;
-	if (wcn->iftype == NL80211_IFTYPE_ADHOC ||
-	    wcn->iftype == NL80211_IFTYPE_AP ||
-	    wcn->iftype == NL80211_IFTYPE_MESH_POINT)
+	if (iftype == NL80211_IFTYPE_ADHOC ||
+	    iftype == NL80211_IFTYPE_AP ||
+	    iftype == NL80211_IFTYPE_MESH_POINT)
 		sta->sta_index = 0xFF;
 	else
 		sta->sta_index = 1;
diff --git a/smd.h b/smd.h
index 964e3c2..f182d76 100644
--- a/smd.h
+++ b/smd.h
@@ -66,7 +66,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, enum nl80211_iftype type,
 			   const u8 *bssid, bool update, u16 beacon_interval);
 int wcn36xx_smd_delete_bss(struct wcn36xx *wcn);
 int wcn36xx_smd_config_sta(struct wcn36xx *wcn, const u8 *bssid,
-			   const u8 *sta_mac);
+			   const u8 *sta_mac, enum nl80211_iftype iftype);
 int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct sk_buff *skb_beacon,
 			    u16 tim_off, u16 p2p_off);
 int wcn36xx_smd_switch_channel(struct wcn36xx *wcn, int ch);
diff --git a/wcn36xx.h b/wcn36xx.h
index 830ae2a..98f1e4a 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -98,6 +98,7 @@ struct wcn36xx_vif {
 	u8 self_sta_index;
 	u8 self_dpu_desc_index;
 };
+
 struct wcn_sta {
 	u8 sta_id;
 	bool is_data_encrypted;
@@ -113,7 +114,6 @@ struct wcn36xx {
 	struct ieee80211_channel *current_channel;
 	enum ieee80211_band	band;
 	struct wcn36xx_hal_mac_ssid ssid;
-	enum nl80211_iftype	iftype;
 	u16			aid;
 	struct wcn36xx_vif	*current_vif;
 	u16			beacon_interval;
-- 
1.8.3.1




More information about the wcn36xx mailing list