[PATCH 2/9] wcn36xx: remove using current_vif from add interface ops

Eugene Krasnikov k.eugene.e at gmail.com
Fri Sep 6 04:09:14 EDT 2013


Pass vif as a parameter to hall calls instead of using current_vif.

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 main.c |  4 +---
 smd.c  | 15 ++++++++++-----
 smd.h  |  2 +-
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/main.c b/main.c
index bb9a73a..daf84e9 100644
--- a/main.c
+++ b/main.c
@@ -656,8 +656,6 @@ static int wcn36xx_add_interface(struct ieee80211_hw *hw,
 	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac add interface vif %p type %d\n",
 		    vif, vif->type);
 
-	wcn->current_vif = (struct wcn36xx_vif *)vif->drv_priv;
-
 	if (!(NL80211_IFTYPE_STATION == vif->type ||
 	      NL80211_IFTYPE_AP == vif->type ||
 	      NL80211_IFTYPE_ADHOC == vif->type ||
@@ -667,7 +665,7 @@ static int wcn36xx_add_interface(struct ieee80211_hw *hw,
 		return -EOPNOTSUPP;
 	}
 
-	wcn36xx_smd_add_sta_self(wcn, vif->addr);
+	wcn36xx_smd_add_sta_self(wcn, vif);
 
 	return 0;
 }
diff --git a/smd.c b/smd.c
index 761af8e..5deadfa 100644
--- a/smd.c
+++ b/smd.c
@@ -607,10 +607,12 @@ out:
 }
 
 static int wcn36xx_smd_add_sta_self_rsp(struct wcn36xx *wcn,
+					struct ieee80211_vif *vif,
 					void *buf,
 					size_t len)
 {
 	struct wcn36xx_hal_add_sta_self_rsp_msg *rsp;
+	struct wcn36xx_vif *priv_vif = (struct wcn36xx_vif *)vif->drv_priv;
 
 	if (len < sizeof(*rsp))
 		return -EINVAL;
@@ -627,13 +629,13 @@ static int wcn36xx_smd_add_sta_self_rsp(struct wcn36xx *wcn,
 		    "hal add sta self status %d self_sta_index %d dpu_index %d\n",
 		    rsp->status, rsp->self_sta_index, rsp->dpu_index);
 
-	wcn->current_vif->self_sta_index = rsp->self_sta_index;
-	wcn->current_vif->self_dpu_desc_index = rsp->dpu_index;
+	priv_vif->self_sta_index = rsp->self_sta_index;
+	priv_vif->self_dpu_desc_index = rsp->dpu_index;
 
 	return 0;
 }
 
-int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, u8 *addr)
+int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct ieee80211_vif *vif)
 {
 	struct wcn36xx_hal_add_sta_self_req msg_body;
 	int ret = 0;
@@ -641,7 +643,7 @@ int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, u8 *addr)
 	mutex_lock(&wcn->hal_mutex);
 	INIT_HAL_MSG(msg_body, WCN36XX_HAL_ADD_STA_SELF_REQ);
 
-	memcpy(&msg_body.self_addr, addr, ETH_ALEN);
+	memcpy(&msg_body.self_addr, vif->addr, ETH_ALEN);
 
 	PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
 
@@ -654,7 +656,10 @@ int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, u8 *addr)
 		wcn36xx_err("Sending hal_add_sta_self failed\n");
 		goto out;
 	}
-	ret = wcn36xx_smd_add_sta_self_rsp(wcn, wcn->hal_buf, wcn->hal_rsp_len);
+	ret = wcn36xx_smd_add_sta_self_rsp(wcn,
+					   vif,
+					   wcn->hal_buf,
+					   wcn->hal_rsp_len);
 	if (ret) {
 		wcn36xx_err("hal_add_sta_self response failed err=%d\n", ret);
 		goto out;
diff --git a/smd.h b/smd.h
index cd1c971..6e49c8e 100644
--- a/smd.h
+++ b/smd.h
@@ -63,7 +63,7 @@ int wcn36xx_smd_start_scan(struct wcn36xx *wcn);
 int wcn36xx_smd_end_scan(struct wcn36xx *wcn);
 int wcn36xx_smd_finish_scan(struct wcn36xx *wcn);
 int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn);
-int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, u8 *addr);
+int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct ieee80211_vif *vif);
 int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr);
 int wcn36xx_smd_delete_sta(struct wcn36xx *wcn, u8 sta_index);
 int wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch);
-- 
1.8.2.2




More information about the wcn36xx mailing list