aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/join.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-08 15:04:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:06:19 -0500
commitaa21c004f80bdf943736c62dccf0c0398d7824f3 (patch)
tree6815328775d3b5ec46bb342c4c256cde0f223863 /drivers/net/wireless/libertas/join.c
parentf86a93e1b2d05a7a38a48c91f8fb8fc7e8f1c734 (diff)
libertas: kill struct lbs_adapter
There seems to be no reason for a separate structure; move it all into struct lbs_private. Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/join.c')
-rw-r--r--drivers/net/wireless/libertas/join.c150
1 files changed, 70 insertions, 80 deletions
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c
index 1550e6afb053..14425d9a198a 100644
--- a/drivers/net/wireless/libertas/join.c
+++ b/drivers/net/wireless/libertas/join.c
@@ -30,13 +30,13 @@
30 * NOTE: Setting the MSB of the basic rates need to be taken 30 * NOTE: Setting the MSB of the basic rates need to be taken
31 * care, either before or after calling this function 31 * care, either before or after calling this function
32 * 32 *
33 * @param adapter A pointer to struct lbs_adapter structure 33 * @param priv A pointer to struct lbs_private structure
34 * @param rate1 the buffer which keeps input and output 34 * @param rate1 the buffer which keeps input and output
35 * @param rate1_size the size of rate1 buffer; new size of buffer on return 35 * @param rate1_size the size of rate1 buffer; new size of buffer on return
36 * 36 *
37 * @return 0 or -1 37 * @return 0 or -1
38 */ 38 */
39static int get_common_rates(struct lbs_adapter *adapter, 39static int get_common_rates(struct lbs_private *priv,
40 u8 *rates, 40 u8 *rates,
41 u16 *rates_size) 41 u16 *rates_size)
42{ 42{
@@ -57,15 +57,15 @@ static int get_common_rates(struct lbs_adapter *adapter,
57 lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size); 57 lbs_deb_hex(LBS_DEB_JOIN, "AP rates ", rates, *rates_size);
58 lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates); 58 lbs_deb_hex(LBS_DEB_JOIN, "card rates ", card_rates, num_card_rates);
59 lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size); 59 lbs_deb_hex(LBS_DEB_JOIN, "common rates", tmp, tmp_size);
60 lbs_deb_join("TX data rate 0x%02x\n", adapter->cur_rate); 60 lbs_deb_join("TX data rate 0x%02x\n", priv->cur_rate);
61 61
62 if (!adapter->auto_rate) { 62 if (!priv->auto_rate) {
63 for (i = 0; i < tmp_size; i++) { 63 for (i = 0; i < tmp_size; i++) {
64 if (tmp[i] == adapter->cur_rate) 64 if (tmp[i] == priv->cur_rate)
65 goto done; 65 goto done;
66 } 66 }
67 lbs_pr_alert("Previously set fixed data rate %#x isn't " 67 lbs_pr_alert("Previously set fixed data rate %#x isn't "
68 "compatible with the network.\n", adapter->cur_rate); 68 "compatible with the network.\n", priv->cur_rate);
69 ret = -1; 69 ret = -1;
70 goto done; 70 goto done;
71 } 71 }
@@ -125,7 +125,6 @@ void lbs_unset_basic_rate_flags(u8 *rates, size_t len)
125 */ 125 */
126int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req) 126int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req)
127{ 127{
128 struct lbs_adapter *adapter = priv->adapter;
129 int ret; 128 int ret;
130 129
131 lbs_deb_enter(LBS_DEB_ASSOC); 130 lbs_deb_enter(LBS_DEB_ASSOC);
@@ -138,11 +137,11 @@ int lbs_associate(struct lbs_private *priv, struct assoc_request *assoc_req)
138 goto done; 137 goto done;
139 138
140 /* set preamble to firmware */ 139 /* set preamble to firmware */
141 if ( (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) 140 if ( (priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
142 && (assoc_req->bss.capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) 141 && (assoc_req->bss.capability & WLAN_CAPABILITY_SHORT_PREAMBLE))
143 adapter->preamble = CMD_TYPE_SHORT_PREAMBLE; 142 priv->preamble = CMD_TYPE_SHORT_PREAMBLE;
144 else 143 else
145 adapter->preamble = CMD_TYPE_LONG_PREAMBLE; 144 priv->preamble = CMD_TYPE_LONG_PREAMBLE;
146 145
147 lbs_set_radio_control(priv); 146 lbs_set_radio_control(priv);
148 147
@@ -164,17 +163,16 @@ done:
164int lbs_start_adhoc_network(struct lbs_private *priv, 163int lbs_start_adhoc_network(struct lbs_private *priv,
165 struct assoc_request *assoc_req) 164 struct assoc_request *assoc_req)
166{ 165{
167 struct lbs_adapter *adapter = priv->adapter;
168 int ret = 0; 166 int ret = 0;
169 167
170 adapter->adhoccreate = 1; 168 priv->adhoccreate = 1;
171 169
172 if (adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) { 170 if (priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) {
173 lbs_deb_join("AdhocStart: Short preamble\n"); 171 lbs_deb_join("AdhocStart: Short preamble\n");
174 adapter->preamble = CMD_TYPE_SHORT_PREAMBLE; 172 priv->preamble = CMD_TYPE_SHORT_PREAMBLE;
175 } else { 173 } else {
176 lbs_deb_join("AdhocStart: Long preamble\n"); 174 lbs_deb_join("AdhocStart: Long preamble\n");
177 adapter->preamble = CMD_TYPE_LONG_PREAMBLE; 175 priv->preamble = CMD_TYPE_LONG_PREAMBLE;
178 } 176 }
179 177
180 lbs_set_radio_control(priv); 178 lbs_set_radio_control(priv);
@@ -200,26 +198,25 @@ int lbs_start_adhoc_network(struct lbs_private *priv,
200int lbs_join_adhoc_network(struct lbs_private *priv, 198int lbs_join_adhoc_network(struct lbs_private *priv,
201 struct assoc_request *assoc_req) 199 struct assoc_request *assoc_req)
202{ 200{
203 struct lbs_adapter *adapter = priv->adapter;
204 struct bss_descriptor * bss = &assoc_req->bss; 201 struct bss_descriptor * bss = &assoc_req->bss;
205 int ret = 0; 202 int ret = 0;
206 203
207 lbs_deb_join("%s: Current SSID '%s', ssid length %u\n", 204 lbs_deb_join("%s: Current SSID '%s', ssid length %u\n",
208 __func__, 205 __func__,
209 escape_essid(adapter->curbssparams.ssid, 206 escape_essid(priv->curbssparams.ssid,
210 adapter->curbssparams.ssid_len), 207 priv->curbssparams.ssid_len),
211 adapter->curbssparams.ssid_len); 208 priv->curbssparams.ssid_len);
212 lbs_deb_join("%s: requested ssid '%s', ssid length %u\n", 209 lbs_deb_join("%s: requested ssid '%s', ssid length %u\n",
213 __func__, escape_essid(bss->ssid, bss->ssid_len), 210 __func__, escape_essid(bss->ssid, bss->ssid_len),
214 bss->ssid_len); 211 bss->ssid_len);
215 212
216 /* check if the requested SSID is already joined */ 213 /* check if the requested SSID is already joined */
217 if ( adapter->curbssparams.ssid_len 214 if ( priv->curbssparams.ssid_len
218 && !lbs_ssid_cmp(adapter->curbssparams.ssid, 215 && !lbs_ssid_cmp(priv->curbssparams.ssid,
219 adapter->curbssparams.ssid_len, 216 priv->curbssparams.ssid_len,
220 bss->ssid, bss->ssid_len) 217 bss->ssid, bss->ssid_len)
221 && (adapter->mode == IW_MODE_ADHOC) 218 && (priv->mode == IW_MODE_ADHOC)
222 && (adapter->connect_status == LBS_CONNECTED)) { 219 && (priv->connect_status == LBS_CONNECTED)) {
223 union iwreq_data wrqu; 220 union iwreq_data wrqu;
224 221
225 lbs_deb_join("ADHOC_J_CMD: New ad-hoc SSID is the same as " 222 lbs_deb_join("ADHOC_J_CMD: New ad-hoc SSID is the same as "
@@ -229,7 +226,7 @@ int lbs_join_adhoc_network(struct lbs_private *priv,
229 * request really was successful, even if just a null-op. 226 * request really was successful, even if just a null-op.
230 */ 227 */
231 memset(&wrqu, 0, sizeof(wrqu)); 228 memset(&wrqu, 0, sizeof(wrqu));
232 memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, 229 memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid,
233 ETH_ALEN); 230 ETH_ALEN);
234 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 231 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
235 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); 232 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
@@ -239,12 +236,12 @@ int lbs_join_adhoc_network(struct lbs_private *priv,
239 /* Use shortpreamble only when both creator and card supports 236 /* Use shortpreamble only when both creator and card supports
240 short preamble */ 237 short preamble */
241 if ( !(bss->capability & WLAN_CAPABILITY_SHORT_PREAMBLE) 238 if ( !(bss->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
242 || !(adapter->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) { 239 || !(priv->capability & WLAN_CAPABILITY_SHORT_PREAMBLE)) {
243 lbs_deb_join("AdhocJoin: Long preamble\n"); 240 lbs_deb_join("AdhocJoin: Long preamble\n");
244 adapter->preamble = CMD_TYPE_LONG_PREAMBLE; 241 priv->preamble = CMD_TYPE_LONG_PREAMBLE;
245 } else { 242 } else {
246 lbs_deb_join("AdhocJoin: Short preamble\n"); 243 lbs_deb_join("AdhocJoin: Short preamble\n");
247 adapter->preamble = CMD_TYPE_SHORT_PREAMBLE; 244 priv->preamble = CMD_TYPE_SHORT_PREAMBLE;
248 } 245 }
249 246
250 lbs_set_radio_control(priv); 247 lbs_set_radio_control(priv);
@@ -252,7 +249,7 @@ int lbs_join_adhoc_network(struct lbs_private *priv,
252 lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel); 249 lbs_deb_join("AdhocJoin: channel = %d\n", assoc_req->channel);
253 lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band); 250 lbs_deb_join("AdhocJoin: band = %c\n", assoc_req->band);
254 251
255 adapter->adhoccreate = 0; 252 priv->adhoccreate = 0;
256 253
257 ret = lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_JOIN, 254 ret = lbs_prepare_and_send_command(priv, CMD_802_11_AD_HOC_JOIN,
258 0, CMD_OPTION_WAITFORRSP, 255 0, CMD_OPTION_WAITFORRSP,
@@ -293,7 +290,6 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv,
293 struct cmd_ds_command *cmd, 290 struct cmd_ds_command *cmd,
294 void *pdata_buf) 291 void *pdata_buf)
295{ 292{
296 struct lbs_adapter *adapter = priv->adapter;
297 struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth; 293 struct cmd_ds_802_11_authenticate *pauthenticate = &cmd->params.auth;
298 int ret = -1; 294 int ret = -1;
299 u8 *bssid = pdata_buf; 295 u8 *bssid = pdata_buf;
@@ -306,7 +302,7 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv,
306 + S_DS_GEN); 302 + S_DS_GEN);
307 303
308 /* translate auth mode to 802.11 defined wire value */ 304 /* translate auth mode to 802.11 defined wire value */
309 switch (adapter->secinfo.auth_mode) { 305 switch (priv->secinfo.auth_mode) {
310 case IW_AUTH_ALG_OPEN_SYSTEM: 306 case IW_AUTH_ALG_OPEN_SYSTEM:
311 pauthenticate->authtype = 0x00; 307 pauthenticate->authtype = 0x00;
312 break; 308 break;
@@ -318,7 +314,7 @@ int lbs_cmd_80211_authenticate(struct lbs_private *priv,
318 break; 314 break;
319 default: 315 default:
320 lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n", 316 lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n",
321 adapter->secinfo.auth_mode); 317 priv->secinfo.auth_mode);
322 goto out; 318 goto out;
323 } 319 }
324 320
@@ -336,7 +332,6 @@ out:
336int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, 332int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
337 struct cmd_ds_command *cmd) 333 struct cmd_ds_command *cmd)
338{ 334{
339 struct lbs_adapter *adapter = priv->adapter;
340 struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; 335 struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth;
341 336
342 lbs_deb_enter(LBS_DEB_JOIN); 337 lbs_deb_enter(LBS_DEB_JOIN);
@@ -346,7 +341,7 @@ int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
346 S_DS_GEN); 341 S_DS_GEN);
347 342
348 /* set AP MAC address */ 343 /* set AP MAC address */
349 memmove(dauth->macaddr, adapter->curbssparams.bssid, ETH_ALEN); 344 memmove(dauth->macaddr, priv->curbssparams.bssid, ETH_ALEN);
350 345
351 /* Reason code 3 = Station is leaving */ 346 /* Reason code 3 = Station is leaving */
352#define REASON_CODE_STA_LEAVING 3 347#define REASON_CODE_STA_LEAVING 3
@@ -359,7 +354,6 @@ int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
359int lbs_cmd_80211_associate(struct lbs_private *priv, 354int lbs_cmd_80211_associate(struct lbs_private *priv,
360 struct cmd_ds_command *cmd, void *pdata_buf) 355 struct cmd_ds_command *cmd, void *pdata_buf)
361{ 356{
362 struct lbs_adapter *adapter = priv->adapter;
363 struct cmd_ds_802_11_associate *passo = &cmd->params.associate; 357 struct cmd_ds_802_11_associate *passo = &cmd->params.associate;
364 int ret = 0; 358 int ret = 0;
365 struct assoc_request * assoc_req = pdata_buf; 359 struct assoc_request * assoc_req = pdata_buf;
@@ -376,7 +370,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
376 370
377 pos = (u8 *) passo; 371 pos = (u8 *) passo;
378 372
379 if (!adapter) { 373 if (!priv) {
380 ret = -1; 374 ret = -1;
381 goto done; 375 goto done;
382 } 376 }
@@ -420,7 +414,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
420 rates->header.type = cpu_to_le16(TLV_TYPE_RATES); 414 rates->header.type = cpu_to_le16(TLV_TYPE_RATES);
421 memcpy(&rates->rates, &bss->rates, MAX_RATES); 415 memcpy(&rates->rates, &bss->rates, MAX_RATES);
422 tmplen = MAX_RATES; 416 tmplen = MAX_RATES;
423 if (get_common_rates(adapter, rates->rates, &tmplen)) { 417 if (get_common_rates(priv, rates->rates, &tmplen)) {
424 ret = -1; 418 ret = -1;
425 goto done; 419 goto done;
426 } 420 }
@@ -429,8 +423,8 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
429 lbs_deb_assoc("ASSOC_CMD: num rates %u\n", tmplen); 423 lbs_deb_assoc("ASSOC_CMD: num rates %u\n", tmplen);
430 424
431 /* Copy the infra. association rates into Current BSS state structure */ 425 /* Copy the infra. association rates into Current BSS state structure */
432 memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); 426 memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates));
433 memcpy(&adapter->curbssparams.rates, &rates->rates, tmplen); 427 memcpy(&priv->curbssparams.rates, &rates->rates, tmplen);
434 428
435 /* Set MSB on basic rates as the firmware requires, but _after_ 429 /* Set MSB on basic rates as the firmware requires, but _after_
436 * copying to current bss rates. 430 * copying to current bss rates.
@@ -450,7 +444,7 @@ int lbs_cmd_80211_associate(struct lbs_private *priv,
450 } 444 }
451 445
452 /* update curbssparams */ 446 /* update curbssparams */
453 adapter->curbssparams.channel = bss->phyparamset.dsparamset.currentchan; 447 priv->curbssparams.channel = bss->phyparamset.dsparamset.currentchan;
454 448
455 if (lbs_parse_dnld_countryinfo_11d(priv, bss)) { 449 if (lbs_parse_dnld_countryinfo_11d(priv, bss)) {
456 ret = -1; 450 ret = -1;
@@ -474,7 +468,6 @@ done:
474int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv, 468int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
475 struct cmd_ds_command *cmd, void *pdata_buf) 469 struct cmd_ds_command *cmd, void *pdata_buf)
476{ 470{
477 struct lbs_adapter *adapter = priv->adapter;
478 struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads; 471 struct cmd_ds_802_11_ad_hoc_start *adhs = &cmd->params.ads;
479 int ret = 0; 472 int ret = 0;
480 int cmdappendsize = 0; 473 int cmdappendsize = 0;
@@ -484,7 +477,7 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
484 477
485 lbs_deb_enter(LBS_DEB_JOIN); 478 lbs_deb_enter(LBS_DEB_JOIN);
486 479
487 if (!adapter) { 480 if (!priv) {
488 ret = -1; 481 ret = -1;
489 goto done; 482 goto done;
490 } 483 }
@@ -494,7 +487,7 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
494 /* 487 /*
495 * Fill in the parameters for 2 data structures: 488 * Fill in the parameters for 2 data structures:
496 * 1. cmd_ds_802_11_ad_hoc_start command 489 * 1. cmd_ds_802_11_ad_hoc_start command
497 * 2. adapter->scantable[i] 490 * 2. priv->scantable[i]
498 * 491 *
499 * Driver will fill up SSID, bsstype,IBSS param, Physical Param, 492 * Driver will fill up SSID, bsstype,IBSS param, Physical Param,
500 * probe delay, and cap info. 493 * probe delay, and cap info.
@@ -512,10 +505,10 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
512 505
513 /* set the BSS type */ 506 /* set the BSS type */
514 adhs->bsstype = CMD_BSS_TYPE_IBSS; 507 adhs->bsstype = CMD_BSS_TYPE_IBSS;
515 adapter->mode = IW_MODE_ADHOC; 508 priv->mode = IW_MODE_ADHOC;
516 if (adapter->beacon_period == 0) 509 if (priv->beacon_period == 0)
517 adapter->beacon_period = MRVDRV_BEACON_INTERVAL; 510 priv->beacon_period = MRVDRV_BEACON_INTERVAL;
518 adhs->beaconperiod = cpu_to_le16(adapter->beacon_period); 511 adhs->beaconperiod = cpu_to_le16(priv->beacon_period);
519 512
520 /* set Physical param set */ 513 /* set Physical param set */
521#define DS_PARA_IE_ID 3 514#define DS_PARA_IE_ID 3
@@ -557,8 +550,8 @@ int lbs_cmd_80211_ad_hoc_start(struct lbs_private *priv,
557 memcpy(adhs->rates, lbs_bg_rates, ratesize); 550 memcpy(adhs->rates, lbs_bg_rates, ratesize);
558 551
559 /* Copy the ad-hoc creating rates into Current BSS state structure */ 552 /* Copy the ad-hoc creating rates into Current BSS state structure */
560 memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); 553 memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates));
561 memcpy(&adapter->curbssparams.rates, &adhs->rates, ratesize); 554 memcpy(&priv->curbssparams.rates, &adhs->rates, ratesize);
562 555
563 /* Set MSB on basic rates as the firmware requires, but _after_ 556 /* Set MSB on basic rates as the firmware requires, but _after_
564 * copying to current bss rates. 557 * copying to current bss rates.
@@ -597,7 +590,6 @@ int lbs_cmd_80211_ad_hoc_stop(struct lbs_private *priv,
597int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv, 590int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
598 struct cmd_ds_command *cmd, void *pdata_buf) 591 struct cmd_ds_command *cmd, void *pdata_buf)
599{ 592{
600 struct lbs_adapter *adapter = priv->adapter;
601 struct cmd_ds_802_11_ad_hoc_join *join_cmd = &cmd->params.adj; 593 struct cmd_ds_802_11_ad_hoc_join *join_cmd = &cmd->params.adj;
602 struct assoc_request * assoc_req = pdata_buf; 594 struct assoc_request * assoc_req = pdata_buf;
603 struct bss_descriptor *bss = &assoc_req->bss; 595 struct bss_descriptor *bss = &assoc_req->bss;
@@ -638,21 +630,21 @@ int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
638 /* probedelay */ 630 /* probedelay */
639 join_cmd->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME); 631 join_cmd->probedelay = cpu_to_le16(CMD_SCAN_PROBE_DELAY_TIME);
640 632
641 adapter->curbssparams.channel = bss->channel; 633 priv->curbssparams.channel = bss->channel;
642 634
643 /* Copy Data rates from the rates recorded in scan response */ 635 /* Copy Data rates from the rates recorded in scan response */
644 memset(join_cmd->bss.rates, 0, sizeof(join_cmd->bss.rates)); 636 memset(join_cmd->bss.rates, 0, sizeof(join_cmd->bss.rates));
645 ratesize = min_t(u16, sizeof(join_cmd->bss.rates), MAX_RATES); 637 ratesize = min_t(u16, sizeof(join_cmd->bss.rates), MAX_RATES);
646 memcpy(join_cmd->bss.rates, bss->rates, ratesize); 638 memcpy(join_cmd->bss.rates, bss->rates, ratesize);
647 if (get_common_rates(adapter, join_cmd->bss.rates, &ratesize)) { 639 if (get_common_rates(priv, join_cmd->bss.rates, &ratesize)) {
648 lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n"); 640 lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n");
649 ret = -1; 641 ret = -1;
650 goto done; 642 goto done;
651 } 643 }
652 644
653 /* Copy the ad-hoc creating rates into Current BSS state structure */ 645 /* Copy the ad-hoc creating rates into Current BSS state structure */
654 memset(&adapter->curbssparams.rates, 0, sizeof(adapter->curbssparams.rates)); 646 memset(&priv->curbssparams.rates, 0, sizeof(priv->curbssparams.rates));
655 memcpy(&adapter->curbssparams.rates, join_cmd->bss.rates, ratesize); 647 memcpy(&priv->curbssparams.rates, join_cmd->bss.rates, ratesize);
656 648
657 /* Set MSB on basic rates as the firmware requires, but _after_ 649 /* Set MSB on basic rates as the firmware requires, but _after_
658 * copying to current bss rates. 650 * copying to current bss rates.
@@ -668,7 +660,7 @@ int lbs_cmd_80211_ad_hoc_join(struct lbs_private *priv,
668 join_cmd->bss.capability = cpu_to_le16(tmp); 660 join_cmd->bss.capability = cpu_to_le16(tmp);
669 } 661 }
670 662
671 if (adapter->psmode == LBS802_11POWERMODEMAX_PSP) { 663 if (priv->psmode == LBS802_11POWERMODEMAX_PSP) {
672 /* wake up first */ 664 /* wake up first */
673 __le32 Localpsmode; 665 __le32 Localpsmode;
674 666
@@ -700,7 +692,6 @@ done:
700int lbs_ret_80211_associate(struct lbs_private *priv, 692int lbs_ret_80211_associate(struct lbs_private *priv,
701 struct cmd_ds_command *resp) 693 struct cmd_ds_command *resp)
702{ 694{
703 struct lbs_adapter *adapter = priv->adapter;
704 int ret = 0; 695 int ret = 0;
705 union iwreq_data wrqu; 696 union iwreq_data wrqu;
706 struct ieeetypes_assocrsp *passocrsp; 697 struct ieeetypes_assocrsp *passocrsp;
@@ -709,12 +700,12 @@ int lbs_ret_80211_associate(struct lbs_private *priv,
709 700
710 lbs_deb_enter(LBS_DEB_ASSOC); 701 lbs_deb_enter(LBS_DEB_ASSOC);
711 702
712 if (!adapter->in_progress_assoc_req) { 703 if (!priv->in_progress_assoc_req) {
713 lbs_deb_assoc("ASSOC_RESP: no in-progress assoc request\n"); 704 lbs_deb_assoc("ASSOC_RESP: no in-progress assoc request\n");
714 ret = -1; 705 ret = -1;
715 goto done; 706 goto done;
716 } 707 }
717 bss = &adapter->in_progress_assoc_req->bss; 708 bss = &priv->in_progress_assoc_req->bss;
718 709
719 passocrsp = (struct ieeetypes_assocrsp *) & resp->params; 710 passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
720 711
@@ -771,29 +762,29 @@ int lbs_ret_80211_associate(struct lbs_private *priv,
771 le16_to_cpu(resp->size) - S_DS_GEN); 762 le16_to_cpu(resp->size) - S_DS_GEN);
772 763
773 /* Send a Media Connected event, according to the Spec */ 764 /* Send a Media Connected event, according to the Spec */
774 adapter->connect_status = LBS_CONNECTED; 765 priv->connect_status = LBS_CONNECTED;
775 766
776 /* Update current SSID and BSSID */ 767 /* Update current SSID and BSSID */
777 memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); 768 memcpy(&priv->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
778 adapter->curbssparams.ssid_len = bss->ssid_len; 769 priv->curbssparams.ssid_len = bss->ssid_len;
779 memcpy(adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); 770 memcpy(priv->curbssparams.bssid, bss->bssid, ETH_ALEN);
780 771
781 lbs_deb_assoc("ASSOC_RESP: currentpacketfilter is 0x%x\n", 772 lbs_deb_assoc("ASSOC_RESP: currentpacketfilter is 0x%x\n",
782 adapter->currentpacketfilter); 773 priv->currentpacketfilter);
783 774
784 adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0; 775 priv->SNR[TYPE_RXPD][TYPE_AVG] = 0;
785 adapter->NF[TYPE_RXPD][TYPE_AVG] = 0; 776 priv->NF[TYPE_RXPD][TYPE_AVG] = 0;
786 777
787 memset(adapter->rawSNR, 0x00, sizeof(adapter->rawSNR)); 778 memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR));
788 memset(adapter->rawNF, 0x00, sizeof(adapter->rawNF)); 779 memset(priv->rawNF, 0x00, sizeof(priv->rawNF));
789 adapter->nextSNRNF = 0; 780 priv->nextSNRNF = 0;
790 adapter->numSNRNF = 0; 781 priv->numSNRNF = 0;
791 782
792 netif_carrier_on(priv->dev); 783 netif_carrier_on(priv->dev);
793 netif_wake_queue(priv->dev); 784 netif_wake_queue(priv->dev);
794 785
795 786
796 memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); 787 memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN);
797 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 788 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
798 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); 789 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
799 790
@@ -816,7 +807,6 @@ int lbs_ret_80211_disassociate(struct lbs_private *priv,
816int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv, 807int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
817 struct cmd_ds_command *resp) 808 struct cmd_ds_command *resp)
818{ 809{
819 struct lbs_adapter *adapter = priv->adapter;
820 int ret = 0; 810 int ret = 0;
821 u16 command = le16_to_cpu(resp->command); 811 u16 command = le16_to_cpu(resp->command);
822 u16 result = le16_to_cpu(resp->result); 812 u16 result = le16_to_cpu(resp->result);
@@ -833,19 +823,19 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
833 lbs_deb_join("ADHOC_RESP: command = %x\n", command); 823 lbs_deb_join("ADHOC_RESP: command = %x\n", command);
834 lbs_deb_join("ADHOC_RESP: result = %x\n", result); 824 lbs_deb_join("ADHOC_RESP: result = %x\n", result);
835 825
836 if (!adapter->in_progress_assoc_req) { 826 if (!priv->in_progress_assoc_req) {
837 lbs_deb_join("ADHOC_RESP: no in-progress association request\n"); 827 lbs_deb_join("ADHOC_RESP: no in-progress association request\n");
838 ret = -1; 828 ret = -1;
839 goto done; 829 goto done;
840 } 830 }
841 bss = &adapter->in_progress_assoc_req->bss; 831 bss = &priv->in_progress_assoc_req->bss;
842 832
843 /* 833 /*
844 * Join result code 0 --> SUCCESS 834 * Join result code 0 --> SUCCESS
845 */ 835 */
846 if (result) { 836 if (result) {
847 lbs_deb_join("ADHOC_RESP: failed\n"); 837 lbs_deb_join("ADHOC_RESP: failed\n");
848 if (adapter->connect_status == LBS_CONNECTED) { 838 if (priv->connect_status == LBS_CONNECTED) {
849 lbs_mac_event_disconnected(priv); 839 lbs_mac_event_disconnected(priv);
850 } 840 }
851 ret = -1; 841 ret = -1;
@@ -860,7 +850,7 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
860 escape_essid(bss->ssid, bss->ssid_len)); 850 escape_essid(bss->ssid, bss->ssid_len));
861 851
862 /* Send a Media Connected event, according to the Spec */ 852 /* Send a Media Connected event, according to the Spec */
863 adapter->connect_status = LBS_CONNECTED; 853 priv->connect_status = LBS_CONNECTED;
864 854
865 if (command == CMD_RET(CMD_802_11_AD_HOC_START)) { 855 if (command == CMD_RET(CMD_802_11_AD_HOC_START)) {
866 /* Update the created network descriptor with the new BSSID */ 856 /* Update the created network descriptor with the new BSSID */
@@ -868,22 +858,22 @@ int lbs_ret_80211_ad_hoc_start(struct lbs_private *priv,
868 } 858 }
869 859
870 /* Set the BSSID from the joined/started descriptor */ 860 /* Set the BSSID from the joined/started descriptor */
871 memcpy(&adapter->curbssparams.bssid, bss->bssid, ETH_ALEN); 861 memcpy(&priv->curbssparams.bssid, bss->bssid, ETH_ALEN);
872 862
873 /* Set the new SSID to current SSID */ 863 /* Set the new SSID to current SSID */
874 memcpy(&adapter->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE); 864 memcpy(&priv->curbssparams.ssid, &bss->ssid, IW_ESSID_MAX_SIZE);
875 adapter->curbssparams.ssid_len = bss->ssid_len; 865 priv->curbssparams.ssid_len = bss->ssid_len;
876 866
877 netif_carrier_on(priv->dev); 867 netif_carrier_on(priv->dev);
878 netif_wake_queue(priv->dev); 868 netif_wake_queue(priv->dev);
879 869
880 memset(&wrqu, 0, sizeof(wrqu)); 870 memset(&wrqu, 0, sizeof(wrqu));
881 memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); 871 memcpy(wrqu.ap_addr.sa_data, priv->curbssparams.bssid, ETH_ALEN);
882 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 872 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
883 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL); 873 wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
884 874
885 lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n"); 875 lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n");
886 lbs_deb_join("ADHOC_RESP: channel = %d\n", adapter->curbssparams.channel); 876 lbs_deb_join("ADHOC_RESP: channel = %d\n", priv->curbssparams.channel);
887 lbs_deb_join("ADHOC_RESP: BSSID = %s\n", 877 lbs_deb_join("ADHOC_RESP: BSSID = %s\n",
888 print_mac(mac, padhocresult->bssid)); 878 print_mac(mac, padhocresult->bssid));
889 879