aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2011-06-20 18:21:48 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-06-22 16:09:47 -0400
commita5ffddb70c5cab29fa00e2fdf12217b64b940796 (patch)
treeaf65f214cbcc9a15d16b0069b54e2ea846d02c2a /drivers/net/wireless
parent55f7782e14032c70051aa92d882b4effda407ad5 (diff)
mwifiex: remove casts of void pointers
In some cases local pointers are used to cast void pointers passed to the function. Those unnecessary local pointers are also removed. This patch was inspired by Joe Perches' patch [PATCH net-next 1/2] wireless: Remove casts of void *; and the comments from Julian Calaby. Signed-off-by: Amitkumar Karwar <akarwar@marvell.com> Cc: Joe Perches <joe@perches.com> Cc: Julian Calaby <julian.calaby@gmail.com> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/mwifiex/11n.c33
-rw-r--r--drivers/net/wireless/mwifiex/11n.h14
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.c5
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.h5
-rw-r--r--drivers/net/wireless/mwifiex/cmdevt.c28
-rw-r--r--drivers/net/wireless/mwifiex/join.c23
-rw-r--r--drivers/net/wireless/mwifiex/main.c2
-rw-r--r--drivers/net/wireless/mwifiex/main.h16
-rw-r--r--drivers/net/wireless/mwifiex/scan.c6
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmd.c101
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c69
-rw-r--r--drivers/net/wireless/mwifiex/sta_rx.c2
-rw-r--r--drivers/net/wireless/mwifiex/txrx.c2
13 files changed, 129 insertions, 177 deletions
diff --git a/drivers/net/wireless/mwifiex/11n.c b/drivers/net/wireless/mwifiex/11n.c
index 916183d39009..34bba5234294 100644
--- a/drivers/net/wireless/mwifiex/11n.c
+++ b/drivers/net/wireless/mwifiex/11n.c
@@ -185,13 +185,12 @@ int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
185 * 185 *
186 * Handling includes changing the header fields into CPU format. 186 * Handling includes changing the header fields into CPU format.
187 */ 187 */
188int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp, void *data_buf) 188int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp,
189 struct mwifiex_ds_11n_tx_cfg *tx_cfg)
189{ 190{
190 struct mwifiex_ds_11n_tx_cfg *tx_cfg;
191 struct host_cmd_ds_11n_cfg *htcfg = &resp->params.htcfg; 191 struct host_cmd_ds_11n_cfg *htcfg = &resp->params.htcfg;
192 192
193 if (data_buf) { 193 if (tx_cfg) {
194 tx_cfg = (struct mwifiex_ds_11n_tx_cfg *) data_buf;
195 tx_cfg->tx_htcap = le16_to_cpu(htcfg->ht_tx_cap); 194 tx_cfg->tx_htcap = le16_to_cpu(htcfg->ht_tx_cap);
196 tx_cfg->tx_htinfo = le16_to_cpu(htcfg->ht_tx_info); 195 tx_cfg->tx_htinfo = le16_to_cpu(htcfg->ht_tx_info);
197 } 196 }
@@ -208,11 +207,10 @@ int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp, void *data_buf)
208 */ 207 */
209int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv, 208int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv,
210 struct host_cmd_ds_command *cmd, int cmd_action, 209 struct host_cmd_ds_command *cmd, int cmd_action,
211 void *data_buf) 210 u16 *buf_size)
212{ 211{
213 struct host_cmd_ds_txbuf_cfg *tx_buf = &cmd->params.tx_buf; 212 struct host_cmd_ds_txbuf_cfg *tx_buf = &cmd->params.tx_buf;
214 u16 action = (u16) cmd_action; 213 u16 action = (u16) cmd_action;
215 u16 buf_size = *((u16 *) data_buf);
216 214
217 cmd->command = cpu_to_le16(HostCmd_CMD_RECONFIGURE_TX_BUFF); 215 cmd->command = cpu_to_le16(HostCmd_CMD_RECONFIGURE_TX_BUFF);
218 cmd->size = 216 cmd->size =
@@ -220,8 +218,8 @@ int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv,
220 tx_buf->action = cpu_to_le16(action); 218 tx_buf->action = cpu_to_le16(action);
221 switch (action) { 219 switch (action) {
222 case HostCmd_ACT_GEN_SET: 220 case HostCmd_ACT_GEN_SET:
223 dev_dbg(priv->adapter->dev, "cmd: set tx_buf=%d\n", buf_size); 221 dev_dbg(priv->adapter->dev, "cmd: set tx_buf=%d\n", *buf_size);
224 tx_buf->buff_size = cpu_to_le16(buf_size); 222 tx_buf->buff_size = cpu_to_le16(*buf_size);
225 break; 223 break;
226 case HostCmd_ACT_GEN_GET: 224 case HostCmd_ACT_GEN_GET:
227 default: 225 default:
@@ -240,13 +238,12 @@ int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv,
240 * - Ensuring correct endian-ness 238 * - Ensuring correct endian-ness
241 */ 239 */
242int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd, 240int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd,
243 int cmd_action, void *data_buf) 241 int cmd_action,
242 struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl)
244{ 243{
245 struct host_cmd_ds_amsdu_aggr_ctrl *amsdu_ctrl = 244 struct host_cmd_ds_amsdu_aggr_ctrl *amsdu_ctrl =
246 &cmd->params.amsdu_aggr_ctrl; 245 &cmd->params.amsdu_aggr_ctrl;
247 u16 action = (u16) cmd_action; 246 u16 action = (u16) cmd_action;
248 struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl =
249 (struct mwifiex_ds_11n_amsdu_aggr_ctrl *) data_buf;
250 247
251 cmd->command = cpu_to_le16(HostCmd_CMD_AMSDU_AGGR_CTRL); 248 cmd->command = cpu_to_le16(HostCmd_CMD_AMSDU_AGGR_CTRL);
252 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_amsdu_aggr_ctrl) 249 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_amsdu_aggr_ctrl)
@@ -272,15 +269,13 @@ int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd,
272 * Handling includes changing the header fields into CPU format. 269 * Handling includes changing the header fields into CPU format.
273 */ 270 */
274int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp, 271int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp,
275 void *data_buf) 272 struct mwifiex_ds_11n_amsdu_aggr_ctrl
273 *amsdu_aggr_ctrl)
276{ 274{
277 struct mwifiex_ds_11n_amsdu_aggr_ctrl *amsdu_aggr_ctrl;
278 struct host_cmd_ds_amsdu_aggr_ctrl *amsdu_ctrl = 275 struct host_cmd_ds_amsdu_aggr_ctrl *amsdu_ctrl =
279 &resp->params.amsdu_aggr_ctrl; 276 &resp->params.amsdu_aggr_ctrl;
280 277
281 if (data_buf) { 278 if (amsdu_aggr_ctrl) {
282 amsdu_aggr_ctrl =
283 (struct mwifiex_ds_11n_amsdu_aggr_ctrl *) data_buf;
284 amsdu_aggr_ctrl->enable = le16_to_cpu(amsdu_ctrl->enable); 279 amsdu_aggr_ctrl->enable = le16_to_cpu(amsdu_ctrl->enable);
285 amsdu_aggr_ctrl->curr_buf_size = 280 amsdu_aggr_ctrl->curr_buf_size =
286 le16_to_cpu(amsdu_ctrl->curr_buf_size); 281 le16_to_cpu(amsdu_ctrl->curr_buf_size);
@@ -296,12 +291,10 @@ int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp,
296 * - Setting HT Tx capability and HT Tx information fields 291 * - Setting HT Tx capability and HT Tx information fields
297 * - Ensuring correct endian-ness 292 * - Ensuring correct endian-ness
298 */ 293 */
299int mwifiex_cmd_11n_cfg(struct host_cmd_ds_command *cmd, 294int mwifiex_cmd_11n_cfg(struct host_cmd_ds_command *cmd, u16 cmd_action,
300 u16 cmd_action, void *data_buf) 295 struct mwifiex_ds_11n_tx_cfg *txcfg)
301{ 296{
302 struct host_cmd_ds_11n_cfg *htcfg = &cmd->params.htcfg; 297 struct host_cmd_ds_11n_cfg *htcfg = &cmd->params.htcfg;
303 struct mwifiex_ds_11n_tx_cfg *txcfg =
304 (struct mwifiex_ds_11n_tx_cfg *) data_buf;
305 298
306 cmd->command = cpu_to_le16(HostCmd_CMD_11N_CFG); 299 cmd->command = cpu_to_le16(HostCmd_CMD_11N_CFG);
307 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_11n_cfg) + S_DS_GEN); 300 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_11n_cfg) + S_DS_GEN);
diff --git a/drivers/net/wireless/mwifiex/11n.h b/drivers/net/wireless/mwifiex/11n.h
index a4390a1a2a9f..90b421e343d4 100644
--- a/drivers/net/wireless/mwifiex/11n.h
+++ b/drivers/net/wireless/mwifiex/11n.h
@@ -29,9 +29,9 @@ int mwifiex_ret_11n_delba(struct mwifiex_private *priv,
29int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv, 29int mwifiex_ret_11n_addba_req(struct mwifiex_private *priv,
30 struct host_cmd_ds_command *resp); 30 struct host_cmd_ds_command *resp);
31int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp, 31int mwifiex_ret_11n_cfg(struct host_cmd_ds_command *resp,
32 void *data_buf); 32 struct mwifiex_ds_11n_tx_cfg *tx_cfg);
33int mwifiex_cmd_11n_cfg(struct host_cmd_ds_command *cmd, 33int mwifiex_cmd_11n_cfg(struct host_cmd_ds_command *cmd, u16 cmd_action,
34 u16 cmd_action, void *data_buf); 34 struct mwifiex_ds_11n_tx_cfg *txcfg);
35 35
36int mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv, 36int mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv,
37 struct mwifiex_bssdescriptor *bss_desc, 37 struct mwifiex_bssdescriptor *bss_desc,
@@ -62,12 +62,14 @@ int mwifiex_get_rx_reorder_tbl(struct mwifiex_private *priv,
62int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv, 62int mwifiex_get_tx_ba_stream_tbl(struct mwifiex_private *priv,
63 struct mwifiex_ds_tx_ba_stream_tbl *buf); 63 struct mwifiex_ds_tx_ba_stream_tbl *buf);
64int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp, 64int mwifiex_ret_amsdu_aggr_ctrl(struct host_cmd_ds_command *resp,
65 void *data_buf); 65 struct mwifiex_ds_11n_amsdu_aggr_ctrl
66 *amsdu_aggr_ctrl);
66int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv, 67int mwifiex_cmd_recfg_tx_buf(struct mwifiex_private *priv,
67 struct host_cmd_ds_command *cmd, 68 struct host_cmd_ds_command *cmd,
68 int cmd_action, void *data_buf); 69 int cmd_action, u16 *buf_size);
69int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd, 70int mwifiex_cmd_amsdu_aggr_ctrl(struct host_cmd_ds_command *cmd,
70 int cmd_action, void *data_buf); 71 int cmd_action,
72 struct mwifiex_ds_11n_amsdu_aggr_ctrl *aa_ctrl);
71 73
72/* 74/*
73 * This function checks whether AMPDU is allowed or not for a particular TID. 75 * This function checks whether AMPDU is allowed or not for a particular TID.
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c
index e5dfdc39a921..7aa9aa0ac958 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c
@@ -328,13 +328,12 @@ int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd, void *data_buf)
328 */ 328 */
329int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv, 329int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
330 struct host_cmd_ds_command *cmd, 330 struct host_cmd_ds_command *cmd,
331 void *data_buf) 331 struct host_cmd_ds_11n_addba_req
332 *cmd_addba_req)
332{ 333{
333 struct host_cmd_ds_11n_addba_rsp *add_ba_rsp = 334 struct host_cmd_ds_11n_addba_rsp *add_ba_rsp =
334 (struct host_cmd_ds_11n_addba_rsp *) 335 (struct host_cmd_ds_11n_addba_rsp *)
335 &cmd->params.add_ba_rsp; 336 &cmd->params.add_ba_rsp;
336 struct host_cmd_ds_11n_addba_req *cmd_addba_req =
337 (struct host_cmd_ds_11n_addba_req *) data_buf;
338 u8 tid; 337 u8 tid;
339 int win_size; 338 int win_size;
340 uint16_t block_ack_param_set; 339 uint16_t block_ack_param_set;
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.h b/drivers/net/wireless/mwifiex/11n_rxreorder.h
index f3ca8c8c18f9..033c8adbdcd4 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.h
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.h
@@ -52,8 +52,9 @@ int mwifiex_ret_11n_addba_resp(struct mwifiex_private *priv,
52int mwifiex_cmd_11n_delba(struct host_cmd_ds_command *cmd, 52int mwifiex_cmd_11n_delba(struct host_cmd_ds_command *cmd,
53 void *data_buf); 53 void *data_buf);
54int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv, 54int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
55 struct host_cmd_ds_command 55 struct host_cmd_ds_command *cmd,
56 *cmd, void *data_buf); 56 struct host_cmd_ds_11n_addba_req
57 *cmd_addba_req);
57int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd, 58int mwifiex_cmd_11n_addba_req(struct host_cmd_ds_command *cmd,
58 void *data_buf); 59 void *data_buf);
59void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv); 60void mwifiex_11n_cleanup_reorder_tbl(struct mwifiex_private *priv);
diff --git a/drivers/net/wireless/mwifiex/cmdevt.c b/drivers/net/wireless/mwifiex/cmdevt.c
index cd89fed206ae..b5352afb8714 100644
--- a/drivers/net/wireless/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/mwifiex/cmdevt.c
@@ -104,13 +104,11 @@ mwifiex_clean_cmd_node(struct mwifiex_adapter *adapter,
104 * main thread. 104 * main thread.
105 */ 105 */
106static int mwifiex_cmd_host_cmd(struct mwifiex_private *priv, 106static int mwifiex_cmd_host_cmd(struct mwifiex_private *priv,
107 struct host_cmd_ds_command *cmd, void *data_buf) 107 struct host_cmd_ds_command *cmd,
108 struct mwifiex_ds_misc_cmd *pcmd_ptr)
108{ 109{
109 struct mwifiex_ds_misc_cmd *pcmd_ptr =
110 (struct mwifiex_ds_misc_cmd *) data_buf;
111
112 /* Copy the HOST command to command buffer */ 110 /* Copy the HOST command to command buffer */
113 memcpy((void *) cmd, pcmd_ptr->cmd, pcmd_ptr->len); 111 memcpy(cmd, pcmd_ptr->cmd, pcmd_ptr->len);
114 dev_dbg(priv->adapter->dev, "cmd: host cmd size = %d\n", pcmd_ptr->len); 112 dev_dbg(priv->adapter->dev, "cmd: host cmd size = %d\n", pcmd_ptr->len);
115 return 0; 113 return 0;
116} 114}
@@ -707,15 +705,14 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter)
707 705
708 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) { 706 if (adapter->curr_cmd->cmd_flag & CMD_F_HOSTCMD) {
709 /* Copy original response back to response buffer */ 707 /* Copy original response back to response buffer */
710 struct mwifiex_ds_misc_cmd *hostcmd = NULL; 708 struct mwifiex_ds_misc_cmd *hostcmd;
711 uint16_t size = le16_to_cpu(resp->size); 709 uint16_t size = le16_to_cpu(resp->size);
712 dev_dbg(adapter->dev, "info: host cmd resp size = %d\n", size); 710 dev_dbg(adapter->dev, "info: host cmd resp size = %d\n", size);
713 size = min_t(u16, size, MWIFIEX_SIZE_OF_CMD_BUFFER); 711 size = min_t(u16, size, MWIFIEX_SIZE_OF_CMD_BUFFER);
714 if (adapter->curr_cmd->data_buf) { 712 if (adapter->curr_cmd->data_buf) {
715 hostcmd = (struct mwifiex_ds_misc_cmd *) 713 hostcmd = adapter->curr_cmd->data_buf;
716 adapter->curr_cmd->data_buf;
717 hostcmd->len = size; 714 hostcmd->len = size;
718 memcpy(hostcmd->cmd, (void *) resp, size); 715 memcpy(hostcmd->cmd, resp, size);
719 } 716 }
720 } 717 }
721 orig_cmdresp_no = le16_to_cpu(resp->command); 718 orig_cmdresp_no = le16_to_cpu(resp->command);
@@ -1155,7 +1152,7 @@ EXPORT_SYMBOL_GPL(mwifiex_process_sleep_confirm_resp);
1155int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv, 1152int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
1156 struct host_cmd_ds_command *cmd, 1153 struct host_cmd_ds_command *cmd,
1157 u16 cmd_action, uint16_t ps_bitmap, 1154 u16 cmd_action, uint16_t ps_bitmap,
1158 void *data_buf) 1155 struct mwifiex_ds_auto_ds *auto_ds)
1159{ 1156{
1160 struct host_cmd_ds_802_11_ps_mode_enh *psmode_enh = 1157 struct host_cmd_ds_802_11_ps_mode_enh *psmode_enh =
1161 &cmd->params.psmode_enh; 1158 &cmd->params.psmode_enh;
@@ -1218,9 +1215,8 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
1218 sizeof(struct mwifiex_ie_types_header)); 1215 sizeof(struct mwifiex_ie_types_header));
1219 cmd_size += sizeof(*auto_ds_tlv); 1216 cmd_size += sizeof(*auto_ds_tlv);
1220 tlv += sizeof(*auto_ds_tlv); 1217 tlv += sizeof(*auto_ds_tlv);
1221 if (data_buf) 1218 if (auto_ds)
1222 idletime = ((struct mwifiex_ds_auto_ds *) 1219 idletime = auto_ds->idle_time;
1223 data_buf)->idle_time;
1224 dev_dbg(priv->adapter->dev, 1220 dev_dbg(priv->adapter->dev,
1225 "cmd: PS Command: Enter Auto Deep Sleep\n"); 1221 "cmd: PS Command: Enter Auto Deep Sleep\n");
1226 auto_ds_tlv->deep_sleep_timeout = cpu_to_le16(idletime); 1222 auto_ds_tlv->deep_sleep_timeout = cpu_to_le16(idletime);
@@ -1239,7 +1235,7 @@ int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
1239 */ 1235 */
1240int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv, 1236int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
1241 struct host_cmd_ds_command *resp, 1237 struct host_cmd_ds_command *resp,
1242 void *data_buf) 1238 struct mwifiex_ds_pm_cfg *pm_cfg)
1243{ 1239{
1244 struct mwifiex_adapter *adapter = priv->adapter; 1240 struct mwifiex_adapter *adapter = priv->adapter;
1245 struct host_cmd_ds_802_11_ps_mode_enh *ps_mode = 1241 struct host_cmd_ds_802_11_ps_mode_enh *ps_mode =
@@ -1282,10 +1278,8 @@ int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
1282 1278
1283 dev_dbg(adapter->dev, "cmd: ps_bitmap=%#x\n", ps_bitmap); 1279 dev_dbg(adapter->dev, "cmd: ps_bitmap=%#x\n", ps_bitmap);
1284 1280
1285 if (data_buf) { 1281 if (pm_cfg) {
1286 /* This section is for get power save mode */ 1282 /* This section is for get power save mode */
1287 struct mwifiex_ds_pm_cfg *pm_cfg =
1288 (struct mwifiex_ds_pm_cfg *)data_buf;
1289 if (ps_bitmap & BITMAP_STA_PS) 1283 if (ps_bitmap & BITMAP_STA_PS)
1290 pm_cfg->param.ps_mode = 1; 1284 pm_cfg->param.ps_mode = 1;
1291 else 1285 else
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index 5eab3dc29b1c..644e2e405cb5 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -364,10 +364,9 @@ static int mwifiex_append_rsn_ie_wpa_wpa2(struct mwifiex_private *priv,
364 */ 364 */
365int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, 365int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
366 struct host_cmd_ds_command *cmd, 366 struct host_cmd_ds_command *cmd,
367 void *data_buf) 367 struct mwifiex_bssdescriptor *bss_desc)
368{ 368{
369 struct host_cmd_ds_802_11_associate *assoc = &cmd->params.associate; 369 struct host_cmd_ds_802_11_associate *assoc = &cmd->params.associate;
370 struct mwifiex_bssdescriptor *bss_desc;
371 struct mwifiex_ie_types_ssid_param_set *ssid_tlv; 370 struct mwifiex_ie_types_ssid_param_set *ssid_tlv;
372 struct mwifiex_ie_types_phy_param_set *phy_tlv; 371 struct mwifiex_ie_types_phy_param_set *phy_tlv;
373 struct mwifiex_ie_types_ss_param_set *ss_tlv; 372 struct mwifiex_ie_types_ss_param_set *ss_tlv;
@@ -380,7 +379,6 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
380 u8 *pos; 379 u8 *pos;
381 int rsn_ie_len = 0; 380 int rsn_ie_len = 0;
382 381
383 bss_desc = (struct mwifiex_bssdescriptor *) data_buf;
384 pos = (u8 *) assoc; 382 pos = (u8 *) assoc;
385 383
386 mwifiex_cfg_tx_buf(priv, bss_desc); 384 mwifiex_cfg_tx_buf(priv, bss_desc);
@@ -748,7 +746,8 @@ done:
748 */ 746 */
749int 747int
750mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, 748mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
751 struct host_cmd_ds_command *cmd, void *data_buf) 749 struct host_cmd_ds_command *cmd,
750 struct mwifiex_802_11_ssid *req_ssid)
752{ 751{
753 int rsn_ie_len = 0; 752 int rsn_ie_len = 0;
754 struct mwifiex_adapter *adapter = priv->adapter; 753 struct mwifiex_adapter *adapter = priv->adapter;
@@ -786,20 +785,15 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
786 785
787 memset(adhoc_start->ssid, 0, IEEE80211_MAX_SSID_LEN); 786 memset(adhoc_start->ssid, 0, IEEE80211_MAX_SSID_LEN);
788 787
789 memcpy(adhoc_start->ssid, 788 memcpy(adhoc_start->ssid, req_ssid->ssid, req_ssid->ssid_len);
790 ((struct mwifiex_802_11_ssid *) data_buf)->ssid,
791 ((struct mwifiex_802_11_ssid *) data_buf)->ssid_len);
792 789
793 dev_dbg(adapter->dev, "info: ADHOC_S_CMD: SSID = %s\n", 790 dev_dbg(adapter->dev, "info: ADHOC_S_CMD: SSID = %s\n",
794 adhoc_start->ssid); 791 adhoc_start->ssid);
795 792
796 memset(bss_desc->ssid.ssid, 0, IEEE80211_MAX_SSID_LEN); 793 memset(bss_desc->ssid.ssid, 0, IEEE80211_MAX_SSID_LEN);
797 memcpy(bss_desc->ssid.ssid, 794 memcpy(bss_desc->ssid.ssid, req_ssid->ssid, req_ssid->ssid_len);
798 ((struct mwifiex_802_11_ssid *) data_buf)->ssid,
799 ((struct mwifiex_802_11_ssid *) data_buf)->ssid_len);
800 795
801 bss_desc->ssid.ssid_len = 796 bss_desc->ssid.ssid_len = req_ssid->ssid_len;
802 ((struct mwifiex_802_11_ssid *) data_buf)->ssid_len;
803 797
804 /* Set the BSS mode */ 798 /* Set the BSS mode */
805 adhoc_start->bss_mode = HostCmd_BSS_MODE_IBSS; 799 adhoc_start->bss_mode = HostCmd_BSS_MODE_IBSS;
@@ -1036,13 +1030,12 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
1036 */ 1030 */
1037int 1031int
1038mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, 1032mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1039 struct host_cmd_ds_command *cmd, void *data_buf) 1033 struct host_cmd_ds_command *cmd,
1034 struct mwifiex_bssdescriptor *bss_desc)
1040{ 1035{
1041 int rsn_ie_len = 0; 1036 int rsn_ie_len = 0;
1042 struct host_cmd_ds_802_11_ad_hoc_join *adhoc_join = 1037 struct host_cmd_ds_802_11_ad_hoc_join *adhoc_join =
1043 &cmd->params.adhoc_join; 1038 &cmd->params.adhoc_join;
1044 struct mwifiex_bssdescriptor *bss_desc =
1045 (struct mwifiex_bssdescriptor *) data_buf;
1046 struct mwifiex_ie_types_chan_list_param_set *chan_tlv; 1039 struct mwifiex_ie_types_chan_list_param_set *chan_tlv;
1047 u32 cmd_append_size = 0; 1040 u32 cmd_append_size = 0;
1048 u16 tmp_cap; 1041 u16 tmp_cap;
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 054a5c348a24..e5fc53dc6887 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -553,7 +553,7 @@ static int
553mwifiex_set_mac_address(struct net_device *dev, void *addr) 553mwifiex_set_mac_address(struct net_device *dev, void *addr)
554{ 554{
555 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 555 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
556 struct sockaddr *hw_addr = (struct sockaddr *) addr; 556 struct sockaddr *hw_addr = addr;
557 int ret; 557 int ret;
558 558
559 memcpy(priv->curr_addr, hw_addr->sa_data, ETH_ALEN); 559 memcpy(priv->curr_addr, hw_addr->sa_data, ETH_ALEN);
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index db201cc1473b..03691c02a6e8 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -736,10 +736,10 @@ void mwifiex_process_sleep_confirm_resp(struct mwifiex_adapter *, u8 *,
736int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv, 736int mwifiex_cmd_enh_power_mode(struct mwifiex_private *priv,
737 struct host_cmd_ds_command *cmd, 737 struct host_cmd_ds_command *cmd,
738 u16 cmd_action, uint16_t ps_bitmap, 738 u16 cmd_action, uint16_t ps_bitmap,
739 void *data_buf); 739 struct mwifiex_ds_auto_ds *auto_ds);
740int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv, 740int mwifiex_ret_enh_power_mode(struct mwifiex_private *priv,
741 struct host_cmd_ds_command *resp, 741 struct host_cmd_ds_command *resp,
742 void *data_buf); 742 struct mwifiex_ds_pm_cfg *pm_cfg);
743void mwifiex_process_hs_config(struct mwifiex_adapter *adapter); 743void mwifiex_process_hs_config(struct mwifiex_adapter *adapter);
744void mwifiex_hs_activated_event(struct mwifiex_private *priv, 744void mwifiex_hs_activated_event(struct mwifiex_private *priv,
745 u8 activated); 745 u8 activated);
@@ -751,7 +751,7 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *, uint16_t cmd_no,
751 u16 cmd_action, u32 cmd_oid, 751 u16 cmd_action, u32 cmd_oid,
752 void *data_buf, void *cmd_buf); 752 void *data_buf, void *cmd_buf);
753int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no, 753int mwifiex_process_sta_cmdresp(struct mwifiex_private *, u16 cmdresp_no,
754 void *cmd_buf); 754 struct host_cmd_ds_command *resp);
755int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *, 755int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *,
756 struct sk_buff *skb); 756 struct sk_buff *skb);
757int mwifiex_process_sta_event(struct mwifiex_private *); 757int mwifiex_process_sta_event(struct mwifiex_private *);
@@ -760,7 +760,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *, u8 first_sta);
760int mwifiex_scan_networks(struct mwifiex_private *priv, 760int mwifiex_scan_networks(struct mwifiex_private *priv,
761 const struct mwifiex_user_scan_cfg *user_scan_in); 761 const struct mwifiex_user_scan_cfg *user_scan_in);
762int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd, 762int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd,
763 void *data_buf); 763 struct mwifiex_scan_cmd_config *scan_cfg);
764void mwifiex_queue_scan_cmd(struct mwifiex_private *priv, 764void mwifiex_queue_scan_cmd(struct mwifiex_private *priv,
765 struct cmd_ctrl_node *cmd_node); 765 struct cmd_ctrl_node *cmd_node);
766int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, 766int mwifiex_ret_802_11_scan(struct mwifiex_private *priv,
@@ -777,8 +777,8 @@ s32 mwifiex_ssid_cmp(struct mwifiex_802_11_ssid *ssid1,
777int mwifiex_associate(struct mwifiex_private *priv, 777int mwifiex_associate(struct mwifiex_private *priv,
778 struct mwifiex_bssdescriptor *bss_desc); 778 struct mwifiex_bssdescriptor *bss_desc);
779int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv, 779int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
780 struct host_cmd_ds_command 780 struct host_cmd_ds_command *cmd,
781 *cmd, void *data_buf); 781 struct mwifiex_bssdescriptor *bss_desc);
782int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, 782int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
783 struct host_cmd_ds_command *resp); 783 struct host_cmd_ds_command *resp);
784void mwifiex_reset_connect_state(struct mwifiex_private *priv); 784void mwifiex_reset_connect_state(struct mwifiex_private *priv);
@@ -791,10 +791,10 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv,
791 struct mwifiex_bssdescriptor *bss_desc); 791 struct mwifiex_bssdescriptor *bss_desc);
792int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, 792int mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
793 struct host_cmd_ds_command *cmd, 793 struct host_cmd_ds_command *cmd,
794 void *data_buf); 794 struct mwifiex_802_11_ssid *req_ssid);
795int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, 795int mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
796 struct host_cmd_ds_command *cmd, 796 struct host_cmd_ds_command *cmd,
797 void *data_buf); 797 struct mwifiex_bssdescriptor *bss_desc);
798int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv, 798int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
799 struct host_cmd_ds_command *resp); 799 struct host_cmd_ds_command *resp);
800int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd); 800int mwifiex_cmd_802_11_bg_scan_query(struct host_cmd_ds_command *cmd);
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 5c22860fb40a..6f88c8ab5de5 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -2357,12 +2357,10 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
2357 * - Setting command ID, and proper size 2357 * - Setting command ID, and proper size
2358 * - Ensuring correct endian-ness 2358 * - Ensuring correct endian-ness
2359 */ 2359 */
2360int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd, void *data_buf) 2360int mwifiex_cmd_802_11_scan(struct host_cmd_ds_command *cmd,
2361 struct mwifiex_scan_cmd_config *scan_cfg)
2361{ 2362{
2362 struct host_cmd_ds_802_11_scan *scan_cmd = &cmd->params.scan; 2363 struct host_cmd_ds_802_11_scan *scan_cmd = &cmd->params.scan;
2363 struct mwifiex_scan_cmd_config *scan_cfg;
2364
2365 scan_cfg = (struct mwifiex_scan_cmd_config *) data_buf;
2366 2364
2367 /* Set fixed field variables in scan command */ 2365 /* Set fixed field variables in scan command */
2368 scan_cmd->bss_mode = scan_cfg->bss_mode; 2366 scan_cmd->bss_mode = scan_cfg->bss_mode;
diff --git a/drivers/net/wireless/mwifiex/sta_cmd.c b/drivers/net/wireless/mwifiex/sta_cmd.c
index 8af3a78d2723..d85a0a60aa6a 100644
--- a/drivers/net/wireless/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/mwifiex/sta_cmd.c
@@ -67,10 +67,9 @@ mwifiex_cmd_802_11_rssi_info(struct mwifiex_private *priv,
67 */ 67 */
68static int mwifiex_cmd_mac_control(struct mwifiex_private *priv, 68static int mwifiex_cmd_mac_control(struct mwifiex_private *priv,
69 struct host_cmd_ds_command *cmd, 69 struct host_cmd_ds_command *cmd,
70 u16 cmd_action, void *data_buf) 70 u16 cmd_action, u16 *action)
71{ 71{
72 struct host_cmd_ds_mac_control *mac_ctrl = &cmd->params.mac_ctrl; 72 struct host_cmd_ds_mac_control *mac_ctrl = &cmd->params.mac_ctrl;
73 u16 action = *((u16 *) data_buf);
74 73
75 if (cmd_action != HostCmd_ACT_GEN_SET) { 74 if (cmd_action != HostCmd_ACT_GEN_SET) {
76 dev_err(priv->adapter->dev, 75 dev_err(priv->adapter->dev,
@@ -81,7 +80,7 @@ static int mwifiex_cmd_mac_control(struct mwifiex_private *priv,
81 cmd->command = cpu_to_le16(HostCmd_CMD_MAC_CONTROL); 80 cmd->command = cpu_to_le16(HostCmd_CMD_MAC_CONTROL);
82 cmd->size = 81 cmd->size =
83 cpu_to_le16(sizeof(struct host_cmd_ds_mac_control) + S_DS_GEN); 82 cpu_to_le16(sizeof(struct host_cmd_ds_mac_control) + S_DS_GEN);
84 mac_ctrl->action = cpu_to_le16(action); 83 mac_ctrl->action = cpu_to_le16(*action);
85 84
86 return 0; 85 return 0;
87} 86}
@@ -104,10 +103,9 @@ static int mwifiex_cmd_mac_control(struct mwifiex_private *priv,
104static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv, 103static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv,
105 struct host_cmd_ds_command *cmd, 104 struct host_cmd_ds_command *cmd,
106 u16 cmd_action, u32 cmd_oid, 105 u16 cmd_action, u32 cmd_oid,
107 void *data_buf) 106 u32 *ul_temp)
108{ 107{
109 struct host_cmd_ds_802_11_snmp_mib *snmp_mib = &cmd->params.smib; 108 struct host_cmd_ds_802_11_snmp_mib *snmp_mib = &cmd->params.smib;
110 u32 ul_temp;
111 109
112 dev_dbg(priv->adapter->dev, "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); 110 dev_dbg(priv->adapter->dev, "cmd: SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
113 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_SNMP_MIB); 111 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_SNMP_MIB);
@@ -127,9 +125,8 @@ static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv,
127 if (cmd_action == HostCmd_ACT_GEN_SET) { 125 if (cmd_action == HostCmd_ACT_GEN_SET) {
128 snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET); 126 snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET);
129 snmp_mib->buf_size = cpu_to_le16(sizeof(u16)); 127 snmp_mib->buf_size = cpu_to_le16(sizeof(u16));
130 ul_temp = *((u32 *) data_buf);
131 *((__le16 *) (snmp_mib->value)) = 128 *((__le16 *) (snmp_mib->value)) =
132 cpu_to_le16((u16) ul_temp); 129 cpu_to_le16((u16) *ul_temp);
133 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) 130 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size)
134 + sizeof(u16)); 131 + sizeof(u16));
135 } 132 }
@@ -139,9 +136,8 @@ static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv,
139 if (cmd_action == HostCmd_ACT_GEN_SET) { 136 if (cmd_action == HostCmd_ACT_GEN_SET) {
140 snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET); 137 snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET);
141 snmp_mib->buf_size = cpu_to_le16(sizeof(u16)); 138 snmp_mib->buf_size = cpu_to_le16(sizeof(u16));
142 ul_temp = *((u32 *) data_buf);
143 *(__le16 *) (snmp_mib->value) = 139 *(__le16 *) (snmp_mib->value) =
144 cpu_to_le16((u16) ul_temp); 140 cpu_to_le16((u16) *ul_temp);
145 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) 141 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size)
146 + sizeof(u16)); 142 + sizeof(u16));
147 } 143 }
@@ -152,9 +148,8 @@ static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv,
152 if (cmd_action == HostCmd_ACT_GEN_SET) { 148 if (cmd_action == HostCmd_ACT_GEN_SET) {
153 snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET); 149 snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET);
154 snmp_mib->buf_size = cpu_to_le16(sizeof(u16)); 150 snmp_mib->buf_size = cpu_to_le16(sizeof(u16));
155 ul_temp = (*(u32 *) data_buf);
156 *((__le16 *) (snmp_mib->value)) = 151 *((__le16 *) (snmp_mib->value)) =
157 cpu_to_le16((u16) ul_temp); 152 cpu_to_le16((u16) *ul_temp);
158 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) 153 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size)
159 + sizeof(u16)); 154 + sizeof(u16));
160 } 155 }
@@ -164,9 +159,8 @@ static int mwifiex_cmd_802_11_snmp_mib(struct mwifiex_private *priv,
164 if (cmd_action == HostCmd_ACT_GEN_SET) { 159 if (cmd_action == HostCmd_ACT_GEN_SET) {
165 snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET); 160 snmp_mib->query_type = cpu_to_le16(HostCmd_ACT_GEN_SET);
166 snmp_mib->buf_size = cpu_to_le16(sizeof(u16)); 161 snmp_mib->buf_size = cpu_to_le16(sizeof(u16));
167 ul_temp = *(u32 *) data_buf;
168 *((__le16 *) (snmp_mib->value)) = 162 *((__le16 *) (snmp_mib->value)) =
169 cpu_to_le16((u16) ul_temp); 163 cpu_to_le16((u16) *ul_temp);
170 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) 164 cmd->size = cpu_to_le16(le16_to_cpu(cmd->size)
171 + sizeof(u16)); 165 + sizeof(u16));
172 } 166 }
@@ -209,13 +203,11 @@ mwifiex_cmd_802_11_get_log(struct host_cmd_ds_command *cmd)
209 */ 203 */
210static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv, 204static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv,
211 struct host_cmd_ds_command *cmd, 205 struct host_cmd_ds_command *cmd,
212 u16 cmd_action, void *data_buf) 206 u16 cmd_action, u16 *pbitmap_rates)
213{ 207{
214 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &cmd->params.tx_rate_cfg; 208 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &cmd->params.tx_rate_cfg;
215 struct mwifiex_rate_scope *rate_scope; 209 struct mwifiex_rate_scope *rate_scope;
216 struct mwifiex_rate_drop_pattern *rate_drop; 210 struct mwifiex_rate_drop_pattern *rate_drop;
217 u16 *pbitmap_rates = (u16 *) data_buf;
218
219 u32 i; 211 u32 i;
220 212
221 cmd->command = cpu_to_le16(HostCmd_CMD_TX_RATE_CFG); 213 cmd->command = cpu_to_le16(HostCmd_CMD_TX_RATE_CFG);
@@ -272,10 +264,10 @@ static int mwifiex_cmd_tx_rate_cfg(struct mwifiex_private *priv,
272 * - Ensuring correct endian-ness 264 * - Ensuring correct endian-ness
273 */ 265 */
274static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd, 266static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd,
275 u16 cmd_action, void *data_buf) 267 u16 cmd_action,
268 struct host_cmd_ds_txpwr_cfg *txp)
276{ 269{
277 struct mwifiex_types_power_group *pg_tlv; 270 struct mwifiex_types_power_group *pg_tlv;
278 struct host_cmd_ds_txpwr_cfg *txp;
279 struct host_cmd_ds_txpwr_cfg *cmd_txp_cfg = &cmd->params.txp_cfg; 271 struct host_cmd_ds_txpwr_cfg *cmd_txp_cfg = &cmd->params.txp_cfg;
280 272
281 cmd->command = cpu_to_le16(HostCmd_CMD_TXPWR_CFG); 273 cmd->command = cpu_to_le16(HostCmd_CMD_TXPWR_CFG);
@@ -283,12 +275,11 @@ static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd,
283 cpu_to_le16(S_DS_GEN + sizeof(struct host_cmd_ds_txpwr_cfg)); 275 cpu_to_le16(S_DS_GEN + sizeof(struct host_cmd_ds_txpwr_cfg));
284 switch (cmd_action) { 276 switch (cmd_action) {
285 case HostCmd_ACT_GEN_SET: 277 case HostCmd_ACT_GEN_SET:
286 txp = (struct host_cmd_ds_txpwr_cfg *) data_buf;
287 if (txp->mode) { 278 if (txp->mode) {
288 pg_tlv = (struct mwifiex_types_power_group 279 pg_tlv = (struct mwifiex_types_power_group
289 *) ((unsigned long) data_buf + 280 *) ((unsigned long) txp +
290 sizeof(struct host_cmd_ds_txpwr_cfg)); 281 sizeof(struct host_cmd_ds_txpwr_cfg));
291 memmove(cmd_txp_cfg, data_buf, 282 memmove(cmd_txp_cfg, txp,
292 sizeof(struct host_cmd_ds_txpwr_cfg) + 283 sizeof(struct host_cmd_ds_txpwr_cfg) +
293 sizeof(struct mwifiex_types_power_group) + 284 sizeof(struct mwifiex_types_power_group) +
294 pg_tlv->length); 285 pg_tlv->length);
@@ -300,8 +291,7 @@ static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd,
300 sizeof(struct mwifiex_types_power_group) + 291 sizeof(struct mwifiex_types_power_group) +
301 pg_tlv->length); 292 pg_tlv->length);
302 } else { 293 } else {
303 memmove(cmd_txp_cfg, data_buf, 294 memmove(cmd_txp_cfg, txp, sizeof(*txp));
304 sizeof(struct host_cmd_ds_txpwr_cfg));
305 } 295 }
306 cmd_txp_cfg->action = cpu_to_le16(cmd_action); 296 cmd_txp_cfg->action = cpu_to_le16(cmd_action);
307 break; 297 break;
@@ -322,22 +312,23 @@ static int mwifiex_cmd_tx_power_cfg(struct host_cmd_ds_command *cmd,
322 * (as required) 312 * (as required)
323 * - Ensuring correct endian-ness 313 * - Ensuring correct endian-ness
324 */ 314 */
325static int mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private *priv, 315static int
326 struct host_cmd_ds_command *cmd, 316mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private *priv,
327 u16 cmd_action, 317 struct host_cmd_ds_command *cmd,
328 struct mwifiex_hs_config_param *data_buf) 318 u16 cmd_action,
319 struct mwifiex_hs_config_param *hscfg_param)
329{ 320{
330 struct mwifiex_adapter *adapter = priv->adapter; 321 struct mwifiex_adapter *adapter = priv->adapter;
331 struct host_cmd_ds_802_11_hs_cfg_enh *hs_cfg = &cmd->params.opt_hs_cfg; 322 struct host_cmd_ds_802_11_hs_cfg_enh *hs_cfg = &cmd->params.opt_hs_cfg;
332 u16 hs_activate = false; 323 u16 hs_activate = false;
333 324
334 if (data_buf == NULL) 325 if (!hscfg_param)
335 /* New Activate command */ 326 /* New Activate command */
336 hs_activate = true; 327 hs_activate = true;
337 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH); 328 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_HS_CFG_ENH);
338 329
339 if (!hs_activate && 330 if (!hs_activate &&
340 (data_buf->conditions 331 (hscfg_param->conditions
341 != cpu_to_le32(HOST_SLEEP_CFG_CANCEL)) 332 != cpu_to_le32(HOST_SLEEP_CFG_CANCEL))
342 && ((adapter->arp_filter_size > 0) 333 && ((adapter->arp_filter_size > 0)
343 && (adapter->arp_filter_size <= ARP_FILTER_MAX_BUF_SIZE))) { 334 && (adapter->arp_filter_size <= ARP_FILTER_MAX_BUF_SIZE))) {
@@ -359,9 +350,9 @@ static int mwifiex_cmd_802_11_hs_cfg(struct mwifiex_private *priv,
359 hs_cfg->params.hs_activate.resp_ctrl = RESP_NEEDED; 350 hs_cfg->params.hs_activate.resp_ctrl = RESP_NEEDED;
360 } else { 351 } else {
361 hs_cfg->action = cpu_to_le16(HS_CONFIGURE); 352 hs_cfg->action = cpu_to_le16(HS_CONFIGURE);
362 hs_cfg->params.hs_config.conditions = data_buf->conditions; 353 hs_cfg->params.hs_config.conditions = hscfg_param->conditions;
363 hs_cfg->params.hs_config.gpio = data_buf->gpio; 354 hs_cfg->params.hs_config.gpio = hscfg_param->gpio;
364 hs_cfg->params.hs_config.gap = data_buf->gap; 355 hs_cfg->params.hs_config.gap = hscfg_param->gap;
365 dev_dbg(adapter->dev, 356 dev_dbg(adapter->dev,
366 "cmd: HS_CFG_CMD: condition:0x%x gpio:0x%x gap:0x%x\n", 357 "cmd: HS_CFG_CMD: condition:0x%x gpio:0x%x gap:0x%x\n",
367 hs_cfg->params.hs_config.conditions, 358 hs_cfg->params.hs_config.conditions,
@@ -405,11 +396,11 @@ static int mwifiex_cmd_802_11_mac_address(struct mwifiex_private *priv,
405 * - Setting MAC multicast address 396 * - Setting MAC multicast address
406 * - Ensuring correct endian-ness 397 * - Ensuring correct endian-ness
407 */ 398 */
408static int mwifiex_cmd_mac_multicast_adr(struct host_cmd_ds_command *cmd, 399static int
409 u16 cmd_action, void *data_buf) 400mwifiex_cmd_mac_multicast_adr(struct host_cmd_ds_command *cmd,
401 u16 cmd_action,
402 struct mwifiex_multicast_list *mcast_list)
410{ 403{
411 struct mwifiex_multicast_list *mcast_list =
412 (struct mwifiex_multicast_list *) data_buf;
413 struct host_cmd_ds_mac_multicast_adr *mcast_addr = &cmd->params.mc_addr; 404 struct host_cmd_ds_mac_multicast_adr *mcast_addr = &cmd->params.mc_addr;
414 405
415 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_mac_multicast_adr) + 406 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_mac_multicast_adr) +
@@ -435,7 +426,7 @@ static int mwifiex_cmd_mac_multicast_adr(struct host_cmd_ds_command *cmd,
435 */ 426 */
436static int mwifiex_cmd_802_11_deauthenticate(struct mwifiex_private *priv, 427static int mwifiex_cmd_802_11_deauthenticate(struct mwifiex_private *priv,
437 struct host_cmd_ds_command *cmd, 428 struct host_cmd_ds_command *cmd,
438 void *data_buf) 429 u8 *mac)
439{ 430{
440 struct host_cmd_ds_802_11_deauthenticate *deauth = &cmd->params.deauth; 431 struct host_cmd_ds_802_11_deauthenticate *deauth = &cmd->params.deauth;
441 432
@@ -444,7 +435,7 @@ static int mwifiex_cmd_802_11_deauthenticate(struct mwifiex_private *priv,
444 + S_DS_GEN); 435 + S_DS_GEN);
445 436
446 /* Set AP MAC address */ 437 /* Set AP MAC address */
447 memcpy(deauth->mac_addr, (u8 *) data_buf, ETH_ALEN); 438 memcpy(deauth->mac_addr, mac, ETH_ALEN);
448 439
449 dev_dbg(priv->adapter->dev, "cmd: Deauth: %pM\n", deauth->mac_addr); 440 dev_dbg(priv->adapter->dev, "cmd: Deauth: %pM\n", deauth->mac_addr);
450 441
@@ -543,15 +534,14 @@ mwifiex_set_keyparamset_wep(struct mwifiex_private *priv,
543 * encryption (TKIP, AES) (as required) 534 * encryption (TKIP, AES) (as required)
544 * - Ensuring correct endian-ness 535 * - Ensuring correct endian-ness
545 */ 536 */
546static int mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv, 537static int
547 struct host_cmd_ds_command *cmd, 538mwifiex_cmd_802_11_key_material(struct mwifiex_private *priv,
548 u16 cmd_action, 539 struct host_cmd_ds_command *cmd,
549 u32 cmd_oid, void *data_buf) 540 u16 cmd_action, u32 cmd_oid,
541 struct mwifiex_ds_encrypt_key *enc_key)
550{ 542{
551 struct host_cmd_ds_802_11_key_material *key_material = 543 struct host_cmd_ds_802_11_key_material *key_material =
552 &cmd->params.key_material; 544 &cmd->params.key_material;
553 struct mwifiex_ds_encrypt_key *enc_key =
554 (struct mwifiex_ds_encrypt_key *) data_buf;
555 u16 key_param_len = 0; 545 u16 key_param_len = 0;
556 int ret = 0; 546 int ret = 0;
557 const u8 bc_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 547 const u8 bc_mac[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
@@ -741,7 +731,7 @@ static int mwifiex_cmd_802_11d_domain_info(struct mwifiex_private *priv,
741 */ 731 */
742static int mwifiex_cmd_802_11_rf_channel(struct mwifiex_private *priv, 732static int mwifiex_cmd_802_11_rf_channel(struct mwifiex_private *priv,
743 struct host_cmd_ds_command *cmd, 733 struct host_cmd_ds_command *cmd,
744 u16 cmd_action, void *data_buf) 734 u16 cmd_action, u16 *channel)
745{ 735{
746 struct host_cmd_ds_802_11_rf_channel *rf_chan = 736 struct host_cmd_ds_802_11_rf_channel *rf_chan =
747 &cmd->params.rf_channel; 737 &cmd->params.rf_channel;
@@ -759,7 +749,7 @@ static int mwifiex_cmd_802_11_rf_channel(struct mwifiex_private *priv,
759 749
760 rf_type = le16_to_cpu(rf_chan->rf_type); 750 rf_type = le16_to_cpu(rf_chan->rf_type);
761 SET_SECONDARYCHAN(rf_type, priv->adapter->chan_offset); 751 SET_SECONDARYCHAN(rf_type, priv->adapter->chan_offset);
762 rf_chan->current_channel = cpu_to_le16(*((u16 *) data_buf)); 752 rf_chan->current_channel = cpu_to_le16(*channel);
763 } 753 }
764 rf_chan->action = cpu_to_le16(cmd_action); 754 rf_chan->action = cpu_to_le16(cmd_action);
765 return 0; 755 return 0;
@@ -774,11 +764,10 @@ static int mwifiex_cmd_802_11_rf_channel(struct mwifiex_private *priv,
774 * - Ensuring correct endian-ness 764 * - Ensuring correct endian-ness
775 */ 765 */
776static int mwifiex_cmd_ibss_coalescing_status(struct host_cmd_ds_command *cmd, 766static int mwifiex_cmd_ibss_coalescing_status(struct host_cmd_ds_command *cmd,
777 u16 cmd_action, void *data_buf) 767 u16 cmd_action, u16 *enable)
778{ 768{
779 struct host_cmd_ds_802_11_ibss_status *ibss_coal = 769 struct host_cmd_ds_802_11_ibss_status *ibss_coal =
780 &(cmd->params.ibss_coalescing); 770 &(cmd->params.ibss_coalescing);
781 u16 enable = 0;
782 771
783 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_IBSS_COALESCING_STATUS); 772 cmd->command = cpu_to_le16(HostCmd_CMD_802_11_IBSS_COALESCING_STATUS);
784 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_ibss_status) + 773 cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_802_11_ibss_status) +
@@ -788,9 +777,8 @@ static int mwifiex_cmd_ibss_coalescing_status(struct host_cmd_ds_command *cmd,
788 777
789 switch (cmd_action) { 778 switch (cmd_action) {
790 case HostCmd_ACT_GEN_SET: 779 case HostCmd_ACT_GEN_SET:
791 if (data_buf != NULL) 780 if (enable)
792 enable = *(u16 *) data_buf; 781 ibss_coal->enable = cpu_to_le16(*enable);
793 ibss_coal->enable = cpu_to_le16(enable);
794 break; 782 break;
795 783
796 /* In other case.. Nothing to do */ 784 /* In other case.. Nothing to do */
@@ -822,9 +810,8 @@ static int mwifiex_cmd_ibss_coalescing_status(struct host_cmd_ds_command *cmd,
822static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd, 810static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd,
823 u16 cmd_action, void *data_buf) 811 u16 cmd_action, void *data_buf)
824{ 812{
825 struct mwifiex_ds_reg_rw *reg_rw; 813 struct mwifiex_ds_reg_rw *reg_rw = data_buf;
826 814
827 reg_rw = (struct mwifiex_ds_reg_rw *) data_buf;
828 switch (le16_to_cpu(cmd->command)) { 815 switch (le16_to_cpu(cmd->command)) {
829 case HostCmd_CMD_MAC_REG_ACCESS: 816 case HostCmd_CMD_MAC_REG_ACCESS:
830 { 817 {
@@ -893,8 +880,7 @@ static int mwifiex_cmd_reg_access(struct host_cmd_ds_command *cmd,
893 } 880 }
894 case HostCmd_CMD_802_11_EEPROM_ACCESS: 881 case HostCmd_CMD_802_11_EEPROM_ACCESS:
895 { 882 {
896 struct mwifiex_ds_read_eeprom *rd_eeprom = 883 struct mwifiex_ds_read_eeprom *rd_eeprom = data_buf;
897 (struct mwifiex_ds_read_eeprom *) data_buf;
898 struct host_cmd_ds_802_11_eeprom_access *cmd_eeprom = 884 struct host_cmd_ds_802_11_eeprom_access *cmd_eeprom =
899 (struct host_cmd_ds_802_11_eeprom_access *) 885 (struct host_cmd_ds_802_11_eeprom_access *)
900 &cmd->params.eeprom; 886 &cmd->params.eeprom;
@@ -923,8 +909,7 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
923 u16 cmd_action, u32 cmd_oid, 909 u16 cmd_action, u32 cmd_oid,
924 void *data_buf, void *cmd_buf) 910 void *data_buf, void *cmd_buf)
925{ 911{
926 struct host_cmd_ds_command *cmd_ptr = 912 struct host_cmd_ds_command *cmd_ptr = cmd_buf;
927 (struct host_cmd_ds_command *) cmd_buf;
928 int ret = 0; 913 int ret = 0;
929 914
930 /* Prepare command */ 915 /* Prepare command */
@@ -1181,7 +1166,7 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta)
1181 /* Send request to firmware */ 1166 /* Send request to firmware */
1182 ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_AMSDU_AGGR_CTRL, 1167 ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_AMSDU_AGGR_CTRL,
1183 HostCmd_ACT_GEN_SET, 0, 1168 HostCmd_ACT_GEN_SET, 0,
1184 (void *) &amsdu_aggr_ctrl); 1169 &amsdu_aggr_ctrl);
1185 if (ret) 1170 if (ret)
1186 return -1; 1171 return -1;
1187 /* MAC Control must be the last command in init_fw */ 1172 /* MAC Control must be the last command in init_fw */
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index d08f76429a0a..ad64c87b91d6 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -120,11 +120,10 @@ mwifiex_process_cmdresp_error(struct mwifiex_private *priv,
120 */ 120 */
121static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv, 121static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv,
122 struct host_cmd_ds_command *resp, 122 struct host_cmd_ds_command *resp,
123 void *data_buf) 123 struct mwifiex_ds_get_signal *signal)
124{ 124{
125 struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp = 125 struct host_cmd_ds_802_11_rssi_info_rsp *rssi_info_rsp =
126 &resp->params.rssi_info_rsp; 126 &resp->params.rssi_info_rsp;
127 struct mwifiex_ds_get_signal *signal;
128 127
129 priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last); 128 priv->data_rssi_last = le16_to_cpu(rssi_info_rsp->data_rssi_last);
130 priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last); 129 priv->data_nf_last = le16_to_cpu(rssi_info_rsp->data_nf_last);
@@ -139,9 +138,8 @@ static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv,
139 priv->bcn_nf_avg = le16_to_cpu(rssi_info_rsp->bcn_nf_avg); 138 priv->bcn_nf_avg = le16_to_cpu(rssi_info_rsp->bcn_nf_avg);
140 139
141 /* Need to indicate IOCTL complete */ 140 /* Need to indicate IOCTL complete */
142 if (data_buf) { 141 if (signal) {
143 signal = (struct mwifiex_ds_get_signal *) data_buf; 142 memset(signal, 0, sizeof(*signal));
144 memset(signal, 0, sizeof(struct mwifiex_ds_get_signal));
145 143
146 signal->selector = ALL_RSSI_INFO_MASK; 144 signal->selector = ALL_RSSI_INFO_MASK;
147 145
@@ -185,32 +183,30 @@ static int mwifiex_ret_802_11_rssi_info(struct mwifiex_private *priv,
185 */ 183 */
186static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv, 184static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv,
187 struct host_cmd_ds_command *resp, 185 struct host_cmd_ds_command *resp,
188 void *data_buf) 186 u32 *ul_temp)
189{ 187{
190 struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib; 188 struct host_cmd_ds_802_11_snmp_mib *smib = &resp->params.smib;
191 u16 oid = le16_to_cpu(smib->oid); 189 u16 oid = le16_to_cpu(smib->oid);
192 u16 query_type = le16_to_cpu(smib->query_type); 190 u16 query_type = le16_to_cpu(smib->query_type);
193 u32 ul_temp;
194 191
195 dev_dbg(priv->adapter->dev, "info: SNMP_RESP: oid value = %#x," 192 dev_dbg(priv->adapter->dev, "info: SNMP_RESP: oid value = %#x,"
196 " query_type = %#x, buf size = %#x\n", 193 " query_type = %#x, buf size = %#x\n",
197 oid, query_type, le16_to_cpu(smib->buf_size)); 194 oid, query_type, le16_to_cpu(smib->buf_size));
198 if (query_type == HostCmd_ACT_GEN_GET) { 195 if (query_type == HostCmd_ACT_GEN_GET) {
199 ul_temp = le16_to_cpu(*((__le16 *) (smib->value))); 196 if (ul_temp)
200 if (data_buf) 197 *ul_temp = le16_to_cpu(*((__le16 *) (smib->value)));
201 *(u32 *)data_buf = ul_temp;
202 switch (oid) { 198 switch (oid) {
203 case FRAG_THRESH_I: 199 case FRAG_THRESH_I:
204 dev_dbg(priv->adapter->dev, 200 dev_dbg(priv->adapter->dev,
205 "info: SNMP_RESP: FragThsd =%u\n", ul_temp); 201 "info: SNMP_RESP: FragThsd =%u\n", *ul_temp);
206 break; 202 break;
207 case RTS_THRESH_I: 203 case RTS_THRESH_I:
208 dev_dbg(priv->adapter->dev, 204 dev_dbg(priv->adapter->dev,
209 "info: SNMP_RESP: RTSThsd =%u\n", ul_temp); 205 "info: SNMP_RESP: RTSThsd =%u\n", *ul_temp);
210 break; 206 break;
211 case SHORT_RETRY_LIM_I: 207 case SHORT_RETRY_LIM_I:
212 dev_dbg(priv->adapter->dev, 208 dev_dbg(priv->adapter->dev,
213 "info: SNMP_RESP: TxRetryCount=%u\n", ul_temp); 209 "info: SNMP_RESP: TxRetryCount=%u\n", *ul_temp);
214 break; 210 break;
215 default: 211 default:
216 break; 212 break;
@@ -228,14 +224,12 @@ static int mwifiex_ret_802_11_snmp_mib(struct mwifiex_private *priv,
228 */ 224 */
229static int mwifiex_ret_get_log(struct mwifiex_private *priv, 225static int mwifiex_ret_get_log(struct mwifiex_private *priv,
230 struct host_cmd_ds_command *resp, 226 struct host_cmd_ds_command *resp,
231 void *data_buf) 227 struct mwifiex_ds_get_stats *stats)
232{ 228{
233 struct host_cmd_ds_802_11_get_log *get_log = 229 struct host_cmd_ds_802_11_get_log *get_log =
234 (struct host_cmd_ds_802_11_get_log *) &resp->params.get_log; 230 (struct host_cmd_ds_802_11_get_log *) &resp->params.get_log;
235 struct mwifiex_ds_get_stats *stats;
236 231
237 if (data_buf) { 232 if (stats) {
238 stats = (struct mwifiex_ds_get_stats *) data_buf;
239 stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame); 233 stats->mcast_tx_frame = le32_to_cpu(get_log->mcast_tx_frame);
240 stats->failed = le32_to_cpu(get_log->failed); 234 stats->failed = le32_to_cpu(get_log->failed);
241 stats->retry = le32_to_cpu(get_log->retry); 235 stats->retry = le32_to_cpu(get_log->retry);
@@ -278,9 +272,8 @@ static int mwifiex_ret_get_log(struct mwifiex_private *priv,
278 */ 272 */
279static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv, 273static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
280 struct host_cmd_ds_command *resp, 274 struct host_cmd_ds_command *resp,
281 void *data_buf) 275 struct mwifiex_rate_cfg *ds_rate)
282{ 276{
283 struct mwifiex_rate_cfg *ds_rate;
284 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg; 277 struct host_cmd_ds_tx_rate_cfg *rate_cfg = &resp->params.tx_rate_cfg;
285 struct mwifiex_rate_scope *rate_scope; 278 struct mwifiex_rate_scope *rate_scope;
286 struct mwifiex_ie_types_header *head; 279 struct mwifiex_ie_types_header *head;
@@ -329,8 +322,7 @@ static int mwifiex_ret_tx_rate_cfg(struct mwifiex_private *priv,
329 HostCmd_CMD_802_11_TX_RATE_QUERY, 322 HostCmd_CMD_802_11_TX_RATE_QUERY,
330 HostCmd_ACT_GEN_GET, 0, NULL); 323 HostCmd_ACT_GEN_GET, 0, NULL);
331 324
332 if (data_buf) { 325 if (ds_rate) {
333 ds_rate = (struct mwifiex_rate_cfg *) data_buf;
334 if (le16_to_cpu(rate_cfg->action) == HostCmd_ACT_GEN_GET) { 326 if (le16_to_cpu(rate_cfg->action) == HostCmd_ACT_GEN_GET) {
335 if (priv->is_data_rate_auto) { 327 if (priv->is_data_rate_auto) {
336 ds_rate->is_rate_auto = 1; 328 ds_rate->is_rate_auto = 1;
@@ -413,8 +405,7 @@ static int mwifiex_get_power_level(struct mwifiex_private *priv, void *data_buf)
413 * and saving the current Tx power level in driver. 405 * and saving the current Tx power level in driver.
414 */ 406 */
415static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv, 407static int mwifiex_ret_tx_power_cfg(struct mwifiex_private *priv,
416 struct host_cmd_ds_command *resp, 408 struct host_cmd_ds_command *resp)
417 void *data_buf)
418{ 409{
419 struct mwifiex_adapter *adapter = priv->adapter; 410 struct mwifiex_adapter *adapter = priv->adapter;
420 struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg; 411 struct host_cmd_ds_txpwr_cfg *txp_cfg = &resp->params.txp_cfg;
@@ -631,21 +622,21 @@ static int mwifiex_ret_802_11d_domain_info(struct mwifiex_private *priv,
631 */ 622 */
632static int mwifiex_ret_802_11_rf_channel(struct mwifiex_private *priv, 623static int mwifiex_ret_802_11_rf_channel(struct mwifiex_private *priv,
633 struct host_cmd_ds_command *resp, 624 struct host_cmd_ds_command *resp,
634 void *data_buf) 625 u16 *new_channel)
635{ 626{
636 struct host_cmd_ds_802_11_rf_channel *rf_channel = 627 struct host_cmd_ds_802_11_rf_channel *rf_channel =
637 &resp->params.rf_channel; 628 &resp->params.rf_channel;
638 u16 new_channel = le16_to_cpu(rf_channel->current_channel);
639 629
640 if (priv->curr_bss_params.bss_descriptor.channel != new_channel) { 630 if (new_channel)
631 *new_channel = le16_to_cpu(rf_channel->current_channel);
632
633 if (priv->curr_bss_params.bss_descriptor.channel != *new_channel) {
641 dev_dbg(priv->adapter->dev, "cmd: Channel Switch: %d to %d\n", 634 dev_dbg(priv->adapter->dev, "cmd: Channel Switch: %d to %d\n",
642 priv->curr_bss_params.bss_descriptor.channel, 635 priv->curr_bss_params.bss_descriptor.channel,
643 new_channel); 636 *new_channel);
644 /* Update the channel again */ 637 /* Update the channel again */
645 priv->curr_bss_params.bss_descriptor.channel = new_channel; 638 priv->curr_bss_params.bss_descriptor.channel = *new_channel;
646 } 639 }
647 if (data_buf)
648 *((u16 *)data_buf) = new_channel;
649 640
650 return 0; 641 return 0;
651} 642}
@@ -658,13 +649,11 @@ static int mwifiex_ret_802_11_rf_channel(struct mwifiex_private *priv,
658 */ 649 */
659static int mwifiex_ret_ver_ext(struct mwifiex_private *priv, 650static int mwifiex_ret_ver_ext(struct mwifiex_private *priv,
660 struct host_cmd_ds_command *resp, 651 struct host_cmd_ds_command *resp,
661 void *data_buf) 652 struct host_cmd_ds_version_ext *version_ext)
662{ 653{
663 struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext; 654 struct host_cmd_ds_version_ext *ver_ext = &resp->params.verext;
664 struct host_cmd_ds_version_ext *version_ext;
665 655
666 if (data_buf) { 656 if (version_ext) {
667 version_ext = (struct host_cmd_ds_version_ext *)data_buf;
668 version_ext->version_str_sel = ver_ext->version_str_sel; 657 version_ext->version_str_sel = ver_ext->version_str_sel;
669 memcpy(version_ext->version_str, ver_ext->version_str, 658 memcpy(version_ext->version_str, ver_ext->version_str,
670 sizeof(char) * 128); 659 sizeof(char) * 128);
@@ -686,8 +675,8 @@ static int mwifiex_ret_reg_access(u16 type, struct host_cmd_ds_command *resp,
686 struct mwifiex_ds_read_eeprom *eeprom; 675 struct mwifiex_ds_read_eeprom *eeprom;
687 676
688 if (data_buf) { 677 if (data_buf) {
689 reg_rw = (struct mwifiex_ds_reg_rw *) data_buf; 678 reg_rw = data_buf;
690 eeprom = (struct mwifiex_ds_read_eeprom *) data_buf; 679 eeprom = data_buf;
691 switch (type) { 680 switch (type) {
692 case HostCmd_CMD_MAC_REG_ACCESS: 681 case HostCmd_CMD_MAC_REG_ACCESS:
693 { 682 {
@@ -825,13 +814,11 @@ static int mwifiex_ret_ibss_coalescing_status(struct mwifiex_private *priv,
825 * This is a generic function, which calls command specific 814 * This is a generic function, which calls command specific
826 * response handlers based on the command ID. 815 * response handlers based on the command ID.
827 */ 816 */
828int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, 817int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv, u16 cmdresp_no,
829 u16 cmdresp_no, void *cmd_buf) 818 struct host_cmd_ds_command *resp)
830{ 819{
831 int ret = 0; 820 int ret = 0;
832 struct mwifiex_adapter *adapter = priv->adapter; 821 struct mwifiex_adapter *adapter = priv->adapter;
833 struct host_cmd_ds_command *resp =
834 (struct host_cmd_ds_command *) cmd_buf;
835 void *data_buf = adapter->curr_cmd->data_buf; 822 void *data_buf = adapter->curr_cmd->data_buf;
836 823
837 /* If the command is not successful, cleanup and return failure */ 824 /* If the command is not successful, cleanup and return failure */
@@ -865,7 +852,7 @@ int mwifiex_process_sta_cmdresp(struct mwifiex_private *priv,
865 "info: CMD_RESP: BG_SCAN result is ready!\n"); 852 "info: CMD_RESP: BG_SCAN result is ready!\n");
866 break; 853 break;
867 case HostCmd_CMD_TXPWR_CFG: 854 case HostCmd_CMD_TXPWR_CFG:
868 ret = mwifiex_ret_tx_power_cfg(priv, resp, data_buf); 855 ret = mwifiex_ret_tx_power_cfg(priv, resp);
869 break; 856 break;
870 case HostCmd_CMD_802_11_PS_MODE_ENH: 857 case HostCmd_CMD_802_11_PS_MODE_ENH:
871 ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf); 858 ret = mwifiex_ret_enh_power_mode(priv, resp, data_buf);
diff --git a/drivers/net/wireless/mwifiex/sta_rx.c b/drivers/net/wireless/mwifiex/sta_rx.c
index 1fdddece7479..27430512f7cd 100644
--- a/drivers/net/wireless/mwifiex/sta_rx.c
+++ b/drivers/net/wireless/mwifiex/sta_rx.c
@@ -187,7 +187,7 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
187 ret = mwifiex_11n_rx_reorder_pkt(priv, local_rx_pd->seq_num, 187 ret = mwifiex_11n_rx_reorder_pkt(priv, local_rx_pd->seq_num,
188 local_rx_pd->priority, ta, 188 local_rx_pd->priority, ta,
189 (u8) local_rx_pd->rx_pkt_type, 189 (u8) local_rx_pd->rx_pkt_type,
190 (void *) skb); 190 skb);
191 191
192 if (ret || (rx_pkt_type == PKT_TYPE_BAR)) { 192 if (ret || (rx_pkt_type == PKT_TYPE_BAR)) {
193 if (priv && (ret == -1)) 193 if (priv && (ret == -1))
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c
index aaa50c074196..6190b2fa57a3 100644
--- a/drivers/net/wireless/mwifiex/txrx.c
+++ b/drivers/net/wireless/mwifiex/txrx.c
@@ -71,7 +71,7 @@ int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,
71 u8 *head_ptr; 71 u8 *head_ptr;
72 struct txpd *local_tx_pd = NULL; 72 struct txpd *local_tx_pd = NULL;
73 73
74 head_ptr = (u8 *) mwifiex_process_sta_txpd(priv, skb); 74 head_ptr = mwifiex_process_sta_txpd(priv, skb);
75 if (head_ptr) { 75 if (head_ptr) {
76 if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) 76 if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA)
77 local_tx_pd = 77 local_tx_pd =