aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/mwifiex/11n_rxreorder.c24
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c131
-rw-r--r--drivers/net/wireless/mwifiex/cfp.c8
-rw-r--r--drivers/net/wireless/mwifiex/init.c5
-rw-r--r--drivers/net/wireless/mwifiex/join.c50
-rw-r--r--drivers/net/wireless/mwifiex/main.c19
-rw-r--r--drivers/net/wireless/mwifiex/scan.c23
-rw-r--r--drivers/net/wireless/mwifiex/sdio.c16
-rw-r--r--drivers/net/wireless/mwifiex/sta_ioctl.c85
-rw-r--r--drivers/net/wireless/mwifiex/sta_tx.c6
-rw-r--r--drivers/net/wireless/mwifiex/txrx.c4
-rw-r--r--drivers/net/wireless/mwifiex/util.c6
-rw-r--r--drivers/net/wireless/mwifiex/wmm.c5
13 files changed, 105 insertions, 277 deletions
diff --git a/drivers/net/wireless/mwifiex/11n_rxreorder.c b/drivers/net/wireless/mwifiex/11n_rxreorder.c
index 755e5d533c03..a93c03fdea82 100644
--- a/drivers/net/wireless/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/mwifiex/11n_rxreorder.c
@@ -27,19 +27,6 @@
27#include "11n_rxreorder.h" 27#include "11n_rxreorder.h"
28 28
29/* 29/*
30 * This function processes a received packet and forwards
31 * it to the kernel/upper layer.
32 */
33static int mwifiex_11n_dispatch_pkt(struct mwifiex_private *priv, void *payload)
34{
35 int ret = 0;
36 struct mwifiex_adapter *adapter = priv->adapter;
37
38 ret = mwifiex_process_rx_packet(adapter, (struct sk_buff *) payload);
39 return ret;
40}
41
42/*
43 * This function dispatches all packets in the Rx reorder table. 30 * This function dispatches all packets in the Rx reorder table.
44 * 31 *
45 * There could be holes in the buffer, which are skipped by the function. 32 * There could be holes in the buffer, which are skipped by the function.
@@ -51,7 +38,7 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
51 struct mwifiex_rx_reorder_tbl 38 struct mwifiex_rx_reorder_tbl
52 *rx_reor_tbl_ptr, int start_win) 39 *rx_reor_tbl_ptr, int start_win)
53{ 40{
54 int no_pkt_to_send, i, xchg; 41 int no_pkt_to_send, i;
55 void *rx_tmp_ptr = NULL; 42 void *rx_tmp_ptr = NULL;
56 unsigned long flags; 43 unsigned long flags;
57 44
@@ -68,7 +55,7 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
68 } 55 }
69 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); 56 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
70 if (rx_tmp_ptr) 57 if (rx_tmp_ptr)
71 mwifiex_11n_dispatch_pkt(priv, rx_tmp_ptr); 58 mwifiex_process_rx_packet(priv->adapter, rx_tmp_ptr);
72 } 59 }
73 60
74 spin_lock_irqsave(&priv->rx_pkt_lock, flags); 61 spin_lock_irqsave(&priv->rx_pkt_lock, flags);
@@ -76,8 +63,7 @@ mwifiex_11n_dispatch_pkt_until_start_win(struct mwifiex_private *priv,
76 * We don't have a circular buffer, hence use rotation to simulate 63 * We don't have a circular buffer, hence use rotation to simulate
77 * circular buffer 64 * circular buffer
78 */ 65 */
79 xchg = rx_reor_tbl_ptr->win_size - no_pkt_to_send; 66 for (i = 0; i < rx_reor_tbl_ptr->win_size - no_pkt_to_send; ++i) {
80 for (i = 0; i < xchg; ++i) {
81 rx_reor_tbl_ptr->rx_reorder_ptr[i] = 67 rx_reor_tbl_ptr->rx_reorder_ptr[i] =
82 rx_reor_tbl_ptr->rx_reorder_ptr[no_pkt_to_send + i]; 68 rx_reor_tbl_ptr->rx_reorder_ptr[no_pkt_to_send + i];
83 rx_reor_tbl_ptr->rx_reorder_ptr[no_pkt_to_send + i] = NULL; 69 rx_reor_tbl_ptr->rx_reorder_ptr[no_pkt_to_send + i] = NULL;
@@ -114,7 +100,7 @@ mwifiex_11n_scan_and_dispatch(struct mwifiex_private *priv,
114 rx_tmp_ptr = rx_reor_tbl_ptr->rx_reorder_ptr[i]; 100 rx_tmp_ptr = rx_reor_tbl_ptr->rx_reorder_ptr[i];
115 rx_reor_tbl_ptr->rx_reorder_ptr[i] = NULL; 101 rx_reor_tbl_ptr->rx_reorder_ptr[i] = NULL;
116 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags); 102 spin_unlock_irqrestore(&priv->rx_pkt_lock, flags);
117 mwifiex_11n_dispatch_pkt(priv, rx_tmp_ptr); 103 mwifiex_process_rx_packet(priv->adapter, rx_tmp_ptr);
118 } 104 }
119 105
120 spin_lock_irqsave(&priv->rx_pkt_lock, flags); 106 spin_lock_irqsave(&priv->rx_pkt_lock, flags);
@@ -429,7 +415,7 @@ int mwifiex_11n_rx_reorder_pkt(struct mwifiex_private *priv,
429 tid, ta); 415 tid, ta);
430 if (!rx_reor_tbl_ptr) { 416 if (!rx_reor_tbl_ptr) {
431 if (pkt_type != PKT_TYPE_BAR) 417 if (pkt_type != PKT_TYPE_BAR)
432 mwifiex_11n_dispatch_pkt(priv, payload); 418 mwifiex_process_rx_packet(priv->adapter, payload);
433 return 0; 419 return 0;
434 } 420 }
435 start_win = rx_reor_tbl_ptr->start_win; 421 start_win = rx_reor_tbl_ptr->start_win;
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 74b6cf20da04..b99ae2677d78 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -34,22 +34,17 @@ static int
34mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type 34mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type
35 channel_type) 35 channel_type)
36{ 36{
37 int channel;
38 switch (channel_type) { 37 switch (channel_type) {
39 case NL80211_CHAN_NO_HT: 38 case NL80211_CHAN_NO_HT:
40 case NL80211_CHAN_HT20: 39 case NL80211_CHAN_HT20:
41 channel = NO_SEC_CHANNEL; 40 return NO_SEC_CHANNEL;
42 break;
43 case NL80211_CHAN_HT40PLUS: 41 case NL80211_CHAN_HT40PLUS:
44 channel = SEC_CHANNEL_ABOVE; 42 return SEC_CHANNEL_ABOVE;
45 break;
46 case NL80211_CHAN_HT40MINUS: 43 case NL80211_CHAN_HT40MINUS:
47 channel = SEC_CHANNEL_BELOW; 44 return SEC_CHANNEL_BELOW;
48 break;
49 default: 45 default:
50 channel = NO_SEC_CHANNEL; 46 return NO_SEC_CHANNEL;
51 } 47 }
52 return channel;
53} 48}
54 49
55/* 50/*
@@ -64,21 +59,16 @@ mwifiex_cfg80211_channel_type_to_mwifiex_channels(enum nl80211_channel_type
64static enum nl80211_channel_type 59static enum nl80211_channel_type
65mwifiex_channels_to_cfg80211_channel_type(int channel_type) 60mwifiex_channels_to_cfg80211_channel_type(int channel_type)
66{ 61{
67 int channel;
68 switch (channel_type) { 62 switch (channel_type) {
69 case NO_SEC_CHANNEL: 63 case NO_SEC_CHANNEL:
70 channel = NL80211_CHAN_HT20; 64 return NL80211_CHAN_HT20;
71 break;
72 case SEC_CHANNEL_ABOVE: 65 case SEC_CHANNEL_ABOVE:
73 channel = NL80211_CHAN_HT40PLUS; 66 return NL80211_CHAN_HT40PLUS;
74 break;
75 case SEC_CHANNEL_BELOW: 67 case SEC_CHANNEL_BELOW:
76 channel = NL80211_CHAN_HT40MINUS; 68 return NL80211_CHAN_HT40MINUS;
77 break;
78 default: 69 default:
79 channel = NL80211_CHAN_HT20; 70 return NL80211_CHAN_HT20;
80 } 71 }
81 return channel;
82} 72}
83 73
84/* 74/*
@@ -117,10 +107,8 @@ mwifiex_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev,
117 u8 key_index, bool pairwise, const u8 *mac_addr) 107 u8 key_index, bool pairwise, const u8 *mac_addr)
118{ 108{
119 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 109 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
120 int ret = 0;
121 110
122 ret = mwifiex_set_encode(priv, NULL, 0, key_index, 1); 111 if (mwifiex_set_encode(priv, NULL, 0, key_index, 1)) {
123 if (ret) {
124 wiphy_err(wiphy, "deleting the crypto keys\n"); 112 wiphy_err(wiphy, "deleting the crypto keys\n");
125 return -EFAULT; 113 return -EFAULT;
126 } 114 }
@@ -137,7 +125,6 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy,
137 enum nl80211_tx_power_setting type, 125 enum nl80211_tx_power_setting type,
138 int dbm) 126 int dbm)
139{ 127{
140 int ret = 0;
141 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 128 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
142 struct mwifiex_power_cfg power_cfg; 129 struct mwifiex_power_cfg power_cfg;
143 130
@@ -148,9 +135,7 @@ mwifiex_cfg80211_set_tx_power(struct wiphy *wiphy,
148 power_cfg.is_power_auto = 1; 135 power_cfg.is_power_auto = 1;
149 } 136 }
150 137
151 ret = mwifiex_set_tx_power(priv, &power_cfg); 138 return mwifiex_set_tx_power(priv, &power_cfg);
152
153 return ret;
154} 139}
155 140
156/* 141/*
@@ -163,7 +148,6 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
163 struct net_device *dev, 148 struct net_device *dev,
164 bool enabled, int timeout) 149 bool enabled, int timeout)
165{ 150{
166 int ret = 0;
167 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 151 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
168 u32 ps_mode; 152 u32 ps_mode;
169 153
@@ -173,9 +157,8 @@ mwifiex_cfg80211_set_power_mgmt(struct wiphy *wiphy,
173 " for IEEE power save\n"); 157 " for IEEE power save\n");
174 158
175 ps_mode = enabled; 159 ps_mode = enabled;
176 ret = mwifiex_drv_set_power(priv, &ps_mode);
177 160
178 return ret; 161 return mwifiex_drv_set_power(priv, &ps_mode);
179} 162}
180 163
181/* 164/*
@@ -187,18 +170,15 @@ mwifiex_cfg80211_set_default_key(struct wiphy *wiphy, struct net_device *netdev,
187 bool multicast) 170 bool multicast)
188{ 171{
189 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 172 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
190 int ret;
191 173
192 /* Return if WEP key not configured */ 174 /* Return if WEP key not configured */
193 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED) 175 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_DISABLED)
194 return 0; 176 return 0;
195 177
196 ret = mwifiex_set_encode(priv, NULL, 0, key_index, 0); 178 if (mwifiex_set_encode(priv, NULL, 0, key_index, 0)) {
197 179 wiphy_err(wiphy, "set default Tx key index\n");
198 wiphy_dbg(wiphy, "info: set default Tx key index\n");
199
200 if (ret)
201 return -EFAULT; 180 return -EFAULT;
181 }
202 182
203 return 0; 183 return 0;
204} 184}
@@ -212,15 +192,12 @@ mwifiex_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
212 struct key_params *params) 192 struct key_params *params)
213{ 193{
214 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 194 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
215 int ret = 0;
216 195
217 ret = mwifiex_set_encode(priv, params->key, params->key_len, 196 if (mwifiex_set_encode(priv, params->key, params->key_len,
218 key_index, 0); 197 key_index, 0)) {
219 198 wiphy_err(wiphy, "crypto keys added\n");
220 wiphy_dbg(wiphy, "info: crypto keys added\n");
221
222 if (ret)
223 return -EFAULT; 199 return -EFAULT;
200 }
224 201
225 return 0; 202 return 0;
226} 203}
@@ -245,7 +222,6 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
245 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy); 222 struct mwifiex_private *priv = mwifiex_cfg80211_get_priv(wiphy);
246 struct mwifiex_adapter *adapter = priv->adapter; 223 struct mwifiex_adapter *adapter = priv->adapter;
247 struct mwifiex_802_11d_domain_reg *domain_info = &adapter->domain_reg; 224 struct mwifiex_802_11d_domain_reg *domain_info = &adapter->domain_reg;
248 int ret = 0;
249 225
250 /* Set country code */ 226 /* Set country code */
251 domain_info->country_code[0] = priv->country_code[0]; 227 domain_info->country_code[0] = priv->country_code[0];
@@ -300,13 +276,14 @@ static int mwifiex_send_domain_info_cmd_fw(struct wiphy *wiphy)
300 } 276 }
301 277
302 domain_info->no_of_triplet = no_of_triplet; 278 domain_info->no_of_triplet = no_of_triplet;
303 /* Send cmd to FW to set domain info */ 279
304 ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO, 280 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_802_11D_DOMAIN_INFO,
305 HostCmd_ACT_GEN_SET, 0, NULL); 281 HostCmd_ACT_GEN_SET, 0, NULL)) {
306 if (ret)
307 wiphy_err(wiphy, "11D: setting domain info in FW\n"); 282 wiphy_err(wiphy, "11D: setting domain info in FW\n");
283 return -1;
284 }
308 285
309 return ret; 286 return 0;
310} 287}
311 288
312/* 289/*
@@ -356,7 +333,6 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
356 enum nl80211_channel_type channel_type) 333 enum nl80211_channel_type channel_type)
357{ 334{
358 struct mwifiex_chan_freq_power cfp; 335 struct mwifiex_chan_freq_power cfp;
359 int ret = 0;
360 struct mwifiex_ds_band_cfg band_cfg; 336 struct mwifiex_ds_band_cfg band_cfg;
361 u32 config_bands = 0; 337 u32 config_bands = 0;
362 struct wiphy *wiphy = priv->wdev->wiphy; 338 struct wiphy *wiphy = priv->wdev->wiphy;
@@ -375,14 +351,14 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
375 band_cfg.config_bands = config_bands; 351 band_cfg.config_bands = config_bands;
376 band_cfg.adhoc_start_band = config_bands; 352 band_cfg.adhoc_start_band = config_bands;
377 } 353 }
378 /* Set channel offset */ 354
379 band_cfg.sec_chan_offset = 355 band_cfg.sec_chan_offset =
380 mwifiex_cfg80211_channel_type_to_mwifiex_channels 356 mwifiex_cfg80211_channel_type_to_mwifiex_channels
381 (channel_type); 357 (channel_type);
382 ret = mwifiex_set_radio_band_cfg(priv, &band_cfg);
383 358
384 if (ret) 359 if (mwifiex_set_radio_band_cfg(priv, &band_cfg))
385 return -EFAULT; 360 return -EFAULT;
361
386 mwifiex_send_domain_info_cmd_fw(wiphy); 362 mwifiex_send_domain_info_cmd_fw(wiphy);
387 } 363 }
388 364
@@ -390,20 +366,16 @@ mwifiex_set_rf_channel(struct mwifiex_private *priv,
390 "mode %d\n", config_bands, band_cfg.sec_chan_offset, 366 "mode %d\n", config_bands, band_cfg.sec_chan_offset,
391 priv->bss_mode); 367 priv->bss_mode);
392 if (!chan) 368 if (!chan)
393 return ret; 369 return 0;
394 370
395 memset(&cfp, 0, sizeof(cfp)); 371 memset(&cfp, 0, sizeof(cfp));
396 cfp.freq = chan->center_freq; 372 cfp.freq = chan->center_freq;
397 /* Convert frequency to channel */
398 cfp.channel = ieee80211_frequency_to_channel(chan->center_freq); 373 cfp.channel = ieee80211_frequency_to_channel(chan->center_freq);
399 374
400 ret = mwifiex_bss_set_channel(priv, &cfp); 375 if (mwifiex_bss_set_channel(priv, &cfp))
401 if (ret)
402 return -EFAULT; 376 return -EFAULT;
403 377
404 ret = mwifiex_drv_change_adhoc_chan(priv, cfp.channel); 378 return mwifiex_drv_change_adhoc_chan(priv, cfp.channel);
405
406 return ret;
407} 379}
408 380
409/* 381/*
@@ -459,17 +431,12 @@ mwifiex_set_frag(struct mwifiex_private *priv, u32 frag_thr)
459static int 431static int
460mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr) 432mwifiex_set_rts(struct mwifiex_private *priv, u32 rts_thr)
461{ 433{
462 int ret = 0;
463
464 if (rts_thr < MWIFIEX_RTS_MIN_VALUE || rts_thr > MWIFIEX_RTS_MAX_VALUE) 434 if (rts_thr < MWIFIEX_RTS_MIN_VALUE || rts_thr > MWIFIEX_RTS_MAX_VALUE)
465 rts_thr = MWIFIEX_RTS_MAX_VALUE; 435 rts_thr = MWIFIEX_RTS_MAX_VALUE;
466 436
467 /* Send request to firmware */ 437 return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
468 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_SNMP_MIB,
469 HostCmd_ACT_GEN_SET, RTS_THRESH_I, 438 HostCmd_ACT_GEN_SET, RTS_THRESH_I,
470 &rts_thr); 439 &rts_thr);
471
472 return ret;
473} 440}
474 441
475/* 442/*
@@ -485,8 +452,11 @@ mwifiex_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
485 452
486 int ret = 0; 453 int ret = 0;
487 454
488 if (changed & WIPHY_PARAM_RTS_THRESHOLD) 455 if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
489 ret = mwifiex_set_rts(priv, wiphy->rts_threshold); 456 ret = mwifiex_set_rts(priv, wiphy->rts_threshold);
457 if (ret)
458 return ret;
459 }
490 460
491 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) 461 if (changed & WIPHY_PARAM_FRAG_THRESHOLD)
492 ret = mwifiex_set_frag(priv, wiphy->frag_threshold); 462 ret = mwifiex_set_frag(priv, wiphy->frag_threshold);
@@ -598,7 +568,6 @@ mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
598 u8 *mac, struct station_info *sinfo) 568 u8 *mac, struct station_info *sinfo)
599{ 569{
600 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 570 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
601 int ret = 0;
602 571
603 mwifiex_dump_station_info(priv, sinfo); 572 mwifiex_dump_station_info(priv, sinfo);
604 573
@@ -607,10 +576,7 @@ mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
607 if (memcmp(mac, priv->cfg_bssid, ETH_ALEN)) 576 if (memcmp(mac, priv->cfg_bssid, ETH_ALEN))
608 return -ENOENT; 577 return -ENOENT;
609 578
610 579 return mwifiex_dump_station_info(priv, sinfo);
611 ret = mwifiex_dump_station_info(priv, sinfo);
612
613 return ret;
614} 580}
615 581
616/* Supported rates to be advertised to the cfg80211 */ 582/* Supported rates to be advertised to the cfg80211 */
@@ -749,15 +715,13 @@ mwifiex_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev,
749 */ 715 */
750static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv) 716static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
751{ 717{
752 int ret = 0;
753 struct ieee80211_channel *chan; 718 struct ieee80211_channel *chan;
754 struct mwifiex_bss_info bss_info; 719 struct mwifiex_bss_info bss_info;
755 int ie_len = 0; 720 int ie_len = 0;
756 u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)]; 721 u8 ie_buf[IEEE80211_MAX_SSID_LEN + sizeof(struct ieee_types_header)];
757 722
758 ret = mwifiex_get_bss_info(priv, &bss_info); 723 if (mwifiex_get_bss_info(priv, &bss_info))
759 if (ret) 724 return -1;
760 return ret;
761 725
762 ie_buf[0] = WLAN_EID_SSID; 726 ie_buf[0] = WLAN_EID_SSID;
763 ie_buf[1] = bss_info.ssid.ssid_len; 727 ie_buf[1] = bss_info.ssid.ssid_len;
@@ -776,7 +740,7 @@ static int mwifiex_cfg80211_inform_ibss_bss(struct mwifiex_private *priv)
776 0, ie_buf, ie_len, 0, GFP_KERNEL); 740 0, ie_buf, ie_len, 0, GFP_KERNEL);
777 memcpy(priv->cfg_bssid, bss_info.bssid, ETH_ALEN); 741 memcpy(priv->cfg_bssid, bss_info.bssid, ETH_ALEN);
778 742
779 return ret; 743 return 0;
780} 744}
781 745
782/* 746/*
@@ -805,9 +769,8 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv,
805 struct mwifiex_bssdescriptor *scan_table; 769 struct mwifiex_bssdescriptor *scan_table;
806 int i, j; 770 int i, j;
807 struct ieee80211_channel *chan; 771 struct ieee80211_channel *chan;
808 u8 *ie, *tmp, *ie_buf; 772 u8 *ie, *ie_buf;
809 u32 ie_len; 773 u32 ie_len;
810 u64 ts = 0;
811 u8 *beacon; 774 u8 *beacon;
812 int beacon_size; 775 int beacon_size;
813 u8 element_id, element_len; 776 u8 element_id, element_len;
@@ -889,9 +852,9 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv,
889 case WLAN_EID_BSS_AC_ACCESS_DELAY: 852 case WLAN_EID_BSS_AC_ACCESS_DELAY:
890 ie[0] = element_id; 853 ie[0] = element_id;
891 ie[1] = element_len; 854 ie[1] = element_len;
892 tmp = (u8 *) beacon;
893 memcpy(&ie[sizeof(struct ieee_types_header)], 855 memcpy(&ie[sizeof(struct ieee_types_header)],
894 tmp + sizeof(struct ieee_types_header), 856 (u8 *) beacon
857 + sizeof(struct ieee_types_header),
895 element_len); 858 element_len);
896 ie_len += ie[1] + 859 ie_len += ie[1] +
897 sizeof(struct ieee_types_header); 860 sizeof(struct ieee_types_header);
@@ -908,7 +871,7 @@ static int mwifiex_inform_bss_from_scan_result(struct mwifiex_private *priv,
908 scan_table[i].freq); 871 scan_table[i].freq);
909 cfg80211_inform_bss(priv->wdev->wiphy, chan, 872 cfg80211_inform_bss(priv->wdev->wiphy, chan,
910 scan_table[i].mac_address, 873 scan_table[i].mac_address,
911 ts, scan_table[i].cap_info_bitmap, 874 0, scan_table[i].cap_info_bitmap,
912 scan_table[i].beacon_period, 875 scan_table[i].beacon_period,
913 ie_buf, ie_len, 876 ie_buf, ie_len,
914 scan_table[i].rssi, GFP_KERNEL); 877 scan_table[i].rssi, GFP_KERNEL);
@@ -941,9 +904,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
941 struct mwifiex_802_11_ssid req_ssid; 904 struct mwifiex_802_11_ssid req_ssid;
942 struct mwifiex_ssid_bssid ssid_bssid; 905 struct mwifiex_ssid_bssid ssid_bssid;
943 int ret = 0; 906 int ret = 0;
944 int auth_type = 0, pairwise_encrypt_mode = 0; 907 int auth_type = 0;
945 int group_encrypt_mode = 0;
946 int alg_is_wep = 0;
947 908
948 memset(&req_ssid, 0, sizeof(struct mwifiex_802_11_ssid)); 909 memset(&req_ssid, 0, sizeof(struct mwifiex_802_11_ssid));
949 memset(&ssid_bssid, 0, sizeof(struct mwifiex_ssid_bssid)); 910 memset(&ssid_bssid, 0, sizeof(struct mwifiex_ssid_bssid));
@@ -1009,9 +970,7 @@ mwifiex_cfg80211_assoc(struct mwifiex_private *priv, size_t ssid_len, u8 *ssid,
1009 ret = mwifiex_set_gen_ie(priv, sme->ie, sme->ie_len); 970 ret = mwifiex_set_gen_ie(priv, sme->ie, sme->ie_len);
1010 971
1011 if (sme->key) { 972 if (sme->key) {
1012 alg_is_wep = mwifiex_is_alg_wep(pairwise_encrypt_mode) 973 if (mwifiex_is_alg_wep(0) | mwifiex_is_alg_wep(0)) {
1013 | mwifiex_is_alg_wep(group_encrypt_mode);
1014 if (alg_is_wep) {
1015 dev_dbg(priv->adapter->dev, 974 dev_dbg(priv->adapter->dev,
1016 "info: setting wep encryption" 975 "info: setting wep encryption"
1017 " with key len %d\n", sme->key_len); 976 " with key len %d\n", sme->key_len);
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c
index bb73cfe14aeb..d0cada5a29a0 100644
--- a/drivers/net/wireless/mwifiex/cfp.c
+++ b/drivers/net/wireless/mwifiex/cfp.c
@@ -145,16 +145,12 @@ u8 mwifiex_data_rate_to_index(u32 rate)
145 */ 145 */
146u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv, u8 *rates) 146u32 mwifiex_get_active_data_rates(struct mwifiex_private *priv, u8 *rates)
147{ 147{
148 u32 k;
149
150 if (!priv->media_connected) 148 if (!priv->media_connected)
151 k = mwifiex_get_supported_rates(priv, rates); 149 return mwifiex_get_supported_rates(priv, rates);
152 else 150 else
153 k = mwifiex_copy_rates(rates, 0, 151 return mwifiex_copy_rates(rates, 0,
154 priv->curr_bss_params.data_rates, 152 priv->curr_bss_params.data_rates,
155 priv->curr_bss_params.num_of_rates); 153 priv->curr_bss_params.num_of_rates);
156
157 return k;
158} 154}
159 155
160/* 156/*
diff --git a/drivers/net/wireless/mwifiex/init.c b/drivers/net/wireless/mwifiex/init.c
index 1b79a5ac9214..fc2c0c5728d9 100644
--- a/drivers/net/wireless/mwifiex/init.c
+++ b/drivers/net/wireless/mwifiex/init.c
@@ -71,7 +71,6 @@ static int mwifiex_add_bss_prio_tbl(struct mwifiex_private *priv)
71static int mwifiex_init_priv(struct mwifiex_private *priv) 71static int mwifiex_init_priv(struct mwifiex_private *priv)
72{ 72{
73 u32 i; 73 u32 i;
74 int ret = 0;
75 74
76 priv->media_connected = false; 75 priv->media_connected = false;
77 memset(priv->curr_addr, 0xff, ETH_ALEN); 76 memset(priv->curr_addr, 0xff, ETH_ALEN);
@@ -139,9 +138,7 @@ static int mwifiex_init_priv(struct mwifiex_private *priv)
139 138
140 priv->scan_block = false; 139 priv->scan_block = false;
141 140
142 ret = mwifiex_add_bss_prio_tbl(priv); 141 return mwifiex_add_bss_prio_tbl(priv);
143
144 return ret;
145} 142}
146 143
147/* 144/*
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index 60d25c690c07..8e1cb4b3fbea 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -749,7 +749,7 @@ int
749mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv, 749mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
750 struct host_cmd_ds_command *cmd, void *data_buf) 750 struct host_cmd_ds_command *cmd, void *data_buf)
751{ 751{
752 int ret = 0, rsn_ie_len = 0; 752 int rsn_ie_len = 0;
753 struct mwifiex_adapter *adapter = priv->adapter; 753 struct mwifiex_adapter *adapter = priv->adapter;
754 struct host_cmd_ds_802_11_ad_hoc_start *adhoc_start = 754 struct host_cmd_ds_802_11_ad_hoc_start *adhoc_start =
755 &cmd->params.adhoc_start; 755 &cmd->params.adhoc_start;
@@ -879,11 +879,9 @@ mwifiex_cmd_802_11_ad_hoc_start(struct mwifiex_private *priv,
879 mwifiex_get_active_data_rates(priv, adhoc_start->DataRate); 879 mwifiex_get_active_data_rates(priv, adhoc_start->DataRate);
880 if ((adapter->adhoc_start_band & BAND_G) && 880 if ((adapter->adhoc_start_band & BAND_G) &&
881 (priv->curr_pkt_filter & HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON)) { 881 (priv->curr_pkt_filter & HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON)) {
882 ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL, 882 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL,
883 HostCmd_ACT_GEN_SET, 0, 883 HostCmd_ACT_GEN_SET, 0,
884 &priv->curr_pkt_filter); 884 &priv->curr_pkt_filter)) {
885
886 if (ret) {
887 dev_err(adapter->dev, 885 dev_err(adapter->dev,
888 "ADHOC_S_CMD: G Protection config failed\n"); 886 "ADHOC_S_CMD: G Protection config failed\n");
889 return -1; 887 return -1;
@@ -1039,7 +1037,7 @@ int
1039mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv, 1037mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1040 struct host_cmd_ds_command *cmd, void *data_buf) 1038 struct host_cmd_ds_command *cmd, void *data_buf)
1041{ 1039{
1042 int ret = 0, rsn_ie_len = 0; 1040 int rsn_ie_len = 0;
1043 struct host_cmd_ds_802_11_ad_hoc_join *adhoc_join = 1041 struct host_cmd_ds_802_11_ad_hoc_join *adhoc_join =
1044 &cmd->params.adhoc_join; 1042 &cmd->params.adhoc_join;
1045 struct mwifiex_bssdescriptor *bss_desc = 1043 struct mwifiex_bssdescriptor *bss_desc =
@@ -1060,10 +1058,9 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1060 priv-> 1058 priv->
1061 curr_pkt_filter | HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON; 1059 curr_pkt_filter | HostCmd_ACT_MAC_ADHOC_G_PROTECTION_ON;
1062 1060
1063 ret = mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL, 1061 if (mwifiex_send_cmd_async(priv, HostCmd_CMD_MAC_CONTROL,
1064 HostCmd_ACT_GEN_SET, 0, 1062 HostCmd_ACT_GEN_SET, 0,
1065 &curr_pkt_filter); 1063 &curr_pkt_filter)) {
1066 if (ret) {
1067 dev_err(priv->adapter->dev, 1064 dev_err(priv->adapter->dev,
1068 "ADHOC_J_CMD: G Protection config failed\n"); 1065 "ADHOC_J_CMD: G Protection config failed\n");
1069 return -1; 1066 return -1;
@@ -1174,7 +1171,7 @@ mwifiex_cmd_802_11_ad_hoc_join(struct mwifiex_private *priv,
1174 1171
1175 adhoc_join->bss_descriptor.cap_info_bitmap = cpu_to_le16(tmp_cap); 1172 adhoc_join->bss_descriptor.cap_info_bitmap = cpu_to_le16(tmp_cap);
1176 1173
1177 return ret; 1174 return 0;
1178} 1175}
1179 1176
1180/* 1177/*
@@ -1192,15 +1189,13 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
1192 struct mwifiex_adapter *adapter = priv->adapter; 1189 struct mwifiex_adapter *adapter = priv->adapter;
1193 struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; 1190 struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result;
1194 struct mwifiex_bssdescriptor *bss_desc; 1191 struct mwifiex_bssdescriptor *bss_desc;
1195 u16 command = le16_to_cpu(resp->command);
1196 u16 result = le16_to_cpu(resp->result);
1197 1192
1198 adhoc_result = &resp->params.adhoc_result; 1193 adhoc_result = &resp->params.adhoc_result;
1199 1194
1200 bss_desc = priv->attempted_bss_desc; 1195 bss_desc = priv->attempted_bss_desc;
1201 1196
1202 /* Join result code 0 --> SUCCESS */ 1197 /* Join result code 0 --> SUCCESS */
1203 if (result) { 1198 if (le16_to_cpu(resp->result)) {
1204 dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); 1199 dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n");
1205 if (priv->media_connected) 1200 if (priv->media_connected)
1206 mwifiex_reset_connect_state(priv); 1201 mwifiex_reset_connect_state(priv);
@@ -1215,7 +1210,7 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
1215 /* Send a Media Connected event, according to the Spec */ 1210 /* Send a Media Connected event, according to the Spec */
1216 priv->media_connected = true; 1211 priv->media_connected = true;
1217 1212
1218 if (command == HostCmd_CMD_802_11_AD_HOC_START) { 1213 if (le16_to_cpu(resp->command) == HostCmd_CMD_802_11_AD_HOC_START) {
1219 dev_dbg(priv->adapter->dev, "info: ADHOC_S_RESP %s\n", 1214 dev_dbg(priv->adapter->dev, "info: ADHOC_S_RESP %s\n",
1220 bss_desc->ssid.ssid); 1215 bss_desc->ssid.ssid);
1221 1216
@@ -1278,7 +1273,6 @@ done:
1278int mwifiex_associate(struct mwifiex_private *priv, 1273int mwifiex_associate(struct mwifiex_private *priv,
1279 struct mwifiex_bssdescriptor *bss_desc) 1274 struct mwifiex_bssdescriptor *bss_desc)
1280{ 1275{
1281 int ret = 0;
1282 u8 current_bssid[ETH_ALEN]; 1276 u8 current_bssid[ETH_ALEN];
1283 1277
1284 /* Return error if the adapter or table entry is not marked as infra */ 1278 /* Return error if the adapter or table entry is not marked as infra */
@@ -1294,10 +1288,8 @@ int mwifiex_associate(struct mwifiex_private *priv,
1294 retrieval */ 1288 retrieval */
1295 priv->assoc_rsp_size = 0; 1289 priv->assoc_rsp_size = 0;
1296 1290
1297 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_ASSOCIATE, 1291 return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_ASSOCIATE,
1298 HostCmd_ACT_GEN_SET, 0, bss_desc); 1292 HostCmd_ACT_GEN_SET, 0, bss_desc);
1299
1300 return ret;
1301} 1293}
1302 1294
1303/* 1295/*
@@ -1309,8 +1301,6 @@ int
1309mwifiex_adhoc_start(struct mwifiex_private *priv, 1301mwifiex_adhoc_start(struct mwifiex_private *priv,
1310 struct mwifiex_802_11_ssid *adhoc_ssid) 1302 struct mwifiex_802_11_ssid *adhoc_ssid)
1311{ 1303{
1312 int ret = 0;
1313
1314 dev_dbg(priv->adapter->dev, "info: Adhoc Channel = %d\n", 1304 dev_dbg(priv->adapter->dev, "info: Adhoc Channel = %d\n",
1315 priv->adhoc_channel); 1305 priv->adhoc_channel);
1316 dev_dbg(priv->adapter->dev, "info: curr_bss_params.channel = %d\n", 1306 dev_dbg(priv->adapter->dev, "info: curr_bss_params.channel = %d\n",
@@ -1318,10 +1308,8 @@ mwifiex_adhoc_start(struct mwifiex_private *priv,
1318 dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %d\n", 1308 dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %d\n",
1319 priv->curr_bss_params.band); 1309 priv->curr_bss_params.band);
1320 1310
1321 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_START, 1311 return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_START,
1322 HostCmd_ACT_GEN_SET, 0, adhoc_ssid); 1312 HostCmd_ACT_GEN_SET, 0, adhoc_ssid);
1323
1324 return ret;
1325} 1313}
1326 1314
1327/* 1315/*
@@ -1333,8 +1321,6 @@ mwifiex_adhoc_start(struct mwifiex_private *priv,
1333int mwifiex_adhoc_join(struct mwifiex_private *priv, 1321int mwifiex_adhoc_join(struct mwifiex_private *priv,
1334 struct mwifiex_bssdescriptor *bss_desc) 1322 struct mwifiex_bssdescriptor *bss_desc)
1335{ 1323{
1336 int ret = 0;
1337
1338 dev_dbg(priv->adapter->dev, "info: adhoc join: curr_bss ssid =%s\n", 1324 dev_dbg(priv->adapter->dev, "info: adhoc join: curr_bss ssid =%s\n",
1339 priv->curr_bss_params.bss_descriptor.ssid.ssid); 1325 priv->curr_bss_params.bss_descriptor.ssid.ssid);
1340 dev_dbg(priv->adapter->dev, "info: adhoc join: curr_bss ssid_len =%u\n", 1326 dev_dbg(priv->adapter->dev, "info: adhoc join: curr_bss ssid_len =%u\n",
@@ -1360,10 +1346,8 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv,
1360 dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %c\n", 1346 dev_dbg(priv->adapter->dev, "info: curr_bss_params.band = %c\n",
1361 priv->curr_bss_params.band); 1347 priv->curr_bss_params.band);
1362 1348
1363 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_JOIN, 1349 return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_AD_HOC_JOIN,
1364 HostCmd_ACT_GEN_SET, 0, bss_desc); 1350 HostCmd_ACT_GEN_SET, 0, bss_desc);
1365
1366 return ret;
1367} 1351}
1368 1352
1369/* 1353/*
@@ -1424,21 +1408,15 @@ EXPORT_SYMBOL_GPL(mwifiex_deauthenticate);
1424u8 1408u8
1425mwifiex_band_to_radio_type(u8 band) 1409mwifiex_band_to_radio_type(u8 band)
1426{ 1410{
1427 u8 ret_radio_type;
1428
1429 switch (band) { 1411 switch (band) {
1430 case BAND_A: 1412 case BAND_A:
1431 case BAND_AN: 1413 case BAND_AN:
1432 case BAND_A | BAND_AN: 1414 case BAND_A | BAND_AN:
1433 ret_radio_type = HostCmd_SCAN_RADIO_TYPE_A; 1415 return HostCmd_SCAN_RADIO_TYPE_A;
1434 break;
1435 case BAND_B: 1416 case BAND_B:
1436 case BAND_G: 1417 case BAND_G:
1437 case BAND_B | BAND_G: 1418 case BAND_B | BAND_G:
1438 default: 1419 default:
1439 ret_radio_type = HostCmd_SCAN_RADIO_TYPE_BG; 1420 return HostCmd_SCAN_RADIO_TYPE_BG;
1440 break;
1441 } 1421 }
1442
1443 return ret_radio_type;
1444} 1422}
diff --git a/drivers/net/wireless/mwifiex/main.c b/drivers/net/wireless/mwifiex/main.c
index 77abfc3d6c32..2c376dd4ad50 100644
--- a/drivers/net/wireless/mwifiex/main.c
+++ b/drivers/net/wireless/mwifiex/main.c
@@ -68,7 +68,6 @@ static struct mwifiex_drv_mode mwifiex_drv_mode_tbl[] = {
68static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops, 68static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops,
69 struct mwifiex_device *mdevice, void **padapter) 69 struct mwifiex_device *mdevice, void **padapter)
70{ 70{
71 int ret = 0;
72 struct mwifiex_adapter *adapter = NULL; 71 struct mwifiex_adapter *adapter = NULL;
73 u8 i = 0; 72 u8 i = 0;
74 73
@@ -84,8 +83,7 @@ static int mwifiex_register(void *card, struct mwifiex_if_ops *if_ops,
84 memmove(&adapter->if_ops, if_ops, sizeof(struct mwifiex_if_ops)); 83 memmove(&adapter->if_ops, if_ops, sizeof(struct mwifiex_if_ops));
85 84
86 /* card specific initialization has been deferred until now .. */ 85 /* card specific initialization has been deferred until now .. */
87 ret = adapter->if_ops.init_if(adapter); 86 if (adapter->if_ops.init_if(adapter))
88 if (ret)
89 goto error; 87 goto error;
90 88
91 adapter->priv_num = 0; 89 adapter->priv_num = 0;
@@ -893,7 +891,6 @@ int
893mwifiex_add_card(void *card, struct semaphore *sem, 891mwifiex_add_card(void *card, struct semaphore *sem,
894 struct mwifiex_if_ops *if_ops) 892 struct mwifiex_if_ops *if_ops)
895{ 893{
896 int status = 0;
897 int i; 894 int i;
898 struct mwifiex_adapter *adapter = NULL; 895 struct mwifiex_adapter *adapter = NULL;
899 struct mwifiex_drv_mode *drv_mode_info = &mwifiex_drv_mode_tbl[0]; 896 struct mwifiex_drv_mode *drv_mode_info = &mwifiex_drv_mode_tbl[0];
@@ -943,12 +940,9 @@ mwifiex_add_card(void *card, struct semaphore *sem,
943 for (i = 0; i < drv_mode_info->intf_num; i++) { 940 for (i = 0; i < drv_mode_info->intf_num; i++) {
944 if (!mwifiex_add_interface(adapter, i, 941 if (!mwifiex_add_interface(adapter, i,
945 adapter->drv_mode->bss_attr[i].bss_type)) { 942 adapter->drv_mode->bss_attr[i].bss_type)) {
946 status = -1; 943 goto err_add_intf;
947 break;
948 } 944 }
949 } 945 }
950 if (status)
951 goto err_add_intf;
952 946
953 up(sem); 947 up(sem);
954 948
@@ -969,8 +963,8 @@ err_kmalloc:
969 (adapter->hw_status == MWIFIEX_HW_STATUS_READY)) { 963 (adapter->hw_status == MWIFIEX_HW_STATUS_READY)) {
970 pr_debug("info: %s: shutdown mwifiex\n", __func__); 964 pr_debug("info: %s: shutdown mwifiex\n", __func__);
971 adapter->init_wait_q_woken = false; 965 adapter->init_wait_q_woken = false;
972 status = mwifiex_shutdown_drv(adapter); 966
973 if (status == -EINPROGRESS) 967 if (mwifiex_shutdown_drv(adapter) == -EINPROGRESS)
974 wait_event_interruptible(adapter->init_wait_q, 968 wait_event_interruptible(adapter->init_wait_q,
975 adapter->init_wait_q_woken); 969 adapter->init_wait_q_woken);
976 } 970 }
@@ -999,7 +993,6 @@ EXPORT_SYMBOL_GPL(mwifiex_add_card);
999int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem) 993int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
1000{ 994{
1001 struct mwifiex_private *priv = NULL; 995 struct mwifiex_private *priv = NULL;
1002 int status;
1003 int i; 996 int i;
1004 997
1005 if (down_interruptible(sem)) 998 if (down_interruptible(sem))
@@ -1023,8 +1016,8 @@ int mwifiex_remove_card(struct mwifiex_adapter *adapter, struct semaphore *sem)
1023 1016
1024 dev_dbg(adapter->dev, "cmd: calling mwifiex_shutdown_drv...\n"); 1017 dev_dbg(adapter->dev, "cmd: calling mwifiex_shutdown_drv...\n");
1025 adapter->init_wait_q_woken = false; 1018 adapter->init_wait_q_woken = false;
1026 status = mwifiex_shutdown_drv(adapter); 1019
1027 if (status == -EINPROGRESS) 1020 if (mwifiex_shutdown_drv(adapter) == -EINPROGRESS)
1028 wait_event_interruptible(adapter->init_wait_q, 1021 wait_event_interruptible(adapter->init_wait_q,
1029 adapter->init_wait_q_woken); 1022 adapter->init_wait_q_woken);
1030 dev_dbg(adapter->dev, "cmd: mwifiex_shutdown_drv done\n"); 1023 dev_dbg(adapter->dev, "cmd: mwifiex_shutdown_drv done\n");
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index 84742715893f..68d905d58606 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -181,7 +181,6 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv,
181 struct mwifiex_ssid_bssid *ssid_bssid) 181 struct mwifiex_ssid_bssid *ssid_bssid)
182{ 182{
183 struct mwifiex_ssid_bssid tmp_ssid_bssid; 183 struct mwifiex_ssid_bssid tmp_ssid_bssid;
184 int ret = 0;
185 u8 *mac = NULL; 184 u8 *mac = NULL;
186 185
187 if (!ssid_bssid) 186 if (!ssid_bssid)
@@ -189,17 +188,17 @@ int mwifiex_find_best_bss(struct mwifiex_private *priv,
189 188
190 memcpy(&tmp_ssid_bssid, ssid_bssid, 189 memcpy(&tmp_ssid_bssid, ssid_bssid,
191 sizeof(struct mwifiex_ssid_bssid)); 190 sizeof(struct mwifiex_ssid_bssid));
192 ret = mwifiex_bss_ioctl_find_bss(priv, &tmp_ssid_bssid);
193 191
194 if (!ret) { 192 if (!mwifiex_bss_ioctl_find_bss(priv, &tmp_ssid_bssid)) {
195 memcpy(ssid_bssid, &tmp_ssid_bssid, 193 memcpy(ssid_bssid, &tmp_ssid_bssid,
196 sizeof(struct mwifiex_ssid_bssid)); 194 sizeof(struct mwifiex_ssid_bssid));
197 mac = (u8 *) &ssid_bssid->bssid; 195 mac = (u8 *) &ssid_bssid->bssid;
198 dev_dbg(priv->adapter->dev, "cmd: found network: ssid=%s," 196 dev_dbg(priv->adapter->dev, "cmd: found network: ssid=%s,"
199 " %pM\n", ssid_bssid->ssid.ssid, mac); 197 " %pM\n", ssid_bssid->ssid.ssid, mac);
198 return 0;
200 } 199 }
201 200
202 return ret; 201 return -1;
203} 202}
204 203
205/* 204/*
@@ -2061,19 +2060,13 @@ mwifiex_process_scan_results(struct mwifiex_private *priv)
2061static u8 2060static u8
2062mwifiex_radio_type_to_band(u8 radio_type) 2061mwifiex_radio_type_to_band(u8 radio_type)
2063{ 2062{
2064 u8 ret_band;
2065
2066 switch (radio_type) { 2063 switch (radio_type) {
2067 case HostCmd_SCAN_RADIO_TYPE_A: 2064 case HostCmd_SCAN_RADIO_TYPE_A:
2068 ret_band = BAND_A; 2065 return BAND_A;
2069 break;
2070 case HostCmd_SCAN_RADIO_TYPE_BG: 2066 case HostCmd_SCAN_RADIO_TYPE_BG:
2071 default: 2067 default:
2072 ret_band = BAND_G; 2068 return BAND_G;
2073 break;
2074 } 2069 }
2075
2076 return ret_band;
2077} 2070}
2078 2071
2079/* 2072/*
@@ -2226,8 +2219,7 @@ static int
2226mwifiex_scan_delete_ssid_table_entry(struct mwifiex_private *priv, 2219mwifiex_scan_delete_ssid_table_entry(struct mwifiex_private *priv,
2227 struct mwifiex_802_11_ssid *del_ssid) 2220 struct mwifiex_802_11_ssid *del_ssid)
2228{ 2221{
2229 int ret = -1; 2222 s32 table_idx = -1;
2230 s32 table_idx;
2231 2223
2232 dev_dbg(priv->adapter->dev, "info: scan: delete ssid entry: %-32s\n", 2224 dev_dbg(priv->adapter->dev, "info: scan: delete ssid entry: %-32s\n",
2233 del_ssid->ssid); 2225 del_ssid->ssid);
@@ -2240,11 +2232,10 @@ mwifiex_scan_delete_ssid_table_entry(struct mwifiex_private *priv,
2240 dev_dbg(priv->adapter->dev, 2232 dev_dbg(priv->adapter->dev,
2241 "info: Scan: Delete SSID Entry: Found Idx = %d\n", 2233 "info: Scan: Delete SSID Entry: Found Idx = %d\n",
2242 table_idx); 2234 table_idx);
2243 ret = 0;
2244 mwifiex_scan_delete_table_entry(priv, table_idx); 2235 mwifiex_scan_delete_table_entry(priv, table_idx);
2245 } 2236 }
2246 2237
2247 return ret; 2238 return table_idx == -1 ? -1 : 0;
2248} 2239}
2249 2240
2250/* 2241/*
diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
index 41c087d3f0f5..5148d0e0fad6 100644
--- a/drivers/net/wireless/mwifiex/sdio.c
+++ b/drivers/net/wireless/mwifiex/sdio.c
@@ -347,12 +347,9 @@ static int mwifiex_read_data_sync(struct mwifiex_adapter *adapter, u8 *buffer,
347 */ 347 */
348static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter) 348static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter)
349{ 349{
350 int ret;
351
352 dev_dbg(adapter->dev, "event: wakeup device...\n"); 350 dev_dbg(adapter->dev, "event: wakeup device...\n");
353 ret = mwifiex_write_reg(adapter, CONFIGURATION_REG, HOST_POWER_UP);
354 351
355 return ret; 352 return mwifiex_write_reg(adapter, CONFIGURATION_REG, HOST_POWER_UP);
356} 353}
357 354
358/* 355/*
@@ -362,12 +359,9 @@ static int mwifiex_pm_wakeup_card(struct mwifiex_adapter *adapter)
362 */ 359 */
363static int mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter) 360static int mwifiex_pm_wakeup_card_complete(struct mwifiex_adapter *adapter)
364{ 361{
365 int ret;
366
367 dev_dbg(adapter->dev, "cmd: wakeup device completed\n"); 362 dev_dbg(adapter->dev, "cmd: wakeup device completed\n");
368 ret = mwifiex_write_reg(adapter, CONFIGURATION_REG, 0);
369 363
370 return ret; 364 return mwifiex_write_reg(adapter, CONFIGURATION_REG, 0);
371} 365}
372 366
373/* 367/*
@@ -1703,13 +1697,9 @@ static struct mwifiex_if_ops sdio_ops = {
1703static int 1697static int
1704mwifiex_sdio_init_module(void) 1698mwifiex_sdio_init_module(void)
1705{ 1699{
1706 int ret;
1707
1708 sema_init(&add_remove_card_sem, 1); 1700 sema_init(&add_remove_card_sem, 1);
1709 1701
1710 ret = sdio_register_driver(&mwifiex_sdio); 1702 return sdio_register_driver(&mwifiex_sdio);
1711
1712 return ret;
1713} 1703}
1714 1704
1715/* 1705/*
diff --git a/drivers/net/wireless/mwifiex/sta_ioctl.c b/drivers/net/wireless/mwifiex/sta_ioctl.c
index 6489f264ef5f..03085a3b20db 100644
--- a/drivers/net/wireless/mwifiex/sta_ioctl.c
+++ b/drivers/net/wireless/mwifiex/sta_ioctl.c
@@ -216,7 +216,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv,
216 ret = mwifiex_adhoc_join(priv, &adapter->scan_table[i]); 216 ret = mwifiex_adhoc_join(priv, &adapter->scan_table[i]);
217 if (ret) 217 if (ret)
218 return ret; 218 return ret;
219 } else { /* i >= 0 */ 219 } else {
220 dev_dbg(adapter->dev, "info: Network not found in " 220 dev_dbg(adapter->dev, "info: Network not found in "
221 "the list, creating adhoc with ssid = %s\n", 221 "the list, creating adhoc with ssid = %s\n",
222 ssid_bssid->ssid.ssid); 222 ssid_bssid->ssid.ssid);
@@ -320,16 +320,13 @@ int mwifiex_set_hs_params(struct mwifiex_private *priv, u16 action,
320 */ 320 */
321int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type) 321int mwifiex_cancel_hs(struct mwifiex_private *priv, int cmd_type)
322{ 322{
323 int ret = 0;
324 struct mwifiex_ds_hs_cfg hscfg; 323 struct mwifiex_ds_hs_cfg hscfg;
325 324
326 /* Cancel Host Sleep */
327 hscfg.conditions = HOST_SLEEP_CFG_CANCEL; 325 hscfg.conditions = HOST_SLEEP_CFG_CANCEL;
328 hscfg.is_invoke_hostcmd = true; 326 hscfg.is_invoke_hostcmd = true;
329 ret = mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_SET,
330 cmd_type, &hscfg);
331 327
332 return ret; 328 return mwifiex_set_hs_params(priv, HostCmd_ACT_GEN_SET,
329 cmd_type, &hscfg);
333} 330}
334EXPORT_SYMBOL_GPL(mwifiex_cancel_hs); 331EXPORT_SYMBOL_GPL(mwifiex_cancel_hs);
335 332
@@ -348,7 +345,6 @@ int mwifiex_enable_hs(struct mwifiex_adapter *adapter)
348 return true; 345 return true;
349 } 346 }
350 347
351 /* Enable Host Sleep */
352 adapter->hs_activate_wait_q_woken = false; 348 adapter->hs_activate_wait_q_woken = false;
353 349
354 memset(&hscfg, 0, sizeof(struct mwifiex_hs_config_param)); 350 memset(&hscfg, 0, sizeof(struct mwifiex_hs_config_param));
@@ -385,23 +381,17 @@ int mwifiex_get_bss_info(struct mwifiex_private *priv,
385 if (!info) 381 if (!info)
386 return -1; 382 return -1;
387 383
388 /* Get current BSS info */
389 bss_desc = &priv->curr_bss_params.bss_descriptor; 384 bss_desc = &priv->curr_bss_params.bss_descriptor;
390 385
391 /* BSS mode */
392 info->bss_mode = priv->bss_mode; 386 info->bss_mode = priv->bss_mode;
393 387
394 /* SSID */
395 memcpy(&info->ssid, &bss_desc->ssid, 388 memcpy(&info->ssid, &bss_desc->ssid,
396 sizeof(struct mwifiex_802_11_ssid)); 389 sizeof(struct mwifiex_802_11_ssid));
397 390
398 /* BSSID */
399 memcpy(&info->bssid, &bss_desc->mac_address, ETH_ALEN); 391 memcpy(&info->bssid, &bss_desc->mac_address, ETH_ALEN);
400 392
401 /* Channel */
402 info->bss_chan = bss_desc->channel; 393 info->bss_chan = bss_desc->channel;
403 394
404 /* Region code */
405 info->region_code = adapter->region_code; 395 info->region_code = adapter->region_code;
406 396
407 /* Scan table index if connected */ 397 /* Scan table index if connected */
@@ -415,20 +405,15 @@ int mwifiex_get_bss_info(struct mwifiex_private *priv,
415 info->scan_table_idx = tbl_idx; 405 info->scan_table_idx = tbl_idx;
416 } 406 }
417 407
418 /* Connection status */
419 info->media_connected = priv->media_connected; 408 info->media_connected = priv->media_connected;
420 409
421 /* Tx power information */
422 info->max_power_level = priv->max_tx_power_level; 410 info->max_power_level = priv->max_tx_power_level;
423 info->min_power_level = priv->min_tx_power_level; 411 info->min_power_level = priv->min_tx_power_level;
424 412
425 /* AdHoc state */
426 info->adhoc_state = priv->adhoc_state; 413 info->adhoc_state = priv->adhoc_state;
427 414
428 /* Last beacon NF */
429 info->bcn_nf_last = priv->bcn_nf_last; 415 info->bcn_nf_last = priv->bcn_nf_last;
430 416
431 /* wep status */
432 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_ENABLED) 417 if (priv->sec_info.wep_status == MWIFIEX_802_11_WEP_ENABLED)
433 info->wep_status = true; 418 info->wep_status = true;
434 else 419 else
@@ -574,22 +559,17 @@ int mwifiex_bss_set_channel(struct mwifiex_private *priv,
574static int mwifiex_bss_ioctl_ibss_channel(struct mwifiex_private *priv, 559static int mwifiex_bss_ioctl_ibss_channel(struct mwifiex_private *priv,
575 u16 action, u16 *channel) 560 u16 action, u16 *channel)
576{ 561{
577 int ret = 0;
578
579 if (action == HostCmd_ACT_GEN_GET) { 562 if (action == HostCmd_ACT_GEN_GET) {
580 if (!priv->media_connected) { 563 if (!priv->media_connected) {
581 *channel = priv->adhoc_channel; 564 *channel = priv->adhoc_channel;
582 return ret; 565 return 0;
583 } 566 }
584 } else { 567 } else {
585 priv->adhoc_channel = (u8) *channel; 568 priv->adhoc_channel = (u8) *channel;
586 } 569 }
587 570
588 /* Send request to firmware */ 571 return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_RF_CHANNEL,
589 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_RF_CHANNEL,
590 action, 0, channel); 572 action, 0, channel);
591
592 return ret;
593} 573}
594 574
595/* 575/*
@@ -602,7 +582,6 @@ int mwifiex_bss_ioctl_find_bss(struct mwifiex_private *priv,
602 struct mwifiex_ssid_bssid *ssid_bssid) 582 struct mwifiex_ssid_bssid *ssid_bssid)
603{ 583{
604 struct mwifiex_adapter *adapter = priv->adapter; 584 struct mwifiex_adapter *adapter = priv->adapter;
605 int ret = 0;
606 struct mwifiex_bssdescriptor *bss_desc; 585 struct mwifiex_bssdescriptor *bss_desc;
607 u8 zero_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 }; 586 u8 zero_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
608 u8 mac[ETH_ALEN]; 587 u8 mac[ETH_ALEN];
@@ -631,10 +610,10 @@ int mwifiex_bss_ioctl_find_bss(struct mwifiex_private *priv,
631 bss_desc = &adapter->scan_table[i]; 610 bss_desc = &adapter->scan_table[i];
632 memcpy(ssid_bssid->bssid, bss_desc->mac_address, ETH_ALEN); 611 memcpy(ssid_bssid->bssid, bss_desc->mac_address, ETH_ALEN);
633 } else { 612 } else {
634 ret = mwifiex_find_best_network(priv, ssid_bssid); 613 return mwifiex_find_best_network(priv, ssid_bssid);
635 } 614 }
636 615
637 return ret; 616 return 0;
638} 617}
639 618
640/* 619/*
@@ -718,7 +697,6 @@ static int mwifiex_rate_ioctl_get_rate_value(struct mwifiex_private *priv,
718 struct mwifiex_rate_cfg *rate_cfg) 697 struct mwifiex_rate_cfg *rate_cfg)
719{ 698{
720 struct mwifiex_adapter *adapter = priv->adapter; 699 struct mwifiex_adapter *adapter = priv->adapter;
721 int ret = 0;
722 700
723 rate_cfg->is_rate_auto = priv->is_data_rate_auto; 701 rate_cfg->is_rate_auto = priv->is_data_rate_auto;
724 if (!priv->media_connected) { 702 if (!priv->media_connected) {
@@ -757,13 +735,12 @@ static int mwifiex_rate_ioctl_get_rate_value(struct mwifiex_private *priv,
757 break; 735 break;
758 } 736 }
759 } else { 737 } else {
760 /* Send request to firmware */ 738 return mwifiex_send_cmd_sync(priv,
761 ret = mwifiex_send_cmd_sync(priv,
762 HostCmd_CMD_802_11_TX_RATE_QUERY, 739 HostCmd_CMD_802_11_TX_RATE_QUERY,
763 HostCmd_ACT_GEN_GET, 0, NULL); 740 HostCmd_ACT_GEN_GET, 0, NULL);
764 } 741 }
765 742
766 return ret; 743 return 0;
767} 744}
768 745
769/* 746/*
@@ -827,7 +804,6 @@ static int mwifiex_rate_ioctl_set_rate_value(struct mwifiex_private *priv,
827 } 804 }
828 } 805 }
829 806
830 /* Send request to firmware */
831 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_TX_RATE_CFG, 807 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_TX_RATE_CFG,
832 HostCmd_ACT_GEN_SET, 0, bitmap_rates); 808 HostCmd_ACT_GEN_SET, 0, bitmap_rates);
833 809
@@ -969,7 +945,6 @@ int mwifiex_set_tx_power(struct mwifiex_private *priv,
969 pg->power_max = (s8) dbm; 945 pg->power_max = (s8) dbm;
970 pg->ht_bandwidth = HT_BW_40; 946 pg->ht_bandwidth = HT_BW_40;
971 } 947 }
972 /* Send request to firmware */
973 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_TXPWR_CFG, 948 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_TXPWR_CFG,
974 HostCmd_ACT_GEN_SET, 0, buf); 949 HostCmd_ACT_GEN_SET, 0, buf);
975 950
@@ -1088,13 +1063,10 @@ static int mwifiex_set_wapi_ie(struct mwifiex_private *priv,
1088static int mwifiex_sec_ioctl_set_wapi_key(struct mwifiex_private *priv, 1063static int mwifiex_sec_ioctl_set_wapi_key(struct mwifiex_private *priv,
1089 struct mwifiex_ds_encrypt_key *encrypt_key) 1064 struct mwifiex_ds_encrypt_key *encrypt_key)
1090{ 1065{
1091 int ret = 0;
1092 1066
1093 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_KEY_MATERIAL, 1067 return mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_KEY_MATERIAL,
1094 HostCmd_ACT_GEN_SET, KEY_INFO_ENABLED, 1068 HostCmd_ACT_GEN_SET, KEY_INFO_ENABLED,
1095 encrypt_key); 1069 encrypt_key);
1096
1097 return ret;
1098} 1070}
1099 1071
1100/* 1072/*
@@ -1128,7 +1100,6 @@ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv,
1128 priv->sec_info.wep_status = MWIFIEX_802_11_WEP_ENABLED; 1100 priv->sec_info.wep_status = MWIFIEX_802_11_WEP_ENABLED;
1129 } else { 1101 } else {
1130 wep_key = &priv->wep_key[index]; 1102 wep_key = &priv->wep_key[index];
1131 /* Cleanup */
1132 memset(wep_key, 0, sizeof(struct mwifiex_wep_key)); 1103 memset(wep_key, 0, sizeof(struct mwifiex_wep_key));
1133 /* Copy the key in the driver */ 1104 /* Copy the key in the driver */
1134 memcpy(wep_key->key_material, 1105 memcpy(wep_key->key_material,
@@ -1151,7 +1122,6 @@ static int mwifiex_sec_ioctl_set_wep_key(struct mwifiex_private *priv,
1151 else 1122 else
1152 priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_WEP_ENABLE; 1123 priv->curr_pkt_filter &= ~HostCmd_ACT_MAC_WEP_ENABLE;
1153 1124
1154 /* Send request to firmware */
1155 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_MAC_CONTROL, 1125 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_MAC_CONTROL,
1156 HostCmd_ACT_GEN_SET, 0, 1126 HostCmd_ACT_GEN_SET, 0,
1157 &priv->curr_pkt_filter); 1127 &priv->curr_pkt_filter);
@@ -1216,13 +1186,11 @@ static int mwifiex_sec_ioctl_set_wpa_key(struct mwifiex_private *priv,
1216 encrypt_key->key_index = MWIFIEX_KEY_INDEX_UNICAST; 1186 encrypt_key->key_index = MWIFIEX_KEY_INDEX_UNICAST;
1217 1187
1218 if (remove_key) 1188 if (remove_key)
1219 /* Send request to firmware */
1220 ret = mwifiex_send_cmd_sync(priv, 1189 ret = mwifiex_send_cmd_sync(priv,
1221 HostCmd_CMD_802_11_KEY_MATERIAL, 1190 HostCmd_CMD_802_11_KEY_MATERIAL,
1222 HostCmd_ACT_GEN_SET, !(KEY_INFO_ENABLED), 1191 HostCmd_ACT_GEN_SET, !(KEY_INFO_ENABLED),
1223 encrypt_key); 1192 encrypt_key);
1224 else 1193 else
1225 /* Send request to firmware */
1226 ret = mwifiex_send_cmd_sync(priv, 1194 ret = mwifiex_send_cmd_sync(priv,
1227 HostCmd_CMD_802_11_KEY_MATERIAL, 1195 HostCmd_CMD_802_11_KEY_MATERIAL,
1228 HostCmd_ACT_GEN_SET, KEY_INFO_ENABLED, 1196 HostCmd_ACT_GEN_SET, KEY_INFO_ENABLED,
@@ -1297,7 +1265,6 @@ int mwifiex_get_signal_info(struct mwifiex_private *priv,
1297 return -1; 1265 return -1;
1298 } 1266 }
1299 1267
1300 /* Send request to firmware */
1301 status = mwifiex_send_cmd_sync(priv, HostCmd_CMD_RSSI_INFO, 1268 status = mwifiex_send_cmd_sync(priv, HostCmd_CMD_RSSI_INFO,
1302 HostCmd_ACT_GEN_GET, 0, signal); 1269 HostCmd_ACT_GEN_GET, 0, signal);
1303 1270
@@ -1324,7 +1291,6 @@ int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key,
1324 int key_len, u8 key_index, int disable) 1291 int key_len, u8 key_index, int disable)
1325{ 1292{
1326 struct mwifiex_ds_encrypt_key encrypt_key; 1293 struct mwifiex_ds_encrypt_key encrypt_key;
1327 int ret = 0;
1328 1294
1329 memset(&encrypt_key, 0, sizeof(struct mwifiex_ds_encrypt_key)); 1295 memset(&encrypt_key, 0, sizeof(struct mwifiex_ds_encrypt_key));
1330 encrypt_key.key_len = key_len; 1296 encrypt_key.key_len = key_len;
@@ -1336,9 +1302,7 @@ int mwifiex_set_encode(struct mwifiex_private *priv, const u8 *key,
1336 encrypt_key.key_disable = true; 1302 encrypt_key.key_disable = true;
1337 } 1303 }
1338 1304
1339 ret = mwifiex_sec_ioctl_encrypt_key(priv, &encrypt_key); 1305 return mwifiex_sec_ioctl_encrypt_key(priv, &encrypt_key);
1340
1341 return ret;
1342} 1306}
1343 1307
1344/* 1308/*
@@ -1351,18 +1315,13 @@ int
1351mwifiex_get_ver_ext(struct mwifiex_private *priv) 1315mwifiex_get_ver_ext(struct mwifiex_private *priv)
1352{ 1316{
1353 struct mwifiex_ver_ext ver_ext; 1317 struct mwifiex_ver_ext ver_ext;
1354 int ret = 0;
1355 1318
1356 /* get fw version */
1357 memset(&ver_ext, 0, sizeof(struct host_cmd_ds_version_ext)); 1319 memset(&ver_ext, 0, sizeof(struct host_cmd_ds_version_ext));
1358 /* Send request to firmware */ 1320 if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_VERSION_EXT,
1359 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_VERSION_EXT, 1321 HostCmd_ACT_GEN_GET, 0, &ver_ext))
1360 HostCmd_ACT_GEN_GET, 0, &ver_ext); 1322 return -1;
1361
1362 if (ret)
1363 ret = -1;
1364 1323
1365 return ret; 1324 return 0;
1366} 1325}
1367 1326
1368/* 1327/*
@@ -1379,7 +1338,6 @@ mwifiex_get_stats_info(struct mwifiex_private *priv,
1379 struct mwifiex_ds_get_stats get_log; 1338 struct mwifiex_ds_get_stats get_log;
1380 1339
1381 memset(&get_log, 0, sizeof(struct mwifiex_ds_get_stats)); 1340 memset(&get_log, 0, sizeof(struct mwifiex_ds_get_stats));
1382 /* Send request to firmware */
1383 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_GET_LOG, 1341 ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_GET_LOG,
1384 HostCmd_ACT_GEN_GET, 0, &get_log); 1342 HostCmd_ACT_GEN_GET, 0, &get_log);
1385 1343
@@ -1412,7 +1370,6 @@ static int mwifiex_reg_mem_ioctl_reg_rw(struct mwifiex_private *priv,
1412 struct mwifiex_ds_reg_rw *reg_rw, 1370 struct mwifiex_ds_reg_rw *reg_rw,
1413 u16 action) 1371 u16 action)
1414{ 1372{
1415 int ret = 0;
1416 u16 cmd_no; 1373 u16 cmd_no;
1417 1374
1418 switch (le32_to_cpu(reg_rw->type)) { 1375 switch (le32_to_cpu(reg_rw->type)) {
@@ -1435,10 +1392,8 @@ static int mwifiex_reg_mem_ioctl_reg_rw(struct mwifiex_private *priv,
1435 return -1; 1392 return -1;
1436 } 1393 }
1437 1394
1438 /* Send request to firmware */ 1395 return mwifiex_send_cmd_sync(priv, cmd_no, action, 0, reg_rw);
1439 ret = mwifiex_send_cmd_sync(priv, cmd_no, action, 0, reg_rw);
1440 1396
1441 return ret;
1442} 1397}
1443 1398
1444/* 1399/*
@@ -1451,15 +1406,13 @@ int
1451mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type, 1406mwifiex_reg_write(struct mwifiex_private *priv, u32 reg_type,
1452 u32 reg_offset, u32 reg_value) 1407 u32 reg_offset, u32 reg_value)
1453{ 1408{
1454 int ret = 0;
1455 struct mwifiex_ds_reg_rw reg_rw; 1409 struct mwifiex_ds_reg_rw reg_rw;
1456 1410
1457 reg_rw.type = cpu_to_le32(reg_type); 1411 reg_rw.type = cpu_to_le32(reg_type);
1458 reg_rw.offset = cpu_to_le32(reg_offset); 1412 reg_rw.offset = cpu_to_le32(reg_offset);
1459 reg_rw.value = cpu_to_le32(reg_value); 1413 reg_rw.value = cpu_to_le32(reg_value);
1460 ret = mwifiex_reg_mem_ioctl_reg_rw(priv, &reg_rw, HostCmd_ACT_GEN_SET);
1461 1414
1462 return ret; 1415 return mwifiex_reg_mem_ioctl_reg_rw(priv, &reg_rw, HostCmd_ACT_GEN_SET);
1463} 1416}
1464 1417
1465/* 1418/*
@@ -1638,7 +1591,6 @@ int
1638mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len) 1591mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len)
1639{ 1592{
1640 struct mwifiex_ds_misc_gen_ie gen_ie; 1593 struct mwifiex_ds_misc_gen_ie gen_ie;
1641 int status = 0;
1642 1594
1643 if (ie_len > IW_CUSTOM_MAX) 1595 if (ie_len > IW_CUSTOM_MAX)
1644 return -EFAULT; 1596 return -EFAULT;
@@ -1646,8 +1598,7 @@ mwifiex_set_gen_ie(struct mwifiex_private *priv, u8 *ie, int ie_len)
1646 gen_ie.type = MWIFIEX_IE_TYPE_GEN_IE; 1598 gen_ie.type = MWIFIEX_IE_TYPE_GEN_IE;
1647 gen_ie.len = ie_len; 1599 gen_ie.len = ie_len;
1648 memcpy(gen_ie.ie_data, ie, ie_len); 1600 memcpy(gen_ie.ie_data, ie, ie_len);
1649 status = mwifiex_misc_ioctl_gen_ie(priv, &gen_ie, HostCmd_ACT_GEN_SET); 1601 if (mwifiex_misc_ioctl_gen_ie(priv, &gen_ie, HostCmd_ACT_GEN_SET))
1650 if (status)
1651 return -EFAULT; 1602 return -EFAULT;
1652 1603
1653 return 0; 1604 return 0;
diff --git a/drivers/net/wireless/mwifiex/sta_tx.c b/drivers/net/wireless/mwifiex/sta_tx.c
index b261d812c4d3..5d37ef160121 100644
--- a/drivers/net/wireless/mwifiex/sta_tx.c
+++ b/drivers/net/wireless/mwifiex/sta_tx.c
@@ -180,15 +180,11 @@ mwifiex_check_last_packet_indication(struct mwifiex_private *priv)
180{ 180{
181 struct mwifiex_adapter *adapter = priv->adapter; 181 struct mwifiex_adapter *adapter = priv->adapter;
182 u8 ret = false; 182 u8 ret = false;
183 u8 prop_ps = true;
184 183
185 if (!adapter->sleep_period.period) 184 if (!adapter->sleep_period.period)
186 return ret; 185 return ret;
187 if (mwifiex_wmm_lists_empty(adapter)) { 186 if (mwifiex_wmm_lists_empty(adapter))
188 if ((priv->curr_bss_params.wmm_uapsd_enabled &&
189 priv->wmm_qosinfo) || prop_ps)
190 ret = true; 187 ret = true;
191 }
192 188
193 if (ret && !adapter->cmd_sent && !adapter->curr_cmd 189 if (ret && !adapter->cmd_sent && !adapter->curr_cmd
194 && !is_command_pending(adapter)) { 190 && !is_command_pending(adapter)) {
diff --git a/drivers/net/wireless/mwifiex/txrx.c b/drivers/net/wireless/mwifiex/txrx.c
index f06923cb1c4b..ce772e078db8 100644
--- a/drivers/net/wireless/mwifiex/txrx.c
+++ b/drivers/net/wireless/mwifiex/txrx.c
@@ -36,7 +36,6 @@
36int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, 36int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
37 struct sk_buff *skb) 37 struct sk_buff *skb)
38{ 38{
39 int ret = 0;
40 struct mwifiex_private *priv = 39 struct mwifiex_private *priv =
41 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); 40 mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
42 struct rxpd *local_rx_pd; 41 struct rxpd *local_rx_pd;
@@ -50,9 +49,8 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
50 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); 49 priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
51 50
52 rx_info->bss_index = priv->bss_index; 51 rx_info->bss_index = priv->bss_index;
53 ret = mwifiex_process_sta_rx_packet(adapter, skb);
54 52
55 return ret; 53 return mwifiex_process_sta_rx_packet(adapter, skb);
56} 54}
57EXPORT_SYMBOL_GPL(mwifiex_handle_rx_packet); 55EXPORT_SYMBOL_GPL(mwifiex_handle_rx_packet);
58 56
diff --git a/drivers/net/wireless/mwifiex/util.c b/drivers/net/wireless/mwifiex/util.c
index 9f65587622fd..7ab4fb279f8a 100644
--- a/drivers/net/wireless/mwifiex/util.c
+++ b/drivers/net/wireless/mwifiex/util.c
@@ -61,7 +61,6 @@ int mwifiex_shutdown_fw_complete(struct mwifiex_adapter *adapter)
61int mwifiex_init_shutdown_fw(struct mwifiex_private *priv, 61int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
62 u32 func_init_shutdown) 62 u32 func_init_shutdown)
63{ 63{
64 int ret;
65 u16 cmd; 64 u16 cmd;
66 65
67 if (func_init_shutdown == MWIFIEX_FUNC_INIT) { 66 if (func_init_shutdown == MWIFIEX_FUNC_INIT) {
@@ -73,10 +72,7 @@ int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
73 return -1; 72 return -1;
74 } 73 }
75 74
76 /* Send command to firmware */ 75 return mwifiex_send_cmd_sync(priv, cmd, HostCmd_ACT_GEN_SET, 0, NULL);
77 ret = mwifiex_send_cmd_sync(priv, cmd, HostCmd_ACT_GEN_SET, 0, NULL);
78
79 return ret;
80} 76}
81EXPORT_SYMBOL_GPL(mwifiex_init_shutdown_fw); 77EXPORT_SYMBOL_GPL(mwifiex_init_shutdown_fw);
82 78
diff --git a/drivers/net/wireless/mwifiex/wmm.c b/drivers/net/wireless/mwifiex/wmm.c
index 99e8431c1e93..c009370f309e 100644
--- a/drivers/net/wireless/mwifiex/wmm.c
+++ b/drivers/net/wireless/mwifiex/wmm.c
@@ -973,7 +973,6 @@ mwifiex_send_single_packet(struct mwifiex_private *priv,
973 struct sk_buff *skb, *skb_next; 973 struct sk_buff *skb, *skb_next;
974 struct mwifiex_tx_param tx_param; 974 struct mwifiex_tx_param tx_param;
975 struct mwifiex_adapter *adapter = priv->adapter; 975 struct mwifiex_adapter *adapter = priv->adapter;
976 int status = 0;
977 struct mwifiex_txinfo *tx_info; 976 struct mwifiex_txinfo *tx_info;
978 977
979 if (skb_queue_empty(&ptr->skb_head)) { 978 if (skb_queue_empty(&ptr->skb_head)) {
@@ -1000,9 +999,7 @@ mwifiex_send_single_packet(struct mwifiex_private *priv,
1000 tx_param.next_pkt_len = ((skb_next) ? skb_next->len + 999 tx_param.next_pkt_len = ((skb_next) ? skb_next->len +
1001 sizeof(struct txpd) : 0); 1000 sizeof(struct txpd) : 0);
1002 1001
1003 status = mwifiex_process_tx(priv, skb, &tx_param); 1002 if (mwifiex_process_tx(priv, skb, &tx_param) == -EBUSY) {
1004
1005 if (status == -EBUSY) {
1006 /* Queue the packet back at the head */ 1003 /* Queue the packet back at the head */
1007 spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags); 1004 spin_lock_irqsave(&priv->wmm.ra_list_spinlock, ra_list_flags);
1008 1005