[PATCH 03/10] smd: cleanup wcn36xx_smd_config_sta()

Kalle Valo kvalo at qca.qualcomm.com
Mon May 27 07:52:49 EDT 2013


Just to make it easier to read and modify. Follow the order from struct
wcn36xx_hal_config_sta_params and set unset fields to zero. No functional
changes.

Signed-off-by: Kalle Valo <kvalo at qca.qualcomm.com>
---
 smd.c |   66 +++++++++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 44 insertions(+), 22 deletions(-)

diff --git a/smd.c b/smd.c
index f8e6458..872e9ed 100644
--- a/smd.c
+++ b/smd.c
@@ -443,40 +443,62 @@ static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
 
 int wcn36xx_smd_config_sta(struct wcn36xx *wcn, u8 *bssid, u8 *sta_mac)
 {
-	struct wcn36xx_hal_config_sta_req_msg msg_body;
+	struct wcn36xx_hal_config_sta_req_msg msg;
+	struct wcn36xx_hal_config_sta_params *sta;
 
-	INIT_HAL_MSG(msg_body, WCN36XX_HAL_CONFIG_STA_REQ);
+	INIT_HAL_MSG(msg, WCN36XX_HAL_CONFIG_STA_REQ);
+
+	sta = &msg.sta_params;
 
-	memcpy(&msg_body.sta_params.bssid, bssid, ETH_ALEN);
-	memcpy(&msg_body.sta_params.mac, sta_mac, ETH_ALEN);
-	msg_body.sta_params.aid = wcn->aid;
-	msg_body.sta_params.type = 0;
-	msg_body.sta_params.listen_interval = 0x8;
-	msg_body.sta_params.ht_capable = 1;
+	memcpy(&sta->bssid, bssid, ETH_ALEN);
+
+	sta->aid = wcn->aid;
+	sta->type = 0;
+	sta->short_preamble_supported = 0;
 
-	msg_body.sta_params.max_ampdu_size = 3;
-	msg_body.sta_params.max_ampdu_density = 5;
-	msg_body.sta_params.sgi_40mhz = 1;
-	msg_body.sta_params.sgi_20Mhz = 1;
+	memcpy(&sta->mac, sta_mac, ETH_ALEN);
+
+	sta->listen_interval = 0x8;
+	sta->wmm_enabled = 0;
+	sta->ht_capable = 1;
+	sta->tx_channel_width_set = 0;
+	sta->rifs_mode = 0;
+	sta->lsig_txop_protection = 0;
+	sta->max_ampdu_size = 3;
+	sta->max_ampdu_density = 5;
+	sta->sgi_40mhz = 1;
+	sta->sgi_20Mhz = 1;
 
-	memcpy(&msg_body.sta_params.supported_rates, &wcn->supported_rates,
+	memcpy(&sta->supported_rates, &wcn->supported_rates,
 		sizeof(wcn->supported_rates));
-	msg_body.sta_params.sta_index = 1;
 
-	if (!(wcn->fw_major == 1 &&
-		wcn->fw_minor == 2 &&
-		wcn->fw_version == 2 &&
-		wcn->fw_revision == 24))
+	sta->rmf = 0;
+	sta->encrypt_type = 0;
+	sta->action = 0;
+	sta->uapsd = 0;
+	sta->max_sp_len = 0;
+	sta->green_field_capable = 0;
+	sta->mimo_ps = WCN36XX_HAL_HT_MIMO_PS_STATIC;
+	sta->delayed_ba_support = 0;
+	sta->max_ampdu_duration = 0;
+	sta->dsss_cck_mode_40mhz = 0;
+	sta->sta_index = 1;
+	sta->bssid_index = 0;
+	sta->p2p = 0;
 
-		return wcn36xx_smd_config_sta_v1(wcn, &msg_body);
+	if (!(wcn->fw_major == 1 &&
+	      wcn->fw_minor == 2 &&
+	      wcn->fw_version == 2 &&
+	      wcn->fw_revision == 24))
+		return wcn36xx_smd_config_sta_v1(wcn, &msg);
 
-	PREPARE_HAL_BUF(wcn->smd_buf, msg_body);
+	PREPARE_HAL_BUF(wcn->smd_buf, msg);
 
 	wcn36xx_dbg(WCN36XX_DBG_HAL,
 		    "hal config sta bssid %pM mac %pM",
-		    msg_body.sta_params.bssid, msg_body.sta_params.mac);
+		    sta->bssid, sta->mac);
 
-	return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+	return wcn36xx_smd_send_and_wait(wcn, msg.header.len);
 }
 
 static int wcn36xx_smd_config_sta_rsp(struct wcn36xx *wcn, void *buf, size_t len)




More information about the wcn36xx mailing list