aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2007-05-25 11:27:16 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-11 14:28:37 -0400
commit9012b28a407511fb355f6d2176a12d4653489672 (patch)
tree771b0f7adb9dbab5c907981bd4fa3a7f6219587d /drivers/net/wireless
parent46868202b2dd22156460a220553a223f406f4f22 (diff)
[PATCH] libertas: make debug configurable
The debug output of libertas was either not present or it was overwhelming. This patch adds the possibility to specify a bitmask for the area of interest. One should then only get the desired output. Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/libertas/11d.c137
-rw-r--r--drivers/net/wireless/libertas/assoc.c99
-rw-r--r--drivers/net/wireless/libertas/cmd.c249
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c158
-rw-r--r--drivers/net/wireless/libertas/debugfs.c6
-rw-r--r--drivers/net/wireless/libertas/defs.h87
-rw-r--r--drivers/net/wireless/libertas/ethtool.c34
-rw-r--r--drivers/net/wireless/libertas/fw.c44
-rw-r--r--drivers/net/wireless/libertas/if_usb.c146
-rw-r--r--drivers/net/wireless/libertas/ioctl.c165
-rw-r--r--drivers/net/wireless/libertas/join.c139
-rw-r--r--drivers/net/wireless/libertas/main.c192
-rw-r--r--drivers/net/wireless/libertas/rx.c50
-rw-r--r--drivers/net/wireless/libertas/scan.c174
-rw-r--r--drivers/net/wireless/libertas/thread.h8
-rw-r--r--drivers/net/wireless/libertas/tx.c17
-rw-r--r--drivers/net/wireless/libertas/wext.c352
17 files changed, 1082 insertions, 975 deletions
diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c
index e0ecc4d483bb..ab76798df0eb 100644
--- a/drivers/net/wireless/libertas/11d.c
+++ b/drivers/net/wireless/libertas/11d.c
@@ -95,7 +95,7 @@ static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan)
95 95
96 for (i = 0; i < cfp_no; i++) { 96 for (i = 0; i < cfp_no; i++) {
97 if ((cfp + i)->channel == firstchan) { 97 if ((cfp + i)->channel == firstchan) {
98 lbs_pr_debug(1, "firstchan found\n"); 98 lbs_deb_11d("firstchan found\n");
99 break; 99 break;
100 } 100 }
101 } 101 }
@@ -129,12 +129,12 @@ static u8 wlan_channel_known_11d(u8 chan,
129 129
130 for (i = 0; i < nr_chan; i++) { 130 for (i = 0; i < nr_chan; i++) {
131 if (chan == chanpwr[i].chan) { 131 if (chan == chanpwr[i].chan) {
132 lbs_pr_debug(1, "11D: Found Chan:%d\n", chan); 132 lbs_deb_11d("11D: Found Chan:%d\n", chan);
133 return 1; 133 return 1;
134 } 134 }
135 } 135 }
136 136
137 lbs_pr_debug(1, "11D: Not Find Chan:%d\n", chan); 137 lbs_deb_11d("11D: Not Find Chan:%d\n", chan);
138 return 0; 138 return 0;
139} 139}
140 140
@@ -174,7 +174,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
174 memcpy(domaininfo->countrycode, parsed_region_chan->countrycode, 174 memcpy(domaininfo->countrycode, parsed_region_chan->countrycode,
175 COUNTRY_CODE_LEN); 175 COUNTRY_CODE_LEN);
176 176
177 lbs_pr_debug(1, "11D:nrchan=%d\n", nr_chan); 177 lbs_deb_11d("11D:nrchan=%d\n", nr_chan);
178 lbs_dbg_hex("11D:parsed_region_chan:", (char *)parsed_region_chan, 178 lbs_dbg_hex("11D:parsed_region_chan:", (char *)parsed_region_chan,
179 sizeof(struct parsed_region_chan_11d)); 179 sizeof(struct parsed_region_chan_11d));
180 180
@@ -212,7 +212,7 @@ static int generate_domain_info_11d(struct parsed_region_chan_11d
212 } 212 }
213 domaininfo->nr_subband = nr_subband; 213 domaininfo->nr_subband = nr_subband;
214 214
215 lbs_pr_debug(1, "nr_subband=%x\n", domaininfo->nr_subband); 215 lbs_deb_11d("nr_subband=%x\n", domaininfo->nr_subband);
216 lbs_dbg_hex("11D:domaininfo:", (char *)domaininfo, 216 lbs_dbg_hex("11D:domaininfo:", (char *)domaininfo,
217 COUNTRY_CODE_LEN + 1 + 217 COUNTRY_CODE_LEN + 1 +
218 sizeof(struct ieeetypes_subbandset) * nr_subband); 218 sizeof(struct ieeetypes_subbandset) * nr_subband);
@@ -233,13 +233,13 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_
233 struct chan_freq_power *cfp; 233 struct chan_freq_power *cfp;
234 234
235 if (region_chan == NULL) { 235 if (region_chan == NULL) {
236 lbs_pr_debug(1, "11D: region_chan is NULL\n"); 236 lbs_deb_11d("11D: region_chan is NULL\n");
237 return; 237 return;
238 } 238 }
239 239
240 cfp = region_chan->CFP; 240 cfp = region_chan->CFP;
241 if (cfp == NULL) { 241 if (cfp == NULL) {
242 lbs_pr_debug(1, "11D: cfp equal NULL \n"); 242 lbs_deb_11d("11D: cfp equal NULL \n");
243 return; 243 return;
244 } 244 }
245 245
@@ -248,19 +248,19 @@ static void wlan_generate_parsed_region_chan_11d(struct region_channel * region_
248 memcpy(parsed_region_chan->countrycode, 248 memcpy(parsed_region_chan->countrycode,
249 wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN); 249 wlan_code_2_region(region_chan->region), COUNTRY_CODE_LEN);
250 250
251 lbs_pr_debug(1, "11D: region[0x%x] band[%d]\n", parsed_region_chan->region, 251 lbs_deb_11d("11D: region[0x%x] band[%d]\n", parsed_region_chan->region,
252 parsed_region_chan->band); 252 parsed_region_chan->band);
253 253
254 for (i = 0; i < region_chan->nrcfp; i++, cfp++) { 254 for (i = 0; i < region_chan->nrcfp; i++, cfp++) {
255 parsed_region_chan->chanpwr[i].chan = cfp->channel; 255 parsed_region_chan->chanpwr[i].chan = cfp->channel;
256 parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower; 256 parsed_region_chan->chanpwr[i].pwr = cfp->maxtxpower;
257 lbs_pr_debug(1, "11D: Chan[%d] Pwr[%d]\n", 257 lbs_deb_11d("11D: Chan[%d] Pwr[%d]\n",
258 parsed_region_chan->chanpwr[i].chan, 258 parsed_region_chan->chanpwr[i].chan,
259 parsed_region_chan->chanpwr[i].pwr); 259 parsed_region_chan->chanpwr[i].pwr);
260 } 260 }
261 parsed_region_chan->nr_chan = region_chan->nrcfp; 261 parsed_region_chan->nr_chan = region_chan->nrcfp;
262 262
263 lbs_pr_debug(1, "11D: nrchan[%d]\n", parsed_region_chan->nr_chan); 263 lbs_deb_11d("11D: nrchan[%d]\n", parsed_region_chan->nr_chan);
264 264
265 return; 265 return;
266} 266}
@@ -277,8 +277,9 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan)
277 struct chan_freq_power *cfp; 277 struct chan_freq_power *cfp;
278 int cfp_no; 278 int cfp_no;
279 u8 idx; 279 u8 idx;
280 int ret = 0;
280 281
281 ENTER(); 282 lbs_deb_enter(LBS_DEB_11D);
282 283
283 cfp = libertas_get_region_cfp_table(region, band, &cfp_no); 284 cfp = libertas_get_region_cfp_table(region, band, &cfp_no);
284 if (cfp == NULL) 285 if (cfp == NULL)
@@ -288,16 +289,19 @@ static u8 wlan_region_chan_supported_11d(u8 region, u8 band, u8 chan)
288 if (chan == (cfp + idx)->channel) { 289 if (chan == (cfp + idx)->channel) {
289 /* If Mrvl Chip Supported? */ 290 /* If Mrvl Chip Supported? */
290 if ((cfp + idx)->unsupported) { 291 if ((cfp + idx)->unsupported) {
291 return 0; 292 ret = 0;
292 } else { 293 } else {
293 return 1; 294 ret = 1;
294 } 295 }
296 goto done;
295 } 297 }
296 } 298 }
297 299
298 /*chan is not in the region table */ 300 /*chan is not in the region table */
299 LEAVE(); 301
300 return 0; 302done:
303 lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
304 return ret;
301} 305}
302 306
303/** 307/**
@@ -321,7 +325,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
321 325
322 u8 j, i; 326 u8 j, i;
323 327
324 ENTER(); 328 lbs_deb_enter(LBS_DEB_11D);
325 329
326 /*validation Rules: 330 /*validation Rules:
327 1. valid region Code 331 1. valid region Code
@@ -337,15 +341,14 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
337 if ((*(countryinfo->countrycode)) == 0 341 if ((*(countryinfo->countrycode)) == 0
338 || (countryinfo->len <= COUNTRY_CODE_LEN)) { 342 || (countryinfo->len <= COUNTRY_CODE_LEN)) {
339 /* No region Info or Wrong region info: treat as No 11D info */ 343 /* No region Info or Wrong region info: treat as No 11D info */
340 LEAVE(); 344 goto done;
341 return 0;
342 } 345 }
343 346
344 /*Step1: check region_code */ 347 /*Step1: check region_code */
345 parsed_region_chan->region = region = 348 parsed_region_chan->region = region =
346 wlan_region_2_code(countryinfo->countrycode); 349 wlan_region_2_code(countryinfo->countrycode);
347 350
348 lbs_pr_debug(1, "regioncode=%x\n", (u8) parsed_region_chan->region); 351 lbs_deb_11d("regioncode=%x\n", (u8) parsed_region_chan->region);
349 lbs_dbg_hex("CountryCode:", (char *)countryinfo->countrycode, 352 lbs_dbg_hex("CountryCode:", (char *)countryinfo->countrycode,
350 COUNTRY_CODE_LEN); 353 COUNTRY_CODE_LEN);
351 354
@@ -361,7 +364,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
361 364
362 if (countryinfo->subband[j].firstchan <= lastchan) { 365 if (countryinfo->subband[j].firstchan <= lastchan) {
363 /*Step2&3. Check First Chan Num increment and no overlap */ 366 /*Step2&3. Check First Chan Num increment and no overlap */
364 lbs_pr_debug(1, "11D: Chan[%d>%d] Overlap\n", 367 lbs_deb_11d("11D: Chan[%d>%d] Overlap\n",
365 countryinfo->subband[j].firstchan, lastchan); 368 countryinfo->subband[j].firstchan, lastchan);
366 continue; 369 continue;
367 } 370 }
@@ -374,7 +377,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
374 377
375 if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) { 378 if (!wlan_get_chan_11d(band, firstchan, i, &curchan)) {
376 /* Chan is not found in UN table */ 379 /* Chan is not found in UN table */
377 lbs_pr_debug(1, "chan is not supported: %d \n", i); 380 lbs_deb_11d("chan is not supported: %d \n", i);
378 break; 381 break;
379 } 382 }
380 383
@@ -389,7 +392,7 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
389 idx++; 392 idx++;
390 } else { 393 } else {
391 /*not supported and ignore the chan */ 394 /*not supported and ignore the chan */
392 lbs_pr_debug(1, 395 lbs_deb_11d(
393 "11D:i[%d] chan[%d] unsupported in region[%x] band[%d]\n", 396 "11D:i[%d] chan[%d] unsupported in region[%x] band[%d]\n",
394 i, curchan, region, band); 397 i, curchan, region, band);
395 } 398 }
@@ -401,11 +404,12 @@ static int parse_domain_info_11d(struct ieeetypes_countryinfofullset*
401 404
402 parsed_region_chan->nr_chan = idx; 405 parsed_region_chan->nr_chan = idx;
403 406
404 lbs_pr_debug(1, "nrchan=%x\n", parsed_region_chan->nr_chan); 407 lbs_deb_11d("nrchan=%x\n", parsed_region_chan->nr_chan);
405 lbs_dbg_hex("11D:parsed_region_chan:", (u8 *) parsed_region_chan, 408 lbs_dbg_hex("11D:parsed_region_chan:", (u8 *) parsed_region_chan,
406 2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx); 409 2 + COUNTRY_CODE_LEN + sizeof(struct parsed_region_chan_11d) * idx);
407 410
408 LEAVE(); 411done:
412 lbs_deb_enter(LBS_DEB_11D);
409 return 0; 413 return 0;
410} 414}
411 415
@@ -420,16 +424,16 @@ u8 libertas_get_scan_type_11d(u8 chan,
420{ 424{
421 u8 scan_type = cmd_scan_type_passive; 425 u8 scan_type = cmd_scan_type_passive;
422 426
423 ENTER(); 427 lbs_deb_enter(LBS_DEB_11D);
424 428
425 if (wlan_channel_known_11d(chan, parsed_region_chan)) { 429 if (wlan_channel_known_11d(chan, parsed_region_chan)) {
426 lbs_pr_debug(1, "11D: Found and do Active Scan\n"); 430 lbs_deb_11d("11D: Found and do Active Scan\n");
427 scan_type = cmd_scan_type_active; 431 scan_type = cmd_scan_type_active;
428 } else { 432 } else {
429 lbs_pr_debug(1, "11D: Not Find and do Passive Scan\n"); 433 lbs_deb_11d("11D: Not Find and do Passive Scan\n");
430 } 434 }
431 435
432 LEAVE(); 436 lbs_deb_leave_args(LBS_DEB_11D, "ret scan_type %d", scan_type);
433 return scan_type; 437 return scan_type;
434 438
435} 439}
@@ -456,7 +460,7 @@ static int wlan_enable_11d(wlan_private * priv, u8 flag)
456 OID_802_11D_ENABLE, 460 OID_802_11D_ENABLE,
457 &priv->adapter->enable11d); 461 &priv->adapter->enable11d);
458 if (ret) 462 if (ret)
459 lbs_pr_debug(1, "11D: Fail to enable 11D \n"); 463 lbs_deb_11d("11D: Fail to enable 11D \n");
460 464
461 return 0; 465 return 0;
462} 466}
@@ -471,7 +475,7 @@ static int set_domain_info_11d(wlan_private * priv)
471 int ret; 475 int ret;
472 476
473 if (!priv->adapter->enable11d) { 477 if (!priv->adapter->enable11d) {
474 lbs_pr_debug(1, "11D: dnld domain Info with 11d disabled\n"); 478 lbs_deb_11d("11D: dnld domain Info with 11d disabled\n");
475 return 0; 479 return 0;
476 } 480 }
477 481
@@ -479,7 +483,7 @@ static int set_domain_info_11d(wlan_private * priv)
479 cmd_act_set, 483 cmd_act_set,
480 cmd_option_waitforrsp, 0, NULL); 484 cmd_option_waitforrsp, 0, NULL);
481 if (ret) 485 if (ret)
482 lbs_pr_debug(1, "11D: Fail to dnld domain Info\n"); 486 lbs_deb_11d("11D: Fail to dnld domain Info\n");
483 487
484 return ret; 488 return ret;
485} 489}
@@ -501,7 +505,7 @@ int libertas_set_universaltable(wlan_private * priv, u8 band)
501 505
502 adapter->universal_channel[i].nrcfp = 506 adapter->universal_channel[i].nrcfp =
503 sizeof(channel_freq_power_UN_BG) / size; 507 sizeof(channel_freq_power_UN_BG) / size;
504 lbs_pr_debug(1, "11D: BG-band nrcfp=%d\n", 508 lbs_deb_11d("11D: BG-band nrcfp=%d\n",
505 adapter->universal_channel[i].nrcfp); 509 adapter->universal_channel[i].nrcfp);
506 510
507 adapter->universal_channel[i].CFP = channel_freq_power_UN_BG; 511 adapter->universal_channel[i].CFP = channel_freq_power_UN_BG;
@@ -531,9 +535,9 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
531 wlan_adapter *adapter = priv->adapter; 535 wlan_adapter *adapter = priv->adapter;
532 u8 nr_subband = adapter->domainreg.nr_subband; 536 u8 nr_subband = adapter->domainreg.nr_subband;
533 537
534 ENTER(); 538 lbs_deb_enter(LBS_DEB_11D);
535 539
536 lbs_pr_debug(1, "nr_subband=%x\n", nr_subband); 540 lbs_deb_11d("nr_subband=%x\n", nr_subband);
537 541
538 cmd->command = cpu_to_le16(cmdno); 542 cmd->command = cpu_to_le16(cmdno);
539 pdomaininfo->action = cpu_to_le16(cmdoption); 543 pdomaininfo->action = cpu_to_le16(cmdoption);
@@ -542,8 +546,7 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
542 cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN); 546 cpu_to_le16(sizeof(pdomaininfo->action) + S_DS_GEN);
543 lbs_dbg_hex("11D: 802_11D_DOMAIN_INFO:", (u8 *) cmd, 547 lbs_dbg_hex("11D: 802_11D_DOMAIN_INFO:", (u8 *) cmd,
544 (int)(cmd->size)); 548 (int)(cmd->size));
545 LEAVE(); 549 goto done;
546 return 0;
547 } 550 }
548 551
549 domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN); 552 domain->header.type = cpu_to_le16(TLV_TYPE_DOMAIN);
@@ -569,8 +572,8 @@ int libertas_cmd_802_11d_domain_info(wlan_private * priv,
569 572
570 lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, (int)(cmd->size)); 573 lbs_dbg_hex("11D:802_11D_DOMAIN_INFO:", (u8 *) cmd, (int)(cmd->size));
571 574
572 LEAVE(); 575done:
573 576 lbs_deb_enter(LBS_DEB_11D);
574 return 0; 577 return 0;
575} 578}
576 579
@@ -585,17 +588,17 @@ int libertas_cmd_enable_11d(wlan_private * priv, struct iwreq *wrq)
585 int data = 0; 588 int data = 0;
586 int *val; 589 int *val;
587 590
588 ENTER(); 591 lbs_deb_enter(LBS_DEB_11D);
589 data = SUBCMD_DATA(wrq); 592 data = SUBCMD_DATA(wrq);
590 593
591 lbs_pr_debug(1, "enable 11D: %s\n", 594 lbs_deb_11d("enable 11D: %s\n",
592 (data == 1) ? "enable" : "Disable"); 595 (data == 1) ? "enable" : "Disable");
593 596
594 wlan_enable_11d(priv, data); 597 wlan_enable_11d(priv, data);
595 val = (int *)wrq->u.name; 598 val = (int *)wrq->u.name;
596 *val = priv->adapter->enable11d; 599 *val = priv->adapter->enable11d;
597 600
598 LEAVE(); 601 lbs_deb_enter(LBS_DEB_11D);
599 return 0; 602 return 0;
600} 603}
601 604
@@ -615,7 +618,7 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
615 s16 ret = 0; 618 s16 ret = 0;
616 u8 nr_subband = 0; 619 u8 nr_subband = 0;
617 620
618 ENTER(); 621 lbs_deb_enter(LBS_DEB_11D);
619 622
620 lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp, 623 lbs_dbg_hex("11D DOMAIN Info Rsp Data:", (u8 *) resp,
621 (int)le16_to_cpu(resp->size)); 624 (int)le16_to_cpu(resp->size));
@@ -623,10 +626,10 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
623 nr_subband = (domain->header.len - 3) / sizeof(struct ieeetypes_subbandset); 626 nr_subband = (domain->header.len - 3) / sizeof(struct ieeetypes_subbandset);
624 /* countrycode 3 bytes */ 627 /* countrycode 3 bytes */
625 628
626 lbs_pr_debug(1, "11D Domain Info Resp: nr_subband=%d\n", nr_subband); 629 lbs_deb_11d("11D Domain Info Resp: nr_subband=%d\n", nr_subband);
627 630
628 if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) { 631 if (nr_subband > MRVDRV_MAX_SUBBAND_802_11D) {
629 lbs_pr_debug(1, "Invalid Numrer of Subband returned!!\n"); 632 lbs_deb_11d("Invalid Numrer of Subband returned!!\n");
630 return -1; 633 return -1;
631 } 634 }
632 635
@@ -637,12 +640,12 @@ int libertas_ret_802_11d_domain_info(wlan_private * priv,
637 case cmd_act_get: 640 case cmd_act_get:
638 break; 641 break;
639 default: 642 default:
640 lbs_pr_debug(1, "Invalid action:%d\n", domaininfo->action); 643 lbs_deb_11d("Invalid action:%d\n", domaininfo->action);
641 ret = -1; 644 ret = -1;
642 break; 645 break;
643 } 646 }
644 647
645 LEAVE(); 648 lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
646 return ret; 649 return ret;
647} 650}
648 651
@@ -656,7 +659,7 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
656 int ret; 659 int ret;
657 wlan_adapter *adapter = priv->adapter; 660 wlan_adapter *adapter = priv->adapter;
658 661
659 ENTER(); 662 lbs_deb_enter(LBS_DEB_11D);
660 if (priv->adapter->enable11d) { 663 if (priv->adapter->enable11d) {
661 memset(&adapter->parsed_region_chan, 0, 664 memset(&adapter->parsed_region_chan, 0,
662 sizeof(struct parsed_region_chan_11d)); 665 sizeof(struct parsed_region_chan_11d));
@@ -665,9 +668,8 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
665 &adapter->parsed_region_chan); 668 &adapter->parsed_region_chan);
666 669
667 if (ret == -1) { 670 if (ret == -1) {
668 lbs_pr_debug(1, "11D: Err Parse domain_info from AP..\n"); 671 lbs_deb_11d("11D: Err Parse domain_info from AP..\n");
669 LEAVE(); 672 goto done;
670 return ret;
671 } 673 }
672 674
673 memset(&adapter->domainreg, 0, 675 memset(&adapter->domainreg, 0,
@@ -678,13 +680,15 @@ int libertas_parse_dnld_countryinfo_11d(wlan_private * priv)
678 ret = set_domain_info_11d(priv); 680 ret = set_domain_info_11d(priv);
679 681
680 if (ret) { 682 if (ret) {
681 lbs_pr_debug(1, "11D: Err set domainInfo to FW\n"); 683 lbs_deb_11d("11D: Err set domainInfo to FW\n");
682 LEAVE(); 684 goto done;
683 return ret;
684 } 685 }
685 } 686 }
686 LEAVE(); 687 ret = 0;
687 return 0; 688
689done:
690 lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
691 return ret;
688} 692}
689 693
690/** 694/**
@@ -699,8 +703,8 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
699 struct region_channel *region_chan; 703 struct region_channel *region_chan;
700 u8 j; 704 u8 j;
701 705
702 ENTER(); 706 lbs_deb_enter(LBS_DEB_11D);
703 lbs_pr_debug(1, "11D:curbssparams.band[%d]\n", adapter->curbssparams.band); 707 lbs_deb_11d("11D:curbssparams.band[%d]\n", adapter->curbssparams.band);
704 708
705 if (priv->adapter->enable11d) { 709 if (priv->adapter->enable11d) {
706 /* update parsed_region_chan_11; dnld domaininf to FW */ 710 /* update parsed_region_chan_11; dnld domaininf to FW */
@@ -709,7 +713,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
709 sizeof(adapter->region_channel[0]); j++) { 713 sizeof(adapter->region_channel[0]); j++) {
710 region_chan = &adapter->region_channel[j]; 714 region_chan = &adapter->region_channel[j];
711 715
712 lbs_pr_debug(1, "11D:[%d] region_chan->band[%d]\n", j, 716 lbs_deb_11d("11D:[%d] region_chan->band[%d]\n", j,
713 region_chan->band); 717 region_chan->band);
714 718
715 if (!region_chan || !region_chan->valid 719 if (!region_chan || !region_chan->valid
@@ -722,10 +726,10 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
722 726
723 if (j >= sizeof(adapter->region_channel) / 727 if (j >= sizeof(adapter->region_channel) /
724 sizeof(adapter->region_channel[0])) { 728 sizeof(adapter->region_channel[0])) {
725 lbs_pr_debug(1, "11D:region_chan not found. band[%d]\n", 729 lbs_deb_11d("11D:region_chan not found. band[%d]\n",
726 adapter->curbssparams.band); 730 adapter->curbssparams.band);
727 LEAVE(); 731 ret = -1;
728 return -1; 732 goto done;
729 } 733 }
730 734
731 memset(&adapter->parsed_region_chan, 0, 735 memset(&adapter->parsed_region_chan, 0,
@@ -742,13 +746,14 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
742 ret = set_domain_info_11d(priv); 746 ret = set_domain_info_11d(priv);
743 747
744 if (ret) { 748 if (ret) {
745 lbs_pr_debug(1, "11D: Err set domainInfo to FW\n"); 749 lbs_deb_11d("11D: Err set domainInfo to FW\n");
746 LEAVE(); 750 goto done;
747 return ret;
748 } 751 }
749 752
750 } 753 }
754 ret = 0;
751 755
752 LEAVE(); 756done:
753 return 0; 757 lbs_deb_leave_args(LBS_DEB_11D, "ret %d", ret);
758 return ret;
754} 759}
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c
index 8e6b6b7eca29..187ffd85c4be 100644
--- a/drivers/net/wireless/libertas/assoc.c
+++ b/drivers/net/wireless/libertas/assoc.c
@@ -20,9 +20,9 @@ static int assoc_helper_essid(wlan_private *priv,
20 int ret = 0; 20 int ret = 0;
21 int i; 21 int i;
22 22
23 ENTER(); 23 lbs_deb_enter(LBS_DEB_ASSOC);
24 24
25 lbs_pr_debug(1, "New SSID requested: %s\n", assoc_req->ssid.ssid); 25 lbs_deb_assoc("New SSID requested: %s\n", assoc_req->ssid.ssid);
26 if (assoc_req->mode == IW_MODE_INFRA) { 26 if (assoc_req->mode == IW_MODE_INFRA) {
27 if (adapter->prescan) { 27 if (adapter->prescan) {
28 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1); 28 libertas_send_specific_SSID_scan(priv, &assoc_req->ssid, 1);
@@ -31,7 +31,7 @@ static int assoc_helper_essid(wlan_private *priv,
31 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, 31 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid,
32 NULL, IW_MODE_INFRA); 32 NULL, IW_MODE_INFRA);
33 if (i >= 0) { 33 if (i >= 0) {
34 lbs_pr_debug(1, 34 lbs_deb_assoc(
35 "SSID found in scan list ... associating...\n"); 35 "SSID found in scan list ... associating...\n");
36 36
37 ret = wlan_associate(priv, &adapter->scantable[i]); 37 ret = wlan_associate(priv, &adapter->scantable[i]);
@@ -41,7 +41,7 @@ static int assoc_helper_essid(wlan_private *priv,
41 ETH_ALEN); 41 ETH_ALEN);
42 } 42 }
43 } else { 43 } else {
44 lbs_pr_debug(1, "SSID '%s' not found; cannot associate\n", 44 lbs_deb_assoc("SSID '%s' not found; cannot associate\n",
45 assoc_req->ssid.ssid); 45 assoc_req->ssid.ssid);
46 } 46 }
47 } else if (assoc_req->mode == IW_MODE_ADHOC) { 47 } else if (assoc_req->mode == IW_MODE_ADHOC) {
@@ -54,18 +54,18 @@ static int assoc_helper_essid(wlan_private *priv,
54 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL, 54 i = libertas_find_SSID_in_list(adapter, &assoc_req->ssid, NULL,
55 IW_MODE_ADHOC); 55 IW_MODE_ADHOC);
56 if (i >= 0) { 56 if (i >= 0) {
57 lbs_pr_debug(1, "SSID found at %d in List, so join\n", ret); 57 lbs_deb_assoc("SSID found at %d in List, so join\n", ret);
58 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 58 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
59 } else { 59 } else {
60 /* else send START command */ 60 /* else send START command */
61 lbs_pr_debug(1, "SSID not found in list, so creating adhoc" 61 lbs_deb_assoc("SSID not found in list, so creating adhoc"
62 " with SSID '%s'\n", assoc_req->ssid.ssid); 62 " with SSID '%s'\n", assoc_req->ssid.ssid);
63 libertas_start_adhoc_network(priv, &assoc_req->ssid); 63 libertas_start_adhoc_network(priv, &assoc_req->ssid);
64 } 64 }
65 memcpy(&assoc_req->bssid, &adapter->current_addr, ETH_ALEN); 65 memcpy(&assoc_req->bssid, &adapter->current_addr, ETH_ALEN);
66 } 66 }
67 67
68 LEAVE(); 68 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
69 return ret; 69 return ret;
70} 70}
71 71
@@ -76,23 +76,21 @@ static int assoc_helper_bssid(wlan_private *priv,
76 wlan_adapter *adapter = priv->adapter; 76 wlan_adapter *adapter = priv->adapter;
77 int i, ret = 0; 77 int i, ret = 0;
78 78
79 ENTER(); 79 lbs_deb_enter_args(LBS_DEB_ASSOC, "BSSID" MAC_FMT "\n",
80
81 lbs_pr_debug(1, "ASSOC: WAP: BSSID = " MAC_FMT "\n",
82 MAC_ARG(assoc_req->bssid)); 80 MAC_ARG(assoc_req->bssid));
83 81
84 /* Search for index position in list for requested MAC */ 82 /* Search for index position in list for requested MAC */
85 i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid, 83 i = libertas_find_BSSID_in_list(adapter, assoc_req->bssid,
86 assoc_req->mode); 84 assoc_req->mode);
87 if (i < 0) { 85 if (i < 0) {
88 lbs_pr_debug(1, "ASSOC: WAP: BSSID " MAC_FMT " not found, " 86 lbs_deb_assoc("ASSOC: WAP: BSSID " MAC_FMT " not found, "
89 "cannot associate.\n", MAC_ARG(assoc_req->bssid)); 87 "cannot associate.\n", MAC_ARG(assoc_req->bssid));
90 goto out; 88 goto out;
91 } 89 }
92 90
93 if (assoc_req->mode == IW_MODE_INFRA) { 91 if (assoc_req->mode == IW_MODE_INFRA) {
94 ret = wlan_associate(priv, &adapter->scantable[i]); 92 ret = wlan_associate(priv, &adapter->scantable[i]);
95 lbs_pr_debug(1, "ASSOC: return from wlan_associate(bssd) was %d\n", ret); 93 lbs_deb_assoc("ASSOC: return from wlan_associate(bssd) was %d\n", ret);
96 } else if (assoc_req->mode == IW_MODE_ADHOC) { 94 } else if (assoc_req->mode == IW_MODE_ADHOC) {
97 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 95 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
98 } 96 }
@@ -100,7 +98,7 @@ static int assoc_helper_bssid(wlan_private *priv,
100 sizeof(struct WLAN_802_11_SSID)); 98 sizeof(struct WLAN_802_11_SSID));
101 99
102out: 100out:
103 LEAVE(); 101 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
104 return ret; 102 return ret;
105} 103}
106 104
@@ -118,7 +116,7 @@ static int assoc_helper_associate(wlan_private *priv,
118 ret = assoc_helper_bssid(priv, assoc_req); 116 ret = assoc_helper_bssid(priv, assoc_req);
119 done = 1; 117 done = 1;
120 if (ret) { 118 if (ret) {
121 lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret); 119 lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
122 } 120 }
123 } 121 }
124 } 122 }
@@ -126,7 +124,7 @@ static int assoc_helper_associate(wlan_private *priv,
126 if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { 124 if (!done && test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
127 ret = assoc_helper_essid(priv, assoc_req); 125 ret = assoc_helper_essid(priv, assoc_req);
128 if (ret) { 126 if (ret) {
129 lbs_pr_debug(1, "ASSOC: bssid: ret = %d\n", ret); 127 lbs_deb_assoc("ASSOC: bssid: ret = %d\n", ret);
130 } 128 }
131 } 129 }
132 130
@@ -140,12 +138,10 @@ static int assoc_helper_mode(wlan_private *priv,
140 wlan_adapter *adapter = priv->adapter; 138 wlan_adapter *adapter = priv->adapter;
141 int ret = 0; 139 int ret = 0;
142 140
143 ENTER(); 141 lbs_deb_enter(LBS_DEB_ASSOC);
144 142
145 if (assoc_req->mode == adapter->mode) { 143 if (assoc_req->mode == adapter->mode)
146 LEAVE(); 144 goto done;
147 return 0;
148 }
149 145
150 if (assoc_req->mode == IW_MODE_INFRA) { 146 if (assoc_req->mode == IW_MODE_INFRA) {
151 if (adapter->psstate != PS_STATE_FULL_POWER) 147 if (adapter->psstate != PS_STATE_FULL_POWER)
@@ -160,7 +156,8 @@ static int assoc_helper_mode(wlan_private *priv,
160 OID_802_11_INFRASTRUCTURE_MODE, 156 OID_802_11_INFRASTRUCTURE_MODE,
161 (void *) (size_t) assoc_req->mode); 157 (void *) (size_t) assoc_req->mode);
162 158
163 LEAVE(); 159done:
160 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
164 return ret; 161 return ret;
165} 162}
166 163
@@ -172,7 +169,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
172 int i; 169 int i;
173 int ret = 0; 170 int ret = 0;
174 171
175 ENTER(); 172 lbs_deb_enter(LBS_DEB_ASSOC);
176 173
177 /* Set or remove WEP keys */ 174 /* Set or remove WEP keys */
178 if ( assoc_req->wep_keys[0].len 175 if ( assoc_req->wep_keys[0].len
@@ -216,7 +213,7 @@ static int assoc_helper_wep_keys(wlan_private *priv,
216 mutex_unlock(&adapter->lock); 213 mutex_unlock(&adapter->lock);
217 214
218out: 215out:
219 LEAVE(); 216 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
220 return ret; 217 return ret;
221} 218}
222 219
@@ -226,14 +223,14 @@ static int assoc_helper_secinfo(wlan_private *priv,
226 wlan_adapter *adapter = priv->adapter; 223 wlan_adapter *adapter = priv->adapter;
227 int ret = 0; 224 int ret = 0;
228 225
229 ENTER(); 226 lbs_deb_enter(LBS_DEB_ASSOC);
230 227
231 memcpy(&adapter->secinfo, &assoc_req->secinfo, 228 memcpy(&adapter->secinfo, &assoc_req->secinfo,
232 sizeof(struct wlan_802_11_security)); 229 sizeof(struct wlan_802_11_security));
233 230
234 ret = libertas_set_mac_packet_filter(priv); 231 ret = libertas_set_mac_packet_filter(priv);
235 232
236 LEAVE(); 233 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
237 return ret; 234 return ret;
238} 235}
239 236
@@ -243,7 +240,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
243{ 240{
244 int ret = 0; 241 int ret = 0;
245 242
246 ENTER(); 243 lbs_deb_enter(LBS_DEB_ASSOC);
247 244
248 /* enable/Disable RSN */ 245 /* enable/Disable RSN */
249 ret = libertas_prepare_and_send_command(priv, 246 ret = libertas_prepare_and_send_command(priv,
@@ -261,7 +258,7 @@ static int assoc_helper_wpa_keys(wlan_private *priv,
261 0, assoc_req); 258 0, assoc_req);
262 259
263out: 260out:
264 LEAVE(); 261 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
265 return ret; 262 return ret;
266} 263}
267 264
@@ -272,7 +269,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
272 wlan_adapter *adapter = priv->adapter; 269 wlan_adapter *adapter = priv->adapter;
273 int ret = 0; 270 int ret = 0;
274 271
275 ENTER(); 272 lbs_deb_enter(LBS_DEB_ASSOC);
276 273
277 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) { 274 if (assoc_req->secinfo.WPAenabled || assoc_req->secinfo.WPA2enabled) {
278 memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len); 275 memcpy(&adapter->wpa_ie, &assoc_req->wpa_ie, assoc_req->wpa_ie_len);
@@ -282,7 +279,7 @@ static int assoc_helper_wpa_ie(wlan_private *priv,
282 adapter->wpa_ie_len = 0; 279 adapter->wpa_ie_len = 0;
283 } 280 }
284 281
285 LEAVE(); 282 lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
286 return ret; 283 return ret;
287} 284}
288 285
@@ -294,21 +291,21 @@ static int should_deauth_infrastructure(wlan_adapter *adapter,
294 return 0; 291 return 0;
295 292
296 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) { 293 if (test_bit(ASSOC_FLAG_SSID, &assoc_req->flags)) {
297 lbs_pr_debug(1, "Deauthenticating due to new SSID in " 294 lbs_deb_assoc("Deauthenticating due to new SSID in "
298 " configuration request.\n"); 295 " configuration request.\n");
299 return 1; 296 return 1;
300 } 297 }
301 298
302 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { 299 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
303 if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) { 300 if (adapter->secinfo.auth_mode != assoc_req->secinfo.auth_mode) {
304 lbs_pr_debug(1, "Deauthenticating due to updated security " 301 lbs_deb_assoc("Deauthenticating due to updated security "
305 "info in configuration request.\n"); 302 "info in configuration request.\n");
306 return 1; 303 return 1;
307 } 304 }
308 } 305 }
309 306
310 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) { 307 if (test_bit(ASSOC_FLAG_BSSID, &assoc_req->flags)) {
311 lbs_pr_debug(1, "Deauthenticating due to new BSSID in " 308 lbs_deb_assoc("Deauthenticating due to new BSSID in "
312 " configuration request.\n"); 309 " configuration request.\n");
313 return 1; 310 return 1;
314 } 311 }
@@ -353,19 +350,17 @@ void libertas_association_worker(struct work_struct *work)
353 int ret = 0; 350 int ret = 0;
354 int find_any_ssid = 0; 351 int find_any_ssid = 0;
355 352
356 ENTER(); 353 lbs_deb_enter(LBS_DEB_ASSOC);
357 354
358 mutex_lock(&adapter->lock); 355 mutex_lock(&adapter->lock);
359 assoc_req = adapter->assoc_req; 356 assoc_req = adapter->assoc_req;
360 adapter->assoc_req = NULL; 357 adapter->assoc_req = NULL;
361 mutex_unlock(&adapter->lock); 358 mutex_unlock(&adapter->lock);
362 359
363 if (!assoc_req) { 360 if (!assoc_req)
364 LEAVE(); 361 goto done;
365 return;
366 }
367 362
368 lbs_pr_debug(1, "ASSOC: starting new association request: flags = 0x%lX\n", 363 lbs_deb_assoc("ASSOC: starting new association request: flags = 0x%lX\n",
369 assoc_req->flags); 364 assoc_req->flags);
370 365
371 /* If 'any' SSID was specified, find an SSID to associate with */ 366 /* If 'any' SSID was specified, find an SSID to associate with */
@@ -386,7 +381,7 @@ void libertas_association_worker(struct work_struct *work)
386 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid, 381 ret = libertas_find_best_network_SSID(priv, &assoc_req->ssid,
387 assoc_req->mode, &new_mode); 382 assoc_req->mode, &new_mode);
388 if (ret) { 383 if (ret) {
389 lbs_pr_debug(1, "Could not find best network\n"); 384 lbs_deb_assoc("Could not find best network\n");
390 ret = -ENETUNREACH; 385 ret = -ENETUNREACH;
391 goto out; 386 goto out;
392 } 387 }
@@ -406,7 +401,7 @@ void libertas_association_worker(struct work_struct *work)
406 if (should_deauth_infrastructure(adapter, assoc_req)) { 401 if (should_deauth_infrastructure(adapter, assoc_req)) {
407 ret = libertas_send_deauthentication(priv); 402 ret = libertas_send_deauthentication(priv);
408 if (ret) { 403 if (ret) {
409 lbs_pr_debug(1, "Deauthentication due to new " 404 lbs_deb_assoc("Deauthentication due to new "
410 "configuration request failed: %d\n", 405 "configuration request failed: %d\n",
411 ret); 406 ret);
412 } 407 }
@@ -415,7 +410,7 @@ void libertas_association_worker(struct work_struct *work)
415 if (should_stop_adhoc(adapter, assoc_req)) { 410 if (should_stop_adhoc(adapter, assoc_req)) {
416 ret = libertas_stop_adhoc_network(priv); 411 ret = libertas_stop_adhoc_network(priv);
417 if (ret) { 412 if (ret) {
418 lbs_pr_debug(1, "Teardown of AdHoc network due to " 413 lbs_deb_assoc("Teardown of AdHoc network due to "
419 "new configuration request failed: %d\n", 414 "new configuration request failed: %d\n",
420 ret); 415 ret);
421 } 416 }
@@ -427,7 +422,7 @@ void libertas_association_worker(struct work_struct *work)
427 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) { 422 if (test_bit(ASSOC_FLAG_MODE, &assoc_req->flags)) {
428 ret = assoc_helper_mode(priv, assoc_req); 423 ret = assoc_helper_mode(priv, assoc_req);
429 if (ret) { 424 if (ret) {
430lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret); 425lbs_deb_assoc("ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
431 goto out; 426 goto out;
432 } 427 }
433 } 428 }
@@ -436,7 +431,7 @@ lbs_pr_debug(1, "ASSOC(:%d) mode: ret = %d\n", __LINE__, ret);
436 || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) { 431 || test_bit(ASSOC_FLAG_WEP_TX_KEYIDX, &assoc_req->flags)) {
437 ret = assoc_helper_wep_keys(priv, assoc_req); 432 ret = assoc_helper_wep_keys(priv, assoc_req);
438 if (ret) { 433 if (ret) {
439lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret); 434lbs_deb_assoc("ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
440 goto out; 435 goto out;
441 } 436 }
442 } 437 }
@@ -444,7 +439,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wep_keys: ret = %d\n", __LINE__, ret);
444 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) { 439 if (test_bit(ASSOC_FLAG_SECINFO, &assoc_req->flags)) {
445 ret = assoc_helper_secinfo(priv, assoc_req); 440 ret = assoc_helper_secinfo(priv, assoc_req);
446 if (ret) { 441 if (ret) {
447lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret); 442lbs_deb_assoc("ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
448 goto out; 443 goto out;
449 } 444 }
450 } 445 }
@@ -452,7 +447,7 @@ lbs_pr_debug(1, "ASSOC(:%d) secinfo: ret = %d\n", __LINE__, ret);
452 if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) { 447 if (test_bit(ASSOC_FLAG_WPA_IE, &assoc_req->flags)) {
453 ret = assoc_helper_wpa_ie(priv, assoc_req); 448 ret = assoc_helper_wpa_ie(priv, assoc_req);
454 if (ret) { 449 if (ret) {
455lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret); 450lbs_deb_assoc("ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
456 goto out; 451 goto out;
457 } 452 }
458 } 453 }
@@ -461,7 +456,7 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_ie: ret = %d\n", __LINE__, ret);
461 || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) { 456 || test_bit(ASSOC_FLAG_WPA_UCAST_KEY, &assoc_req->flags)) {
462 ret = assoc_helper_wpa_keys(priv, assoc_req); 457 ret = assoc_helper_wpa_keys(priv, assoc_req);
463 if (ret) { 458 if (ret) {
464lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret); 459lbs_deb_assoc("ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
465 goto out; 460 goto out;
466 } 461 }
467 } 462 }
@@ -475,19 +470,19 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
475 470
476 ret = assoc_helper_associate(priv, assoc_req); 471 ret = assoc_helper_associate(priv, assoc_req);
477 if (ret) { 472 if (ret) {
478 lbs_pr_debug(1, "ASSOC: association attempt unsuccessful: %d\n", 473 lbs_deb_assoc("ASSOC: association attempt unsuccessful: %d\n",
479 ret); 474 ret);
480 success = 0; 475 success = 0;
481 } 476 }
482 477
483 if (adapter->connect_status != libertas_connected) { 478 if (adapter->connect_status != libertas_connected) {
484 lbs_pr_debug(1, "ASSOC: assoication attempt unsuccessful, " 479 lbs_deb_assoc("ASSOC: assoication attempt unsuccessful, "
485 "not connected.\n"); 480 "not connected.\n");
486 success = 0; 481 success = 0;
487 } 482 }
488 483
489 if (success) { 484 if (success) {
490 lbs_pr_debug(1, "ASSOC: association attempt successful. " 485 lbs_deb_assoc("ASSOC: association attempt successful. "
491 "Associated to '%s' (" MAC_FMT ")\n", 486 "Associated to '%s' (" MAC_FMT ")\n",
492 assoc_req->ssid.ssid, MAC_ARG(assoc_req->bssid)); 487 assoc_req->ssid.ssid, MAC_ARG(assoc_req->bssid));
493 libertas_prepare_and_send_command(priv, 488 libertas_prepare_and_send_command(priv,
@@ -505,11 +500,13 @@ lbs_pr_debug(1, "ASSOC(:%d) wpa_keys: ret = %d\n", __LINE__, ret);
505 500
506out: 501out:
507 if (ret) { 502 if (ret) {
508 lbs_pr_debug(1, "ASSOC: reconfiguration attempt unsuccessful: %d\n", 503 lbs_deb_assoc("ASSOC: reconfiguration attempt unsuccessful: %d\n",
509 ret); 504 ret);
510 } 505 }
511 kfree(assoc_req); 506 kfree(assoc_req);
512 LEAVE(); 507
508done:
509 lbs_deb_leave(LBS_DEB_ASSOC);
513} 510}
514 511
515 512
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index de9cb46a70ff..30f1d41a16d7 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -44,14 +44,14 @@ static int wlan_cmd_hw_spec(wlan_private * priv, struct cmd_ds_command *cmd)
44{ 44{
45 struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec; 45 struct cmd_ds_get_hw_spec *hwspec = &cmd->params.hwspec;
46 46
47 ENTER(); 47 lbs_deb_enter(LBS_DEB_CMD);
48 48
49 cmd->command = cpu_to_le16(cmd_get_hw_spec); 49 cmd->command = cpu_to_le16(cmd_get_hw_spec);
50 cmd->size = 50 cmd->size =
51 cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN); 51 cpu_to_le16(sizeof(struct cmd_ds_get_hw_spec) + S_DS_GEN);
52 memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN); 52 memcpy(hwspec->permanentaddr, priv->adapter->current_addr, ETH_ALEN);
53 53
54 LEAVE(); 54 lbs_deb_leave(LBS_DEB_CMD);
55 return 0; 55 return 0;
56} 56}
57 57
@@ -63,7 +63,7 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
63 u16 action = cmd_action; 63 u16 action = cmd_action;
64 wlan_adapter *adapter = priv->adapter; 64 wlan_adapter *adapter = priv->adapter;
65 65
66 ENTER(); 66 lbs_deb_enter(LBS_DEB_CMD);
67 67
68 cmd->command = cpu_to_le16(cmd_802_11_ps_mode); 68 cmd->command = cpu_to_le16(cmd_802_11_ps_mode);
69 cmd->size = 69 cmd->size =
@@ -73,8 +73,8 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
73 psm->multipledtim = 0; 73 psm->multipledtim = 0;
74 switch (action) { 74 switch (action) {
75 case cmd_subcmd_enter_ps: 75 case cmd_subcmd_enter_ps:
76 lbs_pr_debug(1, "PS command:" "SubCode- Enter PS\n"); 76 lbs_deb_cmd("PS command:" "SubCode- Enter PS\n");
77 lbs_pr_debug(1, "locallisteninterval = %d\n", 77 lbs_deb_cmd("locallisteninterval = %d\n",
78 adapter->locallisteninterval); 78 adapter->locallisteninterval);
79 79
80 psm->locallisteninterval = 80 psm->locallisteninterval =
@@ -86,18 +86,18 @@ static int wlan_cmd_802_11_ps_mode(wlan_private * priv,
86 break; 86 break;
87 87
88 case cmd_subcmd_exit_ps: 88 case cmd_subcmd_exit_ps:
89 lbs_pr_debug(1, "PS command:" "SubCode- Exit PS\n"); 89 lbs_deb_cmd("PS command:" "SubCode- Exit PS\n");
90 break; 90 break;
91 91
92 case cmd_subcmd_sleep_confirmed: 92 case cmd_subcmd_sleep_confirmed:
93 lbs_pr_debug(1, "PS command: SubCode- sleep confirm\n"); 93 lbs_deb_cmd("PS command: SubCode- sleep confirm\n");
94 break; 94 break;
95 95
96 default: 96 default:
97 break; 97 break;
98 } 98 }
99 99
100 LEAVE(); 100 lbs_deb_leave(LBS_DEB_CMD);
101 return 0; 101 return 0;
102} 102}
103 103
@@ -130,7 +130,7 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv,
130 wlan_adapter *adapter = priv->adapter; 130 wlan_adapter *adapter = priv->adapter;
131 struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params; 131 struct cmd_ds_802_11_sleep_params *sp = &cmd->params.sleep_params;
132 132
133 ENTER(); 133 lbs_deb_enter(LBS_DEB_CMD);
134 134
135 cmd->size = 135 cmd->size =
136 cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) + 136 cpu_to_le16((sizeof(struct cmd_ds_802_11_sleep_params)) +
@@ -151,7 +151,7 @@ static int wlan_cmd_802_11_sleep_params(wlan_private * priv,
151 sp->reserved = cpu_to_le16(adapter->sp.sp_reserved); 151 sp->reserved = cpu_to_le16(adapter->sp.sp_reserved);
152 } 152 }
153 153
154 LEAVE(); 154 lbs_deb_leave(LBS_DEB_CMD);
155 return 0; 155 return 0;
156} 156}
157 157
@@ -165,7 +165,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
165 int ret = 0; 165 int ret = 0;
166 struct assoc_request * assoc_req = pdata_buf; 166 struct assoc_request * assoc_req = pdata_buf;
167 167
168 ENTER(); 168 lbs_deb_enter(LBS_DEB_CMD);
169 169
170 cmd->command = cpu_to_le16(cmd_802_11_set_wep); 170 cmd->command = cpu_to_le16(cmd_802_11_set_wep);
171 cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_set_wep)) 171 cmd->size = cpu_to_le16((sizeof(struct cmd_ds_802_11_set_wep))
@@ -175,7 +175,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
175 int i; 175 int i;
176 176
177 if (!assoc_req) { 177 if (!assoc_req) {
178 lbs_pr_debug(1, "Invalid association request!"); 178 lbs_deb_cmd("Invalid association request!");
179 ret = -1; 179 ret = -1;
180 goto done; 180 goto done;
181 } 181 }
@@ -187,7 +187,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
187 (assoc_req->wep_tx_keyidx & 187 (assoc_req->wep_tx_keyidx &
188 (u32)cmd_WEP_KEY_INDEX_MASK)); 188 (u32)cmd_WEP_KEY_INDEX_MASK));
189 189
190 lbs_pr_debug(1, "Tx key Index: %u\n", wep->keyindex); 190 lbs_deb_cmd("Tx key Index: %u\n", wep->keyindex);
191 191
192 /* Copy key types and material to host command structure */ 192 /* Copy key types and material to host command structure */
193 for (i = 0; i < 4; i++) { 193 for (i = 0; i < 4; i++) {
@@ -207,7 +207,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
207 case 0: 207 case 0:
208 break; 208 break;
209 default: 209 default:
210 lbs_pr_debug(1, "Invalid WEP key %d length of %d\n", 210 lbs_deb_cmd("Invalid WEP key %d length of %d\n",
211 i, pkey->len); 211 i, pkey->len);
212 ret = -1; 212 ret = -1;
213 goto done; 213 goto done;
@@ -227,7 +227,7 @@ static int wlan_cmd_802_11_set_wep(wlan_private * priv,
227 ret = 0; 227 ret = 0;
228 228
229done: 229done:
230 LEAVE(); 230 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
231 return ret; 231 return ret;
232} 232}
233 233
@@ -290,7 +290,7 @@ static int wlan_cmd_802_11_key_material(wlan_private * priv,
290 int ret = 0; 290 int ret = 0;
291 int index = 0; 291 int index = 0;
292 292
293 ENTER(); 293 lbs_deb_enter(LBS_DEB_CMD);
294 294
295 cmd->command = cpu_to_le16(cmd_802_11_key_material); 295 cmd->command = cpu_to_le16(cmd_802_11_key_material);
296 pkeymaterial->action = cpu_to_le16(cmd_action); 296 pkeymaterial->action = cpu_to_le16(cmd_action);
@@ -323,7 +323,7 @@ static int wlan_cmd_802_11_key_material(wlan_private * priv,
323 ret = 0; 323 ret = 0;
324 324
325done: 325done:
326 LEAVE(); 326 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
327 return ret; 327 return ret;
328} 328}
329 329
@@ -369,9 +369,9 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
369 wlan_adapter *adapter = priv->adapter; 369 wlan_adapter *adapter = priv->adapter;
370 u8 ucTemp; 370 u8 ucTemp;
371 371
372 ENTER(); 372 lbs_deb_enter(LBS_DEB_CMD);
373 373
374 lbs_pr_debug(1, "SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid); 374 lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);
375 375
376 cmd->command = cpu_to_le16(cmd_802_11_snmp_mib); 376 cmd->command = cpu_to_le16(cmd_802_11_snmp_mib);
377 cmd->size = 377 cmd->size =
@@ -477,16 +477,16 @@ static int wlan_cmd_802_11_snmp_mib(wlan_private * priv,
477 break; 477 break;
478 } 478 }
479 479
480 lbs_pr_debug(1, 480 lbs_deb_cmd(
481 "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n", 481 "SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n",
482 cmd->command, cmd->size, cmd->seqnum, cmd->result); 482 cmd->command, cmd->size, cmd->seqnum, cmd->result);
483 483
484 lbs_pr_debug(1, 484 lbs_deb_cmd(
485 "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n", 485 "SNMP_CMD: action=0x%x, oid=0x%x, oidsize=0x%x, value=0x%x\n",
486 pSNMPMIB->querytype, pSNMPMIB->oid, pSNMPMIB->bufsize, 486 pSNMPMIB->querytype, pSNMPMIB->oid, pSNMPMIB->bufsize,
487 *(u16 *) pSNMPMIB->value); 487 *(u16 *) pSNMPMIB->value);
488 488
489 LEAVE(); 489 lbs_deb_leave(LBS_DEB_CMD);
490 return 0; 490 return 0;
491} 491}
492 492
@@ -498,7 +498,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv,
498 struct cmd_ds_802_11_radio_control *pradiocontrol = 498 struct cmd_ds_802_11_radio_control *pradiocontrol =
499 &cmd->params.radio; 499 &cmd->params.radio;
500 500
501 ENTER(); 501 lbs_deb_enter(LBS_DEB_CMD);
502 502
503 cmd->size = 503 cmd->size =
504 cpu_to_le16((sizeof(struct cmd_ds_802_11_radio_control)) + 504 cpu_to_le16((sizeof(struct cmd_ds_802_11_radio_control)) +
@@ -527,7 +527,7 @@ static int wlan_cmd_802_11_radio_control(wlan_private * priv,
527 else 527 else
528 pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF); 528 pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF);
529 529
530 LEAVE(); 530 lbs_deb_leave(LBS_DEB_CMD);
531 return 0; 531 return 0;
532} 532}
533 533
@@ -538,7 +538,7 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
538 538
539 struct cmd_ds_802_11_rf_tx_power *prtp = &cmd->params.txp; 539 struct cmd_ds_802_11_rf_tx_power *prtp = &cmd->params.txp;
540 540
541 ENTER(); 541 lbs_deb_enter(LBS_DEB_CMD);
542 542
543 cmd->size = 543 cmd->size =
544 cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) + 544 cpu_to_le16((sizeof(struct cmd_ds_802_11_rf_tx_power)) +
@@ -546,7 +546,7 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
546 cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power); 546 cmd->command = cpu_to_le16(cmd_802_11_rf_tx_power);
547 prtp->action = cmd_action; 547 prtp->action = cmd_action;
548 548
549 lbs_pr_debug(1, "RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", cmd->size, 549 lbs_deb_cmd("RF_TX_POWER_CMD: size:%d cmd:0x%x Act:%d\n", cmd->size,
550 cmd->command, prtp->action); 550 cmd->command, prtp->action);
551 551
552 switch (cmd_action) { 552 switch (cmd_action) {
@@ -572,7 +572,8 @@ static int wlan_cmd_802_11_rf_tx_power(wlan_private * priv,
572 prtp->currentlevel = cpu_to_le16(*((u16 *) pdata_buf)); 572 prtp->currentlevel = cpu_to_le16(*((u16 *) pdata_buf));
573 break; 573 break;
574 } 574 }
575 LEAVE(); 575
576 lbs_deb_leave(LBS_DEB_CMD);
576 return 0; 577 return 0;
577} 578}
578 579
@@ -610,13 +611,13 @@ static int wlan_cmd_802_11_rate_adapt_rateset(wlan_private * priv,
610 + S_DS_GEN); 611 + S_DS_GEN);
611 cmd->command = cpu_to_le16(cmd_802_11_rate_adapt_rateset); 612 cmd->command = cpu_to_le16(cmd_802_11_rate_adapt_rateset);
612 613
613 ENTER(); 614 lbs_deb_enter(LBS_DEB_CMD);
614 615
615 rateadapt->action = cmd_action; 616 rateadapt->action = cmd_action;
616 rateadapt->enablehwauto = adapter->enablehwauto; 617 rateadapt->enablehwauto = adapter->enablehwauto;
617 rateadapt->bitmap = adapter->ratebitmap; 618 rateadapt->bitmap = adapter->ratebitmap;
618 619
619 LEAVE(); 620 lbs_deb_leave(LBS_DEB_CMD);
620 return 0; 621 return 0;
621} 622}
622 623
@@ -628,7 +629,7 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv,
628 wlan_adapter *adapter = priv->adapter; 629 wlan_adapter *adapter = priv->adapter;
629 u16 action = cmd_action; 630 u16 action = cmd_action;
630 631
631 ENTER(); 632 lbs_deb_enter(LBS_DEB_CMD);
632 633
633 cmd->size = 634 cmd->size =
634 cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) + 635 cpu_to_le16(sizeof(struct cmd_ds_802_11_data_rate) +
@@ -642,13 +643,13 @@ static int wlan_cmd_802_11_data_rate(wlan_private * priv,
642 643
643 if (action == cmd_act_set_tx_fix_rate) { 644 if (action == cmd_act_set_tx_fix_rate) {
644 pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate); 645 pdatarate->datarate[0] = libertas_data_rate_to_index(adapter->datarate);
645 lbs_pr_debug(1, "Setting FW for fixed rate 0x%02X\n", 646 lbs_deb_cmd("Setting FW for fixed rate 0x%02X\n",
646 adapter->datarate); 647 adapter->datarate);
647 } else if (action == cmd_act_set_tx_auto) { 648 } else if (action == cmd_act_set_tx_auto) {
648 lbs_pr_debug(1, "Setting FW for AUTO rate\n"); 649 lbs_deb_cmd("Setting FW for AUTO rate\n");
649 } 650 }
650 651
651 LEAVE(); 652 lbs_deb_leave(LBS_DEB_CMD);
652 return 0; 653 return 0;
653} 654}
654 655
@@ -719,7 +720,7 @@ static int wlan_cmd_reg_access(wlan_private * priv,
719{ 720{
720 struct wlan_offset_value *offval; 721 struct wlan_offset_value *offval;
721 722
722 ENTER(); 723 lbs_deb_enter(LBS_DEB_CMD);
723 724
724 offval = (struct wlan_offset_value *)pdata_buf; 725 offval = (struct wlan_offset_value *)pdata_buf;
725 726
@@ -785,7 +786,7 @@ static int wlan_cmd_reg_access(wlan_private * priv,
785 break; 786 break;
786 } 787 }
787 788
788 LEAVE(); 789 lbs_deb_leave(LBS_DEB_CMD);
789 return 0; 790 return 0;
790} 791}
791 792
@@ -818,7 +819,7 @@ static int wlan_cmd_802_11_eeprom_access(wlan_private * priv,
818{ 819{
819 struct wlan_ioctl_regrdwr *ea = pdata_buf; 820 struct wlan_ioctl_regrdwr *ea = pdata_buf;
820 821
821 ENTER(); 822 lbs_deb_enter(LBS_DEB_CMD);
822 823
823 cmd->command = cpu_to_le16(cmd_802_11_eeprom_access); 824 cmd->command = cpu_to_le16(cmd_802_11_eeprom_access);
824 cmd->size = 825 cmd->size =
@@ -839,7 +840,7 @@ static int wlan_cmd_bt_access(wlan_private * priv,
839 u16 cmd_action, void *pdata_buf) 840 u16 cmd_action, void *pdata_buf)
840{ 841{
841 struct cmd_ds_bt_access *bt_access = &cmd->params.bt; 842 struct cmd_ds_bt_access *bt_access = &cmd->params.bt;
842 lbs_pr_debug(1, "BT CMD(%d)\n", cmd_action); 843 lbs_deb_cmd("BT CMD(%d)\n", cmd_action);
843 844
844 cmd->command = cpu_to_le16(cmd_bt_access); 845 cmd->command = cpu_to_le16(cmd_bt_access);
845 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access) 846 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_bt_access)
@@ -872,7 +873,7 @@ static int wlan_cmd_fwt_access(wlan_private * priv,
872 u16 cmd_action, void *pdata_buf) 873 u16 cmd_action, void *pdata_buf)
873{ 874{
874 struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; 875 struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt;
875 lbs_pr_debug(1, "FWT CMD(%d)\n", cmd_action); 876 lbs_deb_cmd("FWT CMD(%d)\n", cmd_action);
876 877
877 cmd->command = cpu_to_le16(cmd_fwt_access); 878 cmd->command = cpu_to_le16(cmd_fwt_access);
878 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) 879 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access)
@@ -894,7 +895,7 @@ static int wlan_cmd_mesh_access(wlan_private * priv,
894 u16 cmd_action, void *pdata_buf) 895 u16 cmd_action, void *pdata_buf)
895{ 896{
896 struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh; 897 struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh;
897 lbs_pr_debug(1, "FWT CMD(%d)\n", cmd_action); 898 lbs_deb_cmd("FWT CMD(%d)\n", cmd_action);
898 899
899 cmd->command = cpu_to_le16(cmd_mesh_access); 900 cmd->command = cpu_to_le16(cmd_mesh_access);
900 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) 901 cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access)
@@ -916,16 +917,16 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
916 unsigned long flags; 917 unsigned long flags;
917 struct cmd_ds_command *cmdptr; 918 struct cmd_ds_command *cmdptr;
918 919
919 ENTER(); 920 lbs_deb_enter(LBS_DEB_CMD);
920 921
921 if (!cmdnode) { 922 if (!cmdnode) {
922 lbs_pr_debug(1, "QUEUE_CMD: cmdnode is NULL\n"); 923 lbs_deb_cmd("QUEUE_CMD: cmdnode is NULL\n");
923 goto done; 924 goto done;
924 } 925 }
925 926
926 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 927 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
927 if (!cmdptr) { 928 if (!cmdptr) {
928 lbs_pr_debug(1, "QUEUE_CMD: cmdptr is NULL\n"); 929 lbs_deb_cmd("QUEUE_CMD: cmdptr is NULL\n");
929 goto done; 930 goto done;
930 } 931 }
931 932
@@ -948,13 +949,12 @@ void libertas_queue_cmd(wlan_adapter * adapter, struct cmd_ctrl_node *cmdnode, u
948 949
949 spin_unlock_irqrestore(&adapter->driver_lock, flags); 950 spin_unlock_irqrestore(&adapter->driver_lock, flags);
950 951
951 lbs_pr_debug(1, "QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n", 952 lbs_deb_cmd("QUEUE_CMD: Inserted node=%p, cmd=0x%x in cmdpendingq\n",
952 cmdnode, 953 cmdnode,
953 ((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command); 954 ((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command);
954 955
955done: 956done:
956 LEAVE(); 957 lbs_deb_leave(LBS_DEB_CMD);
957 return;
958} 958}
959 959
960/* 960/*
@@ -974,10 +974,10 @@ static int DownloadcommandToStation(wlan_private * priv,
974 u16 cmdsize; 974 u16 cmdsize;
975 u16 command; 975 u16 command;
976 976
977 ENTER(); 977 lbs_deb_enter(LBS_DEB_CMD);
978 978
979 if (!adapter || !cmdnode) { 979 if (!adapter || !cmdnode) {
980 lbs_pr_debug(1, "DNLD_CMD: adapter = %p, cmdnode = %p\n", 980 lbs_deb_cmd("DNLD_CMD: adapter = %p, cmdnode = %p\n",
981 adapter, cmdnode); 981 adapter, cmdnode);
982 if (cmdnode) { 982 if (cmdnode) {
983 spin_lock_irqsave(&adapter->driver_lock, flags); 983 spin_lock_irqsave(&adapter->driver_lock, flags);
@@ -993,7 +993,7 @@ static int DownloadcommandToStation(wlan_private * priv,
993 993
994 spin_lock_irqsave(&adapter->driver_lock, flags); 994 spin_lock_irqsave(&adapter->driver_lock, flags);
995 if (!cmdptr || !cmdptr->size) { 995 if (!cmdptr || !cmdptr->size) {
996 lbs_pr_debug(1, "DNLD_CMD: cmdptr is Null or cmd size is Zero, " 996 lbs_deb_cmd("DNLD_CMD: cmdptr is Null or cmd size is Zero, "
997 "Not sending\n"); 997 "Not sending\n");
998 __libertas_cleanup_and_insert_cmd(priv, cmdnode); 998 __libertas_cleanup_and_insert_cmd(priv, cmdnode);
999 spin_unlock_irqrestore(&adapter->driver_lock, flags); 999 spin_unlock_irqrestore(&adapter->driver_lock, flags);
@@ -1004,7 +1004,7 @@ static int DownloadcommandToStation(wlan_private * priv,
1004 adapter->cur_cmd = cmdnode; 1004 adapter->cur_cmd = cmdnode;
1005 adapter->cur_cmd_retcode = 0; 1005 adapter->cur_cmd_retcode = 0;
1006 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1006 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1007 lbs_pr_debug(1, "DNLD_CMD:: Before download, size of cmd = %d\n", 1007 lbs_deb_cmd("DNLD_CMD:: Before download, size of cmd = %d\n",
1008 cmdptr->size); 1008 cmdptr->size);
1009 1009
1010 cmdsize = cmdptr->size; 1010 cmdsize = cmdptr->size;
@@ -1017,7 +1017,7 @@ static int DownloadcommandToStation(wlan_private * priv,
1017 ret = libertas_sbi_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize); 1017 ret = libertas_sbi_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize);
1018 1018
1019 if (ret != 0) { 1019 if (ret != 0) {
1020 lbs_pr_debug(1, "DNLD_CMD: Host to Card failed\n"); 1020 lbs_deb_cmd("DNLD_CMD: Host to Card failed\n");
1021 spin_lock_irqsave(&adapter->driver_lock, flags); 1021 spin_lock_irqsave(&adapter->driver_lock, flags);
1022 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); 1022 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
1023 adapter->cur_cmd = NULL; 1023 adapter->cur_cmd = NULL;
@@ -1026,7 +1026,7 @@ static int DownloadcommandToStation(wlan_private * priv,
1026 goto done; 1026 goto done;
1027 } 1027 }
1028 1028
1029 lbs_pr_debug(1, "DNLD_CMD: Sent command 0x%x @ %lu\n", command, jiffies); 1029 lbs_deb_cmd("DNLD_CMD: Sent command 0x%x @ %lu\n", command, jiffies);
1030 lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize); 1030 lbs_dbg_hex("DNLD_CMD: command", cmdnode->bufvirtualaddr, cmdsize);
1031 1031
1032 /* Setup the timer after transmit command */ 1032 /* Setup the timer after transmit command */
@@ -1039,8 +1039,8 @@ static int DownloadcommandToStation(wlan_private * priv,
1039 1039
1040 ret = 0; 1040 ret = 0;
1041 1041
1042 done: 1042done:
1043 LEAVE(); 1043 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1044 return ret; 1044 return ret;
1045} 1045}
1046 1046
@@ -1049,17 +1049,17 @@ static int wlan_cmd_mac_control(wlan_private * priv,
1049{ 1049{
1050 struct cmd_ds_mac_control *mac = &cmd->params.macctrl; 1050 struct cmd_ds_mac_control *mac = &cmd->params.macctrl;
1051 1051
1052 ENTER(); 1052 lbs_deb_enter(LBS_DEB_CMD);
1053 1053
1054 cmd->command = cpu_to_le16(cmd_mac_control); 1054 cmd->command = cpu_to_le16(cmd_mac_control);
1055 cmd->size = 1055 cmd->size =
1056 cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN); 1056 cpu_to_le16(sizeof(struct cmd_ds_mac_control) + S_DS_GEN);
1057 mac->action = cpu_to_le16(priv->adapter->currentpacketfilter); 1057 mac->action = cpu_to_le16(priv->adapter->currentpacketfilter);
1058 1058
1059 lbs_pr_debug(1, "wlan_cmd_mac_control(): action=0x%X size=%d\n", 1059 lbs_deb_cmd("wlan_cmd_mac_control(): action=0x%X size=%d\n",
1060 mac->action, cmd->size); 1060 mac->action, cmd->size);
1061 1061
1062 LEAVE(); 1062 lbs_deb_leave(LBS_DEB_CMD);
1063 return 0; 1063 return 0;
1064} 1064}
1065 1065
@@ -1093,17 +1093,17 @@ int libertas_set_radio_control(wlan_private * priv)
1093{ 1093{
1094 int ret = 0; 1094 int ret = 0;
1095 1095
1096 ENTER(); 1096 lbs_deb_enter(LBS_DEB_CMD);
1097 1097
1098 ret = libertas_prepare_and_send_command(priv, 1098 ret = libertas_prepare_and_send_command(priv,
1099 cmd_802_11_radio_control, 1099 cmd_802_11_radio_control,
1100 cmd_act_set, 1100 cmd_act_set,
1101 cmd_option_waitforrsp, 0, NULL); 1101 cmd_option_waitforrsp, 0, NULL);
1102 1102
1103 lbs_pr_debug(1, "RADIO_SET: on or off: 0x%X, preamble = 0x%X\n", 1103 lbs_deb_cmd("RADIO_SET: on or off: 0x%X, preamble = 0x%X\n",
1104 priv->adapter->radioon, priv->adapter->preamble); 1104 priv->adapter->radioon, priv->adapter->preamble);
1105 1105
1106 LEAVE(); 1106 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1107 return ret; 1107 return ret;
1108} 1108}
1109 1109
@@ -1111,16 +1111,16 @@ int libertas_set_mac_packet_filter(wlan_private * priv)
1111{ 1111{
1112 int ret = 0; 1112 int ret = 0;
1113 1113
1114 ENTER(); 1114 lbs_deb_enter(LBS_DEB_CMD);
1115 1115
1116 lbs_pr_debug(1, "libertas_set_mac_packet_filter value = %x\n", 1116 lbs_deb_cmd("libertas_set_mac_packet_filter value = %x\n",
1117 priv->adapter->currentpacketfilter); 1117 priv->adapter->currentpacketfilter);
1118 1118
1119 /* Send MAC control command to station */ 1119 /* Send MAC control command to station */
1120 ret = libertas_prepare_and_send_command(priv, 1120 ret = libertas_prepare_and_send_command(priv,
1121 cmd_mac_control, 0, 0, 0, NULL); 1121 cmd_mac_control, 0, 0, 0, NULL);
1122 1122
1123 LEAVE(); 1123 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1124 return ret; 1124 return ret;
1125} 1125}
1126 1126
@@ -1146,16 +1146,16 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1146 struct cmd_ds_command *cmdptr; 1146 struct cmd_ds_command *cmdptr;
1147 unsigned long flags; 1147 unsigned long flags;
1148 1148
1149 ENTER(); 1149 lbs_deb_enter(LBS_DEB_CMD);
1150 1150
1151 if (!adapter) { 1151 if (!adapter) {
1152 lbs_pr_debug(1, "PREP_CMD: adapter is Null\n"); 1152 lbs_deb_cmd("PREP_CMD: adapter is Null\n");
1153 ret = -1; 1153 ret = -1;
1154 goto done; 1154 goto done;
1155 } 1155 }
1156 1156
1157 if (adapter->surpriseremoved) { 1157 if (adapter->surpriseremoved) {
1158 lbs_pr_debug(1, "PREP_CMD: Card is Removed\n"); 1158 lbs_deb_cmd("PREP_CMD: Card is Removed\n");
1159 ret = -1; 1159 ret = -1;
1160 goto done; 1160 goto done;
1161 } 1161 }
@@ -1163,7 +1163,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1163 cmdnode = libertas_get_free_cmd_ctrl_node(priv); 1163 cmdnode = libertas_get_free_cmd_ctrl_node(priv);
1164 1164
1165 if (cmdnode == NULL) { 1165 if (cmdnode == NULL) {
1166 lbs_pr_debug(1, "PREP_CMD: No free cmdnode\n"); 1166 lbs_deb_cmd("PREP_CMD: No free cmdnode\n");
1167 1167
1168 /* Wake up main thread to execute next command */ 1168 /* Wake up main thread to execute next command */
1169 wake_up_interruptible(&priv->mainthread.waitq); 1169 wake_up_interruptible(&priv->mainthread.waitq);
@@ -1175,11 +1175,11 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1175 1175
1176 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 1176 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
1177 1177
1178 lbs_pr_debug(1, "PREP_CMD: Val of cmd ptr=%p, command=0x%X\n", 1178 lbs_deb_cmd("PREP_CMD: Val of cmd ptr=%p, command=0x%X\n",
1179 cmdptr, cmd_no); 1179 cmdptr, cmd_no);
1180 1180
1181 if (!cmdptr) { 1181 if (!cmdptr) {
1182 lbs_pr_debug(1, "PREP_CMD: bufvirtualaddr of cmdnode is NULL\n"); 1182 lbs_deb_cmd("PREP_CMD: bufvirtualaddr of cmdnode is NULL\n");
1183 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1183 libertas_cleanup_and_insert_cmd(priv, cmdnode);
1184 ret = -1; 1184 ret = -1;
1185 goto done; 1185 goto done;
@@ -1421,14 +1421,14 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1421 ret = 0; 1421 ret = 0;
1422 break; 1422 break;
1423 default: 1423 default:
1424 lbs_pr_debug(1, "PREP_CMD: unknown command- %#x\n", cmd_no); 1424 lbs_deb_cmd("PREP_CMD: unknown command- %#x\n", cmd_no);
1425 ret = -1; 1425 ret = -1;
1426 break; 1426 break;
1427 } 1427 }
1428 1428
1429 /* return error, since the command preparation failed */ 1429 /* return error, since the command preparation failed */
1430 if (ret != 0) { 1430 if (ret != 0) {
1431 lbs_pr_debug(1, "PREP_CMD: command preparation failed\n"); 1431 lbs_deb_cmd("PREP_CMD: command preparation failed\n");
1432 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1432 libertas_cleanup_and_insert_cmd(priv, cmdnode);
1433 ret = -1; 1433 ret = -1;
1434 goto done; 1434 goto done;
@@ -1441,7 +1441,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1441 wake_up_interruptible(&priv->mainthread.waitq); 1441 wake_up_interruptible(&priv->mainthread.waitq);
1442 1442
1443 if (wait_option & cmd_option_waitforrsp) { 1443 if (wait_option & cmd_option_waitforrsp) {
1444 lbs_pr_debug(1, "PREP_CMD: Wait for CMD response\n"); 1444 lbs_deb_cmd("PREP_CMD: Wait for CMD response\n");
1445 might_sleep(); 1445 might_sleep();
1446 wait_event_interruptible(cmdnode->cmdwait_q, 1446 wait_event_interruptible(cmdnode->cmdwait_q,
1447 cmdnode->cmdwaitqwoken); 1447 cmdnode->cmdwaitqwoken);
@@ -1449,7 +1449,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1449 1449
1450 spin_lock_irqsave(&adapter->driver_lock, flags); 1450 spin_lock_irqsave(&adapter->driver_lock, flags);
1451 if (adapter->cur_cmd_retcode) { 1451 if (adapter->cur_cmd_retcode) {
1452 lbs_pr_debug(1, "PREP_CMD: command failed with return code=%d\n", 1452 lbs_deb_cmd("PREP_CMD: command failed with return code=%d\n",
1453 adapter->cur_cmd_retcode); 1453 adapter->cur_cmd_retcode);
1454 adapter->cur_cmd_retcode = 0; 1454 adapter->cur_cmd_retcode = 0;
1455 ret = -1; 1455 ret = -1;
@@ -1457,7 +1457,7 @@ int libertas_prepare_and_send_command(wlan_private * priv,
1457 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1457 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1458 1458
1459done: 1459done:
1460 LEAVE(); 1460 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1461 return ret; 1461 return ret;
1462} 1462}
1463 1463
@@ -1477,13 +1477,13 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
1477 u8 *ptempvirtualaddr; 1477 u8 *ptempvirtualaddr;
1478 wlan_adapter *adapter = priv->adapter; 1478 wlan_adapter *adapter = priv->adapter;
1479 1479
1480 ENTER(); 1480 lbs_deb_enter(LBS_DEB_CMD);
1481 1481
1482 /* Allocate and initialize cmdCtrlNode */ 1482 /* Allocate and initialize cmdCtrlNode */
1483 ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER; 1483 ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER;
1484 1484
1485 if (!(tempcmd_array = kmalloc(ulbufsize, GFP_KERNEL))) { 1485 if (!(tempcmd_array = kmalloc(ulbufsize, GFP_KERNEL))) {
1486 lbs_pr_debug(1, 1486 lbs_deb_cmd(
1487 "ALLOC_CMD_BUF: failed to allocate tempcmd_array\n"); 1487 "ALLOC_CMD_BUF: failed to allocate tempcmd_array\n");
1488 ret = -1; 1488 ret = -1;
1489 goto done; 1489 goto done;
@@ -1496,7 +1496,7 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
1496 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; 1496 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
1497 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { 1497 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
1498 if (!(ptempvirtualaddr = kmalloc(ulbufsize, GFP_KERNEL))) { 1498 if (!(ptempvirtualaddr = kmalloc(ulbufsize, GFP_KERNEL))) {
1499 lbs_pr_debug(1, 1499 lbs_deb_cmd(
1500 "ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n"); 1500 "ALLOC_CMD_BUF: ptempvirtualaddr: out of memory\n");
1501 ret = -1; 1501 ret = -1;
1502 goto done; 1502 goto done;
@@ -1514,8 +1514,9 @@ int libertas_allocate_cmd_buffer(wlan_private * priv)
1514 } 1514 }
1515 1515
1516 ret = 0; 1516 ret = 0;
1517 done: 1517
1518 LEAVE(); 1518done:
1519 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1519 return ret; 1520 return ret;
1520} 1521}
1521 1522
@@ -1532,11 +1533,11 @@ int libertas_free_cmd_buffer(wlan_private * priv)
1532 struct cmd_ctrl_node *tempcmd_array; 1533 struct cmd_ctrl_node *tempcmd_array;
1533 wlan_adapter *adapter = priv->adapter; 1534 wlan_adapter *adapter = priv->adapter;
1534 1535
1535 ENTER(); 1536 lbs_deb_enter(LBS_DEB_CMD);
1536 1537
1537 /* need to check if cmd array is allocated or not */ 1538 /* need to check if cmd array is allocated or not */
1538 if (adapter->cmd_array == NULL) { 1539 if (adapter->cmd_array == NULL) {
1539 lbs_pr_debug(1, "FREE_CMD_BUF: cmd_array is Null\n"); 1540 lbs_deb_cmd("FREE_CMD_BUF: cmd_array is Null\n");
1540 goto done; 1541 goto done;
1541 } 1542 }
1542 1543
@@ -1546,7 +1547,7 @@ int libertas_free_cmd_buffer(wlan_private * priv)
1546 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER; 1547 ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
1547 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) { 1548 for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
1548 if (tempcmd_array[i].bufvirtualaddr) { 1549 if (tempcmd_array[i].bufvirtualaddr) {
1549 lbs_pr_debug(1, "Free all the array\n"); 1550 lbs_deb_cmd("Free all the array\n");
1550 kfree(tempcmd_array[i].bufvirtualaddr); 1551 kfree(tempcmd_array[i].bufvirtualaddr);
1551 tempcmd_array[i].bufvirtualaddr = NULL; 1552 tempcmd_array[i].bufvirtualaddr = NULL;
1552 } 1553 }
@@ -1554,13 +1555,13 @@ int libertas_free_cmd_buffer(wlan_private * priv)
1554 1555
1555 /* Release cmd_ctrl_node */ 1556 /* Release cmd_ctrl_node */
1556 if (adapter->cmd_array) { 1557 if (adapter->cmd_array) {
1557 lbs_pr_debug(1, "Free cmd_array\n"); 1558 lbs_deb_cmd("Free cmd_array\n");
1558 kfree(adapter->cmd_array); 1559 kfree(adapter->cmd_array);
1559 adapter->cmd_array = NULL; 1560 adapter->cmd_array = NULL;
1560 } 1561 }
1561 1562
1562done: 1563done:
1563 LEAVE(); 1564 lbs_deb_leave(LBS_DEB_CMD);
1564 return 0; 1565 return 0;
1565} 1566}
1566 1567
@@ -1586,16 +1587,18 @@ struct cmd_ctrl_node *libertas_get_free_cmd_ctrl_node(wlan_private * priv)
1586 tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next; 1587 tempnode = (struct cmd_ctrl_node *)adapter->cmdfreeq.next;
1587 list_del((struct list_head *)tempnode); 1588 list_del((struct list_head *)tempnode);
1588 } else { 1589 } else {
1589 lbs_pr_debug(1, "GET_CMD_NODE: cmd_ctrl_node is not available\n"); 1590 lbs_deb_cmd("GET_CMD_NODE: cmd_ctrl_node is not available\n");
1590 tempnode = NULL; 1591 tempnode = NULL;
1591 } 1592 }
1592 1593
1593 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1594 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1594 1595
1595 if (tempnode) { 1596 if (tempnode) {
1597 /*
1596 lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode available\n"); 1598 lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode available\n");
1597 lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode Address = %p\n", 1599 lbs_pr_debug(3, "GET_CMD_NODE: cmdCtrlNode Address = %p\n",
1598 tempnode); 1600 tempnode);
1601 */
1599 cleanup_cmdnode(tempnode); 1602 cleanup_cmdnode(tempnode);
1600 } 1603 }
1601 1604
@@ -1638,7 +1641,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv,
1638 struct cmd_ctrl_node *ptempnode, 1641 struct cmd_ctrl_node *ptempnode,
1639 u32 cmd_oid, u16 wait_option, void *pdata_buf) 1642 u32 cmd_oid, u16 wait_option, void *pdata_buf)
1640{ 1643{
1641 ENTER(); 1644 lbs_deb_enter(LBS_DEB_CMD);
1642 1645
1643 if (!ptempnode) 1646 if (!ptempnode)
1644 return; 1647 return;
@@ -1647,7 +1650,7 @@ void libertas_set_cmd_ctrl_node(wlan_private * priv,
1647 ptempnode->wait_option = wait_option; 1650 ptempnode->wait_option = wait_option;
1648 ptempnode->pdata_buf = pdata_buf; 1651 ptempnode->pdata_buf = pdata_buf;
1649 1652
1650 LEAVE(); 1653 lbs_deb_leave(LBS_DEB_CMD);
1651} 1654}
1652 1655
1653/** 1656/**
@@ -1666,7 +1669,7 @@ int libertas_execute_next_command(wlan_private * priv)
1666 unsigned long flags; 1669 unsigned long flags;
1667 int ret = 0; 1670 int ret = 0;
1668 1671
1669 lbs_pr_debug(1, "libertas_execute_next_command\n"); 1672 lbs_deb_cmd("libertas_execute_next_command\n");
1670 1673
1671 spin_lock_irqsave(&adapter->driver_lock, flags); 1674 spin_lock_irqsave(&adapter->driver_lock, flags);
1672 1675
@@ -1685,7 +1688,7 @@ int libertas_execute_next_command(wlan_private * priv)
1685 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1688 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1686 1689
1687 if (cmdnode) { 1690 if (cmdnode) {
1688 lbs_pr_debug(1, 1691 lbs_deb_cmd(
1689 "EXEC_NEXT_CMD: Got next command from cmdpendingq\n"); 1692 "EXEC_NEXT_CMD: Got next command from cmdpendingq\n");
1690 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr; 1693 cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
1691 1694
@@ -1693,13 +1696,13 @@ int libertas_execute_next_command(wlan_private * priv)
1693 if ((adapter->psstate == PS_STATE_SLEEP) 1696 if ((adapter->psstate == PS_STATE_SLEEP)
1694 || (adapter->psstate == PS_STATE_PRE_SLEEP) 1697 || (adapter->psstate == PS_STATE_PRE_SLEEP)
1695 ) { 1698 ) {
1696 lbs_pr_debug(1, 1699 lbs_deb_cmd(
1697 "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n", 1700 "EXEC_NEXT_CMD: Cannot send cmd 0x%x in psstate %d\n",
1698 cmdptr->command, adapter->psstate); 1701 cmdptr->command, adapter->psstate);
1699 ret = -1; 1702 ret = -1;
1700 goto done; 1703 goto done;
1701 } 1704 }
1702 lbs_pr_debug(1, "EXEC_NEXT_CMD: OK to send command " 1705 lbs_deb_cmd("EXEC_NEXT_CMD: OK to send command "
1703 "0x%x in psstate %d\n", 1706 "0x%x in psstate %d\n",
1704 cmdptr->command, adapter->psstate); 1707 cmdptr->command, adapter->psstate);
1705 } else if (adapter->psstate != PS_STATE_FULL_POWER) { 1708 } else if (adapter->psstate != PS_STATE_FULL_POWER) {
@@ -1737,12 +1740,12 @@ int libertas_execute_next_command(wlan_private * priv)
1737 struct cmd_ds_802_11_ps_mode *psm = 1740 struct cmd_ds_802_11_ps_mode *psm =
1738 &cmdptr->params.psmode; 1741 &cmdptr->params.psmode;
1739 1742
1740 lbs_pr_debug(1, 1743 lbs_deb_cmd(
1741 "EXEC_NEXT_CMD: PS cmd- action=0x%x\n", 1744 "EXEC_NEXT_CMD: PS cmd- action=0x%x\n",
1742 psm->action); 1745 psm->action);
1743 if (psm->action != 1746 if (psm->action !=
1744 cpu_to_le16(cmd_subcmd_exit_ps)) { 1747 cpu_to_le16(cmd_subcmd_exit_ps)) {
1745 lbs_pr_debug(1, 1748 lbs_deb_cmd(
1746 "EXEC_NEXT_CMD: Ignore Enter PS cmd\n"); 1749 "EXEC_NEXT_CMD: Ignore Enter PS cmd\n");
1747 list_del((struct list_head *)cmdnode); 1750 list_del((struct list_head *)cmdnode);
1748 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1751 libertas_cleanup_and_insert_cmd(priv, cmdnode);
@@ -1754,7 +1757,7 @@ int libertas_execute_next_command(wlan_private * priv)
1754 if ((adapter->psstate == PS_STATE_SLEEP) 1757 if ((adapter->psstate == PS_STATE_SLEEP)
1755 || (adapter->psstate == PS_STATE_PRE_SLEEP) 1758 || (adapter->psstate == PS_STATE_PRE_SLEEP)
1756 ) { 1759 ) {
1757 lbs_pr_debug(1, 1760 lbs_deb_cmd(
1758 "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n"); 1761 "EXEC_NEXT_CMD: Ignore ExitPS cmd in sleep\n");
1759 list_del((struct list_head *)cmdnode); 1762 list_del((struct list_head *)cmdnode);
1760 libertas_cleanup_and_insert_cmd(priv, cmdnode); 1763 libertas_cleanup_and_insert_cmd(priv, cmdnode);
@@ -1764,12 +1767,12 @@ int libertas_execute_next_command(wlan_private * priv)
1764 goto done; 1767 goto done;
1765 } 1768 }
1766 1769
1767 lbs_pr_debug(1, 1770 lbs_deb_cmd(
1768 "EXEC_NEXT_CMD: Sending Exit_PS down...\n"); 1771 "EXEC_NEXT_CMD: Sending Exit_PS down...\n");
1769 } 1772 }
1770 } 1773 }
1771 list_del((struct list_head *)cmdnode); 1774 list_del((struct list_head *)cmdnode);
1772 lbs_pr_debug(1, "EXEC_NEXT_CMD: Sending 0x%04X command\n", 1775 lbs_deb_cmd("EXEC_NEXT_CMD: Sending 0x%04X command\n",
1773 cmdptr->command); 1776 cmdptr->command);
1774 DownloadcommandToStation(priv, cmdnode); 1777 DownloadcommandToStation(priv, cmdnode);
1775 } else { 1778 } else {
@@ -1785,13 +1788,13 @@ int libertas_execute_next_command(wlan_private * priv)
1785 /* check for valid WPA group keys */ 1788 /* check for valid WPA group keys */
1786 if (adapter->wpa_mcast_key.len 1789 if (adapter->wpa_mcast_key.len
1787 || adapter->wpa_unicast_key.len) { 1790 || adapter->wpa_unicast_key.len) {
1788 lbs_pr_debug(1, 1791 lbs_deb_cmd(
1789 "EXEC_NEXT_CMD: WPA enabled and GTK_SET" 1792 "EXEC_NEXT_CMD: WPA enabled and GTK_SET"
1790 " go back to PS_SLEEP"); 1793 " go back to PS_SLEEP");
1791 libertas_ps_sleep(priv, 0); 1794 libertas_ps_sleep(priv, 0);
1792 } 1795 }
1793 } else { 1796 } else {
1794 lbs_pr_debug(1, 1797 lbs_deb_cmd(
1795 "EXEC_NEXT_CMD: command PendQ is empty," 1798 "EXEC_NEXT_CMD: command PendQ is empty,"
1796 " go back to PS_SLEEP"); 1799 " go back to PS_SLEEP");
1797 libertas_ps_sleep(priv, 0); 1800 libertas_ps_sleep(priv, 0);
@@ -1809,7 +1812,7 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
1809 union iwreq_data iwrq; 1812 union iwreq_data iwrq;
1810 u8 buf[50]; 1813 u8 buf[50];
1811 1814
1812 ENTER(); 1815 lbs_deb_enter(LBS_DEB_CMD);
1813 1816
1814 memset(&iwrq, 0, sizeof(union iwreq_data)); 1817 memset(&iwrq, 0, sizeof(union iwreq_data));
1815 memset(buf, 0, sizeof(buf)); 1818 memset(buf, 0, sizeof(buf));
@@ -1819,15 +1822,14 @@ void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str)
1819 iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN; 1822 iwrq.data.length = strlen(buf) + 1 + IW_EV_LCP_LEN;
1820 1823
1821 /* Send Event to upper layer */ 1824 /* Send Event to upper layer */
1822 lbs_pr_debug(1, "Event Indication string = %s\n", 1825 lbs_deb_cmd("Event Indication string = %s\n",
1823 (char *)buf); 1826 (char *)buf);
1824 lbs_pr_debug(1, "Event Indication String length = %d\n", iwrq.data.length); 1827 lbs_deb_cmd("Event Indication String length = %d\n", iwrq.data.length);
1825 1828
1826 lbs_pr_debug(1, "Sending wireless event IWEVCUSTOM for %s\n", str); 1829 lbs_deb_cmd("Sending wireless event IWEVCUSTOM for %s\n", str);
1827 wireless_send_event(priv->wlan_dev.netdev, IWEVCUSTOM, &iwrq, buf); 1830 wireless_send_event(priv->wlan_dev.netdev, IWEVCUSTOM, &iwrq, buf);
1828 1831
1829 LEAVE(); 1832 lbs_deb_leave(LBS_DEB_CMD);
1830 return;
1831} 1833}
1832 1834
1833static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size) 1835static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
@@ -1836,9 +1838,9 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
1836 wlan_adapter *adapter = priv->adapter; 1838 wlan_adapter *adapter = priv->adapter;
1837 int ret = 0; 1839 int ret = 0;
1838 1840
1839 ENTER(); 1841 lbs_deb_enter(LBS_DEB_CMD);
1840 1842
1841 lbs_pr_debug(1, "SEND_SLEEPC_CMD: Before download, size of cmd = %d\n", 1843 lbs_deb_cmd("SEND_SLEEPC_CMD: Before download, size of cmd = %d\n",
1842 size); 1844 size);
1843 1845
1844 lbs_dbg_hex("SEND_SLEEPC_CMD: Sleep confirm command", cmdptr, size); 1846 lbs_dbg_hex("SEND_SLEEPC_CMD: Sleep confirm command", cmdptr, size);
@@ -1848,7 +1850,7 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
1848 1850
1849 spin_lock_irqsave(&adapter->driver_lock, flags); 1851 spin_lock_irqsave(&adapter->driver_lock, flags);
1850 if (adapter->intcounter || adapter->currenttxskb) 1852 if (adapter->intcounter || adapter->currenttxskb)
1851 lbs_pr_debug(1, "SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n", 1853 lbs_deb_cmd("SEND_SLEEPC_CMD: intcounter=%d currenttxskb=%p\n",
1852 adapter->intcounter, adapter->currenttxskb); 1854 adapter->intcounter, adapter->currenttxskb);
1853 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1855 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1854 1856
@@ -1860,23 +1862,22 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
1860 if (!adapter->intcounter) { 1862 if (!adapter->intcounter) {
1861 adapter->psstate = PS_STATE_SLEEP; 1863 adapter->psstate = PS_STATE_SLEEP;
1862 } else { 1864 } else {
1863 lbs_pr_debug(1, "SEND_SLEEPC_CMD: After sent,IntC=%d\n", 1865 lbs_deb_cmd("SEND_SLEEPC_CMD: After sent,IntC=%d\n",
1864 adapter->intcounter); 1866 adapter->intcounter);
1865 } 1867 }
1866 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1868 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1867 1869
1868 lbs_pr_debug(1, "SEND_SLEEPC_CMD: Sent Confirm Sleep command\n"); 1870 lbs_deb_cmd("SEND_SLEEPC_CMD: Sent Confirm Sleep command\n");
1869 lbs_pr_debug(1, "+"); 1871 lbs_deb_cmd("+");
1870 } 1872 }
1871 1873
1872 LEAVE(); 1874 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1873 return ret; 1875 return ret;
1874} 1876}
1875 1877
1876void libertas_ps_sleep(wlan_private * priv, int wait_option) 1878void libertas_ps_sleep(wlan_private * priv, int wait_option)
1877{ 1879{
1878 1880 lbs_deb_enter(LBS_DEB_CMD);
1879 ENTER();
1880 1881
1881 /* 1882 /*
1882 * PS is currently supported only in Infrastructure mode 1883 * PS is currently supported only in Infrastructure mode
@@ -1886,8 +1887,7 @@ void libertas_ps_sleep(wlan_private * priv, int wait_option)
1886 libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, 1887 libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode,
1887 cmd_subcmd_enter_ps, wait_option, 0, NULL); 1888 cmd_subcmd_enter_ps, wait_option, 0, NULL);
1888 1889
1889 LEAVE(); 1890 lbs_deb_leave(LBS_DEB_CMD);
1890 return;
1891} 1891}
1892 1892
1893/** 1893/**
@@ -1901,18 +1901,17 @@ void libertas_ps_wakeup(wlan_private * priv, int wait_option)
1901{ 1901{
1902 enum WLAN_802_11_POWER_MODE Localpsmode; 1902 enum WLAN_802_11_POWER_MODE Localpsmode;
1903 1903
1904 ENTER(); 1904 lbs_deb_enter(LBS_DEB_CMD);
1905 1905
1906 Localpsmode = wlan802_11powermodecam; 1906 Localpsmode = wlan802_11powermodecam;
1907 1907
1908 lbs_pr_debug(1, "Exit_PS: Localpsmode = %d\n", Localpsmode); 1908 lbs_deb_cmd("Exit_PS: Localpsmode = %d\n", Localpsmode);
1909 1909
1910 libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode, 1910 libertas_prepare_and_send_command(priv, cmd_802_11_ps_mode,
1911 cmd_subcmd_exit_ps, 1911 cmd_subcmd_exit_ps,
1912 wait_option, 0, &Localpsmode); 1912 wait_option, 0, &Localpsmode);
1913 1913
1914 LEAVE(); 1914 lbs_deb_leave(LBS_DEB_CMD);
1915 return;
1916} 1915}
1917 1916
1918/** 1917/**
@@ -1929,31 +1928,31 @@ void libertas_ps_confirm_sleep(wlan_private * priv, u16 psmode)
1929 wlan_adapter *adapter = priv->adapter; 1928 wlan_adapter *adapter = priv->adapter;
1930 u8 allowed = 1; 1929 u8 allowed = 1;
1931 1930
1932 ENTER(); 1931 lbs_deb_enter(LBS_DEB_CMD);
1933 1932
1934 if (priv->wlan_dev.dnld_sent) { 1933 if (priv->wlan_dev.dnld_sent) {
1935 allowed = 0; 1934 allowed = 0;
1936 lbs_pr_debug(1, "D"); 1935 lbs_deb_cmd("D");
1937 } 1936 }
1938 1937
1939 spin_lock_irqsave(&adapter->driver_lock, flags); 1938 spin_lock_irqsave(&adapter->driver_lock, flags);
1940 if (adapter->cur_cmd) { 1939 if (adapter->cur_cmd) {
1941 allowed = 0; 1940 allowed = 0;
1942 lbs_pr_debug(1, "C"); 1941 lbs_deb_cmd("C");
1943 } 1942 }
1944 if (adapter->intcounter > 0) { 1943 if (adapter->intcounter > 0) {
1945 allowed = 0; 1944 allowed = 0;
1946 lbs_pr_debug(1, "I%d", adapter->intcounter); 1945 lbs_deb_cmd("I%d", adapter->intcounter);
1947 } 1946 }
1948 spin_unlock_irqrestore(&adapter->driver_lock, flags); 1947 spin_unlock_irqrestore(&adapter->driver_lock, flags);
1949 1948
1950 if (allowed) { 1949 if (allowed) {
1951 lbs_pr_debug(1, "Sending libertas_ps_confirm_sleep\n"); 1950 lbs_deb_cmd("Sending libertas_ps_confirm_sleep\n");
1952 sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep, 1951 sendconfirmsleep(priv, (u8 *) & adapter->libertas_ps_confirm_sleep,
1953 sizeof(struct PS_CMD_ConfirmSleep)); 1952 sizeof(struct PS_CMD_ConfirmSleep));
1954 } else { 1953 } else {
1955 lbs_pr_debug(1, "Sleep Confirm has been delayed\n"); 1954 lbs_deb_cmd("Sleep Confirm has been delayed\n");
1956 } 1955 }
1957 1956
1958 LEAVE(); 1957 lbs_deb_leave(LBS_DEB_CMD);
1959} 1958}
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index c86454034b58..9509b8ef6264 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -32,7 +32,7 @@ void libertas_mac_event_disconnected(wlan_private * priv)
32 if (adapter->connect_status != libertas_connected) 32 if (adapter->connect_status != libertas_connected)
33 return; 33 return;
34 34
35 lbs_pr_debug(1, "Handles disconnect event.\n"); 35 lbs_deb_cmd("Handles disconnect event.\n");
36 36
37 memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN); 37 memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
38 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 38 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
@@ -62,10 +62,10 @@ void libertas_mac_event_disconnected(wlan_private * priv)
62 adapter->nextSNRNF = 0; 62 adapter->nextSNRNF = 0;
63 adapter->numSNRNF = 0; 63 adapter->numSNRNF = 0;
64 adapter->rxpd_rate = 0; 64 adapter->rxpd_rate = 0;
65 lbs_pr_debug(1, "Current SSID=%s, ssid length=%u\n", 65 lbs_deb_cmd("Current SSID=%s, ssid length=%u\n",
66 adapter->curbssparams.ssid.ssid, 66 adapter->curbssparams.ssid.ssid,
67 adapter->curbssparams.ssid.ssidlength); 67 adapter->curbssparams.ssid.ssidlength);
68 lbs_pr_debug(1, "Previous SSID=%s, ssid length=%u\n", 68 lbs_deb_cmd("Previous SSID=%s, ssid length=%u\n",
69 adapter->previousssid.ssid, adapter->previousssid.ssidlength); 69 adapter->previousssid.ssid, adapter->previousssid.ssidlength);
70 70
71 /* reset internal flags */ 71 /* reset internal flags */
@@ -90,7 +90,7 @@ void libertas_mac_event_disconnected(wlan_private * priv)
90 90
91 if (adapter->psstate != PS_STATE_FULL_POWER) { 91 if (adapter->psstate != PS_STATE_FULL_POWER) {
92 /* make firmware to exit PS mode */ 92 /* make firmware to exit PS mode */
93 lbs_pr_debug(1, "Disconnected, so exit PS mode.\n"); 93 lbs_deb_cmd("Disconnected, so exit PS mode.\n");
94 libertas_ps_wakeup(priv, 0); 94 libertas_ps_wakeup(priv, 0);
95 } 95 }
96} 96}
@@ -122,9 +122,10 @@ static void handle_mic_failureevent(wlan_private * priv, u32 event)
122static int wlan_ret_reg_access(wlan_private * priv, 122static int wlan_ret_reg_access(wlan_private * priv,
123 u16 type, struct cmd_ds_command *resp) 123 u16 type, struct cmd_ds_command *resp)
124{ 124{
125 int ret = 0;
125 wlan_adapter *adapter = priv->adapter; 126 wlan_adapter *adapter = priv->adapter;
126 127
127 ENTER(); 128 lbs_deb_enter(LBS_DEB_CMD);
128 129
129 switch (type) { 130 switch (type) {
130 case cmd_ret_mac_reg_access: 131 case cmd_ret_mac_reg_access:
@@ -165,12 +166,11 @@ static int wlan_ret_reg_access(wlan_private * priv,
165 } 166 }
166 167
167 default: 168 default:
168 LEAVE(); 169 ret = -1;
169 return -1;
170 } 170 }
171 171
172 LEAVE(); 172 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
173 return 0; 173 return ret;
174} 174}
175 175
176static int wlan_ret_get_hw_spec(wlan_private * priv, 176static int wlan_ret_get_hw_spec(wlan_private * priv,
@@ -181,19 +181,19 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
181 wlan_adapter *adapter = priv->adapter; 181 wlan_adapter *adapter = priv->adapter;
182 int ret = 0; 182 int ret = 0;
183 183
184 ENTER(); 184 lbs_deb_enter(LBS_DEB_CMD);
185 185
186 adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo); 186 adapter->fwcapinfo = le32_to_cpu(hwspec->fwcapinfo);
187 187
188 adapter->fwreleasenumber = hwspec->fwreleasenumber; 188 adapter->fwreleasenumber = hwspec->fwreleasenumber;
189 189
190 lbs_pr_debug(1, "GET_HW_SPEC: FWReleaseVersion- 0x%X\n", 190 lbs_deb_cmd("GET_HW_SPEC: FWReleaseVersion- 0x%X\n",
191 adapter->fwreleasenumber); 191 adapter->fwreleasenumber);
192 lbs_pr_debug(1, "GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n", 192 lbs_deb_cmd("GET_HW_SPEC: Permanent addr- %2x:%2x:%2x:%2x:%2x:%2x\n",
193 hwspec->permanentaddr[0], hwspec->permanentaddr[1], 193 hwspec->permanentaddr[0], hwspec->permanentaddr[1],
194 hwspec->permanentaddr[2], hwspec->permanentaddr[3], 194 hwspec->permanentaddr[2], hwspec->permanentaddr[3],
195 hwspec->permanentaddr[4], hwspec->permanentaddr[5]); 195 hwspec->permanentaddr[4], hwspec->permanentaddr[5]);
196 lbs_pr_debug(1, "GET_HW_SPEC: hwifversion=0x%X version=0x%X\n", 196 lbs_deb_cmd("GET_HW_SPEC: hwifversion=0x%X version=0x%X\n",
197 hwspec->hwifversion, hwspec->version); 197 hwspec->hwifversion, hwspec->version);
198 198
199 adapter->regioncode = le16_to_cpu(hwspec->regioncode); 199 adapter->regioncode = le16_to_cpu(hwspec->regioncode);
@@ -232,8 +232,8 @@ static int wlan_ret_get_hw_spec(wlan_private * priv,
232 goto done; 232 goto done;
233 } 233 }
234 234
235 done: 235done:
236 LEAVE(); 236 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
237 return ret; 237 return ret;
238} 238}
239 239
@@ -243,9 +243,9 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv,
243 struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params; 243 struct cmd_ds_802_11_sleep_params *sp = &resp->params.sleep_params;
244 wlan_adapter *adapter = priv->adapter; 244 wlan_adapter *adapter = priv->adapter;
245 245
246 ENTER(); 246 lbs_deb_enter(LBS_DEB_CMD);
247 247
248 lbs_pr_debug(1, "error=%x offset=%x stabletime=%x calcontrol=%x\n" 248 lbs_deb_cmd("error=%x offset=%x stabletime=%x calcontrol=%x\n"
249 " extsleepclk=%x\n", sp->error, sp->offset, 249 " extsleepclk=%x\n", sp->error, sp->offset,
250 sp->stabletime, sp->calcontrol, sp->externalsleepclk); 250 sp->stabletime, sp->calcontrol, sp->externalsleepclk);
251 adapter->sp.sp_error = le16_to_cpu(sp->error); 251 adapter->sp.sp_error = le16_to_cpu(sp->error);
@@ -255,7 +255,7 @@ static int wlan_ret_802_11_sleep_params(wlan_private * priv,
255 adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk); 255 adapter->sp.sp_extsleepclk = le16_to_cpu(sp->externalsleepclk);
256 adapter->sp.sp_reserved = le16_to_cpu(sp->reserved); 256 adapter->sp.sp_reserved = le16_to_cpu(sp->reserved);
257 257
258 LEAVE(); 258 lbs_deb_enter(LBS_DEB_CMD);
259 return 0; 259 return 0;
260} 260}
261 261
@@ -281,11 +281,11 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
281 u16 oid = le16_to_cpu(smib->oid); 281 u16 oid = le16_to_cpu(smib->oid);
282 u16 querytype = le16_to_cpu(smib->querytype); 282 u16 querytype = le16_to_cpu(smib->querytype);
283 283
284 ENTER(); 284 lbs_deb_enter(LBS_DEB_CMD);
285 285
286 lbs_pr_debug(1, "SNMP_RESP: value of the oid = %x, querytype=%x\n", oid, 286 lbs_deb_cmd("SNMP_RESP: value of the oid = %x, querytype=%x\n", oid,
287 querytype); 287 querytype);
288 lbs_pr_debug(1, "SNMP_RESP: Buf size = %x\n", 288 lbs_deb_cmd("SNMP_RESP: Buf size = %x\n",
289 le16_to_cpu(smib->bufsize)); 289 le16_to_cpu(smib->bufsize));
290 290
291 if (querytype == cmd_act_get) { 291 if (querytype == cmd_act_get) {
@@ -294,21 +294,21 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
294 priv->adapter->fragthsd = 294 priv->adapter->fragthsd =
295 le16_to_cpu(* 295 le16_to_cpu(*
296 ((unsigned short *)(smib->value))); 296 ((unsigned short *)(smib->value)));
297 lbs_pr_debug(1, "SNMP_RESP: fragthsd =%u\n", 297 lbs_deb_cmd("SNMP_RESP: fragthsd =%u\n",
298 priv->adapter->fragthsd); 298 priv->adapter->fragthsd);
299 break; 299 break;
300 case rtsthresh_i: 300 case rtsthresh_i:
301 priv->adapter->rtsthsd = 301 priv->adapter->rtsthsd =
302 le16_to_cpu(* 302 le16_to_cpu(*
303 ((unsigned short *)(smib->value))); 303 ((unsigned short *)(smib->value)));
304 lbs_pr_debug(1, "SNMP_RESP: rtsthsd =%u\n", 304 lbs_deb_cmd("SNMP_RESP: rtsthsd =%u\n",
305 priv->adapter->rtsthsd); 305 priv->adapter->rtsthsd);
306 break; 306 break;
307 case short_retrylim_i: 307 case short_retrylim_i:
308 priv->adapter->txretrycount = 308 priv->adapter->txretrycount =
309 le16_to_cpu(* 309 le16_to_cpu(*
310 ((unsigned short *)(smib->value))); 310 ((unsigned short *)(smib->value)));
311 lbs_pr_debug(1, "SNMP_RESP: txretrycount =%u\n", 311 lbs_deb_cmd("SNMP_RESP: txretrycount =%u\n",
312 priv->adapter->rtsthsd); 312 priv->adapter->rtsthsd);
313 break; 313 break;
314 default: 314 default:
@@ -316,7 +316,7 @@ static int wlan_ret_802_11_snmp_mib(wlan_private * priv,
316 } 316 }
317 } 317 }
318 318
319 LEAVE(); 319 lbs_deb_enter(LBS_DEB_CMD);
320 return 0; 320 return 0;
321} 321}
322 322
@@ -328,7 +328,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
328 wlan_adapter *adapter = priv->adapter; 328 wlan_adapter *adapter = priv->adapter;
329 u16 action = le16_to_cpu(pkeymaterial->action); 329 u16 action = le16_to_cpu(pkeymaterial->action);
330 330
331 ENTER(); 331 lbs_deb_enter(LBS_DEB_CMD);
332 332
333 /* Copy the returned key to driver private data */ 333 /* Copy the returned key to driver private data */
334 if (action == cmd_act_get) { 334 if (action == cmd_act_get) {
@@ -371,7 +371,7 @@ static int wlan_ret_802_11_key_material(wlan_private * priv,
371 } 371 }
372 } 372 }
373 373
374 LEAVE(); 374 lbs_deb_enter(LBS_DEB_CMD);
375 return 0; 375 return 0;
376} 376}
377 377
@@ -381,11 +381,11 @@ static int wlan_ret_802_11_mac_address(wlan_private * priv,
381 struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd; 381 struct cmd_ds_802_11_mac_address *macadd = &resp->params.macadd;
382 wlan_adapter *adapter = priv->adapter; 382 wlan_adapter *adapter = priv->adapter;
383 383
384 ENTER(); 384 lbs_deb_enter(LBS_DEB_CMD);
385 385
386 memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN); 386 memcpy(adapter->current_addr, macadd->macadd, ETH_ALEN);
387 387
388 LEAVE(); 388 lbs_deb_enter(LBS_DEB_CMD);
389 return 0; 389 return 0;
390} 390}
391 391
@@ -395,13 +395,13 @@ static int wlan_ret_802_11_rf_tx_power(wlan_private * priv,
395 struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp; 395 struct cmd_ds_802_11_rf_tx_power *rtp = &resp->params.txp;
396 wlan_adapter *adapter = priv->adapter; 396 wlan_adapter *adapter = priv->adapter;
397 397
398 ENTER(); 398 lbs_deb_enter(LBS_DEB_CMD);
399 399
400 adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel); 400 adapter->txpowerlevel = le16_to_cpu(rtp->currentlevel);
401 401
402 lbs_pr_debug(1, "Current TxPower Level = %d\n", adapter->txpowerlevel); 402 lbs_deb_cmd("Current TxPower Level = %d\n", adapter->txpowerlevel);
403 403
404 LEAVE(); 404 lbs_deb_enter(LBS_DEB_CMD);
405 return 0; 405 return 0;
406} 406}
407 407
@@ -420,7 +420,7 @@ static int wlan_ret_802_11_rf_antenna(wlan_private * priv,
420 adapter->txantennamode = 420 adapter->txantennamode =
421 le16_to_cpu(pAntenna->antennamode); 421 le16_to_cpu(pAntenna->antennamode);
422 422
423 lbs_pr_debug(1, "RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n", 423 lbs_deb_cmd("RF_ANT_RESP: action = 0x%x, mode = 0x%04x\n",
424 action, le16_to_cpu(pAntenna->antennamode)); 424 action, le16_to_cpu(pAntenna->antennamode));
425 425
426 return 0; 426 return 0;
@@ -433,15 +433,14 @@ static int wlan_ret_802_11_rate_adapt_rateset(wlan_private * priv,
433 &resp->params.rateset; 433 &resp->params.rateset;
434 wlan_adapter *adapter = priv->adapter; 434 wlan_adapter *adapter = priv->adapter;
435 435
436 ENTER(); 436 lbs_deb_enter(LBS_DEB_CMD);
437 437
438 if (rates->action == cmd_act_get) { 438 if (rates->action == cmd_act_get) {
439 adapter->enablehwauto = rates->enablehwauto; 439 adapter->enablehwauto = rates->enablehwauto;
440 adapter->ratebitmap = rates->bitmap; 440 adapter->ratebitmap = rates->bitmap;
441 } 441 }
442 442
443 LEAVE(); 443 lbs_deb_enter(LBS_DEB_CMD);
444
445 return 0; 444 return 0;
446} 445}
447 446
@@ -452,7 +451,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv,
452 wlan_adapter *adapter = priv->adapter; 451 wlan_adapter *adapter = priv->adapter;
453 u8 dot11datarate; 452 u8 dot11datarate;
454 453
455 ENTER(); 454 lbs_deb_enter(LBS_DEB_CMD);
456 455
457 lbs_dbg_hex("DATA_RATE_RESP: data_rate- ", 456 lbs_dbg_hex("DATA_RATE_RESP: data_rate- ",
458 (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate)); 457 (u8 *) pdatarate, sizeof(struct cmd_ds_802_11_data_rate));
@@ -464,7 +463,7 @@ static int wlan_ret_802_11_data_rate(wlan_private * priv,
464 } 463 }
465 adapter->datarate = libertas_index_to_data_rate(dot11datarate); 464 adapter->datarate = libertas_index_to_data_rate(dot11datarate);
466 465
467 LEAVE(); 466 lbs_deb_enter(LBS_DEB_CMD);
468 return 0; 467 return 0;
469} 468}
470 469
@@ -477,18 +476,18 @@ static int wlan_ret_802_11_rf_channel(wlan_private * priv,
477 u16 action = le16_to_cpu(rfchannel->action); 476 u16 action = le16_to_cpu(rfchannel->action);
478 u16 newchannel = le16_to_cpu(rfchannel->currentchannel); 477 u16 newchannel = le16_to_cpu(rfchannel->currentchannel);
479 478
480 ENTER(); 479 lbs_deb_enter(LBS_DEB_CMD);
481 480
482 if (action == cmd_opt_802_11_rf_channel_get 481 if (action == cmd_opt_802_11_rf_channel_get
483 && adapter->curbssparams.channel != newchannel) { 482 && adapter->curbssparams.channel != newchannel) {
484 lbs_pr_debug(1, "channel Switch: %d to %d\n", 483 lbs_deb_cmd("channel Switch: %d to %d\n",
485 adapter->curbssparams.channel, newchannel); 484 adapter->curbssparams.channel, newchannel);
486 485
487 /* Update the channel again */ 486 /* Update the channel again */
488 adapter->curbssparams.channel = newchannel; 487 adapter->curbssparams.channel = newchannel;
489 } 488 }
490 489
491 LEAVE(); 490 lbs_deb_enter(LBS_DEB_CMD);
492 return 0; 491 return 0;
493} 492}
494 493
@@ -515,7 +514,7 @@ static int wlan_ret_802_11_rssi(wlan_private * priv,
515 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE, 514 CAL_RSSI(adapter->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
516 adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE); 515 adapter->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
517 516
518 lbs_pr_debug(1, "Beacon RSSI value = 0x%x\n", 517 lbs_deb_cmd("Beacon RSSI value = 0x%x\n",
519 adapter->RSSI[TYPE_BEACON][TYPE_AVG]); 518 adapter->RSSI[TYPE_BEACON][TYPE_AVG]);
520 519
521 return 0; 520 return 0;
@@ -528,11 +527,11 @@ static int wlan_ret_802_11_eeprom_access(wlan_private * priv,
528 struct wlan_ioctl_regrdwr *pbuf; 527 struct wlan_ioctl_regrdwr *pbuf;
529 pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom; 528 pbuf = (struct wlan_ioctl_regrdwr *) adapter->prdeeprom;
530 529
531 lbs_pr_debug(1, "eeprom read len=%x\n", 530 lbs_deb_cmd("eeprom read len=%x\n",
532 le16_to_cpu(resp->params.rdeeprom.bytecount)); 531 le16_to_cpu(resp->params.rdeeprom.bytecount));
533 if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) { 532 if (pbuf->NOB < le16_to_cpu(resp->params.rdeeprom.bytecount)) {
534 pbuf->NOB = 0; 533 pbuf->NOB = 0;
535 lbs_pr_debug(1, "eeprom read return length is too big\n"); 534 lbs_deb_cmd("eeprom read return length is too big\n");
536 return -1; 535 return -1;
537 } 536 }
538 pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount); 537 pbuf->NOB = le16_to_cpu(resp->params.rdeeprom.bytecount);
@@ -553,13 +552,13 @@ static int wlan_ret_get_log(wlan_private * priv,
553 (struct cmd_ds_802_11_get_log *)&resp->params.glog; 552 (struct cmd_ds_802_11_get_log *)&resp->params.glog;
554 wlan_adapter *adapter = priv->adapter; 553 wlan_adapter *adapter = priv->adapter;
555 554
556 ENTER(); 555 lbs_deb_enter(LBS_DEB_CMD);
557 556
558 /* TODO Convert it to Big Endian before copy */ 557 /* TODO Convert it to Big Endian before copy */
559 memcpy(&adapter->logmsg, logmessage, 558 memcpy(&adapter->logmsg, logmessage,
560 sizeof(struct cmd_ds_802_11_get_log)); 559 sizeof(struct cmd_ds_802_11_get_log));
561 560
562 LEAVE(); 561 lbs_deb_enter(LBS_DEB_CMD);
563 return 0; 562 return 0;
564} 563}
565 564
@@ -663,7 +662,7 @@ static inline int handle_cmd_response(u16 respcmd,
663 break; 662 break;
664 663
665 case cmd_ret_802_11_key_material: 664 case cmd_ret_802_11_key_material:
666 lbs_pr_debug(1, "CMD_RESP: KEY_MATERIAL command response\n"); 665 lbs_deb_cmd("CMD_RESP: KEY_MATERIAL command response\n");
667 ret = wlan_ret_802_11_key_material(priv, resp); 666 ret = wlan_ret_802_11_key_material(priv, resp);
668 break; 667 break;
669 668
@@ -739,7 +738,7 @@ static inline int handle_cmd_response(u16 respcmd,
739 priv->adapter->txrate = resp->params.txrate.txrate; 738 priv->adapter->txrate = resp->params.txrate.txrate;
740 break; 739 break;
741 default: 740 default:
742 lbs_pr_debug(1, "CMD_RESP: Unknown command response %#x\n", 741 lbs_deb_cmd("CMD_RESP: Unknown command response %#x\n",
743 resp->command); 742 resp->command);
744 break; 743 break;
745 } 744 }
@@ -755,9 +754,9 @@ int libertas_process_rx_command(wlan_private * priv)
755 ulong flags; 754 ulong flags;
756 u16 result; 755 u16 result;
757 756
758 ENTER(); 757 lbs_deb_enter(LBS_DEB_CMD);
759 758
760 lbs_pr_debug(1, "CMD_RESP: @ %lu\n", jiffies); 759 lbs_deb_cmd("CMD_RESP: @ %lu\n", jiffies);
761 760
762 /* Now we got response from FW, cancel the command timer */ 761 /* Now we got response from FW, cancel the command timer */
763 del_timer(&adapter->command_timer); 762 del_timer(&adapter->command_timer);
@@ -766,7 +765,7 @@ int libertas_process_rx_command(wlan_private * priv)
766 spin_lock_irqsave(&adapter->driver_lock, flags); 765 spin_lock_irqsave(&adapter->driver_lock, flags);
767 766
768 if (!adapter->cur_cmd) { 767 if (!adapter->cur_cmd) {
769 lbs_pr_debug(1, "CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd); 768 lbs_deb_cmd("CMD_RESP: NULL cur_cmd=%p\n", adapter->cur_cmd);
770 ret = -1; 769 ret = -1;
771 spin_unlock_irqrestore(&adapter->driver_lock, flags); 770 spin_unlock_irqrestore(&adapter->driver_lock, flags);
772 goto done; 771 goto done;
@@ -780,11 +779,11 @@ int libertas_process_rx_command(wlan_private * priv)
780 779
781 result = le16_to_cpu(resp->result); 780 result = le16_to_cpu(resp->result);
782 781
783 lbs_pr_debug(1, "CMD_RESP: %x result: %d length: %d\n", respcmd, 782 lbs_deb_cmd("CMD_RESP: %x result: %d length: %d\n", respcmd,
784 result, priv->wlan_dev.upld_len); 783 result, priv->wlan_dev.upld_len);
785 784
786 if (!(respcmd & 0x8000)) { 785 if (!(respcmd & 0x8000)) {
787 lbs_pr_debug(1, "Invalid response to command!"); 786 lbs_deb_cmd("Invalid response to command!");
788 adapter->cur_cmd_retcode = -1; 787 adapter->cur_cmd_retcode = -1;
789 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd); 788 __libertas_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
790 adapter->nr_cmd_pending--; 789 adapter->nr_cmd_pending--;
@@ -801,13 +800,13 @@ int libertas_process_rx_command(wlan_private * priv)
801 struct cmd_ds_802_11_ps_mode *psmode; 800 struct cmd_ds_802_11_ps_mode *psmode;
802 801
803 psmode = &resp->params.psmode; 802 psmode = &resp->params.psmode;
804 lbs_pr_debug(1, 803 lbs_deb_cmd(
805 "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n", 804 "CMD_RESP: PS_MODE cmd reply result=%#x action=0x%X\n",
806 resp->result, psmode->action); 805 resp->result, psmode->action);
807 psmode->action = cpu_to_le16(psmode->action); 806 psmode->action = cpu_to_le16(psmode->action);
808 807
809 if (result) { 808 if (result) {
810 lbs_pr_debug(1, "CMD_RESP: PS command failed- %#x \n", 809 lbs_deb_cmd("CMD_RESP: PS command failed- %#x \n",
811 resp->result); 810 resp->result);
812 if (adapter->mode == IW_MODE_ADHOC) { 811 if (adapter->mode == IW_MODE_ADHOC) {
813 /* 812 /*
@@ -823,13 +822,13 @@ int libertas_process_rx_command(wlan_private * priv)
823 adapter->needtowakeup = 0; 822 adapter->needtowakeup = 0;
824 adapter->psstate = PS_STATE_AWAKE; 823 adapter->psstate = PS_STATE_AWAKE;
825 824
826 lbs_pr_debug(1, "CMD_RESP: Enter_PS command response\n"); 825 lbs_deb_cmd("CMD_RESP: Enter_PS command response\n");
827 if (adapter->connect_status != libertas_connected) { 826 if (adapter->connect_status != libertas_connected) {
828 /* 827 /*
829 * When Deauth Event received before Enter_PS command 828 * When Deauth Event received before Enter_PS command
830 * response, We need to wake up the firmware. 829 * response, We need to wake up the firmware.
831 */ 830 */
832 lbs_pr_debug(1, 831 lbs_deb_cmd(
833 "Disconnected, Going to invoke libertas_ps_wakeup\n"); 832 "Disconnected, Going to invoke libertas_ps_wakeup\n");
834 833
835 mutex_unlock(&adapter->lock); 834 mutex_unlock(&adapter->lock);
@@ -841,9 +840,9 @@ int libertas_process_rx_command(wlan_private * priv)
841 } else if (psmode->action == cmd_subcmd_exit_ps) { 840 } else if (psmode->action == cmd_subcmd_exit_ps) {
842 adapter->needtowakeup = 0; 841 adapter->needtowakeup = 0;
843 adapter->psstate = PS_STATE_FULL_POWER; 842 adapter->psstate = PS_STATE_FULL_POWER;
844 lbs_pr_debug(1, "CMD_RESP: Exit_PS command response\n"); 843 lbs_deb_cmd("CMD_RESP: Exit_PS command response\n");
845 } else { 844 } else {
846 lbs_pr_debug(1, "CMD_RESP: PS- action=0x%X\n", 845 lbs_deb_cmd("CMD_RESP: PS- action=0x%X\n",
847 psmode->action); 846 psmode->action);
848 } 847 }
849 848
@@ -865,7 +864,7 @@ int libertas_process_rx_command(wlan_private * priv)
865 864
866 /* If the command is not successful, cleanup and return failure */ 865 /* If the command is not successful, cleanup and return failure */
867 if ((result != 0 || !(respcmd & 0x8000))) { 866 if ((result != 0 || !(respcmd & 0x8000))) {
868 lbs_pr_debug(1, "CMD_RESP: command reply %#x result=%#x\n", 867 lbs_deb_cmd("CMD_RESP: command reply %#x result=%#x\n",
869 resp->command, resp->result); 868 resp->command, resp->result);
870 /* 869 /*
871 * Handling errors here 870 * Handling errors here
@@ -873,7 +872,7 @@ int libertas_process_rx_command(wlan_private * priv)
873 switch (respcmd) { 872 switch (respcmd) {
874 case cmd_ret_hw_spec_info: 873 case cmd_ret_hw_spec_info:
875 case cmd_ret_802_11_reset: 874 case cmd_ret_802_11_reset:
876 lbs_pr_debug(1, "CMD_RESP: Reset command failed\n"); 875 lbs_deb_cmd("CMD_RESP: Reset command failed\n");
877 break; 876 break;
878 877
879 } 878 }
@@ -903,7 +902,7 @@ int libertas_process_rx_command(wlan_private * priv)
903 902
904done: 903done:
905 mutex_unlock(&adapter->lock); 904 mutex_unlock(&adapter->lock);
906 LEAVE(); 905 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
907 return ret; 906 return ret;
908} 907}
909 908
@@ -917,37 +916,37 @@ int libertas_process_event(wlan_private * priv)
917 eventcause = adapter->eventcause; 916 eventcause = adapter->eventcause;
918 spin_unlock_irq(&adapter->driver_lock); 917 spin_unlock_irq(&adapter->driver_lock);
919 918
920 ENTER(); 919 lbs_deb_enter(LBS_DEB_CMD);
921 920
922 lbs_pr_debug(1, "EVENT Cause %x\n", eventcause); 921 lbs_deb_cmd("EVENT Cause %x\n", eventcause);
923 922
924 switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) { 923 switch (eventcause >> SBI_EVENT_CAUSE_SHIFT) {
925 case MACREG_INT_CODE_LINK_SENSED: 924 case MACREG_INT_CODE_LINK_SENSED:
926 lbs_pr_debug(1, "EVENT: MACREG_INT_CODE_LINK_SENSED\n"); 925 lbs_deb_cmd("EVENT: MACREG_INT_CODE_LINK_SENSED\n");
927 break; 926 break;
928 927
929 case MACREG_INT_CODE_DEAUTHENTICATED: 928 case MACREG_INT_CODE_DEAUTHENTICATED:
930 lbs_pr_debug(1, "EVENT: Deauthenticated\n"); 929 lbs_deb_cmd("EVENT: Deauthenticated\n");
931 libertas_mac_event_disconnected(priv); 930 libertas_mac_event_disconnected(priv);
932 break; 931 break;
933 932
934 case MACREG_INT_CODE_DISASSOCIATED: 933 case MACREG_INT_CODE_DISASSOCIATED:
935 lbs_pr_debug(1, "EVENT: Disassociated\n"); 934 lbs_deb_cmd("EVENT: Disassociated\n");
936 libertas_mac_event_disconnected(priv); 935 libertas_mac_event_disconnected(priv);
937 break; 936 break;
938 937
939 case MACREG_INT_CODE_LINK_LOSE_NO_SCAN: 938 case MACREG_INT_CODE_LINK_LOSE_NO_SCAN:
940 lbs_pr_debug(1, "EVENT: Link lost\n"); 939 lbs_deb_cmd("EVENT: Link lost\n");
941 libertas_mac_event_disconnected(priv); 940 libertas_mac_event_disconnected(priv);
942 break; 941 break;
943 942
944 case MACREG_INT_CODE_PS_SLEEP: 943 case MACREG_INT_CODE_PS_SLEEP:
945 lbs_pr_debug(1, "EVENT: SLEEP\n"); 944 lbs_deb_cmd("EVENT: SLEEP\n");
946 lbs_pr_debug(1, "_"); 945 lbs_deb_cmd("_");
947 946
948 /* handle unexpected PS SLEEP event */ 947 /* handle unexpected PS SLEEP event */
949 if (adapter->psstate == PS_STATE_FULL_POWER) { 948 if (adapter->psstate == PS_STATE_FULL_POWER) {
950 lbs_pr_debug(1, 949 lbs_deb_cmd(
951 "EVENT: In FULL POWER mode - ignore PS SLEEP\n"); 950 "EVENT: In FULL POWER mode - ignore PS SLEEP\n");
952 break; 951 break;
953 } 952 }
@@ -958,12 +957,12 @@ int libertas_process_event(wlan_private * priv)
958 break; 957 break;
959 958
960 case MACREG_INT_CODE_PS_AWAKE: 959 case MACREG_INT_CODE_PS_AWAKE:
961 lbs_pr_debug(1, "EVENT: AWAKE \n"); 960 lbs_deb_cmd("EVENT: AWAKE \n");
962 lbs_pr_debug(1, "|"); 961 lbs_deb_cmd("|");
963 962
964 /* handle unexpected PS AWAKE event */ 963 /* handle unexpected PS AWAKE event */
965 if (adapter->psstate == PS_STATE_FULL_POWER) { 964 if (adapter->psstate == PS_STATE_FULL_POWER) {
966 lbs_pr_debug(1, 965 lbs_deb_cmd(
967 "EVENT: In FULL POWER mode - ignore PS AWAKE\n"); 966 "EVENT: In FULL POWER mode - ignore PS AWAKE\n");
968 break; 967 break;
969 } 968 }
@@ -977,18 +976,18 @@ int libertas_process_event(wlan_private * priv)
977 * adapter->needtowakeup will be set to FALSE 976 * adapter->needtowakeup will be set to FALSE
978 * in libertas_ps_wakeup() 977 * in libertas_ps_wakeup()
979 */ 978 */
980 lbs_pr_debug(1, "Waking up...\n"); 979 lbs_deb_cmd("Waking up...\n");
981 libertas_ps_wakeup(priv, 0); 980 libertas_ps_wakeup(priv, 0);
982 } 981 }
983 break; 982 break;
984 983
985 case MACREG_INT_CODE_MIC_ERR_UNICAST: 984 case MACREG_INT_CODE_MIC_ERR_UNICAST:
986 lbs_pr_debug(1, "EVENT: UNICAST MIC ERROR\n"); 985 lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
987 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST); 986 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST);
988 break; 987 break;
989 988
990 case MACREG_INT_CODE_MIC_ERR_MULTICAST: 989 case MACREG_INT_CODE_MIC_ERR_MULTICAST:
991 lbs_pr_debug(1, "EVENT: MULTICAST MIC ERROR\n"); 990 lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
992 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST); 991 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
993 break; 992 break;
994 case MACREG_INT_CODE_MIB_CHANGED: 993 case MACREG_INT_CODE_MIB_CHANGED:
@@ -996,7 +995,7 @@ int libertas_process_event(wlan_private * priv)
996 break; 995 break;
997 996
998 case MACREG_INT_CODE_ADHOC_BCN_LOST: 997 case MACREG_INT_CODE_ADHOC_BCN_LOST:
999 lbs_pr_debug(1, "EVENT: HWAC - ADHOC BCN LOST\n"); 998 lbs_deb_cmd("EVENT: HWAC - ADHOC BCN LOST\n");
1000 break; 999 break;
1001 1000
1002 case MACREG_INT_CODE_RSSI_LOW: 1001 case MACREG_INT_CODE_RSSI_LOW:
@@ -1024,6 +1023,7 @@ int libertas_process_event(wlan_private * priv)
1024 spin_lock_irq(&adapter->driver_lock); 1023 spin_lock_irq(&adapter->driver_lock);
1025 adapter->eventcause = 0; 1024 adapter->eventcause = 0;
1026 spin_unlock_irq(&adapter->driver_lock); 1025 spin_unlock_irq(&adapter->driver_lock);
1027 LEAVE(); 1026
1027 lbs_deb_enter_args(LBS_DEB_CMD, "ret %d", ret);
1028 return ret; 1028 return ret;
1029} 1029}
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index 1d880e7973ba..eb1cee42ccef 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -402,11 +402,11 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf,
402 u16 wait_option = cmd_option_waitforrsp; 402 u16 wait_option = cmd_option_waitforrsp;
403 403
404 if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) { 404 if (!(*cmdnode = libertas_get_free_cmd_ctrl_node(priv))) {
405 lbs_pr_debug(1, "failed libertas_get_free_cmd_ctrl_node\n"); 405 lbs_deb_debugfs("failed libertas_get_free_cmd_ctrl_node\n");
406 return -ENOMEM; 406 return -ENOMEM;
407 } 407 }
408 if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) { 408 if (!(*response_buf = kmalloc(3000, GFP_KERNEL))) {
409 lbs_pr_debug(1, "failed to allocate response buffer!\n"); 409 lbs_deb_debugfs("failed to allocate response buffer!\n");
410 return -ENOMEM; 410 return -ENOMEM;
411 } 411 }
412 libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL); 412 libertas_set_cmd_ctrl_node(priv, *cmdnode, 0, wait_option, NULL);
@@ -1864,7 +1864,7 @@ static ssize_t wlan_debugfs_write(struct file *f, const char __user *buf,
1864 return 0; 1864 return 0;
1865 1865
1866 if (copy_from_user(pdata, buf, cnt)) { 1866 if (copy_from_user(pdata, buf, cnt)) {
1867 lbs_pr_debug(1, "Copy from user failed\n"); 1867 lbs_deb_debugfs("Copy from user failed\n");
1868 kfree(pdata); 1868 kfree(pdata);
1869 return 0; 1869 return 0;
1870 } 1870 }
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h
index cd95977cf89a..ae59b37fd47f 100644
--- a/drivers/net/wireless/libertas/defs.h
+++ b/drivers/net/wireless/libertas/defs.h
@@ -7,14 +7,77 @@
7 7
8#include <linux/spinlock.h> 8#include <linux/spinlock.h>
9 9
10extern unsigned int libertas_debug;
11
12#ifdef CONFIG_LIBERTAS_DEBUG 10#ifdef CONFIG_LIBERTAS_DEBUG
13#define DEBUG 11#define DEBUG
14#define PROC_DEBUG 12#define PROC_DEBUG
15#endif 13#endif
16 14
17#define DRV_NAME "usb8xxx" 15#define DRV_NAME "usb8xxx"
16
17
18#define LBS_DEB_ENTER (1<<0)
19#define LBS_DEB_LEAVE (1<<1)
20#define LBS_DEB_MAIN (1<<2)
21#define LBS_DEB_NET (1<<3)
22#define LBS_DEB_MESH (1<<4)
23#define LBS_DEB_WEXT (1<<5)
24#define LBS_DEB_IOCTL (1<<6)
25#define LBS_DEB_SCAN (1<<7)
26#define LBS_DEB_ASSOC (1<<8)
27#define LBS_DEB_JOIN (1<<9)
28#define LBS_DEB_11D (1<<10)
29#define LBS_DEB_DEBUGFS (1<<11)
30#define LBS_DEB_ETHTOOL (1<<12)
31#define LBS_DEB_HOST (1<<13)
32#define LBS_DEB_CMD (1<<14)
33#define LBS_DEB_RX (1<<15)
34#define LBS_DEB_TX (1<<16)
35#define LBS_DEB_FW (1<<17)
36#define LBS_DEB_USB (1<<18)
37#define LBS_DEB_CS (1<<19)
38#define LBS_DEB_THREAD (1<<20)
39#define LBS_DEB_HEX (1<<21)
40
41extern unsigned int libertas_debug_flags;
42
43#ifdef DEBUG
44#define LBS_DEB_LL(grp, fmt, args...) \
45do { if ((libertas_debug_flags & (grp)) == (grp)) \
46 printk(KERN_DEBUG DRV_NAME "%s: " fmt, \
47 in_interrupt() ? " (INT)" : "", ## args); } while (0)
48#else
49#define LBS_DEB_LL(grp, fmt, args...) do {} while (0)
50#endif
51
52#define lbs_deb_enter(grp) \
53 LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s() %d enter\n", __FUNCTION__, __LINE__);
54#define lbs_deb_enter_args(grp, fmt, args...) \
55 LBS_DEB_LL(grp | LBS_DEB_ENTER, "%s(" fmt "):%d\n", __FUNCTION__, ## args, __LINE__);
56#define lbs_deb_leave(grp) \
57 LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave\n", __FUNCTION__, __LINE__);
58#define lbs_deb_leave_args(grp, fmt, args...) \
59 LBS_DEB_LL(grp | LBS_DEB_LEAVE, "%s():%d leave, " fmt "\n", \
60 __FUNCTION__, __LINE__, ##args);
61#define lbs_deb_main(fmt, args...) LBS_DEB_LL(LBS_DEB_MAIN, fmt, ##args)
62#define lbs_deb_net(fmt, args...) LBS_DEB_LL(LBS_DEB_NET, fmt, ##args)
63#define lbs_deb_mesh(fmt, args...) LBS_DEB_LL(LBS_DEB_MESH, fmt, ##args)
64#define lbs_deb_wext(fmt, args...) LBS_DEB_LL(LBS_DEB_WEXT, fmt, ##args)
65#define lbs_deb_ioctl(fmt, args...) LBS_DEB_LL(LBS_DEB_IOCTL, fmt, ##args)
66#define lbs_deb_scan(fmt, args...) LBS_DEB_LL(LBS_DEB_SCAN, fmt, ##args)
67#define lbs_deb_assoc(fmt, args...) LBS_DEB_LL(LBS_DEB_ASSOC, fmt, ##args)
68#define lbs_deb_join(fmt, args...) LBS_DEB_LL(LBS_DEB_JOIN, fmt, ##args)
69#define lbs_deb_11d(fmt, args...) LBS_DEB_LL(LBS_DEB_11D, fmt, ##args)
70#define lbs_deb_debugfs(fmt, args...) LBS_DEB_LL(LBS_DEB_DEBUGFS, fmt, ##args)
71#define lbs_deb_ethtool(fmt, args...) LBS_DEB_LL(LBS_DEB_ETHTOOL, fmt, ##args)
72#define lbs_deb_host(fmt, args...) LBS_DEB_LL(LBS_DEB_HOST, fmt, ##args)
73#define lbs_deb_cmd(fmt, args...) LBS_DEB_LL(LBS_DEB_CMD, fmt, ##args)
74#define lbs_deb_rx(fmt, args...) LBS_DEB_LL(LBS_DEB_RX, fmt, ##args)
75#define lbs_deb_tx(fmt, args...) LBS_DEB_LL(LBS_DEB_TX, fmt, ##args)
76#define lbs_deb_fw(fmt, args...) LBS_DEB_LL(LBS_DEB_FW, fmt, ##args)
77#define lbs_deb_usb(fmt, args...) LBS_DEB_LL(LBS_DEB_USB, fmt, ##args)
78#define lbs_deb_usbd(dev, fmt, args...) LBS_DEB_LL(LBS_DEB_USB, "%s:" fmt, (dev)->bus_id, ##args)
79#define lbs_deb_cs(fmt, args...) LBS_DEB_LL(LBS_DEB_CS, fmt, ##args)
80#define lbs_deb_thread(fmt, args...) LBS_DEB_LL(LBS_DEB_THREAD, fmt, ##args)
18 81
19#define lbs_pr_info(format, args...) \ 82#define lbs_pr_info(format, args...) \
20 printk(KERN_INFO DRV_NAME": " format, ## args) 83 printk(KERN_INFO DRV_NAME": " format, ## args)
@@ -24,37 +87,25 @@ extern unsigned int libertas_debug;
24 printk(KERN_ALERT DRV_NAME": " format, ## args) 87 printk(KERN_ALERT DRV_NAME": " format, ## args)
25 88
26#ifdef DEBUG 89#ifdef DEBUG
27#define lbs_pr_debug(level, format, args...) \
28 do { if (libertas_debug >= level) \
29 printk(KERN_INFO DRV_NAME": " format, ##args); } while (0)
30#define lbs_dev_dbg(level, device, format, args...) \
31 lbs_pr_debug(level, "%s: " format, \
32 (device)->bus_id , ## args)
33
34static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) 90static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
35{ 91{
36 int i = 0; 92 int i = 0;
37 93
38 if (!libertas_debug) 94 if (!(libertas_debug_flags & LBS_DEB_HEX))
39 return; 95 return;
40 96
41 printk(KERN_DEBUG "%s: ", prompt); 97 printk(KERN_DEBUG "%s: ", prompt);
42 for (i = 1; i <= len; i++) { 98 for (i = 1; i <= len; i++) {
43 printk(KERN_DEBUG "%02x ", (u8) * buf); 99 printk("%02x ", (u8) * buf);
44 buf++; 100 buf++;
45 } 101 }
46 printk("\n"); 102 printk("\n");
47} 103}
48#else 104#else
49#define lbs_pr_debug(level, format, args...) do {} while (0)
50#define lbs_dev_dbg(level, device, format, args...) do {} while (0)
51#define lbs_dbg_hex(x,y,z) do {} while (0) 105#define lbs_dbg_hex(x,y,z) do {} while (0)
52#endif 106#endif
53 107
54#define ENTER() lbs_pr_debug(1, "Enter: %s:%i\n", \ 108
55 __FUNCTION__, __LINE__)
56#define LEAVE() lbs_pr_debug(1, "Leave: %s:%i\n", \
57 __FUNCTION__, __LINE__)
58 109
59/** Buffer Constants */ 110/** Buffer Constants */
60 111
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index 0064de542963..4655953730cc 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -69,7 +69,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
69 69
70 /* +14 is for action, offset, and NOB in 70 /* +14 is for action, offset, and NOB in
71 * response */ 71 * response */
72 lbs_pr_debug(1, "action:%d offset: %x NOB: %02x\n", 72 lbs_deb_ethtool("action:%d offset: %x NOB: %02x\n",
73 regctrl.action, regctrl.offset, regctrl.NOB); 73 regctrl.action, regctrl.offset, regctrl.NOB);
74 74
75 ret = libertas_prepare_and_send_command(priv, 75 ret = libertas_prepare_and_send_command(priv,
@@ -81,8 +81,7 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
81 if (ret) { 81 if (ret) {
82 if (adapter->prdeeprom) 82 if (adapter->prdeeprom)
83 kfree(adapter->prdeeprom); 83 kfree(adapter->prdeeprom);
84 LEAVE(); 84 goto done;
85 return ret;
86 } 85 }
87 86
88 mdelay(10); 87 mdelay(10);
@@ -101,7 +100,11 @@ static int libertas_ethtool_get_eeprom(struct net_device *dev,
101 kfree(adapter->prdeeprom); 100 kfree(adapter->prdeeprom);
102// mutex_unlock(&priv->mutex); 101// mutex_unlock(&priv->mutex);
103 102
104 return 0; 103 ret = 0;
104
105done:
106 lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
107 return ret;
105} 108}
106 109
107static void libertas_ethtool_get_stats(struct net_device * dev, 110static void libertas_ethtool_get_stats(struct net_device * dev,
@@ -109,7 +112,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
109{ 112{
110 wlan_private *priv = dev->priv; 113 wlan_private *priv = dev->priv;
111 114
112 ENTER(); 115 lbs_deb_enter(LBS_DEB_ETHTOOL);
113 116
114 stats->cmd = ETHTOOL_GSTATS; 117 stats->cmd = ETHTOOL_GSTATS;
115 BUG_ON(stats->n_stats != MESH_STATS_NUM); 118 BUG_ON(stats->n_stats != MESH_STATS_NUM);
@@ -122,7 +125,7 @@ static void libertas_ethtool_get_stats(struct net_device * dev,
122 data[5] = priv->mstats.fwd_bcast_cnt; 125 data[5] = priv->mstats.fwd_bcast_cnt;
123 data[6] = priv->mstats.drop_blind; 126 data[6] = priv->mstats.drop_blind;
124 127
125 LEAVE(); 128 lbs_deb_enter(LBS_DEB_ETHTOOL);
126} 129}
127 130
128static int libertas_ethtool_get_stats_count(struct net_device * dev) 131static int libertas_ethtool_get_stats_count(struct net_device * dev)
@@ -131,15 +134,16 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
131 wlan_private *priv = dev->priv; 134 wlan_private *priv = dev->priv;
132 struct cmd_ds_mesh_access mesh_access; 135 struct cmd_ds_mesh_access mesh_access;
133 136
134 ENTER(); 137 lbs_deb_enter(LBS_DEB_ETHTOOL);
138
135 /* Get Mesh Statistics */ 139 /* Get Mesh Statistics */
136 ret = libertas_prepare_and_send_command(priv, 140 ret = libertas_prepare_and_send_command(priv,
137 cmd_mesh_access, cmd_act_mesh_get_stats, 141 cmd_mesh_access, cmd_act_mesh_get_stats,
138 cmd_option_waitforrsp, 0, &mesh_access); 142 cmd_option_waitforrsp, 0, &mesh_access);
139 143
140 if (ret) { 144 if (ret) {
141 LEAVE(); 145 ret = 0;
142 return 0; 146 goto done;
143 } 147 }
144 148
145 priv->mstats.fwd_drop_rbt = mesh_access.data[0]; 149 priv->mstats.fwd_drop_rbt = mesh_access.data[0];
@@ -150,8 +154,11 @@ static int libertas_ethtool_get_stats_count(struct net_device * dev)
150 priv->mstats.fwd_bcast_cnt = mesh_access.data[5]; 154 priv->mstats.fwd_bcast_cnt = mesh_access.data[5];
151 priv->mstats.drop_blind = mesh_access.data[6]; 155 priv->mstats.drop_blind = mesh_access.data[6];
152 156
153 LEAVE(); 157 ret = MESH_STATS_NUM;
154 return MESH_STATS_NUM; 158
159done:
160 lbs_deb_enter_args(LBS_DEB_ETHTOOL, "ret %d", ret);
161 return ret;
155} 162}
156 163
157static void libertas_ethtool_get_strings (struct net_device * dev, 164static void libertas_ethtool_get_strings (struct net_device * dev,
@@ -160,7 +167,8 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
160{ 167{
161 int i; 168 int i;
162 169
163 ENTER(); 170 lbs_deb_enter(LBS_DEB_ETHTOOL);
171
164 switch (stringset) { 172 switch (stringset) {
165 case ETH_SS_STATS: 173 case ETH_SS_STATS:
166 for (i=0; i < MESH_STATS_NUM; i++) { 174 for (i=0; i < MESH_STATS_NUM; i++) {
@@ -170,7 +178,7 @@ static void libertas_ethtool_get_strings (struct net_device * dev,
170 } 178 }
171 break; 179 break;
172 } 180 }
173 LEAVE(); 181 lbs_deb_enter(LBS_DEB_ETHTOOL);
174} 182}
175 183
176struct ethtool_ops libertas_ethtool_ops = { 184struct ethtool_ops libertas_ethtool_ops = {
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index 5c63c9b1659c..48c3d8545966 100644
--- a/drivers/net/wireless/libertas/fw.c
+++ b/drivers/net/wireless/libertas/fw.c
@@ -20,8 +20,8 @@
20char *libertas_fw_name = NULL; 20char *libertas_fw_name = NULL;
21module_param_named(fw_name, libertas_fw_name, charp, 0644); 21module_param_named(fw_name, libertas_fw_name, charp, 0644);
22 22
23unsigned int libertas_debug = 0; 23unsigned int libertas_debug_flags = 0;
24module_param(libertas_debug, int, 0); 24module_param_named(debug, libertas_debug_flags, int, 0);
25 25
26/** 26/**
27 * @brief This function checks the validity of Boot2/FW image. 27 * @brief This function checks the validity of Boot2/FW image.
@@ -61,9 +61,9 @@ static int check_fwfile_format(u8 *data, u32 totlen)
61 } while (!exit); 61 } while (!exit);
62 62
63 if (ret) 63 if (ret)
64 lbs_pr_err("bin file format check FAIL...\n"); 64 lbs_pr_err("firmware file format check FAIL\n");
65 else 65 else
66 lbs_pr_debug(1, "bin file format check PASS...\n"); 66 lbs_deb_fw("firmware file format check PASS\n");
67 67
68 return ret; 68 return ret;
69} 69}
@@ -81,13 +81,13 @@ static int wlan_setup_station_hw(wlan_private * priv)
81 int ret = -1; 81 int ret = -1;
82 wlan_adapter *adapter = priv->adapter; 82 wlan_adapter *adapter = priv->adapter;
83 83
84 ENTER(); 84 lbs_deb_enter(LBS_DEB_FW);
85 85
86 if ((ret = request_firmware(&priv->firmware, libertas_fw_name, 86 if ((ret = request_firmware(&priv->firmware, libertas_fw_name,
87 priv->hotplug_device)) < 0) { 87 priv->hotplug_device)) < 0) {
88 lbs_pr_err("request_firmware() failed, error code = %#x\n", 88 lbs_pr_err("request_firmware() failed with %#x\n",
89 ret); 89 ret);
90 lbs_pr_err("%s not found in /lib/firmware\n", libertas_fw_name); 90 lbs_pr_err("firmware %s not found\n", libertas_fw_name);
91 goto done; 91 goto done;
92 } 92 }
93 93
@@ -101,7 +101,7 @@ static int wlan_setup_station_hw(wlan_private * priv)
101 release_firmware(priv->firmware); 101 release_firmware(priv->firmware);
102 102
103 if (ret) { 103 if (ret) {
104 lbs_pr_debug(1, "Bootloader in invalid state!\n"); 104 lbs_deb_fw("bootloader in invalid state\n");
105 ret = -1; 105 ret = -1;
106 goto done; 106 goto done;
107 } 107 }
@@ -133,9 +133,8 @@ static int wlan_setup_station_hw(wlan_private * priv)
133 133
134 ret = 0; 134 ret = 0;
135done: 135done:
136 LEAVE(); 136 lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
137 137 return ret;
138 return (ret);
139} 138}
140 139
141static int wlan_allocate_adapter(wlan_private * priv) 140static int wlan_allocate_adapter(wlan_private * priv)
@@ -264,7 +263,7 @@ int libertas_init_fw(wlan_private * priv)
264 int ret = -1; 263 int ret = -1;
265 wlan_adapter *adapter = priv->adapter; 264 wlan_adapter *adapter = priv->adapter;
266 265
267 ENTER(); 266 lbs_deb_enter(LBS_DEB_FW);
268 267
269 /* Allocate adapter structure */ 268 /* Allocate adapter structure */
270 if ((ret = wlan_allocate_adapter(priv)) != 0) 269 if ((ret = wlan_allocate_adapter(priv)) != 0)
@@ -288,7 +287,7 @@ int libertas_init_fw(wlan_private * priv)
288 287
289 ret = 0; 288 ret = 0;
290done: 289done:
291 LEAVE(); 290 lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
292 return ret; 291 return ret;
293} 292}
294 293
@@ -297,25 +296,24 @@ void libertas_free_adapter(wlan_private * priv)
297 wlan_adapter *adapter = priv->adapter; 296 wlan_adapter *adapter = priv->adapter;
298 297
299 if (!adapter) { 298 if (!adapter) {
300 lbs_pr_debug(1, "Why double free adapter?:)\n"); 299 lbs_deb_fw("why double free adapter?\n");
301 return; 300 return;
302 } 301 }
303 302
304 lbs_pr_debug(1, "Free command buffer\n"); 303 lbs_deb_fw("free command buffer\n");
305 libertas_free_cmd_buffer(priv); 304 libertas_free_cmd_buffer(priv);
306 305
307 lbs_pr_debug(1, "Free commandTimer\n"); 306 lbs_deb_fw("free command_timer\n");
308 del_timer(&adapter->command_timer); 307 del_timer(&adapter->command_timer);
309 308
310 lbs_pr_debug(1, "Free scantable\n"); 309 lbs_deb_fw("free scantable\n");
311 if (adapter->scantable) { 310 if (adapter->scantable) {
312 kfree(adapter->scantable); 311 kfree(adapter->scantable);
313 adapter->scantable = NULL; 312 adapter->scantable = NULL;
314 } 313 }
315 314
316 lbs_pr_debug(1, "Free adapter\n");
317
318 /* Free the adapter object itself */ 315 /* Free the adapter object itself */
316 lbs_deb_fw("free adapter\n");
319 kfree(adapter); 317 kfree(adapter);
320 priv->adapter = NULL; 318 priv->adapter = NULL;
321} 319}
@@ -334,17 +332,17 @@ static void command_timer_fn(unsigned long data)
334 332
335 ptempnode = adapter->cur_cmd; 333 ptempnode = adapter->cur_cmd;
336 if (ptempnode == NULL) { 334 if (ptempnode == NULL) {
337 lbs_pr_debug(1, "PTempnode Empty\n"); 335 lbs_deb_fw("ptempnode empty\n");
338 return; 336 return;
339 } 337 }
340 338
341 cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr; 339 cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
342 if (!cmd) { 340 if (!cmd) {
343 lbs_pr_debug(1, "cmd is NULL\n"); 341 lbs_deb_fw("cmd is NULL\n");
344 return; 342 return;
345 } 343 }
346 344
347 lbs_pr_info("command_timer_fn fired (%x)\n", cmd->command); 345 lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
348 346
349 if (!adapter->fw_ready) 347 if (!adapter->fw_ready)
350 return; 348 return;
@@ -353,7 +351,7 @@ static void command_timer_fn(unsigned long data)
353 adapter->cur_cmd = NULL; 351 adapter->cur_cmd = NULL;
354 spin_unlock_irqrestore(&adapter->driver_lock, flags); 352 spin_unlock_irqrestore(&adapter->driver_lock, flags);
355 353
356 lbs_pr_debug(1, "Re-sending same command as it timeout...!\n"); 354 lbs_deb_fw("re-sending same command because of timeout\n");
357 libertas_queue_cmd(adapter, ptempnode, 0); 355 libertas_queue_cmd(adapter, ptempnode, 0);
358 356
359 wake_up_interruptible(&priv->mainthread.waitq); 357 wake_up_interruptible(&priv->mainthread.waitq);
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 38063de9da43..208d25700040 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -46,9 +46,11 @@ static void if_usb_write_bulk_callback(struct urb *urb)
46 /* print the failure status number for debug */ 46 /* print the failure status number for debug */
47 lbs_pr_info("URB in failure status\n"); 47 lbs_pr_info("URB in failure status\n");
48 } else { 48 } else {
49 lbs_dev_dbg(2, &urb->dev->dev, "URB status is successfull\n"); 49 /*
50 lbs_dev_dbg(2, &urb->dev->dev, "Actual length transmitted %d\n", 50 lbs_deb_usbd(&urb->dev->dev, "URB status is successfull\n");
51 lbs_deb_usbd(&urb->dev->dev, "Actual length transmitted %d\n",
51 urb->actual_length); 52 urb->actual_length);
53 */
52 priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; 54 priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
53 /* Wake main thread if commands are pending */ 55 /* Wake main thread if commands are pending */
54 if (!adapter->cur_cmd) 56 if (!adapter->cur_cmd)
@@ -67,7 +69,7 @@ static void if_usb_write_bulk_callback(struct urb *urb)
67 */ 69 */
68void if_usb_free(struct usb_card_rec *cardp) 70void if_usb_free(struct usb_card_rec *cardp)
69{ 71{
70 ENTER(); 72 lbs_deb_enter(LBS_DEB_USB);
71 73
72 /* Unlink tx & rx urb */ 74 /* Unlink tx & rx urb */
73 usb_kill_urb(cardp->tx_urb); 75 usb_kill_urb(cardp->tx_urb);
@@ -82,8 +84,7 @@ void if_usb_free(struct usb_card_rec *cardp)
82 kfree(cardp->bulk_out_buffer); 84 kfree(cardp->bulk_out_buffer);
83 cardp->bulk_out_buffer = NULL; 85 cardp->bulk_out_buffer = NULL;
84 86
85 LEAVE(); 87 lbs_deb_leave(LBS_DEB_USB);
86 return;
87} 88}
88 89
89/** 90/**
@@ -113,7 +114,7 @@ static int if_usb_probe(struct usb_interface *intf,
113 usb_cardp->udev = udev; 114 usb_cardp->udev = udev;
114 iface_desc = intf->cur_altsetting; 115 iface_desc = intf->cur_altsetting;
115 116
116 lbs_dev_dbg(1, &udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X" 117 lbs_deb_usbd(&udev->dev, "bcdUSB = 0x%X bDeviceClass = 0x%X"
117 " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n", 118 " bDeviceSubClass = 0x%X, bDeviceProtocol = 0x%X\n",
118 udev->descriptor.bcdUSB, 119 udev->descriptor.bcdUSB,
119 udev->descriptor.bDeviceClass, 120 udev->descriptor.bDeviceClass,
@@ -126,12 +127,12 @@ static int if_usb_probe(struct usb_interface *intf,
126 && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == 127 && ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
127 USB_ENDPOINT_XFER_BULK)) { 128 USB_ENDPOINT_XFER_BULK)) {
128 /* we found a bulk in endpoint */ 129 /* we found a bulk in endpoint */
129 lbs_dev_dbg(1, &udev->dev, "Bulk in size is %d\n", 130 lbs_deb_usbd(&udev->dev, "Bulk in size is %d\n",
130 endpoint->wMaxPacketSize); 131 endpoint->wMaxPacketSize);
131 if (! 132 if (!
132 (usb_cardp->rx_urb = 133 (usb_cardp->rx_urb =
133 usb_alloc_urb(0, GFP_KERNEL))) { 134 usb_alloc_urb(0, GFP_KERNEL))) {
134 lbs_dev_dbg(1, &udev->dev, 135 lbs_deb_usbd(&udev->dev,
135 "Rx URB allocation failed\n"); 136 "Rx URB allocation failed\n");
136 goto dealloc; 137 goto dealloc;
137 } 138 }
@@ -142,7 +143,7 @@ static int if_usb_probe(struct usb_interface *intf,
142 usb_cardp->bulk_in_endpointAddr = 143 usb_cardp->bulk_in_endpointAddr =
143 (endpoint-> 144 (endpoint->
144 bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); 145 bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);
145 lbs_dev_dbg(1, &udev->dev, "in_endpoint = %d\n", 146 lbs_deb_usbd(&udev->dev, "in_endpoint = %d\n",
146 endpoint->bEndpointAddress); 147 endpoint->bEndpointAddress);
147 } 148 }
148 149
@@ -155,26 +156,26 @@ static int if_usb_probe(struct usb_interface *intf,
155 if (! 156 if (!
156 (usb_cardp->tx_urb = 157 (usb_cardp->tx_urb =
157 usb_alloc_urb(0, GFP_KERNEL))) { 158 usb_alloc_urb(0, GFP_KERNEL))) {
158 lbs_dev_dbg(1,&udev->dev, 159 lbs_deb_usbd(&udev->dev,
159 "Tx URB allocation failed\n"); 160 "Tx URB allocation failed\n");
160 goto dealloc; 161 goto dealloc;
161 } 162 }
162 163
163 usb_cardp->bulk_out_size = 164 usb_cardp->bulk_out_size =
164 endpoint->wMaxPacketSize; 165 endpoint->wMaxPacketSize;
165 lbs_dev_dbg(1, &udev->dev, 166 lbs_deb_usbd(&udev->dev,
166 "Bulk out size is %d\n", 167 "Bulk out size is %d\n",
167 endpoint->wMaxPacketSize); 168 endpoint->wMaxPacketSize);
168 usb_cardp->bulk_out_endpointAddr = 169 usb_cardp->bulk_out_endpointAddr =
169 endpoint->bEndpointAddress; 170 endpoint->bEndpointAddress;
170 lbs_dev_dbg(1, &udev->dev, "out_endpoint = %d\n", 171 lbs_deb_usbd(&udev->dev, "out_endpoint = %d\n",
171 endpoint->bEndpointAddress); 172 endpoint->bEndpointAddress);
172 usb_cardp->bulk_out_buffer = 173 usb_cardp->bulk_out_buffer =
173 kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE, 174 kmalloc(MRVDRV_ETH_TX_PACKET_BUFFER_SIZE,
174 GFP_KERNEL); 175 GFP_KERNEL);
175 176
176 if (!usb_cardp->bulk_out_buffer) { 177 if (!usb_cardp->bulk_out_buffer) {
177 lbs_dev_dbg(1, &udev->dev, 178 lbs_deb_usbd(&udev->dev,
178 "Could not allocate buffer\n"); 179 "Could not allocate buffer\n");
179 goto dealloc; 180 goto dealloc;
180 } 181 }
@@ -226,7 +227,7 @@ static void if_usb_disconnect(struct usb_interface *intf)
226 adapter->surpriseremoved = 1; 227 adapter->surpriseremoved = 1;
227 228
228 /* card is removed and we can call wlan_remove_card */ 229 /* card is removed and we can call wlan_remove_card */
229 lbs_dev_dbg(1, &cardp->udev->dev, "call remove card\n"); 230 lbs_deb_usbd(&cardp->udev->dev, "call remove card\n");
230 wlan_remove_card(cardp); 231 wlan_remove_card(cardp);
231 232
232 /* Unlink and free urb */ 233 /* Unlink and free urb */
@@ -262,8 +263,10 @@ static int if_prog_firmware(wlan_private * priv)
262 cardp->fwseqnum = cardp->lastseqnum - 1; 263 cardp->fwseqnum = cardp->lastseqnum - 1;
263 } 264 }
264 265
265 lbs_dev_dbg(2, &cardp->udev->dev, "totalbytes = %d\n", 266 /*
267 lbs_deb_usbd(&cardp->udev->dev, "totalbytes = %d\n",
266 cardp->totalbytes); 268 cardp->totalbytes);
269 */
267 270
268 memcpy(fwheader, &firmware[cardp->totalbytes], 271 memcpy(fwheader, &firmware[cardp->totalbytes],
269 sizeof(struct fwheader)); 272 sizeof(struct fwheader));
@@ -271,12 +274,14 @@ static int if_prog_firmware(wlan_private * priv)
271 cardp->fwlastblksent = cardp->totalbytes; 274 cardp->fwlastblksent = cardp->totalbytes;
272 cardp->totalbytes += sizeof(struct fwheader); 275 cardp->totalbytes += sizeof(struct fwheader);
273 276
274 lbs_dev_dbg(2, &cardp->udev->dev,"Copy Data\n"); 277 /* lbs_deb_usbd(&cardp->udev->dev,"Copy Data\n"); */
275 memcpy(fwdata->data, &firmware[cardp->totalbytes], 278 memcpy(fwdata->data, &firmware[cardp->totalbytes],
276 fwdata->fwheader.datalength); 279 fwdata->fwheader.datalength);
277 280
278 lbs_dev_dbg(2, &cardp->udev->dev, 281 /*
282 lbs_deb_usbd(&cardp->udev->dev,
279 "Data length = %d\n", fwdata->fwheader.datalength); 283 "Data length = %d\n", fwdata->fwheader.datalength);
284 */
280 285
281 cardp->fwseqnum = cardp->fwseqnum + 1; 286 cardp->fwseqnum = cardp->fwseqnum + 1;
282 287
@@ -285,26 +290,32 @@ static int if_prog_firmware(wlan_private * priv)
285 cardp->totalbytes += fwdata->fwheader.datalength; 290 cardp->totalbytes += fwdata->fwheader.datalength;
286 291
287 if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) { 292 if (fwheader->dnldcmd == FW_HAS_DATA_TO_RECV) {
288 lbs_dev_dbg(2, &cardp->udev->dev, "There is data to follow\n"); 293 /*
289 lbs_dev_dbg(2, &cardp->udev->dev, 294 lbs_deb_usbd(&cardp->udev->dev, "There is data to follow\n");
295 lbs_deb_usbd(&cardp->udev->dev,
290 "seqnum = %d totalbytes = %d\n", cardp->fwseqnum, 296 "seqnum = %d totalbytes = %d\n", cardp->fwseqnum,
291 cardp->totalbytes); 297 cardp->totalbytes);
298 */
292 memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE); 299 memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
293 usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE); 300 usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
294 301
295 } else if (fwdata->fwheader.dnldcmd == FW_HAS_LAST_BLOCK) { 302 } else if (fwdata->fwheader.dnldcmd == FW_HAS_LAST_BLOCK) {
296 lbs_dev_dbg(2, &cardp->udev->dev, 303 /*
304 lbs_deb_usbd(&cardp->udev->dev,
297 "Host has finished FW downloading\n"); 305 "Host has finished FW downloading\n");
298 lbs_dev_dbg(2, &cardp->udev->dev, 306 lbs_deb_usbd(&cardp->udev->dev,
299 "Donwloading FW JUMP BLOCK\n"); 307 "Donwloading FW JUMP BLOCK\n");
308 */
300 memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE); 309 memcpy(cardp->bulk_out_buffer, fwheader, FW_DATA_XMIT_SIZE);
301 usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE); 310 usb_tx_block(priv, cardp->bulk_out_buffer, FW_DATA_XMIT_SIZE);
302 cardp->fwfinalblk = 1; 311 cardp->fwfinalblk = 1;
303 } 312 }
304 313
305 lbs_dev_dbg(2, &cardp->udev->dev, 314 /*
315 lbs_deb_usbd(&cardp->udev->dev,
306 "The firmware download is done size is %d\n", 316 "The firmware download is done size is %d\n",
307 cardp->totalbytes); 317 cardp->totalbytes);
318 */
308 319
309 kfree(fwdata); 320 kfree(fwdata);
310 321
@@ -340,7 +351,7 @@ int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
340 351
341 /* check if device is removed */ 352 /* check if device is removed */
342 if (priv->adapter->surpriseremoved) { 353 if (priv->adapter->surpriseremoved) {
343 lbs_dev_dbg(1, &cardp->udev->dev, "Device removed\n"); 354 lbs_deb_usbd(&cardp->udev->dev, "Device removed\n");
344 goto tx_ret; 355 goto tx_ret;
345 } 356 }
346 357
@@ -353,10 +364,10 @@ int usb_tx_block(wlan_private * priv, u8 * payload, u16 nb)
353 364
354 if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) { 365 if ((ret = usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) {
355 /* transfer failed */ 366 /* transfer failed */
356 lbs_dev_dbg(1, &cardp->udev->dev, "usb_submit_urb failed\n"); 367 lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb failed\n");
357 ret = -1; 368 ret = -1;
358 } else { 369 } else {
359 lbs_dev_dbg(2, &cardp->udev->dev, "usb_submit_urb success\n"); 370 /* lbs_deb_usbd(&cardp->udev->dev, "usb_submit_urb success\n"); */
360 ret = 0; 371 ret = 0;
361 } 372 }
362 373
@@ -390,13 +401,13 @@ static int __if_usb_submit_rx_urb(wlan_private * priv,
390 401
391 cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET; 402 cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET;
392 403
393 lbs_dev_dbg(2, &cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); 404 /* lbs_deb_usbd(&cardp->udev->dev, "Pointer for rx_urb %p\n", cardp->rx_urb); */
394 if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) { 405 if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) {
395 /* handle failure conditions */ 406 /* handle failure conditions */
396 lbs_dev_dbg(1, &cardp->udev->dev, "Submit Rx URB failed\n"); 407 lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB failed\n");
397 ret = -1; 408 ret = -1;
398 } else { 409 } else {
399 lbs_dev_dbg(2, &cardp->udev->dev, "Submit Rx URB success\n"); 410 /* lbs_deb_usbd(&cardp->udev->dev, "Submit Rx URB success\n"); */
400 ret = 0; 411 ret = 0;
401 } 412 }
402 413
@@ -424,7 +435,7 @@ static void if_usb_receive_fwload(struct urb *urb)
424 struct bootcmdrespStr bootcmdresp; 435 struct bootcmdrespStr bootcmdresp;
425 436
426 if (urb->status) { 437 if (urb->status) {
427 lbs_dev_dbg(1, &cardp->udev->dev, 438 lbs_deb_usbd(&cardp->udev->dev,
428 "URB status is failed during fw load\n"); 439 "URB status is failed during fw load\n");
429 kfree_skb(skb); 440 kfree_skb(skb);
430 return; 441 return;
@@ -437,7 +448,7 @@ static void if_usb_receive_fwload(struct urb *urb)
437 kfree_skb(skb); 448 kfree_skb(skb);
438 if_usb_submit_rx_urb_fwload(priv); 449 if_usb_submit_rx_urb_fwload(priv);
439 cardp->bootcmdresp = 1; 450 cardp->bootcmdresp = 1;
440 lbs_dev_dbg(1, &cardp->udev->dev, 451 lbs_deb_usbd(&cardp->udev->dev,
441 "Received valid boot command response\n"); 452 "Received valid boot command response\n");
442 return; 453 return;
443 } 454 }
@@ -455,7 +466,7 @@ static void if_usb_receive_fwload(struct urb *urb)
455 bootcmdresp.u8result); 466 bootcmdresp.u8result);
456 } else { 467 } else {
457 cardp->bootcmdresp = 1; 468 cardp->bootcmdresp = 1;
458 lbs_dev_dbg(1, &cardp->udev->dev, 469 lbs_deb_usbd(&cardp->udev->dev,
459 "Received valid boot command response\n"); 470 "Received valid boot command response\n");
460 } 471 }
461 kfree_skb(skb); 472 kfree_skb(skb);
@@ -465,7 +476,7 @@ static void if_usb_receive_fwload(struct urb *urb)
465 476
466 syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC); 477 syncfwheader = kmalloc(sizeof(struct fwsyncheader), GFP_ATOMIC);
467 if (!syncfwheader) { 478 if (!syncfwheader) {
468 lbs_dev_dbg(1, &cardp->udev->dev, "Failure to allocate syncfwheader\n"); 479 lbs_deb_usbd(&cardp->udev->dev, "Failure to allocate syncfwheader\n");
469 kfree_skb(skb); 480 kfree_skb(skb);
470 return; 481 return;
471 } 482 }
@@ -474,14 +485,16 @@ static void if_usb_receive_fwload(struct urb *urb)
474 sizeof(struct fwsyncheader)); 485 sizeof(struct fwsyncheader));
475 486
476 if (!syncfwheader->cmd) { 487 if (!syncfwheader->cmd) {
477 lbs_dev_dbg(2, &cardp->udev->dev, 488 /*
489 lbs_deb_usbd(&cardp->udev->dev,
478 "FW received Blk with correct CRC\n"); 490 "FW received Blk with correct CRC\n");
479 lbs_dev_dbg(2, &cardp->udev->dev, 491 lbs_deb_usbd(&cardp->udev->dev,
480 "FW received Blk seqnum = %d\n", 492 "FW received Blk seqnum = %d\n",
481 syncfwheader->seqnum); 493 syncfwheader->seqnum);
494 */
482 cardp->CRC_OK = 1; 495 cardp->CRC_OK = 1;
483 } else { 496 } else {
484 lbs_dev_dbg(1, &cardp->udev->dev, 497 lbs_deb_usbd(&cardp->udev->dev,
485 "FW received Blk with CRC error\n"); 498 "FW received Blk with CRC error\n");
486 cardp->CRC_OK = 0; 499 cardp->CRC_OK = 0;
487 } 500 }
@@ -511,7 +524,7 @@ static inline void process_cmdtypedata(int recvlength, struct sk_buff *skb,
511{ 524{
512 if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE + 525 if (recvlength > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE +
513 MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) { 526 MESSAGE_HEADER_LEN || recvlength < MRVDRV_MIN_PKT_LEN) {
514 lbs_dev_dbg(1, &cardp->udev->dev, 527 lbs_deb_usbd(&cardp->udev->dev,
515 "Packet length is Invalid\n"); 528 "Packet length is Invalid\n");
516 kfree_skb(skb); 529 kfree_skb(skb);
517 return; 530 return;
@@ -531,7 +544,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
531{ 544{
532 u8 *cmdbuf; 545 u8 *cmdbuf;
533 if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) { 546 if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) {
534 lbs_dev_dbg(1, &cardp->udev->dev, 547 lbs_deb_usbd(&cardp->udev->dev,
535 "The receive buffer is too large\n"); 548 "The receive buffer is too large\n");
536 kfree_skb(skb); 549 kfree_skb(skb);
537 return; 550 return;
@@ -558,7 +571,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
558 libertas_interrupt(priv->wlan_dev.netdev); 571 libertas_interrupt(priv->wlan_dev.netdev);
559 spin_unlock(&priv->adapter->driver_lock); 572 spin_unlock(&priv->adapter->driver_lock);
560 573
561 lbs_dev_dbg(1, &cardp->udev->dev, 574 lbs_deb_usbd(&cardp->udev->dev,
562 "Wake up main thread to handle cmd response\n"); 575 "Wake up main thread to handle cmd response\n");
563 576
564 return; 577 return;
@@ -582,11 +595,11 @@ static void if_usb_receive(struct urb *urb)
582 u8 *recvbuff = NULL; 595 u8 *recvbuff = NULL;
583 u32 recvtype; 596 u32 recvtype;
584 597
585 ENTER(); 598 lbs_deb_enter(LBS_DEB_USB);
586 599
587 if (recvlength) { 600 if (recvlength) {
588 if (urb->status) { 601 if (urb->status) {
589 lbs_dev_dbg(1, &cardp->udev->dev, 602 lbs_deb_usbd(&cardp->udev->dev,
590 "URB status is failed\n"); 603 "URB status is failed\n");
591 kfree_skb(skb); 604 kfree_skb(skb);
592 goto setup_for_next; 605 goto setup_for_next;
@@ -594,12 +607,12 @@ static void if_usb_receive(struct urb *urb)
594 607
595 recvbuff = skb->data + IPFIELD_ALIGN_OFFSET; 608 recvbuff = skb->data + IPFIELD_ALIGN_OFFSET;
596 memcpy(&recvtype, recvbuff, sizeof(u32)); 609 memcpy(&recvtype, recvbuff, sizeof(u32));
597 lbs_dev_dbg(1, &cardp->udev->dev, 610 lbs_deb_usbd(&cardp->udev->dev,
598 "Recv length = 0x%x\n", recvlength); 611 "Recv length = 0x%x\n", recvlength);
599 lbs_dev_dbg(1, &cardp->udev->dev, 612 lbs_deb_usbd(&cardp->udev->dev,
600 "Receive type = 0x%X\n", recvtype); 613 "Receive type = 0x%X\n", recvtype);
601 recvtype = le32_to_cpu(recvtype); 614 recvtype = le32_to_cpu(recvtype);
602 lbs_dev_dbg(1, &cardp->udev->dev, 615 lbs_deb_usbd(&cardp->udev->dev,
603 "Receive type after = 0x%X\n", recvtype); 616 "Receive type after = 0x%X\n", recvtype);
604 } else if (urb->status) 617 } else if (urb->status)
605 goto rx_exit; 618 goto rx_exit;
@@ -618,7 +631,7 @@ static void if_usb_receive(struct urb *urb)
618 /* Event cause handling */ 631 /* Event cause handling */
619 spin_lock(&priv->adapter->driver_lock); 632 spin_lock(&priv->adapter->driver_lock);
620 cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN); 633 cardp->usb_event_cause = *(u32 *) (recvbuff + MESSAGE_HEADER_LEN);
621 lbs_dev_dbg(1, &cardp->udev->dev,"**EVENT** 0x%X\n", 634 lbs_deb_usbd(&cardp->udev->dev,"**EVENT** 0x%X\n",
622 cardp->usb_event_cause); 635 cardp->usb_event_cause);
623 if (cardp->usb_event_cause & 0xffff0000) { 636 if (cardp->usb_event_cause & 0xffff0000) {
624 libertas_send_tx_feedback(priv); 637 libertas_send_tx_feedback(priv);
@@ -639,8 +652,7 @@ static void if_usb_receive(struct urb *urb)
639setup_for_next: 652setup_for_next:
640 if_usb_submit_rx_urb(priv); 653 if_usb_submit_rx_urb(priv);
641rx_exit: 654rx_exit:
642 LEAVE(); 655 lbs_deb_leave(LBS_DEB_USB);
643 return;
644} 656}
645 657
646/** 658/**
@@ -657,8 +669,8 @@ int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb
657 u32 tmp; 669 u32 tmp;
658 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; 670 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
659 671
660 lbs_dev_dbg(1, &cardp->udev->dev,"*** type = %u\n", type); 672 lbs_deb_usbd(&cardp->udev->dev,"*** type = %u\n", type);
661 lbs_dev_dbg(1, &cardp->udev->dev,"size after = %d\n", nb); 673 lbs_deb_usbd(&cardp->udev->dev,"size after = %d\n", nb);
662 674
663 if (type == MVMS_CMD) { 675 if (type == MVMS_CMD) {
664 tmp = cpu_to_le32(CMD_TYPE_REQUEST); 676 tmp = cpu_to_le32(CMD_TYPE_REQUEST);
@@ -689,7 +701,7 @@ int libertas_sbi_get_int_status(wlan_private * priv, u8 * ireg)
689 *ireg = cardp->usb_int_cause; 701 *ireg = cardp->usb_int_cause;
690 cardp->usb_int_cause = 0; 702 cardp->usb_int_cause = 0;
691 703
692 lbs_dev_dbg(1, &cardp->udev->dev,"Int cause is 0x%X\n", *ireg); 704 lbs_deb_usbd(&cardp->udev->dev,"Int cause is 0x%X\n", *ireg);
693 705
694 return 0; 706 return 0;
695} 707}
@@ -736,9 +748,9 @@ int libertas_sbi_unregister_dev(wlan_private * priv)
736 */ 748 */
737int libertas_sbi_register_dev(wlan_private * priv) 749int libertas_sbi_register_dev(wlan_private * priv)
738{ 750{
739
740 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; 751 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
741 ENTER(); 752
753 lbs_deb_enter(LBS_DEB_USB);
742 754
743 cardp->priv = priv; 755 cardp->priv = priv;
744 cardp->eth_dev = priv->wlan_dev.netdev; 756 cardp->eth_dev = priv->wlan_dev.netdev;
@@ -746,10 +758,10 @@ int libertas_sbi_register_dev(wlan_private * priv)
746 758
747 SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev)); 759 SET_NETDEV_DEV(cardp->eth_dev, &(cardp->udev->dev));
748 760
749 lbs_dev_dbg(1, &cardp->udev->dev, "udev pointer is at %p\n", 761 lbs_deb_usbd(&cardp->udev->dev, "udev pointer is at %p\n",
750 cardp->udev); 762 cardp->udev);
751 763
752 LEAVE(); 764 lbs_deb_leave(LBS_DEB_USB);
753 return 0; 765 return 0;
754} 766}
755 767
@@ -760,16 +772,17 @@ int libertas_sbi_prog_firmware(wlan_private * priv)
760 struct usb_card_rec *cardp = priv->wlan_dev.card; 772 struct usb_card_rec *cardp = priv->wlan_dev.card;
761 int i = 0; 773 int i = 0;
762 static int reset_count = 10; 774 static int reset_count = 10;
775 int ret = 0;
763 776
764 ENTER(); 777 lbs_deb_enter(LBS_DEB_USB);
765 778
766 cardp->rinfo.priv = priv; 779 cardp->rinfo.priv = priv;
767 780
768restart: 781restart:
769 if (if_usb_submit_rx_urb_fwload(priv) < 0) { 782 if (if_usb_submit_rx_urb_fwload(priv) < 0) {
770 lbs_dev_dbg(1, &cardp->udev->dev, "URB submission is failed\n"); 783 lbs_deb_usbd(&cardp->udev->dev, "URB submission is failed\n");
771 LEAVE(); 784 ret = -1;
772 return -1; 785 goto done;
773 } 786 }
774 787
775 cardp->bootcmdresp = 0; 788 cardp->bootcmdresp = 0;
@@ -807,7 +820,7 @@ restart:
807 if_prog_firmware(priv); 820 if_prog_firmware(priv);
808 821
809 do { 822 do {
810 lbs_dev_dbg(1, &cardp->udev->dev,"Wlan sched timeout\n"); 823 lbs_deb_usbd(&cardp->udev->dev,"Wlan sched timeout\n");
811 i++; 824 i++;
812 msleep_interruptible(100); 825 msleep_interruptible(100);
813 if (priv->adapter->surpriseremoved || i >= 20) 826 if (priv->adapter->surpriseremoved || i >= 20)
@@ -822,8 +835,8 @@ restart:
822 } 835 }
823 836
824 lbs_pr_info("FW download failure, time = %d ms\n", i * 100); 837 lbs_pr_info("FW download failure, time = %d ms\n", i * 100);
825 LEAVE(); 838 ret = -1;
826 return -1; 839 goto done;
827 } 840 }
828 841
829 if_usb_submit_rx_urb(priv); 842 if_usb_submit_rx_urb(priv);
@@ -833,8 +846,9 @@ restart:
833 846
834 priv->adapter->fw_ready = 1; 847 priv->adapter->fw_ready = 1;
835 848
836 LEAVE(); 849done:
837 return 0; 850 lbs_deb_leave_args(LBS_DEB_USB, "ret %d", ret);
851 return ret;
838} 852}
839 853
840/** 854/**
@@ -854,7 +868,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
854 struct usb_card_rec *cardp = usb_get_intfdata(intf); 868 struct usb_card_rec *cardp = usb_get_intfdata(intf);
855 wlan_private *priv = cardp->priv; 869 wlan_private *priv = cardp->priv;
856 870
857 ENTER(); 871 lbs_deb_enter(LBS_DEB_USB);
858 872
859 if (priv->adapter->psstate != PS_STATE_FULL_POWER) 873 if (priv->adapter->psstate != PS_STATE_FULL_POWER)
860 return -1; 874 return -1;
@@ -867,7 +881,7 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
867 881
868 cardp->rx_urb_recall = 1; 882 cardp->rx_urb_recall = 1;
869 883
870 LEAVE(); 884 lbs_deb_leave(LBS_DEB_USB);
871 return 0; 885 return 0;
872} 886}
873 887
@@ -875,7 +889,7 @@ static int if_usb_resume(struct usb_interface *intf)
875{ 889{
876 struct usb_card_rec *cardp = usb_get_intfdata(intf); 890 struct usb_card_rec *cardp = usb_get_intfdata(intf);
877 891
878 ENTER(); 892 lbs_deb_enter(LBS_DEB_USB);
879 893
880 cardp->rx_urb_recall = 0; 894 cardp->rx_urb_recall = 0;
881 895
@@ -883,7 +897,7 @@ static int if_usb_resume(struct usb_interface *intf)
883 897
884 netif_device_attach(cardp->eth_dev); 898 netif_device_attach(cardp->eth_dev);
885 899
886 LEAVE(); 900 lbs_deb_leave(LBS_DEB_USB);
887 return 0; 901 return 0;
888} 902}
889#else 903#else
diff --git a/drivers/net/wireless/libertas/ioctl.c b/drivers/net/wireless/libertas/ioctl.c
index a8f76c358992..3f95e97a309e 100644
--- a/drivers/net/wireless/libertas/ioctl.c
+++ b/drivers/net/wireless/libertas/ioctl.c
@@ -30,6 +30,7 @@
30static int wlan_set_region(wlan_private * priv, u16 region_code) 30static int wlan_set_region(wlan_private * priv, u16 region_code)
31{ 31{
32 int i; 32 int i;
33 int ret = 0;
33 34
34 for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) { 35 for (i = 0; i < MRVDRV_MAX_REGION_CODE; i++) {
35 // use the region code to search for the index 36 // use the region code to search for the index
@@ -42,17 +43,18 @@ static int wlan_set_region(wlan_private * priv, u16 region_code)
42 43
43 // if it's unidentified region code 44 // if it's unidentified region code
44 if (i >= MRVDRV_MAX_REGION_CODE) { 45 if (i >= MRVDRV_MAX_REGION_CODE) {
45 lbs_pr_debug(1, "region Code not identified\n"); 46 lbs_deb_ioctl("region Code not identified\n");
46 LEAVE(); 47 ret = -1;
47 return -1; 48 goto done;
48 } 49 }
49 50
50 if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) { 51 if (libertas_set_regiontable(priv, priv->adapter->regioncode, 0)) {
51 LEAVE(); 52 ret = -EINVAL;
52 return -EINVAL;
53 } 53 }
54 54
55 return 0; 55done:
56 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
57 return ret;
56} 58}
57 59
58static inline int hex2int(char c) 60static inline int hex2int(char c)
@@ -125,8 +127,10 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
125 char ethaddrs_str[18]; 127 char ethaddrs_str[18];
126 char *pos; 128 char *pos;
127 u8 ethaddr[ETH_ALEN]; 129 u8 ethaddr[ETH_ALEN];
130 int ret;
131
132 lbs_deb_enter(LBS_DEB_IOCTL);
128 133
129 ENTER();
130 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, 134 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
131 sizeof(ethaddrs_str))) 135 sizeof(ethaddrs_str)))
132 return -EFAULT; 136 return -EFAULT;
@@ -136,11 +140,12 @@ static int wlan_bt_add_ioctl(wlan_private * priv, struct ifreq *req)
136 return -EINVAL; 140 return -EINVAL;
137 } 141 }
138 142
139 lbs_pr_debug(1, "BT: adding %s\n", ethaddrs_str); 143 lbs_deb_ioctl("BT: adding %s\n", ethaddrs_str);
140 LEAVE(); 144 ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
141 return (libertas_prepare_and_send_command(priv, cmd_bt_access,
142 cmd_act_bt_access_add, 145 cmd_act_bt_access_add,
143 cmd_option_waitforrsp, 0, ethaddr)); 146 cmd_option_waitforrsp, 0, ethaddr);
147 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
148 return ret;
144} 149}
145 150
146/** 151/**
@@ -156,7 +161,8 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
156 u8 ethaddr[ETH_ALEN]; 161 u8 ethaddr[ETH_ALEN];
157 char *pos; 162 char *pos;
158 163
159 ENTER(); 164 lbs_deb_enter(LBS_DEB_IOCTL);
165
160 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer, 166 if (copy_from_user(ethaddrs_str, wrq->u.data.pointer,
161 sizeof(ethaddrs_str))) 167 sizeof(ethaddrs_str)))
162 return -EFAULT; 168 return -EFAULT;
@@ -166,13 +172,14 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
166 return -EINVAL; 172 return -EINVAL;
167 } 173 }
168 174
169 lbs_pr_debug(1, "BT: deleting %s\n", ethaddrs_str); 175 lbs_deb_ioctl("BT: deleting %s\n", ethaddrs_str);
170 176
171 return (libertas_prepare_and_send_command(priv, 177 return (libertas_prepare_and_send_command(priv,
172 cmd_bt_access, 178 cmd_bt_access,
173 cmd_act_bt_access_del, 179 cmd_act_bt_access_del,
174 cmd_option_waitforrsp, 0, ethaddr)); 180 cmd_option_waitforrsp, 0, ethaddr));
175 LEAVE(); 181
182 lbs_deb_leave(LBS_DEB_IOCTL);
176 return 0; 183 return 0;
177} 184}
178 185
@@ -183,7 +190,7 @@ static int wlan_bt_del_ioctl(wlan_private * priv, struct ifreq *req)
183 */ 190 */
184static int wlan_bt_reset_ioctl(wlan_private * priv) 191static int wlan_bt_reset_ioctl(wlan_private * priv)
185{ 192{
186 ENTER(); 193 lbs_deb_enter(LBS_DEB_IOCTL);
187 194
188 lbs_pr_alert( "BT: resetting\n"); 195 lbs_pr_alert( "BT: resetting\n");
189 196
@@ -192,7 +199,7 @@ static int wlan_bt_reset_ioctl(wlan_private * priv)
192 cmd_act_bt_access_reset, 199 cmd_act_bt_access_reset,
193 cmd_option_waitforrsp, 0, NULL)); 200 cmd_option_waitforrsp, 0, NULL));
194 201
195 LEAVE(); 202 lbs_deb_leave(LBS_DEB_IOCTL);
196 return 0; 203 return 0;
197} 204}
198 205
@@ -216,10 +223,10 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
216 char *pbuf = outstr; 223 char *pbuf = outstr;
217 int ret; 224 int ret;
218 225
219 ENTER(); 226 lbs_deb_enter(LBS_DEB_IOCTL);
220 227
221 if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) { 228 if (copy_from_user(outstr, wrq->u.data.pointer, sizeof(outstr))) {
222 lbs_pr_debug(1, "Copy from user failed\n"); 229 lbs_deb_ioctl("Copy from user failed\n");
223 return -1; 230 return -1;
224 } 231 }
225 param.id = simple_strtoul(outstr, NULL, 10); 232 param.id = simple_strtoul(outstr, NULL, 10);
@@ -246,11 +253,11 @@ static int wlan_bt_list_ioctl(wlan_private * priv, struct ifreq *req)
246 wrq->u.data.length = strlen(outstr); 253 wrq->u.data.length = strlen(outstr);
247 if (copy_to_user(wrq->u.data.pointer, (char *)outstr, 254 if (copy_to_user(wrq->u.data.pointer, (char *)outstr,
248 wrq->u.data.length)) { 255 wrq->u.data.length)) {
249 lbs_pr_debug(1, "BT_LIST: Copy to user failed!\n"); 256 lbs_deb_ioctl("BT_LIST: Copy to user failed!\n");
250 return -EFAULT; 257 return -EFAULT;
251 } 258 }
252 259
253 LEAVE(); 260 lbs_deb_leave(LBS_DEB_IOCTL);
254 return 0; 261 return 0;
255} 262}
256 263
@@ -278,8 +285,10 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
278 char in_str[128]; 285 char in_str[128];
279 static struct cmd_ds_fwt_access fwt_access; 286 static struct cmd_ds_fwt_access fwt_access;
280 char *ptr; 287 char *ptr;
288 int ret;
289
290 lbs_deb_enter(LBS_DEB_IOCTL);
281 291
282 ENTER();
283 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 292 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
284 return -EFAULT; 293 return -EFAULT;
285 294
@@ -348,20 +357,22 @@ static int wlan_fwt_add_ioctl(wlan_private * priv, struct ifreq *req)
348 char ethaddr1_str[18], ethaddr2_str[18]; 357 char ethaddr1_str[18], ethaddr2_str[18];
349 eth_addr2str(fwt_access.da, ethaddr1_str); 358 eth_addr2str(fwt_access.da, ethaddr1_str);
350 eth_addr2str(fwt_access.ra, ethaddr2_str); 359 eth_addr2str(fwt_access.ra, ethaddr2_str);
351 lbs_pr_debug(1, "FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str, 360 lbs_deb_ioctl("FWT_ADD: adding (da:%s,%i,ra:%s)\n", ethaddr1_str,
352 fwt_access.dir, ethaddr2_str); 361 fwt_access.dir, ethaddr2_str);
353 lbs_pr_debug(1, "FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n", 362 lbs_deb_ioctl("FWT_ADD: ssn:%u dsn:%u met:%u hop:%u ttl:%u exp:%u slp:%u snr:%u\n",
354 fwt_access.ssn, fwt_access.dsn, fwt_access.metric, 363 fwt_access.ssn, fwt_access.dsn, fwt_access.metric,
355 fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration, 364 fwt_access.hopcount, fwt_access.ttl, fwt_access.expiration,
356 fwt_access.sleepmode, fwt_access.snr); 365 fwt_access.sleepmode, fwt_access.snr);
357 } 366 }
358#endif 367#endif
359 368
360 LEAVE(); 369 ret = libertas_prepare_and_send_command(priv, cmd_fwt_access,
361 return (libertas_prepare_and_send_command(priv, cmd_fwt_access, 370 cmd_act_fwt_access_add,
362 cmd_act_fwt_access_add, 371 cmd_option_waitforrsp, 0,
363 cmd_option_waitforrsp, 0, 372 (void *)&fwt_access);
364 (void *)&fwt_access)); 373
374 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
375 return ret;
365} 376}
366 377
367/** 378/**
@@ -376,8 +387,10 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
376 char in_str[64]; 387 char in_str[64];
377 static struct cmd_ds_fwt_access fwt_access; 388 static struct cmd_ds_fwt_access fwt_access;
378 char *ptr; 389 char *ptr;
390 int ret;
391
392 lbs_deb_enter(LBS_DEB_IOCTL);
379 393
380 ENTER();
381 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 394 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
382 return -EFAULT; 395 return -EFAULT;
383 396
@@ -399,20 +412,21 @@ static int wlan_fwt_del_ioctl(wlan_private * priv, struct ifreq *req)
399#ifdef DEBUG 412#ifdef DEBUG
400 { 413 {
401 char ethaddr1_str[18], ethaddr2_str[18]; 414 char ethaddr1_str[18], ethaddr2_str[18];
402 lbs_pr_debug(1, "FWT_DEL: line is %s\n", in_str); 415 lbs_deb_ioctl("FWT_DEL: line is %s\n", in_str);
403 eth_addr2str(fwt_access.da, ethaddr1_str); 416 eth_addr2str(fwt_access.da, ethaddr1_str);
404 eth_addr2str(fwt_access.ra, ethaddr2_str); 417 eth_addr2str(fwt_access.ra, ethaddr2_str);
405 lbs_pr_debug(1, "FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str, 418 lbs_deb_ioctl("FWT_DEL: removing (da:%s,ra:%s,dir:%d)\n", ethaddr1_str,
406 ethaddr2_str, fwt_access.dir); 419 ethaddr2_str, fwt_access.dir);
407 } 420 }
408#endif 421#endif
409 422
410 LEAVE(); 423 ret = libertas_prepare_and_send_command(priv,
411 return (libertas_prepare_and_send_command(priv, 424 cmd_fwt_access,
412 cmd_fwt_access, 425 cmd_act_fwt_access_del,
413 cmd_act_fwt_access_del, 426 cmd_option_waitforrsp, 0,
414 cmd_option_waitforrsp, 0, 427 (void *)&fwt_access);
415 (void *)&fwt_access)); 428 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
429 return ret;
416} 430}
417 431
418 432
@@ -453,7 +467,8 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
453 static char out_str[128]; 467 static char out_str[128];
454 int ret; 468 int ret;
455 469
456 ENTER(); 470 lbs_deb_enter(LBS_DEB_IOCTL);
471
457 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 472 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
458 return -EFAULT; 473 return -EFAULT;
459 474
@@ -465,9 +480,9 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
465#ifdef DEBUG 480#ifdef DEBUG
466 { 481 {
467 char ethaddr1_str[18]; 482 char ethaddr1_str[18];
468 lbs_pr_debug(1, "FWT_LOOKUP: line is %s\n", in_str); 483 lbs_deb_ioctl("FWT_LOOKUP: line is %s\n", in_str);
469 eth_addr2str(fwt_access.da, ethaddr1_str); 484 eth_addr2str(fwt_access.da, ethaddr1_str);
470 lbs_pr_debug(1, "FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str); 485 lbs_deb_ioctl("FWT_LOOKUP: looking for (da:%s)\n", ethaddr1_str);
471 } 486 }
472#endif 487#endif
473 488
@@ -485,11 +500,11 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
485 wrq->u.data.length = strlen(out_str); 500 wrq->u.data.length = strlen(out_str);
486 if (copy_to_user(wrq->u.data.pointer, (char *)out_str, 501 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
487 wrq->u.data.length)) { 502 wrq->u.data.length)) {
488 lbs_pr_debug(1, "FWT_LOOKUP: Copy to user failed!\n"); 503 lbs_deb_ioctl("FWT_LOOKUP: Copy to user failed!\n");
489 return -EFAULT; 504 return -EFAULT;
490 } 505 }
491 506
492 LEAVE(); 507 lbs_deb_leave(LBS_DEB_IOCTL);
493 return 0; 508 return 0;
494} 509}
495 510
@@ -500,7 +515,7 @@ static int wlan_fwt_lookup_ioctl(wlan_private * priv, struct ifreq *req)
500 */ 515 */
501static int wlan_fwt_reset_ioctl(wlan_private * priv) 516static int wlan_fwt_reset_ioctl(wlan_private * priv)
502{ 517{
503 lbs_pr_debug(1, "FWT: resetting\n"); 518 lbs_deb_ioctl("FWT: resetting\n");
504 519
505 return (libertas_prepare_and_send_command(priv, 520 return (libertas_prepare_and_send_command(priv,
506 cmd_fwt_access, 521 cmd_fwt_access,
@@ -524,7 +539,8 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
524 char *pbuf = out_str; 539 char *pbuf = out_str;
525 int ret; 540 int ret;
526 541
527 ENTER(); 542 lbs_deb_enter(LBS_DEB_IOCTL);
543
528 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 544 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
529 return -EFAULT; 545 return -EFAULT;
530 546
@@ -532,8 +548,8 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
532 548
533#ifdef DEBUG 549#ifdef DEBUG
534 { 550 {
535 lbs_pr_debug(1, "FWT_LIST: line is %s\n", in_str); 551 lbs_deb_ioctl("FWT_LIST: line is %s\n", in_str);
536 lbs_pr_debug(1, "FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id)); 552 lbs_deb_ioctl("FWT_LIST: listing id:%i\n", le32_to_cpu(fwt_access.id));
537 } 553 }
538#endif 554#endif
539 555
@@ -549,11 +565,11 @@ static int wlan_fwt_list_ioctl(wlan_private * priv, struct ifreq *req)
549 wrq->u.data.length = strlen(out_str); 565 wrq->u.data.length = strlen(out_str);
550 if (copy_to_user(wrq->u.data.pointer, (char *)out_str, 566 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
551 wrq->u.data.length)) { 567 wrq->u.data.length)) {
552 lbs_pr_debug(1, "FWT_LIST: Copy to user failed!\n"); 568 lbs_deb_ioctl("FWT_LIST: Copy to user failed!\n");
553 return -EFAULT; 569 return -EFAULT;
554 } 570 }
555 571
556 LEAVE(); 572 lbs_deb_leave(LBS_DEB_IOCTL);
557 return 0; 573 return 0;
558} 574}
559 575
@@ -573,7 +589,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
573 char *pbuf = out_str; 589 char *pbuf = out_str;
574 int ret; 590 int ret;
575 591
576 ENTER(); 592 lbs_deb_enter(LBS_DEB_IOCTL);
593
577 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 594 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
578 return -EFAULT; 595 return -EFAULT;
579 596
@@ -581,8 +598,8 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
581 598
582#ifdef DEBUG 599#ifdef DEBUG
583 { 600 {
584 lbs_pr_debug(1, "FWT_LIST_ROUTE: line is %s\n", in_str); 601 lbs_deb_ioctl("FWT_LIST_ROUTE: line is %s\n", in_str);
585 lbs_pr_debug(1, "FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id)); 602 lbs_deb_ioctl("FWT_LIST_ROUTE: listing id:%i\n", le32_to_cpu(fwt_access.id));
586 } 603 }
587#endif 604#endif
588 605
@@ -608,11 +625,11 @@ static int wlan_fwt_list_route_ioctl(wlan_private * priv, struct ifreq *req)
608 wrq->u.data.length = strlen(out_str); 625 wrq->u.data.length = strlen(out_str);
609 if (copy_to_user(wrq->u.data.pointer, (char *)out_str, 626 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
610 wrq->u.data.length)) { 627 wrq->u.data.length)) {
611 lbs_pr_debug(1, "FWT_LIST_ROUTE: Copy to user failed!\n"); 628 lbs_deb_ioctl("FWT_LIST_ROUTE: Copy to user failed!\n");
612 return -EFAULT; 629 return -EFAULT;
613 } 630 }
614 631
615 LEAVE(); 632 lbs_deb_leave(LBS_DEB_IOCTL);
616 return 0; 633 return 0;
617} 634}
618 635
@@ -632,7 +649,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
632 char *pbuf = out_str; 649 char *pbuf = out_str;
633 int ret; 650 int ret;
634 651
635 ENTER(); 652 lbs_deb_enter(LBS_DEB_IOCTL);
653
636 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str))) 654 if (copy_from_user(in_str, wrq->u.data.pointer, sizeof(in_str)))
637 return -EFAULT; 655 return -EFAULT;
638 656
@@ -641,8 +659,8 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
641 659
642#ifdef DEBUG 660#ifdef DEBUG
643 { 661 {
644 lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: line is %s\n", in_str); 662 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: line is %s\n", in_str);
645 lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id)); 663 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: listing id:%i\n", le32_to_cpu(fwt_access.id));
646 } 664 }
647#endif 665#endif
648 666
@@ -663,11 +681,11 @@ static int wlan_fwt_list_neighbor_ioctl(wlan_private * priv, struct ifreq *req)
663 wrq->u.data.length = strlen(out_str); 681 wrq->u.data.length = strlen(out_str);
664 if (copy_to_user(wrq->u.data.pointer, (char *)out_str, 682 if (copy_to_user(wrq->u.data.pointer, (char *)out_str,
665 wrq->u.data.length)) { 683 wrq->u.data.length)) {
666 lbs_pr_debug(1, "FWT_LIST_NEIGHBOR: Copy to user failed!\n"); 684 lbs_deb_ioctl("FWT_LIST_NEIGHBOR: Copy to user failed!\n");
667 return -EFAULT; 685 return -EFAULT;
668 } 686 }
669 687
670 LEAVE(); 688 lbs_deb_leave(LBS_DEB_IOCTL);
671 return 0; 689 return 0;
672} 690}
673 691
@@ -684,9 +702,9 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
684 static struct cmd_ds_fwt_access fwt_access; 702 static struct cmd_ds_fwt_access fwt_access;
685 int ret; 703 int ret;
686 704
687 ENTER(); 705 lbs_deb_enter(LBS_DEB_IOCTL);
688 706
689 lbs_pr_debug(1, "FWT: cleaning up\n"); 707 lbs_deb_ioctl("FWT: cleaning up\n");
690 708
691 memset(&fwt_access, 0, sizeof(fwt_access)); 709 memset(&fwt_access, 0, sizeof(fwt_access));
692 710
@@ -700,7 +718,7 @@ static int wlan_fwt_cleanup_ioctl(wlan_private * priv, struct ifreq *req)
700 else 718 else
701 return -EFAULT; 719 return -EFAULT;
702 720
703 LEAVE(); 721 lbs_deb_leave(LBS_DEB_IOCTL);
704 return 0; 722 return 0;
705} 723}
706 724
@@ -716,9 +734,9 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
716 static struct cmd_ds_fwt_access fwt_access; 734 static struct cmd_ds_fwt_access fwt_access;
717 int ret; 735 int ret;
718 736
719 ENTER(); 737 lbs_deb_enter(LBS_DEB_IOCTL);
720 738
721 lbs_pr_debug(1, "FWT: getting time\n"); 739 lbs_deb_ioctl("FWT: getting time\n");
722 740
723 memset(&fwt_access, 0, sizeof(fwt_access)); 741 memset(&fwt_access, 0, sizeof(fwt_access));
724 742
@@ -732,7 +750,7 @@ static int wlan_fwt_time_ioctl(wlan_private * priv, struct ifreq *req)
732 else 750 else
733 return -EFAULT; 751 return -EFAULT;
734 752
735 LEAVE(); 753 lbs_deb_leave(LBS_DEB_IOCTL);
736 return 0; 754 return 0;
737} 755}
738 756
@@ -748,7 +766,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
748 struct cmd_ds_mesh_access mesh_access; 766 struct cmd_ds_mesh_access mesh_access;
749 int ret; 767 int ret;
750 768
751 ENTER(); 769 lbs_deb_enter(LBS_DEB_IOCTL);
752 770
753 memset(&mesh_access, 0, sizeof(mesh_access)); 771 memset(&mesh_access, 0, sizeof(mesh_access));
754 772
@@ -762,7 +780,7 @@ static int wlan_mesh_get_ttl_ioctl(wlan_private * priv, struct ifreq *req)
762 else 780 else
763 return -EFAULT; 781 return -EFAULT;
764 782
765 LEAVE(); 783 lbs_deb_leave(LBS_DEB_IOCTL);
766 return 0; 784 return 0;
767} 785}
768 786
@@ -777,7 +795,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
777 struct cmd_ds_mesh_access mesh_access; 795 struct cmd_ds_mesh_access mesh_access;
778 int ret; 796 int ret;
779 797
780 ENTER(); 798 lbs_deb_enter(LBS_DEB_IOCTL);
781 799
782 if( (ttl > 0xff) || (ttl < 0) ) 800 if( (ttl > 0xff) || (ttl < 0) )
783 return -EINVAL; 801 return -EINVAL;
@@ -793,7 +811,7 @@ static int wlan_mesh_set_ttl_ioctl(wlan_private * priv, int ttl)
793 if (ret != 0) 811 if (ret != 0)
794 ret = -EFAULT; 812 ret = -EFAULT;
795 813
796 LEAVE(); 814 lbs_deb_leave(LBS_DEB_IOCTL);
797 return ret; 815 return ret;
798} 816}
799 817
@@ -815,9 +833,9 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
815 wlan_adapter *adapter = priv->adapter; 833 wlan_adapter *adapter = priv->adapter;
816 struct iwreq *wrq = (struct iwreq *)req; 834 struct iwreq *wrq = (struct iwreq *)req;
817 835
818 ENTER(); 836 lbs_deb_enter(LBS_DEB_IOCTL);
819 837
820 lbs_pr_debug(1, "libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd); 838 lbs_deb_ioctl("libertas_do_ioctl: ioctl cmd = 0x%x\n", cmd);
821 switch (cmd) { 839 switch (cmd) {
822 case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */ 840 case WLAN_SETNONE_GETNONE: /* set WPA mode on/off ioctl #20 */
823 switch (wrq->u.data.flags) { 841 switch (wrq->u.data.flags) {
@@ -937,7 +955,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
937 (data, wrq->u.data.pointer, 955 (data, wrq->u.data.pointer,
938 sizeof(int) * 956 sizeof(int) *
939 wrq->u.data.length)) { 957 wrq->u.data.length)) {
940 lbs_pr_debug(1, 958 lbs_deb_ioctl(
941 "Copy from user failed\n"); 959 "Copy from user failed\n");
942 return -EFAULT; 960 return -EFAULT;
943 } 961 }
@@ -970,7 +988,7 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
970 if (copy_to_user(wrq->u.data.pointer, data, 988 if (copy_to_user(wrq->u.data.pointer, data,
971 sizeof(int) * 989 sizeof(int) *
972 gpio->header.len)) { 990 gpio->header.len)) {
973 lbs_pr_debug(1, "Copy to user failed\n"); 991 lbs_deb_ioctl("Copy to user failed\n");
974 return -EFAULT; 992 return -EFAULT;
975 } 993 }
976 994
@@ -984,7 +1002,8 @@ int libertas_do_ioctl(struct net_device *dev, struct ifreq *req, int cmd)
984 ret = -EINVAL; 1002 ret = -EINVAL;
985 break; 1003 break;
986 } 1004 }
987 LEAVE(); 1005
1006 lbs_deb_leave_args(LBS_DEB_IOCTL, "ret %d", ret);
988 return ret; 1007 return ret;
989} 1008}
990 1009
diff --git a/drivers/net/wireless/libertas/join.c b/drivers/net/wireless/libertas/join.c
index d4926b83e145..10c31f56f38b 100644
--- a/drivers/net/wireless/libertas/join.c
+++ b/drivers/net/wireless/libertas/join.c
@@ -60,7 +60,7 @@ static int get_common_rates(wlan_adapter * adapter, u8 * rate1,
60 lbs_dbg_hex("rate1 (AP) rates:", tmp, sizeof(tmp)); 60 lbs_dbg_hex("rate1 (AP) rates:", tmp, sizeof(tmp));
61 lbs_dbg_hex("rate2 (Card) rates:", rate2, rate2_size); 61 lbs_dbg_hex("rate2 (Card) rates:", rate2, rate2_size);
62 lbs_dbg_hex("Common rates:", ptr, rate1_size); 62 lbs_dbg_hex("Common rates:", ptr, rate1_size);
63 lbs_pr_debug(1, "Tx datarate is set to 0x%X\n", adapter->datarate); 63 lbs_deb_join("Tx datarate is set to 0x%X\n", adapter->datarate);
64 64
65 if (!adapter->is_datarate_auto) { 65 if (!adapter->is_datarate_auto) {
66 while (*ptr) { 66 while (*ptr) {
@@ -109,16 +109,14 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
109 wlan_adapter *adapter = priv->adapter; 109 wlan_adapter *adapter = priv->adapter;
110 int ret; 110 int ret;
111 111
112 ENTER(); 112 lbs_deb_enter(LBS_DEB_JOIN);
113 113
114 ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate, 114 ret = libertas_prepare_and_send_command(priv, cmd_802_11_authenticate,
115 0, cmd_option_waitforrsp, 115 0, cmd_option_waitforrsp,
116 0, pbssdesc->macaddress); 116 0, pbssdesc->macaddress);
117 117
118 if (ret) { 118 if (ret)
119 LEAVE(); 119 goto done;
120 return ret;
121 }
122 120
123 /* set preamble to firmware */ 121 /* set preamble to firmware */
124 if (adapter->capinfo.shortpreamble && pbssdesc->cap.shortpreamble) 122 if (adapter->capinfo.shortpreamble && pbssdesc->cap.shortpreamble)
@@ -131,7 +129,8 @@ int wlan_associate(wlan_private * priv, struct bss_descriptor * pbssdesc)
131 ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate, 129 ret = libertas_prepare_and_send_command(priv, cmd_802_11_associate,
132 0, cmd_option_waitforrsp, 0, pbssdesc); 130 0, cmd_option_waitforrsp, 0, pbssdesc);
133 131
134 LEAVE(); 132done:
133 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
135 return ret; 134 return ret;
136} 135}
137 136
@@ -150,19 +149,19 @@ int libertas_start_adhoc_network(wlan_private * priv, struct WLAN_802_11_SSID *a
150 adapter->adhoccreate = 1; 149 adapter->adhoccreate = 1;
151 150
152 if (!adapter->capinfo.shortpreamble) { 151 if (!adapter->capinfo.shortpreamble) {
153 lbs_pr_debug(1, "AdhocStart: Long preamble\n"); 152 lbs_deb_join("AdhocStart: Long preamble\n");
154 adapter->preamble = cmd_type_long_preamble; 153 adapter->preamble = cmd_type_long_preamble;
155 } else { 154 } else {
156 lbs_pr_debug(1, "AdhocStart: Short preamble\n"); 155 lbs_deb_join("AdhocStart: Short preamble\n");
157 adapter->preamble = cmd_type_short_preamble; 156 adapter->preamble = cmd_type_short_preamble;
158 } 157 }
159 158
160 libertas_set_radio_control(priv); 159 libertas_set_radio_control(priv);
161 160
162 lbs_pr_debug(1, "Adhoc channel = %d\n", adapter->adhocchannel); 161 lbs_deb_join("Adhoc channel = %d\n", adapter->adhocchannel);
163 lbs_pr_debug(1, "curbssparams.channel = %d\n", 162 lbs_deb_join("curbssparams.channel = %d\n",
164 adapter->curbssparams.channel); 163 adapter->curbssparams.channel);
165 lbs_pr_debug(1, "curbssparams.band = %d\n", adapter->curbssparams.band); 164 lbs_deb_join("curbssparams.band = %d\n", adapter->curbssparams.band);
166 165
167 ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start, 166 ret = libertas_prepare_and_send_command(priv, cmd_802_11_ad_hoc_start,
168 0, cmd_option_waitforrsp, 0, adhocssid); 167 0, cmd_option_waitforrsp, 0, adhocssid);
@@ -184,12 +183,12 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs
184 wlan_adapter *adapter = priv->adapter; 183 wlan_adapter *adapter = priv->adapter;
185 int ret = 0; 184 int ret = 0;
186 185
187 lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid =%s\n", 186 lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid =%s\n",
188 adapter->curbssparams.ssid.ssid); 187 adapter->curbssparams.ssid.ssid);
189 lbs_pr_debug(1, "libertas_join_adhoc_network: CurBss.ssid_len =%u\n", 188 lbs_deb_join("libertas_join_adhoc_network: CurBss.ssid_len =%u\n",
190 adapter->curbssparams.ssid.ssidlength); 189 adapter->curbssparams.ssid.ssidlength);
191 lbs_pr_debug(1, "libertas_join_adhoc_network: ssid =%s\n", pbssdesc->ssid.ssid); 190 lbs_deb_join("libertas_join_adhoc_network: ssid =%s\n", pbssdesc->ssid.ssid);
192 lbs_pr_debug(1, "libertas_join_adhoc_network: ssid len =%u\n", 191 lbs_deb_join("libertas_join_adhoc_network: ssid len =%u\n",
193 pbssdesc->ssid.ssidlength); 192 pbssdesc->ssid.ssidlength);
194 193
195 /* check if the requested SSID is already joined */ 194 /* check if the requested SSID is already joined */
@@ -197,7 +196,7 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs
197 && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid) 196 && !libertas_SSID_cmp(&pbssdesc->ssid, &adapter->curbssparams.ssid)
198 && (adapter->mode == IW_MODE_ADHOC)) { 197 && (adapter->mode == IW_MODE_ADHOC)) {
199 198
200 lbs_pr_debug(1, 199 lbs_deb_join(
201 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, " 200 "ADHOC_J_CMD: New ad-hoc SSID is the same as current, "
202 "not attempting to re-join"); 201 "not attempting to re-join");
203 202
@@ -207,18 +206,18 @@ int libertas_join_adhoc_network(wlan_private * priv, struct bss_descriptor * pbs
207 /*Use shortpreamble only when both creator and card supports 206 /*Use shortpreamble only when both creator and card supports
208 short preamble */ 207 short preamble */
209 if (!pbssdesc->cap.shortpreamble || !adapter->capinfo.shortpreamble) { 208 if (!pbssdesc->cap.shortpreamble || !adapter->capinfo.shortpreamble) {
210 lbs_pr_debug(1, "AdhocJoin: Long preamble\n"); 209 lbs_deb_join("AdhocJoin: Long preamble\n");
211 adapter->preamble = cmd_type_long_preamble; 210 adapter->preamble = cmd_type_long_preamble;
212 } else { 211 } else {
213 lbs_pr_debug(1, "AdhocJoin: Short preamble\n"); 212 lbs_deb_join("AdhocJoin: Short preamble\n");
214 adapter->preamble = cmd_type_short_preamble; 213 adapter->preamble = cmd_type_short_preamble;
215 } 214 }
216 215
217 libertas_set_radio_control(priv); 216 libertas_set_radio_control(priv);
218 217
219 lbs_pr_debug(1, "curbssparams.channel = %d\n", 218 lbs_deb_join("curbssparams.channel = %d\n",
220 adapter->curbssparams.channel); 219 adapter->curbssparams.channel);
221 lbs_pr_debug(1, "curbssparams.band = %c\n", adapter->curbssparams.band); 220 lbs_deb_join("curbssparams.band = %c\n", adapter->curbssparams.band);
222 221
223 adapter->adhoccreate = 0; 222 adapter->adhoccreate = 0;
224 223
@@ -281,14 +280,14 @@ int libertas_cmd_80211_authenticate(wlan_private * priv,
281 pauthenticate->authtype = 0x80; 280 pauthenticate->authtype = 0x80;
282 break; 281 break;
283 default: 282 default:
284 lbs_pr_debug(1, "AUTH_CMD: invalid auth alg 0x%X\n", 283 lbs_deb_join("AUTH_CMD: invalid auth alg 0x%X\n",
285 adapter->secinfo.auth_mode); 284 adapter->secinfo.auth_mode);
286 goto out; 285 goto out;
287 } 286 }
288 287
289 memcpy(pauthenticate->macaddr, bssid, ETH_ALEN); 288 memcpy(pauthenticate->macaddr, bssid, ETH_ALEN);
290 289
291 lbs_pr_debug(1, "AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n", 290 lbs_deb_join("AUTH_CMD: Bssid is : %x:%x:%x:%x:%x:%x\n",
292 bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]); 291 bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5]);
293 ret = 0; 292 ret = 0;
294 293
@@ -302,7 +301,7 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv,
302 wlan_adapter *adapter = priv->adapter; 301 wlan_adapter *adapter = priv->adapter;
303 struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth; 302 struct cmd_ds_802_11_deauthenticate *dauth = &cmd->params.deauth;
304 303
305 ENTER(); 304 lbs_deb_enter(LBS_DEB_JOIN);
306 305
307 cmd->command = cpu_to_le16(cmd_802_11_deauthenticate); 306 cmd->command = cpu_to_le16(cmd_802_11_deauthenticate);
308 cmd->size = 307 cmd->size =
@@ -317,7 +316,7 @@ int libertas_cmd_80211_deauthenticate(wlan_private * priv,
317#define REASON_CODE_STA_LEAVING 3 316#define REASON_CODE_STA_LEAVING 3
318 dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING); 317 dauth->reasoncode = cpu_to_le16(REASON_CODE_STA_LEAVING);
319 318
320 LEAVE(); 319 lbs_deb_leave(LBS_DEB_JOIN);
321 return 0; 320 return 0;
322} 321}
323 322
@@ -338,7 +337,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
338 struct mrvlietypes_ratesparamset *rates; 337 struct mrvlietypes_ratesparamset *rates;
339 struct mrvlietypes_rsnparamset *rsn; 338 struct mrvlietypes_rsnparamset *rsn;
340 339
341 ENTER(); 340 lbs_deb_enter(LBS_DEB_JOIN);
342 341
343 pbssdesc = pdata_buf; 342 pbssdesc = pdata_buf;
344 pos = (u8 *) passo; 343 pos = (u8 *) passo;
@@ -427,7 +426,7 @@ int libertas_cmd_80211_associate(wlan_private * priv,
427 memcpy(&adapter->curbssparams.datarates, &rates->rates, 426 memcpy(&adapter->curbssparams.datarates, &rates->rates,
428 min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len)); 427 min_t(size_t, sizeof(adapter->curbssparams.datarates), rates->header.len));
429 428
430 lbs_pr_debug(1, "ASSOC_CMD: rates->header.len = %d\n", rates->header.len); 429 lbs_deb_join("ASSOC_CMD: rates->header.len = %d\n", rates->header.len);
431 430
432 /* set IBSS field */ 431 /* set IBSS field */
433 if (pbssdesc->mode == IW_MODE_INFRA) { 432 if (pbssdesc->mode == IW_MODE_INFRA) {
@@ -445,13 +444,13 @@ int libertas_cmd_80211_associate(wlan_private * priv,
445 /* set the capability info at last */ 444 /* set the capability info at last */
446 memcpy(&tmpcap, &pbssdesc->cap, sizeof(passo->capinfo)); 445 memcpy(&tmpcap, &pbssdesc->cap, sizeof(passo->capinfo));
447 tmpcap &= CAPINFO_MASK; 446 tmpcap &= CAPINFO_MASK;
448 lbs_pr_debug(1, "ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", 447 lbs_deb_join("ASSOC_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
449 tmpcap, CAPINFO_MASK); 448 tmpcap, CAPINFO_MASK);
450 tmpcap = cpu_to_le16(tmpcap); 449 tmpcap = cpu_to_le16(tmpcap);
451 memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo)); 450 memcpy(&passo->capinfo, &tmpcap, sizeof(passo->capinfo));
452 451
453 done: 452done:
454 LEAVE(); 453 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
455 return ret; 454 return ret;
456} 455}
457 456
@@ -467,7 +466,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
467 struct bss_descriptor *pbssdesc; 466 struct bss_descriptor *pbssdesc;
468 struct WLAN_802_11_SSID *ssid = pssid; 467 struct WLAN_802_11_SSID *ssid = pssid;
469 468
470 ENTER(); 469 lbs_deb_enter(LBS_DEB_JOIN);
471 470
472 if (!adapter) { 471 if (!adapter) {
473 ret = -1; 472 ret = -1;
@@ -495,7 +494,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
495 494
496 memcpy(adhs->SSID, ssid->ssid, ssid->ssidlength); 495 memcpy(adhs->SSID, ssid->ssid, ssid->ssidlength);
497 496
498 lbs_pr_debug(1, "ADHOC_S_CMD: SSID = %s\n", adhs->SSID); 497 lbs_deb_join("ADHOC_S_CMD: SSID = %s\n", adhs->SSID);
499 498
500 memset(pbssdesc->ssid.ssid, 0, IW_ESSID_MAX_SIZE); 499 memset(pbssdesc->ssid.ssid, 0, IW_ESSID_MAX_SIZE);
501 memcpy(pbssdesc->ssid.ssid, ssid->ssid, ssid->ssidlength); 500 memcpy(pbssdesc->ssid.ssid, ssid->ssid, ssid->ssidlength);
@@ -516,7 +515,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
516 515
517 WARN_ON(!adapter->adhocchannel); 516 WARN_ON(!adapter->adhocchannel);
518 517
519 lbs_pr_debug(1, "ADHOC_S_CMD: Creating ADHOC on channel %d\n", 518 lbs_deb_join("ADHOC_S_CMD: Creating ADHOC on channel %d\n",
520 adapter->adhocchannel); 519 adapter->adhocchannel);
521 520
522 adapter->curbssparams.channel = adapter->adhocchannel; 521 adapter->curbssparams.channel = adapter->adhocchannel;
@@ -547,11 +546,11 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
547 546
548 /* set up privacy in adapter->scantable[i] */ 547 /* set up privacy in adapter->scantable[i] */
549 if (adapter->secinfo.wep_enabled) { 548 if (adapter->secinfo.wep_enabled) {
550 lbs_pr_debug(1, "ADHOC_S_CMD: WEP enabled, setting privacy on\n"); 549 lbs_deb_join("ADHOC_S_CMD: WEP enabled, setting privacy on\n");
551 pbssdesc->privacy = wlan802_11privfilter8021xWEP; 550 pbssdesc->privacy = wlan802_11privfilter8021xWEP;
552 adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON; 551 adhs->cap.privacy = AD_HOC_CAP_PRIVACY_ON;
553 } else { 552 } else {
554 lbs_pr_debug(1, "ADHOC_S_CMD: WEP disabled, setting privacy off\n"); 553 lbs_deb_join("ADHOC_S_CMD: WEP disabled, setting privacy off\n");
555 pbssdesc->privacy = wlan802_11privfilteracceptall; 554 pbssdesc->privacy = wlan802_11privfilteracceptall;
556 } 555 }
557 556
@@ -574,14 +573,14 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
574 memcpy(&adapter->curbssparams.datarates, 573 memcpy(&adapter->curbssparams.datarates,
575 &adhs->datarate, adapter->curbssparams.numofrates); 574 &adhs->datarate, adapter->curbssparams.numofrates);
576 575
577 lbs_pr_debug(1, "ADHOC_S_CMD: rates=%02x %02x %02x %02x \n", 576 lbs_deb_join("ADHOC_S_CMD: rates=%02x %02x %02x %02x \n",
578 adhs->datarate[0], adhs->datarate[1], 577 adhs->datarate[0], adhs->datarate[1],
579 adhs->datarate[2], adhs->datarate[3]); 578 adhs->datarate[2], adhs->datarate[3]);
580 579
581 lbs_pr_debug(1, "ADHOC_S_CMD: AD HOC Start command is ready\n"); 580 lbs_deb_join("ADHOC_S_CMD: AD HOC Start command is ready\n");
582 581
583 if (libertas_create_dnld_countryinfo_11d(priv)) { 582 if (libertas_create_dnld_countryinfo_11d(priv)) {
584 lbs_pr_debug(1, "ADHOC_S_CMD: dnld_countryinfo_11d failed\n"); 583 lbs_deb_join("ADHOC_S_CMD: dnld_countryinfo_11d failed\n");
585 ret = -1; 584 ret = -1;
586 goto done; 585 goto done;
587 } 586 }
@@ -596,7 +595,7 @@ int libertas_cmd_80211_ad_hoc_start(wlan_private * priv,
596 595
597 ret = 0; 596 ret = 0;
598done: 597done:
599 LEAVE(); 598 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
600 return ret; 599 return ret;
601} 600}
602 601
@@ -622,7 +621,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
622 u16 tmpcap; 621 u16 tmpcap;
623 int i; 622 int i;
624 623
625 ENTER(); 624 lbs_deb_enter(LBS_DEB_JOIN);
626 625
627 adapter->pattemptedbssdesc = pbssdesc; 626 adapter->pattemptedbssdesc = pbssdesc;
628 627
@@ -647,13 +646,13 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
647 memcpy(&tmpcap, &pbssdesc->cap, sizeof(struct ieeetypes_capinfo)); 646 memcpy(&tmpcap, &pbssdesc->cap, sizeof(struct ieeetypes_capinfo));
648 tmpcap &= CAPINFO_MASK; 647 tmpcap &= CAPINFO_MASK;
649 648
650 lbs_pr_debug(1, "ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n", 649 lbs_deb_join("ADHOC_J_CMD: tmpcap=%4X CAPINFO_MASK=%4X\n",
651 tmpcap, CAPINFO_MASK); 650 tmpcap, CAPINFO_MASK);
652 memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap, 651 memcpy(&padhocjoin->bssdescriptor.cap, &tmpcap,
653 sizeof(struct ieeetypes_capinfo)); 652 sizeof(struct ieeetypes_capinfo));
654 653
655 /* information on BSSID descriptor passed to FW */ 654 /* information on BSSID descriptor passed to FW */
656 lbs_pr_debug(1, 655 lbs_deb_join(
657 "ADHOC_J_CMD: BSSID = %2x-%2x-%2x-%2x-%2x-%2x, SSID = %s\n", 656 "ADHOC_J_CMD: BSSID = %2x-%2x-%2x-%2x-%2x-%2x, SSID = %s\n",
658 padhocjoin->bssdescriptor.BSSID[0], 657 padhocjoin->bssdescriptor.BSSID[0],
659 padhocjoin->bssdescriptor.BSSID[1], 658 padhocjoin->bssdescriptor.BSSID[1],
@@ -685,7 +684,7 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
685 if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates, 684 if (get_common_rates(adapter, padhocjoin->bssdescriptor.datarates,
686 sizeof(padhocjoin->bssdescriptor.datarates), 685 sizeof(padhocjoin->bssdescriptor.datarates),
687 card_rates, card_rates_size)) { 686 card_rates, card_rates_size)) {
688 lbs_pr_debug(1, "ADHOC_J_CMD: get_common_rates returns error.\n"); 687 lbs_deb_join("ADHOC_J_CMD: get_common_rates returns error.\n");
689 ret = -1; 688 ret = -1;
690 goto done; 689 goto done;
691 } 690 }
@@ -742,8 +741,8 @@ int libertas_cmd_80211_ad_hoc_join(wlan_private * priv,
742 memcpy(&padhocjoin->bssdescriptor.cap, 741 memcpy(&padhocjoin->bssdescriptor.cap,
743 &tmpcap, sizeof(struct ieeetypes_capinfo)); 742 &tmpcap, sizeof(struct ieeetypes_capinfo));
744 743
745 done: 744done:
746 LEAVE(); 745 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
747 return ret; 746 return ret;
748} 747}
749 748
@@ -756,7 +755,7 @@ int libertas_ret_80211_associate(wlan_private * priv,
756 struct ieeetypes_assocrsp *passocrsp; 755 struct ieeetypes_assocrsp *passocrsp;
757 struct bss_descriptor *pbssdesc; 756 struct bss_descriptor *pbssdesc;
758 757
759 ENTER(); 758 lbs_deb_enter(LBS_DEB_JOIN);
760 759
761 passocrsp = (struct ieeetypes_assocrsp *) & resp->params; 760 passocrsp = (struct ieeetypes_assocrsp *) & resp->params;
762 761
@@ -764,9 +763,8 @@ int libertas_ret_80211_associate(wlan_private * priv,
764 763
765 libertas_mac_event_disconnected(priv); 764 libertas_mac_event_disconnected(priv);
766 765
767 lbs_pr_debug(1, 766 lbs_deb_join("ASSOC_RESP: Association failed, status code = %d\n",
768 "ASSOC_RESP: Association failed, status code = %d\n", 767 passocrsp->statuscode);
769 passocrsp->statuscode);
770 768
771 ret = -1; 769 ret = -1;
772 goto done; 770 goto done;
@@ -781,7 +779,7 @@ int libertas_ret_80211_associate(wlan_private * priv,
781 /* Set the attempted BSSID Index to current */ 779 /* Set the attempted BSSID Index to current */
782 pbssdesc = adapter->pattemptedbssdesc; 780 pbssdesc = adapter->pattemptedbssdesc;
783 781
784 lbs_pr_debug(1, "ASSOC_RESP: %s\n", pbssdesc->ssid.ssid); 782 lbs_deb_join("ASSOC_RESP: %s\n", pbssdesc->ssid.ssid);
785 783
786 /* Set the new SSID to current SSID */ 784 /* Set the new SSID to current SSID */
787 memcpy(&adapter->curbssparams.ssid, 785 memcpy(&adapter->curbssparams.ssid,
@@ -795,7 +793,7 @@ int libertas_ret_80211_associate(wlan_private * priv,
795 memcpy(&adapter->curbssparams.bssdescriptor, 793 memcpy(&adapter->curbssparams.bssdescriptor,
796 pbssdesc, sizeof(struct bss_descriptor)); 794 pbssdesc, sizeof(struct bss_descriptor));
797 795
798 lbs_pr_debug(1, "ASSOC_RESP: currentpacketfilter is %x\n", 796 lbs_deb_join("ASSOC_RESP: currentpacketfilter is %x\n",
799 adapter->currentpacketfilter); 797 adapter->currentpacketfilter);
800 798
801 adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0; 799 adapter->SNR[TYPE_RXPD][TYPE_AVG] = 0;
@@ -809,25 +807,25 @@ int libertas_ret_80211_associate(wlan_private * priv,
809 netif_carrier_on(priv->wlan_dev.netdev); 807 netif_carrier_on(priv->wlan_dev.netdev);
810 netif_wake_queue(priv->wlan_dev.netdev); 808 netif_wake_queue(priv->wlan_dev.netdev);
811 809
812 lbs_pr_debug(1, "ASSOC_RESP: Associated \n"); 810 lbs_deb_join("ASSOC_RESP: Associated \n");
813 811
814 memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN); 812 memcpy(wrqu.ap_addr.sa_data, adapter->curbssparams.bssid, ETH_ALEN);
815 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 813 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
816 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); 814 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
817 815
818 done: 816done:
819 LEAVE(); 817 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
820 return ret; 818 return ret;
821} 819}
822 820
823int libertas_ret_80211_disassociate(wlan_private * priv, 821int libertas_ret_80211_disassociate(wlan_private * priv,
824 struct cmd_ds_command *resp) 822 struct cmd_ds_command *resp)
825{ 823{
826 ENTER(); 824 lbs_deb_enter(LBS_DEB_JOIN);
827 825
828 libertas_mac_event_disconnected(priv); 826 libertas_mac_event_disconnected(priv);
829 827
830 LEAVE(); 828 lbs_deb_leave(LBS_DEB_JOIN);
831 return 0; 829 return 0;
832} 830}
833 831
@@ -842,13 +840,13 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
842 union iwreq_data wrqu; 840 union iwreq_data wrqu;
843 struct bss_descriptor *pbssdesc; 841 struct bss_descriptor *pbssdesc;
844 842
845 ENTER(); 843 lbs_deb_enter(LBS_DEB_JOIN);
846 844
847 padhocresult = &resp->params.result; 845 padhocresult = &resp->params.result;
848 846
849 lbs_pr_debug(1, "ADHOC_S_RESP: size = %d\n", le16_to_cpu(resp->size)); 847 lbs_deb_join("ADHOC_S_RESP: size = %d\n", le16_to_cpu(resp->size));
850 lbs_pr_debug(1, "ADHOC_S_RESP: command = %x\n", command); 848 lbs_deb_join("ADHOC_S_RESP: command = %x\n", command);
851 lbs_pr_debug(1, "ADHOC_S_RESP: result = %x\n", result); 849 lbs_deb_join("ADHOC_S_RESP: result = %x\n", result);
852 850
853 pbssdesc = adapter->pattemptedbssdesc; 851 pbssdesc = adapter->pattemptedbssdesc;
854 852
@@ -856,7 +854,7 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
856 * Join result code 0 --> SUCCESS 854 * Join result code 0 --> SUCCESS
857 */ 855 */
858 if (result) { 856 if (result) {
859 lbs_pr_debug(1, "ADHOC_RESP failed\n"); 857 lbs_deb_join("ADHOC_RESP failed\n");
860 if (adapter->connect_status == libertas_connected) { 858 if (adapter->connect_status == libertas_connected) {
861 libertas_mac_event_disconnected(priv); 859 libertas_mac_event_disconnected(priv);
862 } 860 }
@@ -864,15 +862,15 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
864 memset(&adapter->curbssparams.bssdescriptor, 862 memset(&adapter->curbssparams.bssdescriptor,
865 0x00, sizeof(adapter->curbssparams.bssdescriptor)); 863 0x00, sizeof(adapter->curbssparams.bssdescriptor));
866 864
867 LEAVE(); 865 ret = -1;
868 return -1; 866 goto done;
869 } 867 }
870 868
871 /* 869 /*
872 * Now the join cmd should be successful 870 * Now the join cmd should be successful
873 * If BSSID has changed use SSID to compare instead of BSSID 871 * If BSSID has changed use SSID to compare instead of BSSID
874 */ 872 */
875 lbs_pr_debug(1, "ADHOC_J_RESP %s\n", pbssdesc->ssid.ssid); 873 lbs_deb_join("ADHOC_J_RESP %s\n", pbssdesc->ssid.ssid);
876 874
877 /* Send a Media Connected event, according to the Spec */ 875 /* Send a Media Connected event, according to the Spec */
878 adapter->connect_status = libertas_connected; 876 adapter->connect_status = libertas_connected;
@@ -906,24 +904,25 @@ int libertas_ret_80211_ad_hoc_start(wlan_private * priv,
906 wrqu.ap_addr.sa_family = ARPHRD_ETHER; 904 wrqu.ap_addr.sa_family = ARPHRD_ETHER;
907 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL); 905 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWAP, &wrqu, NULL);
908 906
909 lbs_pr_debug(1, "ADHOC_RESP: - Joined/Started Ad Hoc\n"); 907 lbs_deb_join("ADHOC_RESP: - Joined/Started Ad Hoc\n");
910 lbs_pr_debug(1, "ADHOC_RESP: channel = %d\n", adapter->adhocchannel); 908 lbs_deb_join("ADHOC_RESP: channel = %d\n", adapter->adhocchannel);
911 lbs_pr_debug(1, "ADHOC_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n", 909 lbs_deb_join("ADHOC_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n",
912 padhocresult->BSSID[0], padhocresult->BSSID[1], 910 padhocresult->BSSID[0], padhocresult->BSSID[1],
913 padhocresult->BSSID[2], padhocresult->BSSID[3], 911 padhocresult->BSSID[2], padhocresult->BSSID[3],
914 padhocresult->BSSID[4], padhocresult->BSSID[5]); 912 padhocresult->BSSID[4], padhocresult->BSSID[5]);
915 913
916 LEAVE(); 914done:
915 lbs_deb_leave_args(LBS_DEB_JOIN, "ret %d", ret);
917 return ret; 916 return ret;
918} 917}
919 918
920int libertas_ret_80211_ad_hoc_stop(wlan_private * priv, 919int libertas_ret_80211_ad_hoc_stop(wlan_private * priv,
921 struct cmd_ds_command *resp) 920 struct cmd_ds_command *resp)
922{ 921{
923 ENTER(); 922 lbs_deb_enter(LBS_DEB_JOIN);
924 923
925 libertas_mac_event_disconnected(priv); 924 libertas_mac_event_disconnected(priv);
926 925
927 LEAVE(); 926 lbs_deb_leave(LBS_DEB_JOIN);
928 return 0; 927 return 0;
929} 928}
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 6bf162a107b0..cd107366beb7 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -11,6 +11,7 @@
11#include <linux/if_arp.h> 11#include <linux/if_arp.h>
12 12
13#include <net/iw_handler.h> 13#include <net/iw_handler.h>
14#include <net/ieee80211.h>
14 15
15#include "host.h" 16#include "host.h"
16#include "sbi.h" 17#include "sbi.h"
@@ -227,7 +228,8 @@ static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get,
227 * function to work around the issue. 228 * function to work around the issue.
228 * 229 *
229 */ 230 */
230static int pre_open_check(struct net_device *dev) { 231static int pre_open_check(struct net_device *dev)
232{
231 wlan_private *priv = (wlan_private *) dev->priv; 233 wlan_private *priv = (wlan_private *) dev->priv;
232 wlan_adapter *adapter = priv->adapter; 234 wlan_adapter *adapter = priv->adapter;
233 int i = 0; 235 int i = 0;
@@ -237,8 +239,7 @@ static int pre_open_check(struct net_device *dev) {
237 msleep_interruptible(100); 239 msleep_interruptible(100);
238 } 240 }
239 if (!adapter->fw_ready) { 241 if (!adapter->fw_ready) {
240 lbs_pr_info("FW not ready, pre_open_check() return failure\n"); 242 lbs_pr_err("firmware not ready\n");
241 LEAVE();
242 return -1; 243 return -1;
243 } 244 }
244 245
@@ -256,8 +257,7 @@ static int wlan_dev_open(struct net_device *dev)
256 wlan_private *priv = (wlan_private *) dev->priv; 257 wlan_private *priv = (wlan_private *) dev->priv;
257 wlan_adapter *adapter = priv->adapter; 258 wlan_adapter *adapter = priv->adapter;
258 259
259 ENTER(); 260 lbs_deb_enter(LBS_DEB_NET);
260
261 261
262 priv->open = 1; 262 priv->open = 1;
263 263
@@ -266,7 +266,7 @@ static int wlan_dev_open(struct net_device *dev)
266 } else 266 } else
267 netif_carrier_off(priv->wlan_dev.netdev); 267 netif_carrier_off(priv->wlan_dev.netdev);
268 268
269 LEAVE(); 269 lbs_deb_leave(LBS_DEB_NET);
270 return 0; 270 return 0;
271} 271}
272/** 272/**
@@ -311,12 +311,12 @@ static int wlan_dev_close(struct net_device *dev)
311{ 311{
312 wlan_private *priv = dev->priv; 312 wlan_private *priv = dev->priv;
313 313
314 ENTER(); 314 lbs_deb_enter(LBS_DEB_NET);
315 315
316 netif_carrier_off(priv->wlan_dev.netdev); 316 netif_carrier_off(priv->wlan_dev.netdev);
317 priv->open = 0; 317 priv->open = 0;
318 318
319 LEAVE(); 319 lbs_deb_leave(LBS_DEB_NET);
320 return 0; 320 return 0;
321} 321}
322 322
@@ -361,7 +361,7 @@ static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
361 int ret = 0; 361 int ret = 0;
362 wlan_private *priv = dev->priv; 362 wlan_private *priv = dev->priv;
363 363
364 ENTER(); 364 lbs_deb_enter(LBS_DEB_NET);
365 365
366 if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) { 366 if (priv->wlan_dev.dnld_sent || priv->adapter->TxLockFlag) {
367 priv->stats.tx_dropped++; 367 priv->stats.tx_dropped++;
@@ -373,7 +373,7 @@ static int wlan_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
373 if (libertas_process_tx(priv, skb) == 0) 373 if (libertas_process_tx(priv, skb) == 0)
374 dev->trans_start = jiffies; 374 dev->trans_start = jiffies;
375done: 375done:
376 LEAVE(); 376 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
377 return ret; 377 return ret;
378} 378}
379 379
@@ -384,31 +384,41 @@ done:
384static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) 384static int mesh_pre_start_xmit(struct sk_buff *skb, struct net_device *dev)
385{ 385{
386 wlan_private *priv = dev->priv; 386 wlan_private *priv = dev->priv;
387 ENTER(); 387 int ret;
388
389 lbs_deb_enter(LBS_DEB_MESH);
390
388 SET_MESH_FRAME(skb); 391 SET_MESH_FRAME(skb);
389 LEAVE();
390 392
391 return wlan_hard_start_xmit(skb, priv->wlan_dev.netdev); 393 ret = wlan_hard_start_xmit(skb, priv->wlan_dev.netdev);
394 lbs_deb_leave_args(LBS_DEB_MESH, "ret %d", ret);
395 return ret;
392} 396}
393 397
394/** 398/**
395 * @brief Mark non-mesh packets and handover them to wlan_hard_start_xmit 399 * @brief Mark non-mesh packets and handover them to wlan_hard_start_xmit
396 * 400 *
397 */ 401 */
398static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev) { 402static int wlan_pre_start_xmit(struct sk_buff *skb, struct net_device *dev)
399 ENTER(); 403{
404 int ret;
405
406 lbs_deb_enter(LBS_DEB_NET);
407
400 UNSET_MESH_FRAME(skb); 408 UNSET_MESH_FRAME(skb);
401 LEAVE(); 409
402 return wlan_hard_start_xmit(skb, dev); 410 ret = wlan_hard_start_xmit(skb, dev);
411 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
412 return ret;
403} 413}
404 414
405static void wlan_tx_timeout(struct net_device *dev) 415static void wlan_tx_timeout(struct net_device *dev)
406{ 416{
407 wlan_private *priv = (wlan_private *) dev->priv; 417 wlan_private *priv = (wlan_private *) dev->priv;
408 418
409 ENTER(); 419 lbs_deb_enter(LBS_DEB_TX);
410 420
411 lbs_pr_err("tx watch dog timeout!\n"); 421 lbs_pr_err("tx watch dog timeout\n");
412 422
413 priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; 423 priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
414 dev->trans_start = jiffies; 424 dev->trans_start = jiffies;
@@ -424,7 +434,7 @@ static void wlan_tx_timeout(struct net_device *dev)
424 } else if (priv->adapter->connect_status == libertas_connected) 434 } else if (priv->adapter->connect_status == libertas_connected)
425 netif_wake_queue(priv->wlan_dev.netdev); 435 netif_wake_queue(priv->wlan_dev.netdev);
426 436
427 LEAVE(); 437 lbs_deb_leave(LBS_DEB_TX);
428} 438}
429 439
430/** 440/**
@@ -447,7 +457,7 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr)
447 wlan_adapter *adapter = priv->adapter; 457 wlan_adapter *adapter = priv->adapter;
448 struct sockaddr *phwaddr = addr; 458 struct sockaddr *phwaddr = addr;
449 459
450 ENTER(); 460 lbs_deb_enter(LBS_DEB_NET);
451 461
452 memset(adapter->current_addr, 0, ETH_ALEN); 462 memset(adapter->current_addr, 0, ETH_ALEN);
453 463
@@ -462,7 +472,7 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr)
462 cmd_option_waitforrsp, 0, NULL); 472 cmd_option_waitforrsp, 0, NULL);
463 473
464 if (ret) { 474 if (ret) {
465 lbs_pr_debug(1, "set mac address failed.\n"); 475 lbs_deb_net("set MAC address failed\n");
466 ret = -1; 476 ret = -1;
467 goto done; 477 goto done;
468 } 478 }
@@ -472,7 +482,7 @@ static int wlan_set_mac_address(struct net_device *dev, void *addr)
472 memcpy(((wlan_private *) dev->priv)->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN); 482 memcpy(((wlan_private *) dev->priv)->mesh_dev->dev_addr, adapter->current_addr, ETH_ALEN);
473 483
474done: 484done:
475 LEAVE(); 485 lbs_deb_leave_args(LBS_DEB_NET, "ret %d", ret);
476 return ret; 486 return ret;
477} 487}
478 488
@@ -497,12 +507,12 @@ static void wlan_set_multicast_list(struct net_device *dev)
497 wlan_adapter *adapter = priv->adapter; 507 wlan_adapter *adapter = priv->adapter;
498 int oldpacketfilter; 508 int oldpacketfilter;
499 509
500 ENTER(); 510 lbs_deb_enter(LBS_DEB_NET);
501 511
502 oldpacketfilter = adapter->currentpacketfilter; 512 oldpacketfilter = adapter->currentpacketfilter;
503 513
504 if (dev->flags & IFF_PROMISC) { 514 if (dev->flags & IFF_PROMISC) {
505 lbs_pr_debug(1, "enable Promiscuous mode\n"); 515 lbs_deb_net("enable promiscuous mode\n");
506 adapter->currentpacketfilter |= 516 adapter->currentpacketfilter |=
507 cmd_act_mac_promiscuous_enable; 517 cmd_act_mac_promiscuous_enable;
508 adapter->currentpacketfilter &= 518 adapter->currentpacketfilter &=
@@ -515,7 +525,7 @@ static void wlan_set_multicast_list(struct net_device *dev)
515 525
516 if (dev->flags & IFF_ALLMULTI || dev->mc_count > 526 if (dev->flags & IFF_ALLMULTI || dev->mc_count >
517 MRVDRV_MAX_MULTICAST_LIST_SIZE) { 527 MRVDRV_MAX_MULTICAST_LIST_SIZE) {
518 lbs_pr_debug(1, "Enabling All Multicast!\n"); 528 lbs_deb_net( "enabling all multicast\n");
519 adapter->currentpacketfilter |= 529 adapter->currentpacketfilter |=
520 cmd_act_mac_all_multicast_enable; 530 cmd_act_mac_all_multicast_enable;
521 adapter->currentpacketfilter &= 531 adapter->currentpacketfilter &=
@@ -525,8 +535,8 @@ static void wlan_set_multicast_list(struct net_device *dev)
525 ~cmd_act_mac_all_multicast_enable; 535 ~cmd_act_mac_all_multicast_enable;
526 536
527 if (!dev->mc_count) { 537 if (!dev->mc_count) {
528 lbs_pr_debug(1, "No multicast addresses - " 538 lbs_deb_net("no multicast addresses, "
529 "disabling multicast!\n"); 539 "disabling multicast\n");
530 adapter->currentpacketfilter &= 540 adapter->currentpacketfilter &=
531 ~cmd_act_mac_multicast_enable; 541 ~cmd_act_mac_multicast_enable;
532 } else { 542 } else {
@@ -538,12 +548,12 @@ static void wlan_set_multicast_list(struct net_device *dev)
538 adapter->nr_of_multicastmacaddr = 548 adapter->nr_of_multicastmacaddr =
539 wlan_copy_multicast_address(adapter, dev); 549 wlan_copy_multicast_address(adapter, dev);
540 550
541 lbs_pr_debug(1, "Multicast addresses: %d\n", 551 lbs_deb_net("multicast addresses: %d\n",
542 dev->mc_count); 552 dev->mc_count);
543 553
544 for (i = 0; i < dev->mc_count; i++) { 554 for (i = 0; i < dev->mc_count; i++) {
545 lbs_pr_debug(1, "Multicast address %d:" 555 lbs_deb_net("Multicast address %d:"
546 "%x %x %x %x %x %x\n", i, 556 MAC_FMT "\n", i,
547 adapter->multicastlist[i][0], 557 adapter->multicastlist[i][0],
548 adapter->multicastlist[i][1], 558 adapter->multicastlist[i][1],
549 adapter->multicastlist[i][2], 559 adapter->multicastlist[i][2],
@@ -551,7 +561,7 @@ static void wlan_set_multicast_list(struct net_device *dev)
551 adapter->multicastlist[i][4], 561 adapter->multicastlist[i][4],
552 adapter->multicastlist[i][5]); 562 adapter->multicastlist[i][5]);
553 } 563 }
554 /* set multicast addresses to firmware */ 564 /* send multicast addresses to firmware */
555 libertas_prepare_and_send_command(priv, 565 libertas_prepare_and_send_command(priv,
556 cmd_mac_multicast_adr, 566 cmd_mac_multicast_adr,
557 cmd_act_set, 0, 0, 567 cmd_act_set, 0, 0,
@@ -564,13 +574,13 @@ static void wlan_set_multicast_list(struct net_device *dev)
564 libertas_set_mac_packet_filter(priv); 574 libertas_set_mac_packet_filter(priv);
565 } 575 }
566 576
567 LEAVE(); 577 lbs_deb_leave(LBS_DEB_NET);
568} 578}
569 579
570/** 580/**
571 * @brief This function hanldes the major job in WLAN driver. 581 * @brief This function handles the major jobs in the WLAN driver.
572 * it handles the event generated by firmware, rx data received 582 * It handles all events generated by firmware, RX data received
573 * from firmware and tx data sent from kernel. 583 * from firmware and TX data sent from kernel.
574 * 584 *
575 * @param data A pointer to wlan_thread structure 585 * @param data A pointer to wlan_thread structure
576 * @return 0 586 * @return 0
@@ -583,14 +593,14 @@ static int wlan_service_main_thread(void *data)
583 wait_queue_t wait; 593 wait_queue_t wait;
584 u8 ireg = 0; 594 u8 ireg = 0;
585 595
586 ENTER(); 596 lbs_deb_enter(LBS_DEB_THREAD);
587 597
588 wlan_activate_thread(thread); 598 wlan_activate_thread(thread);
589 599
590 init_waitqueue_entry(&wait, current); 600 init_waitqueue_entry(&wait, current);
591 601
592 for (;;) { 602 for (;;) {
593 lbs_pr_debug(1, "main-thread 111: intcounter=%d " 603 lbs_deb_thread( "main-thread 111: intcounter=%d "
594 "currenttxskb=%p dnld_sent=%d\n", 604 "currenttxskb=%p dnld_sent=%d\n",
595 adapter->intcounter, 605 adapter->intcounter,
596 adapter->currenttxskb, priv->wlan_dev.dnld_sent); 606 adapter->currenttxskb, priv->wlan_dev.dnld_sent);
@@ -602,7 +612,7 @@ static int wlan_service_main_thread(void *data)
602 (!adapter->intcounter 612 (!adapter->intcounter
603 && (priv->wlan_dev.dnld_sent || adapter->cur_cmd || 613 && (priv->wlan_dev.dnld_sent || adapter->cur_cmd ||
604 list_empty(&adapter->cmdpendingq)))) { 614 list_empty(&adapter->cmdpendingq)))) {
605 lbs_pr_debug(1, 615 lbs_deb_thread(
606 "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n", 616 "main-thread sleeping... Conn=%d IntC=%d PS_mode=%d PS_State=%d\n",
607 adapter->connect_status, adapter->intcounter, 617 adapter->connect_status, adapter->intcounter,
608 adapter->psmode, adapter->psstate); 618 adapter->psmode, adapter->psstate);
@@ -612,7 +622,7 @@ static int wlan_service_main_thread(void *data)
612 spin_unlock_irq(&adapter->driver_lock); 622 spin_unlock_irq(&adapter->driver_lock);
613 623
614 624
615 lbs_pr_debug(1, 625 lbs_deb_thread(
616 "main-thread 222 (waking up): intcounter=%d currenttxskb=%p " 626 "main-thread 222 (waking up): intcounter=%d currenttxskb=%p "
617 "dnld_sent=%d\n", adapter->intcounter, 627 "dnld_sent=%d\n", adapter->intcounter,
618 adapter->currenttxskb, priv->wlan_dev.dnld_sent); 628 adapter->currenttxskb, priv->wlan_dev.dnld_sent);
@@ -621,14 +631,14 @@ static int wlan_service_main_thread(void *data)
621 remove_wait_queue(&thread->waitq, &wait); 631 remove_wait_queue(&thread->waitq, &wait);
622 try_to_freeze(); 632 try_to_freeze();
623 633
624 lbs_pr_debug(1, "main-thread 333: intcounter=%d currenttxskb=%p " 634 lbs_deb_thread("main-thread 333: intcounter=%d currenttxskb=%p "
625 "dnld_sent=%d\n", 635 "dnld_sent=%d\n",
626 adapter->intcounter, 636 adapter->intcounter,
627 adapter->currenttxskb, priv->wlan_dev.dnld_sent); 637 adapter->currenttxskb, priv->wlan_dev.dnld_sent);
628 638
629 if (kthread_should_stop() 639 if (kthread_should_stop()
630 || adapter->surpriseremoved) { 640 || adapter->surpriseremoved) {
631 lbs_pr_debug(1, 641 lbs_deb_thread(
632 "main-thread: break from main thread: surpriseremoved=0x%x\n", 642 "main-thread: break from main thread: surpriseremoved=0x%x\n",
633 adapter->surpriseremoved); 643 adapter->surpriseremoved);
634 break; 644 break;
@@ -642,7 +652,7 @@ static int wlan_service_main_thread(void *data)
642 int_status = libertas_sbi_get_int_status(priv, &ireg); 652 int_status = libertas_sbi_get_int_status(priv, &ireg);
643 653
644 if (int_status) { 654 if (int_status) {
645 lbs_pr_debug(1, 655 lbs_deb_thread(
646 "main-thread: reading HOST_INT_STATUS_REG failed\n"); 656 "main-thread: reading HOST_INT_STATUS_REG failed\n");
647 spin_unlock_irq(&adapter->driver_lock); 657 spin_unlock_irq(&adapter->driver_lock);
648 continue; 658 continue;
@@ -650,14 +660,14 @@ static int wlan_service_main_thread(void *data)
650 adapter->hisregcpy |= ireg; 660 adapter->hisregcpy |= ireg;
651 } 661 }
652 662
653 lbs_pr_debug(1, "main-thread 444: intcounter=%d currenttxskb=%p " 663 lbs_deb_thread("main-thread 444: intcounter=%d currenttxskb=%p "
654 "dnld_sent=%d\n", 664 "dnld_sent=%d\n",
655 adapter->intcounter, 665 adapter->intcounter,
656 adapter->currenttxskb, priv->wlan_dev.dnld_sent); 666 adapter->currenttxskb, priv->wlan_dev.dnld_sent);
657 667
658 /* command response? */ 668 /* command response? */
659 if (adapter->hisregcpy & his_cmdupldrdy) { 669 if (adapter->hisregcpy & his_cmdupldrdy) {
660 lbs_pr_debug(1, "main-thread: cmd response ready.\n"); 670 lbs_deb_thread("main-thread: cmd response ready\n");
661 671
662 adapter->hisregcpy &= ~his_cmdupldrdy; 672 adapter->hisregcpy &= ~his_cmdupldrdy;
663 spin_unlock_irq(&adapter->driver_lock); 673 spin_unlock_irq(&adapter->driver_lock);
@@ -667,13 +677,13 @@ static int wlan_service_main_thread(void *data)
667 677
668 /* Any Card Event */ 678 /* Any Card Event */
669 if (adapter->hisregcpy & his_cardevent) { 679 if (adapter->hisregcpy & his_cardevent) {
670 lbs_pr_debug(1, "main-thread: Card Event Activity.\n"); 680 lbs_deb_thread("main-thread: Card Event Activity\n");
671 681
672 adapter->hisregcpy &= ~his_cardevent; 682 adapter->hisregcpy &= ~his_cardevent;
673 683
674 if (libertas_sbi_read_event_cause(priv)) { 684 if (libertas_sbi_read_event_cause(priv)) {
675 lbs_pr_alert( 685 lbs_pr_alert(
676 "main-thread: libertas_sbi_read_event_cause failed.\n"); 686 "main-thread: libertas_sbi_read_event_cause failed\n");
677 spin_unlock_irq(&adapter->driver_lock); 687 spin_unlock_irq(&adapter->driver_lock);
678 continue; 688 continue;
679 } 689 }
@@ -687,7 +697,7 @@ static int wlan_service_main_thread(void *data)
687 if (!priv->wlan_dev.dnld_sent && !adapter->cur_cmd) { 697 if (!priv->wlan_dev.dnld_sent && !adapter->cur_cmd) {
688 if (adapter->connect_status == 698 if (adapter->connect_status ==
689 libertas_connected) { 699 libertas_connected) {
690 lbs_pr_debug(1, 700 lbs_deb_thread(
691 "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p " 701 "main_thread: PRE_SLEEP--intcounter=%d currenttxskb=%p "
692 "dnld_sent=%d cur_cmd=%p, confirm now\n", 702 "dnld_sent=%d cur_cmd=%p, confirm now\n",
693 adapter->intcounter, 703 adapter->intcounter,
@@ -735,7 +745,7 @@ static int wlan_service_main_thread(void *data)
735 wake_up_all(&adapter->cmd_pending); 745 wake_up_all(&adapter->cmd_pending);
736 wlan_deactivate_thread(thread); 746 wlan_deactivate_thread(thread);
737 747
738 LEAVE(); 748 lbs_deb_leave(LBS_DEB_THREAD);
739 return 0; 749 return 0;
740} 750}
741 751
@@ -752,11 +762,11 @@ wlan_private *wlan_add_card(void *card)
752 struct net_device *mesh_dev = NULL; 762 struct net_device *mesh_dev = NULL;
753 wlan_private *priv = NULL; 763 wlan_private *priv = NULL;
754 764
755 ENTER(); 765 lbs_deb_enter(LBS_DEB_NET);
756 766
757 /* Allocate an Ethernet device and register it */ 767 /* Allocate an Ethernet device and register it */
758 if (!(dev = alloc_etherdev(sizeof(wlan_private)))) { 768 if (!(dev = alloc_etherdev(sizeof(wlan_private)))) {
759 lbs_pr_alert( "Init ethernet device failed!\n"); 769 lbs_pr_err("init ethX device failed\n");
760 return NULL; 770 return NULL;
761 } 771 }
762 772
@@ -764,13 +774,13 @@ wlan_private *wlan_add_card(void *card)
764 774
765 /* allocate buffer for wlan_adapter */ 775 /* allocate buffer for wlan_adapter */
766 if (!(priv->adapter = kmalloc(sizeof(wlan_adapter), GFP_KERNEL))) { 776 if (!(priv->adapter = kmalloc(sizeof(wlan_adapter), GFP_KERNEL))) {
767 lbs_pr_alert( "Allocate buffer for wlan_adapter failed!\n"); 777 lbs_pr_err("allocate buffer for wlan_adapter failed\n");
768 goto err_kmalloc; 778 goto err_kmalloc;
769 } 779 }
770 780
771 /* Allocate a virtual mesh device */ 781 /* Allocate a virtual mesh device */
772 if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) { 782 if (!(mesh_dev = alloc_netdev(0, "msh%d", ether_setup))) {
773 lbs_pr_debug(1, "Init ethernet device failed!\n"); 783 lbs_deb_mesh("init mshX device failed\n");
774 return NULL; 784 return NULL;
775 } 785 }
776 786
@@ -827,7 +837,7 @@ wlan_private *wlan_add_card(void *card)
827 init_waitqueue_head(&priv->adapter->cmd_pending); 837 init_waitqueue_head(&priv->adapter->cmd_pending);
828 priv->adapter->nr_cmd_pending = 0; 838 priv->adapter->nr_cmd_pending = 0;
829 839
830 lbs_pr_debug(1, "Starting kthread...\n"); 840 lbs_deb_thread("Starting kthread...\n");
831 priv->mainthread.priv = priv; 841 priv->mainthread.priv = priv;
832 wlan_create_thread(wlan_service_main_thread, 842 wlan_create_thread(wlan_service_main_thread,
833 &priv->mainthread, "wlan_main_service"); 843 &priv->mainthread, "wlan_main_service");
@@ -842,28 +852,28 @@ wlan_private *wlan_add_card(void *card)
842 * IRQ. 852 * IRQ.
843 */ 853 */
844 if (libertas_sbi_register_dev(priv) < 0) { 854 if (libertas_sbi_register_dev(priv) < 0) {
845 lbs_pr_info("failed to register wlan device!\n"); 855 lbs_pr_err("failed to register WLAN device\n");
846 goto err_registerdev; 856 goto err_registerdev;
847 } 857 }
848 858
849 /* init FW and HW */ 859 /* init FW and HW */
850 if (libertas_init_fw(priv)) { 860 if (libertas_init_fw(priv)) {
851 lbs_pr_debug(1, "Firmware Init failed\n"); 861 lbs_pr_err("firmware init failed\n");
852 goto err_registerdev; 862 goto err_registerdev;
853 } 863 }
854 864
855 if (register_netdev(dev)) { 865 if (register_netdev(dev)) {
856 lbs_pr_err("Cannot register network device!\n"); 866 lbs_pr_err("cannot register ethX device\n");
857 goto err_init_fw; 867 goto err_init_fw;
858 } 868 }
859 869
860 /* Register virtual mesh interface */ 870 /* Register virtual mesh interface */
861 if (register_netdev(mesh_dev)) { 871 if (register_netdev(mesh_dev)) {
862 lbs_pr_info("Cannot register mesh virtual interface!\n"); 872 lbs_pr_err("cannot register mshX virtual interface\n");
863 goto err_init_fw; 873 goto err_init_fw;
864 } 874 }
865 875
866 lbs_pr_info("%s: Marvell Wlan 802.11 adapter\n", dev->name); 876 lbs_pr_info("%s: Marvell WLAN 802.11 adapter\n", dev->name);
867 877
868 libertas_debugfs_init_one(priv, dev); 878 libertas_debugfs_init_one(priv, dev);
869 879
@@ -874,7 +884,7 @@ wlan_private *wlan_add_card(void *card)
874 if (device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp)) 884 if (device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp))
875 goto err_create_file; 885 goto err_create_file;
876 886
877 LEAVE(); 887 lbs_deb_leave_args(LBS_DEB_NET, "priv %p", priv);
878 return priv; 888 return priv;
879 889
880err_create_file: 890err_create_file:
@@ -891,7 +901,7 @@ err_kmalloc:
891 free_netdev(dev); 901 free_netdev(dev);
892 free_netdev(mesh_dev); 902 free_netdev(mesh_dev);
893 903
894 LEAVE(); 904 lbs_deb_leave_args(LBS_DEB_NET, "priv NULL");
895 return NULL; 905 return NULL;
896} 906}
897 907
@@ -900,6 +910,8 @@ static void wake_pending_cmdnodes(wlan_private *priv)
900 struct cmd_ctrl_node *cmdnode; 910 struct cmd_ctrl_node *cmdnode;
901 unsigned long flags; 911 unsigned long flags;
902 912
913 lbs_deb_enter(LBS_DEB_CMD);
914
903 spin_lock_irqsave(&priv->adapter->driver_lock, flags); 915 spin_lock_irqsave(&priv->adapter->driver_lock, flags);
904 list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) { 916 list_for_each_entry(cmdnode, &priv->adapter->cmdpendingq, list) {
905 cmdnode->cmdwaitqwoken = 1; 917 cmdnode->cmdwaitqwoken = 1;
@@ -918,19 +930,15 @@ int wlan_remove_card(void *card)
918 union iwreq_data wrqu; 930 union iwreq_data wrqu;
919 int i; 931 int i;
920 932
921 ENTER(); 933 lbs_deb_enter(LBS_DEB_NET);
922 934
923 if (!priv) { 935 if (!priv)
924 LEAVE(); 936 goto out;
925 return 0;
926 }
927 937
928 adapter = priv->adapter; 938 adapter = priv->adapter;
929 939
930 if (!adapter) { 940 if (!adapter)
931 LEAVE(); 941 goto out;
932 return 0;
933 }
934 942
935 dev = priv->wlan_dev.netdev; 943 dev = priv->wlan_dev.netdev;
936 mesh_dev = priv->mesh_dev; 944 mesh_dev = priv->mesh_dev;
@@ -964,7 +972,7 @@ int wlan_remove_card(void *card)
964 972
965 libertas_debugfs_remove_one(priv); 973 libertas_debugfs_remove_one(priv);
966 974
967 lbs_pr_debug(1, "Free adapter\n"); 975 lbs_deb_net("free adapter\n");
968 libertas_free_adapter(priv); 976 libertas_free_adapter(priv);
969 977
970 for (i = 0; i<libertas_found; i++) { 978 for (i = 0; i<libertas_found; i++) {
@@ -975,14 +983,15 @@ int wlan_remove_card(void *card)
975 } 983 }
976 } 984 }
977 985
978 lbs_pr_debug(1, "Unregister finish\n"); 986 lbs_deb_net("unregister finish\n");
979 987
980 priv->wlan_dev.netdev = NULL; 988 priv->wlan_dev.netdev = NULL;
981 priv->mesh_dev = NULL ; 989 priv->mesh_dev = NULL ;
982 free_netdev(mesh_dev); 990 free_netdev(mesh_dev);
983 free_netdev(dev); 991 free_netdev(dev);
984 992
985 LEAVE(); 993out:
994 lbs_deb_leave(LBS_DEB_NET);
986 return 0; 995 return 0;
987} 996}
988 997
@@ -999,33 +1008,34 @@ struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band, int *c
999{ 1008{
1000 int i, end; 1009 int i, end;
1001 1010
1002 ENTER(); 1011 lbs_deb_enter(LBS_DEB_MAIN);
1003 1012
1004 end = sizeof(region_cfp_table)/sizeof(struct region_cfp_table); 1013 end = sizeof(region_cfp_table)/sizeof(struct region_cfp_table);
1005 1014
1006 for (i = 0; i < end ; i++) { 1015 for (i = 0; i < end ; i++) {
1007 lbs_pr_debug(1, "region_cfp_table[i].region=%d\n", 1016 lbs_deb_main("region_cfp_table[i].region=%d\n",
1008 region_cfp_table[i].region); 1017 region_cfp_table[i].region);
1009 if (region_cfp_table[i].region == region) { 1018 if (region_cfp_table[i].region == region) {
1010 *cfp_no = region_cfp_table[i].cfp_no_BG; 1019 *cfp_no = region_cfp_table[i].cfp_no_BG;
1011 LEAVE(); 1020 lbs_deb_leave(LBS_DEB_MAIN);
1012 return region_cfp_table[i].cfp_BG; 1021 return region_cfp_table[i].cfp_BG;
1013 } 1022 }
1014 } 1023 }
1015 1024
1016 LEAVE(); 1025 lbs_deb_leave_args(LBS_DEB_MAIN, "ret NULL");
1017 return NULL; 1026 return NULL;
1018} 1027}
1019 1028
1020int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band) 1029int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band)
1021{ 1030{
1022 wlan_adapter *adapter = priv->adapter; 1031 wlan_adapter *adapter = priv->adapter;
1032 int ret = 0;
1023 int i = 0; 1033 int i = 0;
1024 1034
1025 struct chan_freq_power *cfp; 1035 struct chan_freq_power *cfp;
1026 int cfp_no; 1036 int cfp_no;
1027 1037
1028 ENTER(); 1038 lbs_deb_enter(LBS_DEB_MAIN);
1029 1039
1030 memset(adapter->region_channel, 0, sizeof(adapter->region_channel)); 1040 memset(adapter->region_channel, 0, sizeof(adapter->region_channel));
1031 1041
@@ -1035,17 +1045,19 @@ int libertas_set_regiontable(wlan_private * priv, u8 region, u8 band)
1035 adapter->region_channel[i].nrcfp = cfp_no; 1045 adapter->region_channel[i].nrcfp = cfp_no;
1036 adapter->region_channel[i].CFP = cfp; 1046 adapter->region_channel[i].CFP = cfp;
1037 } else { 1047 } else {
1038 lbs_pr_debug(1, "wrong region code %#x in band B-G\n", 1048 lbs_deb_main("wrong region code %#x in band B/G\n",
1039 region); 1049 region);
1040 return -1; 1050 ret = -1;
1051 goto out;
1041 } 1052 }
1042 adapter->region_channel[i].valid = 1; 1053 adapter->region_channel[i].valid = 1;
1043 adapter->region_channel[i].region = region; 1054 adapter->region_channel[i].region = region;
1044 adapter->region_channel[i].band = band; 1055 adapter->region_channel[i].band = band;
1045 i++; 1056 i++;
1046 } 1057 }
1047 LEAVE(); 1058out:
1048 return 0; 1059 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1060 return ret;
1049} 1061}
1050 1062
1051/** 1063/**
@@ -1060,9 +1072,9 @@ void libertas_interrupt(struct net_device *dev)
1060{ 1072{
1061 wlan_private *priv = dev->priv; 1073 wlan_private *priv = dev->priv;
1062 1074
1063 ENTER(); 1075 lbs_deb_enter(LBS_DEB_MAIN);
1064 1076
1065 lbs_pr_debug(1, "libertas_interrupt: intcounter=%d\n", 1077 lbs_deb_main("libertas_interrupt: intcounter=%d\n",
1066 priv->adapter->intcounter); 1078 priv->adapter->intcounter);
1067 1079
1068 priv->adapter->intcounter++; 1080 priv->adapter->intcounter++;
@@ -1074,14 +1086,14 @@ void libertas_interrupt(struct net_device *dev)
1074 1086
1075 wake_up_interruptible(&priv->mainthread.waitq); 1087 wake_up_interruptible(&priv->mainthread.waitq);
1076 1088
1077 LEAVE(); 1089 lbs_deb_leave(LBS_DEB_MAIN);
1078} 1090}
1079 1091
1080static int wlan_init_module(void) 1092static int wlan_init_module(void)
1081{ 1093{
1082 int ret = 0; 1094 int ret = 0;
1083 1095
1084 ENTER(); 1096 lbs_deb_enter(LBS_DEB_MAIN);
1085 1097
1086 if (libertas_fw_name == NULL) { 1098 if (libertas_fw_name == NULL) {
1087 libertas_fw_name = default_fw_name; 1099 libertas_fw_name = default_fw_name;
@@ -1092,11 +1104,9 @@ static int wlan_init_module(void)
1092 if (libertas_sbi_register()) { 1104 if (libertas_sbi_register()) {
1093 ret = -1; 1105 ret = -1;
1094 libertas_debugfs_remove(); 1106 libertas_debugfs_remove();
1095 goto done;
1096 } 1107 }
1097 1108
1098done: 1109 lbs_deb_leave_args(LBS_DEB_MAIN, "ret %d", ret);
1099 LEAVE();
1100 return ret; 1110 return ret;
1101} 1111}
1102 1112
@@ -1104,7 +1114,7 @@ static void wlan_cleanup_module(void)
1104{ 1114{
1105 int i; 1115 int i;
1106 1116
1107 ENTER(); 1117 lbs_deb_enter(LBS_DEB_MAIN);
1108 1118
1109 for (i = 0; i<libertas_found; i++) { 1119 for (i = 0; i<libertas_found; i++) {
1110 wlan_private *priv = libertas_devs[i]->priv; 1120 wlan_private *priv = libertas_devs[i]->priv;
@@ -1114,7 +1124,7 @@ static void wlan_cleanup_module(void)
1114 libertas_sbi_unregister(); 1124 libertas_sbi_unregister();
1115 libertas_debugfs_remove(); 1125 libertas_debugfs_remove();
1116 1126
1117 LEAVE(); 1127 lbs_deb_leave(LBS_DEB_MAIN);
1118} 1128}
1119 1129
1120module_init(wlan_init_module); 1130module_init(wlan_init_module);
diff --git a/drivers/net/wireless/libertas/rx.c b/drivers/net/wireless/libertas/rx.c
index 96619a32951b..371cbf17ad48 100644
--- a/drivers/net/wireless/libertas/rx.c
+++ b/drivers/net/wireless/libertas/rx.c
@@ -106,10 +106,10 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
106{ 106{
107 wlan_adapter *adapter = priv->adapter; 107 wlan_adapter *adapter = priv->adapter;
108 108
109 ENTER(); 109 lbs_deb_enter(LBS_DEB_RX);
110 110
111 lbs_pr_debug(1, "rxpd: SNR = %d, NF = %d\n", p_rx_pd->snr, p_rx_pd->nf); 111 lbs_deb_rx("rxpd: SNR %d, NF %d\n", p_rx_pd->snr, p_rx_pd->nf);
112 lbs_pr_debug(1, "Before computing SNR: SNR- avg = %d, NF-avg = %d\n", 112 lbs_deb_rx("before computing SNR: SNR-avg = %d, NF-avg = %d\n",
113 adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, 113 adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
114 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); 114 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
115 115
@@ -121,7 +121,7 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
121 121
122 adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE; 122 adapter->SNR[TYPE_RXPD][TYPE_AVG] = wlan_getavgsnr(priv) * AVG_SCALE;
123 adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE; 123 adapter->NF[TYPE_RXPD][TYPE_AVG] = wlan_getavgnf(priv) * AVG_SCALE;
124 lbs_pr_debug(1, "After computing SNR: SNR-avg = %d, NF-avg = %d\n", 124 lbs_deb_rx("after computing SNR: SNR-avg = %d, NF-avg = %d\n",
125 adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, 125 adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
126 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); 126 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
127 127
@@ -133,12 +133,12 @@ static void wlan_compute_rssi(wlan_private * priv, struct rxpd *p_rx_pd)
133 CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE, 133 CAL_RSSI(adapter->SNR[TYPE_RXPD][TYPE_AVG] / AVG_SCALE,
134 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE); 134 adapter->NF[TYPE_RXPD][TYPE_AVG] / AVG_SCALE);
135 135
136 LEAVE(); 136 lbs_deb_leave(LBS_DEB_RX);
137} 137}
138 138
139void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb) 139void libertas_upload_rx_packet(wlan_private * priv, struct sk_buff *skb)
140{ 140{
141 lbs_pr_debug(1, "skb->data=%p\n", skb->data); 141 lbs_deb_rx("skb->data %p\n", skb->data);
142 142
143 if(IS_MESH_FRAME(skb)) 143 if(IS_MESH_FRAME(skb))
144 skb->dev = priv->mesh_dev; 144 skb->dev = priv->mesh_dev;
@@ -171,7 +171,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
171 171
172 const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; 172 const u8 rfc1042_eth_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
173 173
174 ENTER(); 174 lbs_deb_enter(LBS_DEB_RX);
175 175
176 if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH) 176 if (priv->adapter->debugmode & MRVDRV_DEBUG_RX_PATH)
177 lbs_dbg_hex("RX packet: ", skb->data, 177 lbs_dbg_hex("RX packet: ", skb->data,
@@ -191,7 +191,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
191 min_t(unsigned int, skb->len, 100)); 191 min_t(unsigned int, skb->len, 100));
192 192
193 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { 193 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
194 lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n"); 194 lbs_deb_rx("rx err: frame received with bad length\n");
195 priv->stats.rx_length_errors++; 195 priv->stats.rx_length_errors++;
196 ret = 0; 196 ret = 0;
197 goto done; 197 goto done;
@@ -201,14 +201,14 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
201 * Check rxpd status and update 802.3 stat, 201 * Check rxpd status and update 802.3 stat,
202 */ 202 */
203 if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) { 203 if (!(p_rx_pd->status & MRVDRV_RXPD_STATUS_OK)) {
204 lbs_pr_debug(1, "RX error: frame received with bad status\n"); 204 lbs_deb_rx("rx err: frame received with bad status\n");
205 lbs_pr_alert("rxpd Not OK\n"); 205 lbs_pr_alert("rxpd not ok\n");
206 priv->stats.rx_errors++; 206 priv->stats.rx_errors++;
207 ret = 0; 207 ret = 0;
208 goto done; 208 goto done;
209 } 209 }
210 210
211 lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n", 211 lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
212 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); 212 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
213 213
214 lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr, 214 lbs_dbg_hex("RX Data: Dest", p_rx_pkt->eth803_hdr.dest_addr,
@@ -266,7 +266,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
266 266
267 wlan_compute_rssi(priv, p_rx_pd); 267 wlan_compute_rssi(priv, p_rx_pd);
268 268
269 lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); 269 lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
270 priv->stats.rx_bytes += skb->len; 270 priv->stats.rx_bytes += skb->len;
271 priv->stats.rx_packets++; 271 priv->stats.rx_packets++;
272 272
@@ -274,8 +274,7 @@ int libertas_process_rxed_packet(wlan_private * priv, struct sk_buff *skb)
274 274
275 ret = 0; 275 ret = 0;
276done: 276done:
277 LEAVE(); 277 lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
278
279 return ret; 278 return ret;
280} 279}
281 280
@@ -314,7 +313,7 @@ static u8 convert_mv_rate_to_radiotap(u8 rate)
314 case 11: /* 54 Mbps */ 313 case 11: /* 54 Mbps */
315 return 108; 314 return 108;
316 } 315 }
317 lbs_pr_alert( "Invalid Marvell WLAN rate (%i)\n", rate); 316 lbs_pr_alert("Invalid Marvell WLAN rate %i\n", rate);
318 return 0; 317 return 0;
319} 318}
320 319
@@ -336,7 +335,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
336 struct rx_radiotap_hdr radiotap_hdr; 335 struct rx_radiotap_hdr radiotap_hdr;
337 struct rx_radiotap_hdr *pradiotap_hdr; 336 struct rx_radiotap_hdr *pradiotap_hdr;
338 337
339 ENTER(); 338 lbs_deb_enter(LBS_DEB_RX);
340 339
341 p_rx_pkt = (struct rx80211packethdr *) skb->data; 340 p_rx_pkt = (struct rx80211packethdr *) skb->data;
342 prxpd = &p_rx_pkt->rx_pd; 341 prxpd = &p_rx_pkt->rx_pd;
@@ -344,7 +343,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
344 // lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100)); 343 // lbs_dbg_hex("RX Data: Before chop rxpd", skb->data, min(skb->len, 100));
345 344
346 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) { 345 if (skb->len < (ETH_HLEN + 8 + sizeof(struct rxpd))) {
347 lbs_pr_debug(1, "RX error: FRAME RECEIVED WITH BAD LENGTH\n"); 346 lbs_deb_rx("rx err: frame received wit bad length\n");
348 priv->stats.rx_length_errors++; 347 priv->stats.rx_length_errors++;
349 ret = 0; 348 ret = 0;
350 goto done; 349 goto done;
@@ -354,11 +353,11 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
354 * Check rxpd status and update 802.3 stat, 353 * Check rxpd status and update 802.3 stat,
355 */ 354 */
356 if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) { 355 if (!(prxpd->status & MRVDRV_RXPD_STATUS_OK)) {
357 //lbs_pr_debug(1, "RX error: frame received with bad status\n"); 356 //lbs_deb_rx("rx err: frame received with bad status\n");
358 priv->stats.rx_errors++; 357 priv->stats.rx_errors++;
359 } 358 }
360 359
361 lbs_pr_debug(1, "RX Data: skb->len - sizeof(RxPd) = %d - %zd = %zd\n", 360 lbs_deb_rx("rx data: skb->len-sizeof(RxPd) = %d-%zd = %zd\n",
362 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd)); 361 skb->len, sizeof(struct rxpd), skb->len - sizeof(struct rxpd));
363 362
364 /* create the exported radio header */ 363 /* create the exported radio header */
@@ -399,7 +398,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
399 if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) && 398 if ((skb_headroom(skb) < sizeof(struct rx_radiotap_hdr)) &&
400 pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0, 399 pskb_expand_head(skb, sizeof(struct rx_radiotap_hdr), 0,
401 GFP_ATOMIC)) { 400 GFP_ATOMIC)) {
402 lbs_pr_alert( "%s: couldn't pskb_expand_head\n", 401 lbs_pr_alert("%s: couldn't pskb_expand_head\n",
403 __func__); 402 __func__);
404 } 403 }
405 404
@@ -414,7 +413,7 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
414 413
415 default: 414 default:
416 /* unknown header */ 415 /* unknown header */
417 lbs_pr_alert( "Unknown radiomode (%i)\n", 416 lbs_pr_alert("Unknown radiomode %i\n",
418 priv->adapter->radiomode); 417 priv->adapter->radiomode);
419 /* don't export any header */ 418 /* don't export any header */
420 /* chop the rxpd */ 419 /* chop the rxpd */
@@ -431,15 +430,16 @@ static int process_rxed_802_11_packet(wlan_private * priv, struct sk_buff *skb)
431 430
432 wlan_compute_rssi(priv, prxpd); 431 wlan_compute_rssi(priv, prxpd);
433 432
434 lbs_pr_debug(1, "RX Data: size of actual packet = %d\n", skb->len); 433 lbs_deb_rx("rx data: size of actual packet %d\n", skb->len);
435 priv->stats.rx_bytes += skb->len; 434 priv->stats.rx_bytes += skb->len;
436 priv->stats.rx_packets++; 435 priv->stats.rx_packets++;
437 436
438 libertas_upload_rx_packet(priv, skb); 437 libertas_upload_rx_packet(priv, skb);
439 438
440 ret = 0; 439 ret = 0;
441done:
442 LEAVE();
443 440
444 return (ret); 441done:
442 skb->protocol = __constant_htons(0x0019); /* ETH_P_80211_RAW */
443 lbs_deb_leave_args(LBS_DEB_RX, "ret %d", ret);
444 return ret;
445} 445}
diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
index 966a89367061..4e3a7b60a867 100644
--- a/drivers/net/wireless/libertas/scan.c
+++ b/drivers/net/wireless/libertas/scan.c
@@ -86,7 +86,7 @@
86 */ 86 */
87static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode) 87static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
88{ 88{
89 ENTER(); 89 lbs_deb_enter(LBS_DEB_ASSOC);
90 90
91 if (adapter->scantable[index].mode == mode) { 91 if (adapter->scantable[index].mode == mode) {
92 if ( !adapter->secinfo.wep_enabled 92 if ( !adapter->secinfo.wep_enabled
@@ -96,15 +96,13 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
96 && adapter->scantable[index].rsn_ie[0] != WPA2_IE 96 && adapter->scantable[index].rsn_ie[0] != WPA2_IE
97 && !adapter->scantable[index].privacy) { 97 && !adapter->scantable[index].privacy) {
98 /* no security */ 98 /* no security */
99 LEAVE(); 99 goto done;
100 return index;
101 } else if ( adapter->secinfo.wep_enabled 100 } else if ( adapter->secinfo.wep_enabled
102 && !adapter->secinfo.WPAenabled 101 && !adapter->secinfo.WPAenabled
103 && !adapter->secinfo.WPA2enabled 102 && !adapter->secinfo.WPA2enabled
104 && adapter->scantable[index].privacy) { 103 && adapter->scantable[index].privacy) {
105 /* static WEP enabled */ 104 /* static WEP enabled */
106 LEAVE(); 105 goto done;
107 return index;
108 } else if ( !adapter->secinfo.wep_enabled 106 } else if ( !adapter->secinfo.wep_enabled
109 && adapter->secinfo.WPAenabled 107 && adapter->secinfo.WPAenabled
110 && !adapter->secinfo.WPA2enabled 108 && !adapter->secinfo.WPA2enabled
@@ -113,7 +111,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
113 && adapter->scantable[index].privacy */ 111 && adapter->scantable[index].privacy */
114 ) { 112 ) {
115 /* WPA enabled */ 113 /* WPA enabled */
116 lbs_pr_debug(1, 114 lbs_deb_scan(
117 "is_network_compatible() WPA: index=%d wpa_ie=%#x " 115 "is_network_compatible() WPA: index=%d wpa_ie=%#x "
118 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " 116 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
119 "privacy=%#x\n", index, 117 "privacy=%#x\n", index,
@@ -123,8 +121,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
123 adapter->secinfo.WPAenabled ? "e" : "d", 121 adapter->secinfo.WPAenabled ? "e" : "d",
124 adapter->secinfo.WPA2enabled ? "e" : "d", 122 adapter->secinfo.WPA2enabled ? "e" : "d",
125 adapter->scantable[index].privacy); 123 adapter->scantable[index].privacy);
126 LEAVE(); 124 goto done;
127 return index;
128 } else if ( !adapter->secinfo.wep_enabled 125 } else if ( !adapter->secinfo.wep_enabled
129 && !adapter->secinfo.WPAenabled 126 && !adapter->secinfo.WPAenabled
130 && adapter->secinfo.WPA2enabled 127 && adapter->secinfo.WPA2enabled
@@ -133,7 +130,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
133 && adapter->scantable[index].privacy */ 130 && adapter->scantable[index].privacy */
134 ) { 131 ) {
135 /* WPA2 enabled */ 132 /* WPA2 enabled */
136 lbs_pr_debug(1, 133 lbs_deb_scan(
137 "is_network_compatible() WPA2: index=%d wpa_ie=%#x " 134 "is_network_compatible() WPA2: index=%d wpa_ie=%#x "
138 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s " 135 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s "
139 "privacy=%#x\n", index, 136 "privacy=%#x\n", index,
@@ -143,8 +140,7 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
143 adapter->secinfo.WPAenabled ? "e" : "d", 140 adapter->secinfo.WPAenabled ? "e" : "d",
144 adapter->secinfo.WPA2enabled ? "e" : "d", 141 adapter->secinfo.WPA2enabled ? "e" : "d",
145 adapter->scantable[index].privacy); 142 adapter->scantable[index].privacy);
146 LEAVE(); 143 goto done;
147 return index;
148 } else if ( !adapter->secinfo.wep_enabled 144 } else if ( !adapter->secinfo.wep_enabled
149 && !adapter->secinfo.WPAenabled 145 && !adapter->secinfo.WPAenabled
150 && !adapter->secinfo.WPA2enabled 146 && !adapter->secinfo.WPA2enabled
@@ -152,19 +148,18 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
152 && (adapter->scantable[index].rsn_ie[0] != WPA2_IE) 148 && (adapter->scantable[index].rsn_ie[0] != WPA2_IE)
153 && adapter->scantable[index].privacy) { 149 && adapter->scantable[index].privacy) {
154 /* dynamic WEP enabled */ 150 /* dynamic WEP enabled */
155 lbs_pr_debug(1, 151 lbs_deb_scan(
156 "is_network_compatible() dynamic WEP: index=%d " 152 "is_network_compatible() dynamic WEP: index=%d "
157 "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n", 153 "wpa_ie=%#x wpa2_ie=%#x privacy=%#x\n",
158 index, 154 index,
159 adapter->scantable[index].wpa_ie[0], 155 adapter->scantable[index].wpa_ie[0],
160 adapter->scantable[index].rsn_ie[0], 156 adapter->scantable[index].rsn_ie[0],
161 adapter->scantable[index].privacy); 157 adapter->scantable[index].privacy);
162 LEAVE(); 158 goto done;
163 return index;
164 } 159 }
165 160
166 /* security doesn't match */ 161 /* security doesn't match */
167 lbs_pr_debug(1, 162 lbs_deb_scan(
168 "is_network_compatible() FAILED: index=%d wpa_ie=%#x " 163 "is_network_compatible() FAILED: index=%d wpa_ie=%#x "
169 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n", 164 "wpa2_ie=%#x WEP=%s WPA=%s WPA2=%s privacy=%#x\n",
170 index, 165 index,
@@ -174,13 +169,16 @@ static int is_network_compatible(wlan_adapter * adapter, int index, u8 mode)
174 adapter->secinfo.WPAenabled ? "e" : "d", 169 adapter->secinfo.WPAenabled ? "e" : "d",
175 adapter->secinfo.WPA2enabled ? "e" : "d", 170 adapter->secinfo.WPA2enabled ? "e" : "d",
176 adapter->scantable[index].privacy); 171 adapter->scantable[index].privacy);
177 LEAVE(); 172 index = -ECONNREFUSED;
178 return -ECONNREFUSED; 173 goto done;
179 } 174 }
180 175
181 /* mode doesn't match */ 176 /* mode doesn't match */
182 LEAVE(); 177 index = -ENETUNREACH;
183 return -ENETUNREACH; 178
179done:
180 lbs_deb_leave_args(LBS_DEB_SCAN, "index %d", index);
181 return index;
184} 182}
185 183
186/** 184/**
@@ -246,7 +244,7 @@ static void wlan_scan_process_results(wlan_private * priv)
246 } 244 }
247 245
248 for (i = 0; i < adapter->numinscantable; i++) { 246 for (i = 0; i < adapter->numinscantable; i++) {
249 lbs_pr_debug(1, "Scan:(%02d) %02x:%02x:%02x:%02x:%02x:%02x, " 247 lbs_deb_scan("Scan:(%02d) %02x:%02x:%02x:%02x:%02x:%02x, "
250 "RSSI[%03d], SSID[%s]\n", 248 "RSSI[%03d], SSID[%s]\n",
251 i, 249 i,
252 adapter->scantable[i].macaddress[0], 250 adapter->scantable[i].macaddress[0],
@@ -529,7 +527,7 @@ wlan_scan_setup_scan_config(wlan_private * priv,
529 527
530 if (puserscanin && puserscanin->chanlist[0].channumber) { 528 if (puserscanin && puserscanin->chanlist[0].channumber) {
531 529
532 lbs_pr_debug(1, "Scan: Using supplied channel list\n"); 530 lbs_deb_scan("Scan: Using supplied channel list\n");
533 531
534 for (chanidx = 0; 532 for (chanidx = 0;
535 chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX 533 chanidx < WLAN_IOCTL_USER_SCAN_CHAN_MAX
@@ -573,11 +571,11 @@ wlan_scan_setup_scan_config(wlan_private * priv,
573 == 571 ==
574 priv->adapter->curbssparams.channel)) { 572 priv->adapter->curbssparams.channel)) {
575 *pscancurrentonly = 1; 573 *pscancurrentonly = 1;
576 lbs_pr_debug(1, "Scan: Scanning current channel only"); 574 lbs_deb_scan("Scan: Scanning current channel only");
577 } 575 }
578 576
579 } else { 577 } else {
580 lbs_pr_debug(1, "Scan: Creating full region channel list\n"); 578 lbs_deb_scan("Scan: Creating full region channel list\n");
581 wlan_scan_create_channel_list(priv, pscanchanlist, 579 wlan_scan_create_channel_list(priv, pscanchanlist,
582 *pfilteredscan); 580 *pfilteredscan);
583 } 581 }
@@ -626,10 +624,10 @@ static int wlan_scan_channel_list(wlan_private * priv,
626 int scanned = 0; 624 int scanned = 0;
627 union iwreq_data wrqu; 625 union iwreq_data wrqu;
628 626
629 ENTER(); 627 lbs_deb_enter(LBS_DEB_ASSOC);
630 628
631 if (pscancfgout == 0 || pchantlvout == 0 || pscanchanlist == 0) { 629 if (pscancfgout == 0 || pchantlvout == 0 || pscanchanlist == 0) {
632 lbs_pr_debug(1, "Scan: Null detect: %p, %p, %p\n", 630 lbs_deb_scan("Scan: Null detect: %p, %p, %p\n",
633 pscancfgout, pchantlvout, pscanchanlist); 631 pscancfgout, pchantlvout, pscanchanlist);
634 return -1; 632 return -1;
635 } 633 }
@@ -663,7 +661,7 @@ static int wlan_scan_channel_list(wlan_private * priv,
663 while (tlvidx < maxchanperscan && ptmpchan->channumber 661 while (tlvidx < maxchanperscan && ptmpchan->channumber
664 && !doneearly && scanned < 2) { 662 && !doneearly && scanned < 2) {
665 663
666 lbs_pr_debug(1, 664 lbs_deb_scan(
667 "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n", 665 "Scan: Chan(%3d), Radio(%d), mode(%d,%d), Dur(%d)\n",
668 ptmpchan->channumber, ptmpchan->radiotype, 666 ptmpchan->channumber, ptmpchan->radiotype,
669 ptmpchan->chanscanmode.passivescan, 667 ptmpchan->chanscanmode.passivescan,
@@ -726,7 +724,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
726 0, 0, pscancfgout); 724 0, 0, pscancfgout);
727 if (scanned >= 2 && !full_scan) { 725 if (scanned >= 2 && !full_scan) {
728 priv->adapter->last_scanned_channel = ptmpchan->channumber; 726 priv->adapter->last_scanned_channel = ptmpchan->channumber;
729 return 0; 727 ret = 0;
728 goto done;
730 } 729 }
731 scanned = 0; 730 scanned = 0;
732 } 731 }
@@ -736,7 +735,8 @@ static int wlan_scan_channel_list(wlan_private * priv,
736 memset(&wrqu, 0, sizeof(union iwreq_data)); 735 memset(&wrqu, 0, sizeof(union iwreq_data));
737 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL); 736 wireless_send_event(priv->wlan_dev.netdev, SIOCGIWSCAN, &wrqu, NULL);
738 737
739 LEAVE(); 738done:
739 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
740 return ret; 740 return ret;
741} 741}
742 742
@@ -767,7 +767,7 @@ int wlan_scan_networks(wlan_private * priv,
767 int maxchanperscan; 767 int maxchanperscan;
768 int ret; 768 int ret;
769 769
770 ENTER(); 770 lbs_deb_enter(LBS_DEB_ASSOC);
771 771
772 scan_chan_list = kzalloc(sizeof(struct chanscanparamset) * 772 scan_chan_list = kzalloc(sizeof(struct chanscanparamset) *
773 WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL); 773 WLAN_IOCTL_USER_SCAN_CHAN_MAX, GFP_KERNEL);
@@ -836,7 +836,7 @@ out:
836 if (scan_chan_list) 836 if (scan_chan_list)
837 kfree(scan_chan_list); 837 kfree(scan_chan_list);
838 838
839 LEAVE(); 839 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
840 return ret; 840 return ret;
841} 841}
842 842
@@ -867,7 +867,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
867 tlvbufleft = tlvbufsize; 867 tlvbufleft = tlvbufsize;
868 *ptsftlv = NULL; 868 *ptsftlv = NULL;
869 869
870 lbs_pr_debug(1, "SCAN_RESP: tlvbufsize = %d\n", tlvbufsize); 870 lbs_deb_scan("SCAN_RESP: tlvbufsize = %d\n", tlvbufsize);
871 lbs_dbg_hex("SCAN_RESP: TLV Buf", (u8 *) ptlv, tlvbufsize); 871 lbs_dbg_hex("SCAN_RESP: TLV Buf", (u8 *) ptlv, tlvbufsize);
872 872
873 while (tlvbufleft >= sizeof(struct mrvlietypesheader)) { 873 while (tlvbufleft >= sizeof(struct mrvlietypesheader)) {
@@ -880,7 +880,7 @@ void wlan_ret_802_11_scan_get_tlv_ptrs(struct mrvlietypes_data * ptlv,
880 break; 880 break;
881 881
882 default: 882 default:
883 lbs_pr_debug(1, "SCAN_RESP: Unhandled TLV = %d\n", 883 lbs_deb_scan("SCAN_RESP: Unhandled TLV = %d\n",
884 tlvtype); 884 tlvtype);
885 /* Give up, this seems corrupted */ 885 /* Give up, this seems corrupted */
886 return; 886 return;
@@ -921,13 +921,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
921 u16 beaconsize; 921 u16 beaconsize;
922 u8 founddatarateie; 922 u8 founddatarateie;
923 int bytesleftforcurrentbeacon; 923 int bytesleftforcurrentbeacon;
924 int ret;
924 925
925 struct IE_WPA *pIe; 926 struct IE_WPA *pIe;
926 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 }; 927 const u8 oui01[4] = { 0x00, 0x50, 0xf2, 0x01 };
927 928
928 struct ieeetypes_countryinfoset *pcountryinfo; 929 struct ieeetypes_countryinfoset *pcountryinfo;
929 930
930 ENTER(); 931 lbs_deb_enter(LBS_DEB_ASSOC);
931 932
932 founddatarateie = 0; 933 founddatarateie = 0;
933 ratesize = 0; 934 ratesize = 0;
@@ -959,7 +960,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
959 bytesleftforcurrentbeacon = beaconsize; 960 bytesleftforcurrentbeacon = beaconsize;
960 961
961 memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN); 962 memcpy(pBSSEntry->macaddress, pcurrentptr, ETH_ALEN);
962 lbs_pr_debug(1, "InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n", 963 lbs_deb_scan("InterpretIE: AP MAC Addr-%x:%x:%x:%x:%x:%x\n",
963 pBSSEntry->macaddress[0], pBSSEntry->macaddress[1], 964 pBSSEntry->macaddress[0], pBSSEntry->macaddress[1],
964 pBSSEntry->macaddress[2], pBSSEntry->macaddress[3], 965 pBSSEntry->macaddress[2], pBSSEntry->macaddress[3],
965 pBSSEntry->macaddress[4], pBSSEntry->macaddress[5]); 966 pBSSEntry->macaddress[4], pBSSEntry->macaddress[5]);
@@ -968,7 +969,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
968 bytesleftforcurrentbeacon -= ETH_ALEN; 969 bytesleftforcurrentbeacon -= ETH_ALEN;
969 970
970 if (bytesleftforcurrentbeacon < 12) { 971 if (bytesleftforcurrentbeacon < 12) {
971 lbs_pr_debug(1, "InterpretIE: Not enough bytes left\n"); 972 lbs_deb_scan("InterpretIE: Not enough bytes left\n");
972 return -1; 973 return -1;
973 } 974 }
974 975
@@ -979,7 +980,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
979 980
980 /* RSSI is 1 byte long */ 981 /* RSSI is 1 byte long */
981 pBSSEntry->rssi = le32_to_cpu((long)(*pcurrentptr)); 982 pBSSEntry->rssi = le32_to_cpu((long)(*pcurrentptr));
982 lbs_pr_debug(1, "InterpretIE: RSSI=%02X\n", *pcurrentptr); 983 lbs_deb_scan("InterpretIE: RSSI=%02X\n", *pcurrentptr);
983 pcurrentptr += 1; 984 pcurrentptr += 1;
984 bytesleftforcurrentbeacon -= 1; 985 bytesleftforcurrentbeacon -= 1;
985 986
@@ -997,7 +998,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
997 998
998 /* capability information is 2 bytes long */ 999 /* capability information is 2 bytes long */
999 memcpy(&fixedie.capabilities, pcurrentptr, 2); 1000 memcpy(&fixedie.capabilities, pcurrentptr, 2);
1000 lbs_pr_debug(1, "InterpretIE: fixedie.capabilities=0x%X\n", 1001 lbs_deb_scan("InterpretIE: fixedie.capabilities=0x%X\n",
1001 fixedie.capabilities); 1002 fixedie.capabilities);
1002 fixedie.capabilities = le16_to_cpu(fixedie.capabilities); 1003 fixedie.capabilities = le16_to_cpu(fixedie.capabilities);
1003 pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities; 1004 pcap = (struct ieeetypes_capinfo *) & fixedie.capabilities;
@@ -1006,14 +1007,14 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1006 bytesleftforcurrentbeacon -= 2; 1007 bytesleftforcurrentbeacon -= 2;
1007 1008
1008 /* rest of the current buffer are IE's */ 1009 /* rest of the current buffer are IE's */
1009 lbs_pr_debug(1, "InterpretIE: IElength for this AP = %d\n", 1010 lbs_deb_scan("InterpretIE: IElength for this AP = %d\n",
1010 bytesleftforcurrentbeacon); 1011 bytesleftforcurrentbeacon);
1011 1012
1012 lbs_dbg_hex("InterpretIE: IE info", (u8 *) pcurrentptr, 1013 lbs_dbg_hex("InterpretIE: IE info", (u8 *) pcurrentptr,
1013 bytesleftforcurrentbeacon); 1014 bytesleftforcurrentbeacon);
1014 1015
1015 if (pcap->privacy) { 1016 if (pcap->privacy) {
1016 lbs_pr_debug(1, "InterpretIE: AP WEP enabled\n"); 1017 lbs_deb_scan("InterpretIE: AP WEP enabled\n");
1017 pBSSEntry->privacy = wlan802_11privfilter8021xWEP; 1018 pBSSEntry->privacy = wlan802_11privfilter8021xWEP;
1018 } else { 1019 } else {
1019 pBSSEntry->privacy = wlan802_11privfilteracceptall; 1020 pBSSEntry->privacy = wlan802_11privfilteracceptall;
@@ -1031,7 +1032,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1031 elemlen = *((u8 *) pcurrentptr + 1); 1032 elemlen = *((u8 *) pcurrentptr + 1);
1032 1033
1033 if (bytesleftforcurrentbeacon < elemlen) { 1034 if (bytesleftforcurrentbeacon < elemlen) {
1034 lbs_pr_debug(1, "InterpretIE: error in processing IE, " 1035 lbs_deb_scan("InterpretIE: error in processing IE, "
1035 "bytes left < IE length\n"); 1036 "bytes left < IE length\n");
1036 bytesleftforcurrentbeacon = 0; 1037 bytesleftforcurrentbeacon = 0;
1037 continue; 1038 continue;
@@ -1043,7 +1044,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1043 pBSSEntry->ssid.ssidlength = elemlen; 1044 pBSSEntry->ssid.ssidlength = elemlen;
1044 memcpy(pBSSEntry->ssid.ssid, (pcurrentptr + 2), 1045 memcpy(pBSSEntry->ssid.ssid, (pcurrentptr + 2),
1045 elemlen); 1046 elemlen);
1046 lbs_pr_debug(1, "ssid: %32s", pBSSEntry->ssid.ssid); 1047 lbs_deb_scan("ssid: %32s", pBSSEntry->ssid.ssid);
1047 break; 1048 break;
1048 1049
1049 case SUPPORTED_RATES: 1050 case SUPPORTED_RATES:
@@ -1056,7 +1057,7 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1056 break; 1057 break;
1057 1058
1058 case EXTRA_IE: 1059 case EXTRA_IE:
1059 lbs_pr_debug(1, "InterpretIE: EXTRA_IE Found!\n"); 1060 lbs_deb_scan("InterpretIE: EXTRA_IE Found!\n");
1060 pBSSEntry->extra_ie = 1; 1061 pBSSEntry->extra_ie = 1;
1061 break; 1062 break;
1062 1063
@@ -1108,12 +1109,12 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1108 if (pcountryinfo->len < 1109 if (pcountryinfo->len <
1109 sizeof(pcountryinfo->countrycode) 1110 sizeof(pcountryinfo->countrycode)
1110 || pcountryinfo->len > 254) { 1111 || pcountryinfo->len > 254) {
1111 lbs_pr_debug(1, "InterpretIE: 11D- Err " 1112 lbs_deb_scan("InterpretIE: 11D- Err "
1112 "CountryInfo len =%d min=%zd max=254\n", 1113 "CountryInfo len =%d min=%zd max=254\n",
1113 pcountryinfo->len, 1114 pcountryinfo->len,
1114 sizeof(pcountryinfo->countrycode)); 1115 sizeof(pcountryinfo->countrycode));
1115 LEAVE(); 1116 ret = -1;
1116 return -1; 1117 goto done;
1117 } 1118 }
1118 1119
1119 memcpy(&pBSSEntry->countryinfo, 1120 memcpy(&pBSSEntry->countryinfo,
@@ -1188,8 +1189,11 @@ static int InterpretBSSDescriptionWithIE(struct bss_descriptor * pBSSEntry,
1188 bytesleftforcurrentbeacon -= (elemlen + 2); 1189 bytesleftforcurrentbeacon -= (elemlen + 2);
1189 1190
1190 } /* while (bytesleftforcurrentbeacon > 2) */ 1191 } /* while (bytesleftforcurrentbeacon > 2) */
1192 ret = 0;
1191 1193
1192 return 0; 1194done:
1195 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
1196 return ret;
1193} 1197}
1194 1198
1195/** 1199/**
@@ -1228,7 +1232,7 @@ int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode)
1228 if (!bssid) 1232 if (!bssid)
1229 return -EFAULT; 1233 return -EFAULT;
1230 1234
1231 lbs_pr_debug(1, "FindBSSID: Num of BSSIDs = %d\n", 1235 lbs_deb_scan("FindBSSID: Num of BSSIDs = %d\n",
1232 adapter->numinscantable); 1236 adapter->numinscantable);
1233 1237
1234 /* Look through the scan table for a compatible match. The ret return 1238 /* Look through the scan table for a compatible match. The ret return
@@ -1272,7 +1276,7 @@ int libertas_find_SSID_in_list(wlan_adapter * adapter,
1272 int i; 1276 int i;
1273 int j; 1277 int j;
1274 1278
1275 lbs_pr_debug(1, "Num of Entries in Table = %d\n", adapter->numinscantable); 1279 lbs_deb_scan("Num of Entries in Table = %d\n", adapter->numinscantable);
1276 1280
1277 for (i = 0; i < adapter->numinscantable; i++) { 1281 for (i = 0; i < adapter->numinscantable; i++) {
1278 if (!libertas_SSID_cmp(&adapter->scantable[i].ssid, ssid) && 1282 if (!libertas_SSID_cmp(&adapter->scantable[i].ssid, ssid) &&
@@ -1337,9 +1341,9 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
1337 u8 bestrssi = 0; 1341 u8 bestrssi = 0;
1338 int i; 1342 int i;
1339 1343
1340 ENTER(); 1344 lbs_deb_enter(LBS_DEB_ASSOC);
1341 1345
1342 lbs_pr_debug(1, "Num of BSSIDs = %d\n", adapter->numinscantable); 1346 lbs_deb_scan("Num of BSSIDs = %d\n", adapter->numinscantable);
1343 1347
1344 for (i = 0; i < adapter->numinscantable; i++) { 1348 for (i = 0; i < adapter->numinscantable; i++) {
1345 switch (mode) { 1349 switch (mode) {
@@ -1366,7 +1370,7 @@ int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode)
1366 } 1370 }
1367 } 1371 }
1368 1372
1369 LEAVE(); 1373 lbs_deb_leave_args(LBS_DEB_SCAN, "bestnet %d", bestnet);
1370 return bestnet; 1374 return bestnet;
1371} 1375}
1372 1376
@@ -1387,7 +1391,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
1387 struct bss_descriptor *preqbssid; 1391 struct bss_descriptor *preqbssid;
1388 int i; 1392 int i;
1389 1393
1390 ENTER(); 1394 lbs_deb_enter(LBS_DEB_ASSOC);
1391 1395
1392 memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID)); 1396 memset(pSSID, 0, sizeof(struct WLAN_802_11_SSID));
1393 1397
@@ -1412,7 +1416,7 @@ int libertas_find_best_network_SSID(wlan_private * priv,
1412 } 1416 }
1413 1417
1414out: 1418out:
1415 LEAVE(); 1419 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
1416 return ret; 1420 return ret;
1417} 1421}
1418 1422
@@ -1432,14 +1436,14 @@ int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
1432 wlan_private *priv = dev->priv; 1436 wlan_private *priv = dev->priv;
1433 wlan_adapter *adapter = priv->adapter; 1437 wlan_adapter *adapter = priv->adapter;
1434 1438
1435 ENTER(); 1439 lbs_deb_enter(LBS_DEB_SCAN);
1436 1440
1437 wlan_scan_networks(priv, NULL, 0); 1441 wlan_scan_networks(priv, NULL, 0);
1438 1442
1439 if (adapter->surpriseremoved) 1443 if (adapter->surpriseremoved)
1440 return -1; 1444 return -1;
1441 1445
1442 LEAVE(); 1446 lbs_deb_leave(LBS_DEB_SCAN);
1443 return 0; 1447 return 0;
1444} 1448}
1445 1449
@@ -1459,7 +1463,7 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
1459 wlan_adapter *adapter = priv->adapter; 1463 wlan_adapter *adapter = priv->adapter;
1460 struct wlan_ioctl_user_scan_cfg scancfg; 1464 struct wlan_ioctl_user_scan_cfg scancfg;
1461 1465
1462 ENTER(); 1466 lbs_deb_enter(LBS_DEB_ASSOC);
1463 1467
1464 if (prequestedssid == NULL) { 1468 if (prequestedssid == NULL) {
1465 return -1; 1469 return -1;
@@ -1476,7 +1480,7 @@ int libertas_send_specific_SSID_scan(wlan_private * priv,
1476 return -1; 1480 return -1;
1477 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending); 1481 wait_event_interruptible(adapter->cmd_pending, !adapter->nr_cmd_pending);
1478 1482
1479 LEAVE(); 1483 lbs_deb_leave(LBS_DEB_ASSOC);
1480 return 0; 1484 return 0;
1481} 1485}
1482 1486
@@ -1493,7 +1497,7 @@ int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppr
1493{ 1497{
1494 struct wlan_ioctl_user_scan_cfg scancfg; 1498 struct wlan_ioctl_user_scan_cfg scancfg;
1495 1499
1496 ENTER(); 1500 lbs_deb_enter(LBS_DEB_ASSOC);
1497 1501
1498 if (bssid == NULL) { 1502 if (bssid == NULL) {
1499 return -1; 1503 return -1;
@@ -1509,7 +1513,7 @@ int libertas_send_specific_BSSID_scan(wlan_private * priv, u8 * bssid, u8 keeppr
1509 wait_event_interruptible(priv->adapter->cmd_pending, 1513 wait_event_interruptible(priv->adapter->cmd_pending,
1510 !priv->adapter->nr_cmd_pending); 1514 !priv->adapter->nr_cmd_pending);
1511 1515
1512 LEAVE(); 1516 lbs_deb_leave(LBS_DEB_ASSOC);
1513 return 0; 1517 return 0;
1514} 1518}
1515 1519
@@ -1546,7 +1550,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1546 u8 buf[16 + 256 * 2]; 1550 u8 buf[16 + 256 * 2];
1547 u8 *ptr; 1551 u8 *ptr;
1548 1552
1549 ENTER(); 1553 lbs_deb_enter(LBS_DEB_ASSOC);
1550 1554
1551 /* 1555 /*
1552 * if there's either commands in the queue or one being 1556 * if there's either commands in the queue or one being
@@ -1561,10 +1565,10 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1561 } 1565 }
1562 1566
1563 if (adapter->connect_status == libertas_connected) 1567 if (adapter->connect_status == libertas_connected)
1564 lbs_pr_debug(1, "Current ssid: %32s\n", 1568 lbs_deb_scan("Current ssid: %32s\n",
1565 adapter->curbssparams.ssid.ssid); 1569 adapter->curbssparams.ssid.ssid);
1566 1570
1567 lbs_pr_debug(1, "Scan: Get: numinscantable = %d\n", 1571 lbs_deb_scan("Scan: Get: numinscantable = %d\n",
1568 adapter->numinscantable); 1572 adapter->numinscantable);
1569 1573
1570 /* The old API using SIOCGIWAPLIST had a hard limit of IW_MAX_AP. 1574 /* The old API using SIOCGIWAPLIST had a hard limit of IW_MAX_AP.
@@ -1574,7 +1578,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1574 */ 1578 */
1575 for (i = 0; i < adapter->numinscantable; i++) { 1579 for (i = 0; i < adapter->numinscantable; i++) {
1576 if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) { 1580 if ((current_ev + MAX_SCAN_CELL_SIZE) >= end_buf) {
1577 lbs_pr_debug(1, "i=%d break out: current_ev=%p end_buf=%p " 1581 lbs_deb_scan("i=%d break out: current_ev=%p end_buf=%p "
1578 "MAX_SCAN_CELL_SIZE=%zd\n", 1582 "MAX_SCAN_CELL_SIZE=%zd\n",
1579 i, current_ev, end_buf, MAX_SCAN_CELL_SIZE); 1583 i, current_ev, end_buf, MAX_SCAN_CELL_SIZE);
1580 break; 1584 break;
@@ -1582,13 +1586,13 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1582 1586
1583 pscantable = &adapter->scantable[i]; 1587 pscantable = &adapter->scantable[i];
1584 1588
1585 lbs_pr_debug(1, "i=%d ssid: %32s\n", i, pscantable->ssid.ssid); 1589 lbs_deb_scan("i=%d ssid: %32s\n", i, pscantable->ssid.ssid);
1586 1590
1587 cfp = 1591 cfp =
1588 libertas_find_cfp_by_band_and_channel(adapter, 0, 1592 libertas_find_cfp_by_band_and_channel(adapter, 0,
1589 pscantable->channel); 1593 pscantable->channel);
1590 if (!cfp) { 1594 if (!cfp) {
1591 lbs_pr_debug(1, "Invalid channel number %d\n", 1595 lbs_deb_scan("Invalid channel number %d\n",
1592 pscantable->channel); 1596 pscantable->channel);
1593 continue; 1597 continue;
1594 } 1598 }
@@ -1767,9 +1771,9 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1767 ptr += sprintf(ptr, "extra_ie"); 1771 ptr += sprintf(ptr, "extra_ie");
1768 iwe.u.data.length = strlen(buf); 1772 iwe.u.data.length = strlen(buf);
1769 1773
1770 lbs_pr_debug(1, "iwe.u.data.length %d\n", 1774 lbs_deb_scan("iwe.u.data.length %d\n",
1771 iwe.u.data.length); 1775 iwe.u.data.length);
1772 lbs_pr_debug(1, "BUF: %s \n", buf); 1776 lbs_deb_scan("BUF: %s \n", buf);
1773 1777
1774 iwe.cmd = IWEVCUSTOM; 1778 iwe.cmd = IWEVCUSTOM;
1775 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length; 1779 iwe.len = IW_EV_POINT_LEN + iwe.u.data.length;
@@ -1790,7 +1794,7 @@ int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
1790 dwrq->length = (current_ev - extra); 1794 dwrq->length = (current_ev - extra);
1791 dwrq->flags = 0; 1795 dwrq->flags = 0;
1792 1796
1793 LEAVE(); 1797 lbs_deb_leave(LBS_DEB_ASSOC);
1794 return 0; 1798 return 0;
1795} 1799}
1796 1800
@@ -1820,7 +1824,7 @@ int libertas_cmd_80211_scan(wlan_private * priv,
1820 struct cmd_ds_802_11_scan *pscan = &cmd->params.scan; 1824 struct cmd_ds_802_11_scan *pscan = &cmd->params.scan;
1821 struct wlan_scan_cmd_config *pscancfg; 1825 struct wlan_scan_cmd_config *pscancfg;
1822 1826
1823 ENTER(); 1827 lbs_deb_enter(LBS_DEB_ASSOC);
1824 1828
1825 pscancfg = pdata_buf; 1829 pscancfg = pdata_buf;
1826 1830
@@ -1836,9 +1840,10 @@ int libertas_cmd_80211_scan(wlan_private * priv,
1836 + sizeof(pscan->BSSID) 1840 + sizeof(pscan->BSSID)
1837 + pscancfg->tlvbufferlen + S_DS_GEN); 1841 + pscancfg->tlvbufferlen + S_DS_GEN);
1838 1842
1839 lbs_pr_debug(1, "SCAN_CMD: command=%x, size=%x, seqnum=%x\n", 1843 lbs_deb_scan("SCAN_CMD: command=%x, size=%x, seqnum=%x\n",
1840 cmd->command, cmd->size, cmd->seqnum); 1844 cmd->command, cmd->size, cmd->seqnum);
1841 LEAVE(); 1845
1846 lbs_deb_leave(LBS_DEB_ASSOC);
1842 return 0; 1847 return 0;
1843} 1848}
1844 1849
@@ -1881,24 +1886,25 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
1881 int idx; 1886 int idx;
1882 int tlvbufsize; 1887 int tlvbufsize;
1883 u64 tsfval; 1888 u64 tsfval;
1889 int ret;
1884 1890
1885 ENTER(); 1891 lbs_deb_enter(LBS_DEB_ASSOC);
1886 1892
1887 pscan = &resp->params.scanresp; 1893 pscan = &resp->params.scanresp;
1888 1894
1889 if (pscan->nr_sets > MRVDRV_MAX_BSSID_LIST) { 1895 if (pscan->nr_sets > MRVDRV_MAX_BSSID_LIST) {
1890 lbs_pr_debug(1, 1896 lbs_deb_scan(
1891 "SCAN_RESP: Invalid number of AP returned (%d)!!\n", 1897 "SCAN_RESP: Invalid number of AP returned (%d)!!\n",
1892 pscan->nr_sets); 1898 pscan->nr_sets);
1893 LEAVE(); 1899 ret = -1;
1894 return -1; 1900 goto done;
1895 } 1901 }
1896 1902
1897 bytesleft = le16_to_cpu(pscan->bssdescriptsize); 1903 bytesleft = le16_to_cpu(pscan->bssdescriptsize);
1898 lbs_pr_debug(1, "SCAN_RESP: bssdescriptsize %d\n", bytesleft); 1904 lbs_deb_scan("SCAN_RESP: bssdescriptsize %d\n", bytesleft);
1899 1905
1900 scanrespsize = le16_to_cpu(resp->size); 1906 scanrespsize = le16_to_cpu(resp->size);
1901 lbs_pr_debug(1, "SCAN_RESP: returned %d AP before parsing\n", 1907 lbs_deb_scan("SCAN_RESP: returned %d AP before parsing\n",
1902 pscan->nr_sets); 1908 pscan->nr_sets);
1903 1909
1904 numintable = adapter->numinscantable; 1910 numintable = adapter->numinscantable;
@@ -1935,7 +1941,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
1935 0) 1941 0)
1936 && CHECK_SSID_IS_VALID(&newbssentry.ssid)) { 1942 && CHECK_SSID_IS_VALID(&newbssentry.ssid)) {
1937 1943
1938 lbs_pr_debug(1, 1944 lbs_deb_scan(
1939 "SCAN_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n", 1945 "SCAN_RESP: BSSID = %02x:%02x:%02x:%02x:%02x:%02x\n",
1940 newbssentry.macaddress[0], 1946 newbssentry.macaddress[0],
1941 newbssentry.macaddress[1], 1947 newbssentry.macaddress[1],
@@ -1968,7 +1974,7 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
1968 ssid, 1974 ssid,
1969 newbssentry.ssid.ssidlength) == 1975 newbssentry.ssid.ssidlength) ==
1970 0)) { 1976 0)) {
1971 lbs_pr_debug(1, 1977 lbs_deb_scan(
1972 "SCAN_RESP: Duplicate of index: %d\n", 1978 "SCAN_RESP: Duplicate of index: %d\n",
1973 bssIdx); 1979 bssIdx);
1974 break; 1980 break;
@@ -2012,18 +2018,20 @@ int libertas_ret_80211_scan(wlan_private * priv, struct cmd_ds_command *resp)
2012 } else { 2018 } else {
2013 2019
2014 /* error parsing/interpreting the scan response, skipped */ 2020 /* error parsing/interpreting the scan response, skipped */
2015 lbs_pr_debug(1, "SCAN_RESP: " 2021 lbs_deb_scan("SCAN_RESP: "
2016 "InterpretBSSDescriptionWithIE returned ERROR\n"); 2022 "InterpretBSSDescriptionWithIE returned ERROR\n");
2017 } 2023 }
2018 } 2024 }
2019 2025
2020 lbs_pr_debug(1, "SCAN_RESP: Scanned %2d APs, %d valid, %d total\n", 2026 lbs_deb_scan("SCAN_RESP: Scanned %2d APs, %d valid, %d total\n",
2021 pscan->nr_sets, numintable - adapter->numinscantable, 2027 pscan->nr_sets, numintable - adapter->numinscantable,
2022 numintable); 2028 numintable);
2023 2029
2024 /* Update the total number of BSSIDs in the scan table */ 2030 /* Update the total number of BSSIDs in the scan table */
2025 adapter->numinscantable = numintable; 2031 adapter->numinscantable = numintable;
2032 ret = 0;
2026 2033
2027 LEAVE(); 2034done:
2028 return 0; 2035 lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
2036 return ret;
2029} 2037}
diff --git a/drivers/net/wireless/libertas/thread.h b/drivers/net/wireless/libertas/thread.h
index 207b8a6cc33d..b1f34d92ff3e 100644
--- a/drivers/net/wireless/libertas/thread.h
+++ b/drivers/net/wireless/libertas/thread.h
@@ -21,11 +21,11 @@ static inline void wlan_activate_thread(struct wlan_thread * thr)
21 21
22static inline void wlan_deactivate_thread(struct wlan_thread * thr) 22static inline void wlan_deactivate_thread(struct wlan_thread * thr)
23{ 23{
24 ENTER(); 24 lbs_deb_enter(LBS_DEB_THREAD);
25 25
26 thr->pid = 0; 26 thr->pid = 0;
27 27
28 LEAVE(); 28 lbs_deb_leave(LBS_DEB_THREAD);
29} 29}
30 30
31static inline void wlan_create_thread(int (*wlanfunc) (void *), 31static inline void wlan_create_thread(int (*wlanfunc) (void *),
@@ -36,7 +36,7 @@ static inline void wlan_create_thread(int (*wlanfunc) (void *),
36 36
37static inline int wlan_terminate_thread(struct wlan_thread * thr) 37static inline int wlan_terminate_thread(struct wlan_thread * thr)
38{ 38{
39 ENTER(); 39 lbs_deb_enter(LBS_DEB_THREAD);
40 40
41 /* Check if the thread is active or not */ 41 /* Check if the thread is active or not */
42 if (!thr->pid) { 42 if (!thr->pid) {
@@ -45,7 +45,7 @@ static inline int wlan_terminate_thread(struct wlan_thread * thr)
45 } 45 }
46 kthread_stop(thr->task); 46 kthread_stop(thr->task);
47 47
48 LEAVE(); 48 lbs_deb_leave(LBS_DEB_THREAD);
49 return 0; 49 return 0;
50} 50}
51 51
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index d4b13478c9a7..964321fd5e69 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -68,7 +68,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
68 u32 new_rate; 68 u32 new_rate;
69 u8 *ptr = priv->adapter->tmptxbuf; 69 u8 *ptr = priv->adapter->tmptxbuf;
70 70
71 ENTER(); 71 lbs_deb_enter(LBS_DEB_TX);
72 72
73 if (priv->adapter->surpriseremoved) 73 if (priv->adapter->surpriseremoved)
74 return -1; 74 return -1;
@@ -78,7 +78,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
78 min_t(unsigned int, skb->len, 100)); 78 min_t(unsigned int, skb->len, 100));
79 79
80 if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) { 80 if (!skb->len || (skb->len > MRVDRV_ETH_TX_PACKET_BUFFER_SIZE)) {
81 lbs_pr_debug(1, "Tx error: Bad skb length %d : %zd\n", 81 lbs_deb_tx("tx err: skb length %d 0 or > %zd\n",
82 skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE); 82 skb->len, MRVDRV_ETH_TX_PACKET_BUFFER_SIZE);
83 ret = -1; 83 ret = -1;
84 goto done; 84 goto done;
@@ -138,13 +138,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
138 sizeof(struct txpd)); 138 sizeof(struct txpd));
139 139
140 if (ret) { 140 if (ret) {
141 lbs_pr_debug(1, "Tx error: libertas_sbi_host_to_card failed: 0x%X\n", ret); 141 lbs_deb_tx("tx err: libertas_sbi_host_to_card returned 0x%X\n", ret);
142 goto done; 142 goto done;
143 } 143 }
144 144
145 lbs_pr_debug(1, "SendSinglePacket succeeds\n"); 145 lbs_deb_tx("SendSinglePacket succeeds\n");
146 146
147 done: 147done:
148 if (!ret) { 148 if (!ret) {
149 priv->stats.tx_packets++; 149 priv->stats.tx_packets++;
150 priv->stats.tx_bytes += skb->len; 150 priv->stats.tx_bytes += skb->len;
@@ -166,7 +166,7 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
166 priv->adapter->currenttxskb = NULL; 166 priv->adapter->currenttxskb = NULL;
167 } 167 }
168 168
169 LEAVE(); 169 lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
170 return ret; 170 return ret;
171} 171}
172 172
@@ -214,8 +214,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
214{ 214{
215 int ret = -1; 215 int ret = -1;
216 216
217 ENTER(); 217 lbs_deb_enter(LBS_DEB_TX);
218
219 lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100)); 218 lbs_dbg_hex("TX Data", skb->data, min_t(unsigned int, skb->len, 100));
220 219
221 if (priv->wlan_dev.dnld_sent) { 220 if (priv->wlan_dev.dnld_sent) {
@@ -234,7 +233,7 @@ int libertas_process_tx(wlan_private * priv, struct sk_buff *skb)
234 233
235 ret = SendSinglePacket(priv, skb); 234 ret = SendSinglePacket(priv, skb);
236done: 235done:
237 LEAVE(); 236 lbs_deb_leave_args(LBS_DEB_TX, "ret %d", ret);
238 return ret; 237 return ret;
239} 238}
240 239
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 408bc0aa9567..3cbefea68738 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -110,8 +110,8 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada
110 } 110 }
111 111
112 if (!cfp && channel) 112 if (!cfp && channel)
113 lbs_pr_debug(1, "libertas_find_cfp_by_band_and_channel(): cannot find " 113 lbs_deb_wext("libertas_find_cfp_by_band_and_channel: can't find "
114 "cfp by band %d & channel %d\n", band, channel); 114 "cfp by band %d / channel %d\n", band, channel);
115 115
116 return cfp; 116 return cfp;
117} 117}
@@ -151,8 +151,8 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter,
151 } 151 }
152 152
153 if (!cfp && freq) 153 if (!cfp && freq)
154 lbs_pr_debug(1, "find_cfp_by_band_and_freql(): cannot find cfp by " 154 lbs_deb_wext("find_cfp_by_band_and_freql: can't find cfp by "
155 "band %d & freq %d\n", band, freq); 155 "band %d / freq %d\n", band, freq);
156 156
157 return cfp; 157 return cfp;
158} 158}
@@ -168,7 +168,7 @@ static int updatecurrentchannel(wlan_private * priv)
168 cmd_opt_802_11_rf_channel_get, 168 cmd_opt_802_11_rf_channel_get,
169 cmd_option_waitforrsp, 0, NULL); 169 cmd_option_waitforrsp, 0, NULL);
170 170
171 lbs_pr_debug(1, "Current channel = %d\n", 171 lbs_deb_wext("current channel %d\n",
172 priv->adapter->curbssparams.channel); 172 priv->adapter->curbssparams.channel);
173 173
174 return ret; 174 return ret;
@@ -176,7 +176,7 @@ static int updatecurrentchannel(wlan_private * priv)
176 176
177static int setcurrentchannel(wlan_private * priv, int channel) 177static int setcurrentchannel(wlan_private * priv, int channel)
178{ 178{
179 lbs_pr_debug(1, "Set channel = %d\n", channel); 179 lbs_deb_wext("set channel %d\n", channel);
180 180
181 /* 181 /*
182 ** Current channel is not set to adhocchannel requested, set channel 182 ** Current channel is not set to adhocchannel requested, set channel
@@ -197,11 +197,10 @@ static int changeadhocchannel(wlan_private * priv, int channel)
197 197
198 if (adapter->curbssparams.channel == adapter->adhocchannel) { 198 if (adapter->curbssparams.channel == adapter->adhocchannel) {
199 /* adhocchannel is set to the current channel already */ 199 /* adhocchannel is set to the current channel already */
200 LEAVE(); 200 goto out;
201 return 0;
202 } 201 }
203 202
204 lbs_pr_debug(1, "Updating channel from %d to %d\n", 203 lbs_deb_wext("updating channel from %d to %d\n",
205 adapter->curbssparams.channel, adapter->adhocchannel); 204 adapter->curbssparams.channel, adapter->adhocchannel);
206 205
207 setcurrentchannel(priv, adapter->adhocchannel); 206 setcurrentchannel(priv, adapter->adhocchannel);
@@ -209,30 +208,29 @@ static int changeadhocchannel(wlan_private * priv, int channel)
209 updatecurrentchannel(priv); 208 updatecurrentchannel(priv);
210 209
211 if (adapter->curbssparams.channel != adapter->adhocchannel) { 210 if (adapter->curbssparams.channel != adapter->adhocchannel) {
212 lbs_pr_debug(1, "failed to updated channel to %d, channel = %d\n", 211 lbs_deb_wext("failed to updated channel to %d, channel = %d\n",
213 adapter->adhocchannel, adapter->curbssparams.channel); 212 adapter->adhocchannel, adapter->curbssparams.channel);
214 LEAVE(); 213 ret = -1;
215 return -1; 214 goto out;
216 } 215 }
217 216
218 if (adapter->connect_status == libertas_connected) { 217 if (adapter->connect_status == libertas_connected) {
219 int i; 218 int i;
220 struct WLAN_802_11_SSID curadhocssid; 219 struct WLAN_802_11_SSID curadhocssid;
221 220
222 lbs_pr_debug(1, "channel Changed while in an IBSS\n"); 221 lbs_deb_wext("channel changed while in IBSS\n");
223 222
224 /* Copy the current ssid */ 223 /* Copy the current ssid */
225 memcpy(&curadhocssid, &adapter->curbssparams.ssid, 224 memcpy(&curadhocssid, &adapter->curbssparams.ssid,
226 sizeof(struct WLAN_802_11_SSID)); 225 sizeof(struct WLAN_802_11_SSID));
227 226
228 /* Exit Adhoc mode */ 227 /* Exit Adhoc mode */
229 lbs_pr_debug(1, "In changeadhocchannel(): Sending Adhoc Stop\n"); 228 lbs_deb_wext("in changeadhocchannel(): sending Adhoc stop\n");
230 ret = libertas_stop_adhoc_network(priv); 229 ret = libertas_stop_adhoc_network(priv);
231 230
232 if (ret) { 231 if (ret)
233 LEAVE(); 232 goto out;
234 return ret; 233
235 }
236 /* Scan for the network, do not save previous results. Stale 234 /* Scan for the network, do not save previous results. Stale
237 * scan data will cause us to join a non-existant adhoc network 235 * scan data will cause us to join a non-existant adhoc network
238 */ 236 */
@@ -243,20 +241,21 @@ static int changeadhocchannel(wlan_private * priv, int channel)
243 IW_MODE_ADHOC); 241 IW_MODE_ADHOC);
244 242
245 if (i >= 0) { 243 if (i >= 0) {
246 lbs_pr_debug(1, "SSID found at %d in List," 244 lbs_deb_wext("SSID found at %d in list,"
247 "so join\n", i); 245 "so join\n", i);
248 libertas_join_adhoc_network(priv, &adapter->scantable[i]); 246 libertas_join_adhoc_network(priv, &adapter->scantable[i]);
249 } else { 247 } else {
250 // else send START command 248 // else send START command
251 lbs_pr_debug(1, "SSID not found in list, " 249 lbs_deb_wext("SSID not found in list, "
252 "so creating adhoc with ssid = %s\n", 250 "creating AdHoc with SSID '%s'\n",
253 curadhocssid.ssid); 251 curadhocssid.ssid);
254 libertas_start_adhoc_network(priv, &curadhocssid); 252 libertas_start_adhoc_network(priv, &curadhocssid);
255 } // end of else (START command) 253 } // end of else (START command)
256 } 254 }
257 255
258 LEAVE(); 256out:
259 return 0; 257 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
258 return ret;
260} 259}
261 260
262/** 261/**
@@ -271,10 +270,10 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option)
271 int ret = 0; 270 int ret = 0;
272 wlan_adapter *adapter = priv->adapter; 271 wlan_adapter *adapter = priv->adapter;
273 272
274 ENTER(); 273 lbs_deb_enter(LBS_DEB_WEXT);
275 274
276 if (adapter->radioon != option) { 275 if (adapter->radioon != option) {
277 lbs_pr_debug(1, "Switching %s the Radio\n", option ? "On" : "Off"); 276 lbs_deb_wext("switching radio %s\n", option ? "on" : "off");
278 adapter->radioon = option; 277 adapter->radioon = option;
279 278
280 ret = libertas_prepare_and_send_command(priv, 279 ret = libertas_prepare_and_send_command(priv,
@@ -283,7 +282,7 @@ int wlan_radio_ioctl(wlan_private * priv, u8 option)
283 cmd_option_waitforrsp, 0, NULL); 282 cmd_option_waitforrsp, 0, NULL);
284 } 283 }
285 284
286 LEAVE(); 285 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
287 return ret; 286 return ret;
288} 287}
289 288
@@ -320,15 +319,15 @@ static int get_active_data_rates(wlan_adapter * adapter,
320{ 319{
321 int k = 0; 320 int k = 0;
322 321
323 ENTER(); 322 lbs_deb_enter(LBS_DEB_WEXT);
324 323
325 if (adapter->connect_status != libertas_connected) { 324 if (adapter->connect_status != libertas_connected) {
326 if (adapter->mode == IW_MODE_INFRA) { 325 if (adapter->mode == IW_MODE_INFRA) {
327 lbs_pr_debug(1, "Infra\n"); 326 lbs_deb_wext("infra\n");
328 k = copyrates(rates, k, libertas_supported_rates, 327 k = copyrates(rates, k, libertas_supported_rates,
329 sizeof(libertas_supported_rates)); 328 sizeof(libertas_supported_rates));
330 } else { 329 } else {
331 lbs_pr_debug(1, "Adhoc G\n"); 330 lbs_deb_wext("Adhoc G\n");
332 k = copyrates(rates, k, libertas_adhoc_rates_g, 331 k = copyrates(rates, k, libertas_adhoc_rates_g,
333 sizeof(libertas_adhoc_rates_g)); 332 sizeof(libertas_adhoc_rates_g));
334 } 333 }
@@ -337,8 +336,7 @@ static int get_active_data_rates(wlan_adapter * adapter,
337 adapter->curbssparams.numofrates); 336 adapter->curbssparams.numofrates);
338 } 337 }
339 338
340 LEAVE(); 339 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", k);
341
342 return k; 340 return k;
343} 341}
344 342
@@ -350,7 +348,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
350 char mrvl[6] = { "MRVL-" }; 348 char mrvl[6] = { "MRVL-" };
351 int cnt; 349 int cnt;
352 350
353 ENTER(); 351 lbs_deb_enter(LBS_DEB_WEXT);
354 352
355 strcpy(cwrq, mrvl); 353 strcpy(cwrq, mrvl);
356 354
@@ -368,8 +366,7 @@ static int wlan_get_name(struct net_device *dev, struct iw_request_info *info,
368 } 366 }
369 *cwrq = '\0'; 367 *cwrq = '\0';
370 368
371 LEAVE(); 369 lbs_deb_leave(LBS_DEB_WEXT);
372
373 return 0; 370 return 0;
374} 371}
375 372
@@ -380,14 +377,14 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
380 wlan_adapter *adapter = priv->adapter; 377 wlan_adapter *adapter = priv->adapter;
381 struct chan_freq_power *cfp; 378 struct chan_freq_power *cfp;
382 379
383 ENTER(); 380 lbs_deb_enter(LBS_DEB_WEXT);
384 381
385 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0, 382 cfp = libertas_find_cfp_by_band_and_channel(adapter, 0,
386 adapter->curbssparams.channel); 383 adapter->curbssparams.channel);
387 384
388 if (!cfp) { 385 if (!cfp) {
389 if (adapter->curbssparams.channel) 386 if (adapter->curbssparams.channel)
390 lbs_pr_debug(1, "Invalid channel=%d\n", 387 lbs_deb_wext("invalid channel %d\n",
391 adapter->curbssparams.channel); 388 adapter->curbssparams.channel);
392 return -EINVAL; 389 return -EINVAL;
393 } 390 }
@@ -395,9 +392,8 @@ static int wlan_get_freq(struct net_device *dev, struct iw_request_info *info,
395 fwrq->m = (long)cfp->freq * 100000; 392 fwrq->m = (long)cfp->freq * 100000;
396 fwrq->e = 1; 393 fwrq->e = 1;
397 394
398 lbs_pr_debug(1, "freq=%u\n", fwrq->m); 395 lbs_deb_wext("freq %u\n", fwrq->m);
399 396 lbs_deb_leave(LBS_DEB_WEXT);
400 LEAVE();
401 return 0; 397 return 0;
402} 398}
403 399
@@ -407,7 +403,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
407 wlan_private *priv = dev->priv; 403 wlan_private *priv = dev->priv;
408 wlan_adapter *adapter = priv->adapter; 404 wlan_adapter *adapter = priv->adapter;
409 405
410 ENTER(); 406 lbs_deb_enter(LBS_DEB_WEXT);
411 407
412 if (adapter->connect_status == libertas_connected) { 408 if (adapter->connect_status == libertas_connected) {
413 memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN); 409 memcpy(awrq->sa_data, adapter->curbssparams.bssid, ETH_ALEN);
@@ -416,7 +412,7 @@ static int wlan_get_wap(struct net_device *dev, struct iw_request_info *info,
416 } 412 }
417 awrq->sa_family = ARPHRD_ETHER; 413 awrq->sa_family = ARPHRD_ETHER;
418 414
419 LEAVE(); 415 lbs_deb_leave(LBS_DEB_WEXT);
420 return 0; 416 return 0;
421} 417}
422 418
@@ -426,7 +422,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
426 wlan_private *priv = dev->priv; 422 wlan_private *priv = dev->priv;
427 wlan_adapter *adapter = priv->adapter; 423 wlan_adapter *adapter = priv->adapter;
428 424
429 ENTER(); 425 lbs_deb_enter(LBS_DEB_WEXT);
430 426
431 /* 427 /*
432 * Check the size of the string 428 * Check the size of the string
@@ -441,7 +437,7 @@ static int wlan_set_nick(struct net_device *dev, struct iw_request_info *info,
441 memcpy(adapter->nodename, extra, dwrq->length); 437 memcpy(adapter->nodename, extra, dwrq->length);
442 mutex_unlock(&adapter->lock); 438 mutex_unlock(&adapter->lock);
443 439
444 LEAVE(); 440 lbs_deb_leave(LBS_DEB_WEXT);
445 return 0; 441 return 0;
446} 442}
447 443
@@ -451,7 +447,7 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
451 wlan_private *priv = dev->priv; 447 wlan_private *priv = dev->priv;
452 wlan_adapter *adapter = priv->adapter; 448 wlan_adapter *adapter = priv->adapter;
453 449
454 ENTER(); 450 lbs_deb_enter(LBS_DEB_WEXT);
455 451
456 /* 452 /*
457 * Get the Nick Name saved 453 * Get the Nick Name saved
@@ -472,7 +468,7 @@ static int wlan_get_nick(struct net_device *dev, struct iw_request_info *info,
472 */ 468 */
473 dwrq->length = strlen(extra) + 1; 469 dwrq->length = strlen(extra) + 1;
474 470
475 LEAVE(); 471 lbs_deb_leave(LBS_DEB_WEXT);
476 return 0; 472 return 0;
477} 473}
478 474
@@ -484,7 +480,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
484 wlan_adapter *adapter = priv->adapter; 480 wlan_adapter *adapter = priv->adapter;
485 int rthr = vwrq->value; 481 int rthr = vwrq->value;
486 482
487 ENTER(); 483 lbs_deb_enter(LBS_DEB_WEXT);
488 484
489 if (vwrq->disabled) { 485 if (vwrq->disabled) {
490 adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE; 486 adapter->rtsthsd = rthr = MRVDRV_RTS_MAX_VALUE;
@@ -498,7 +494,7 @@ static int wlan_set_rts(struct net_device *dev, struct iw_request_info *info,
498 cmd_act_set, cmd_option_waitforrsp, 494 cmd_act_set, cmd_option_waitforrsp,
499 OID_802_11_RTS_THRESHOLD, &rthr); 495 OID_802_11_RTS_THRESHOLD, &rthr);
500 496
501 LEAVE(); 497 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
502 return ret; 498 return ret;
503} 499}
504 500
@@ -509,24 +505,23 @@ static int wlan_get_rts(struct net_device *dev, struct iw_request_info *info,
509 wlan_private *priv = dev->priv; 505 wlan_private *priv = dev->priv;
510 wlan_adapter *adapter = priv->adapter; 506 wlan_adapter *adapter = priv->adapter;
511 507
512 ENTER(); 508 lbs_deb_enter(LBS_DEB_WEXT);
513 509
514 adapter->rtsthsd = 0; 510 adapter->rtsthsd = 0;
515 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, 511 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
516 cmd_act_get, cmd_option_waitforrsp, 512 cmd_act_get, cmd_option_waitforrsp,
517 OID_802_11_RTS_THRESHOLD, NULL); 513 OID_802_11_RTS_THRESHOLD, NULL);
518 if (ret) { 514 if (ret)
519 LEAVE(); 515 goto out;
520 return ret;
521 }
522 516
523 vwrq->value = adapter->rtsthsd; 517 vwrq->value = adapter->rtsthsd;
524 vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE) 518 vwrq->disabled = ((vwrq->value < MRVDRV_RTS_MIN_VALUE)
525 || (vwrq->value > MRVDRV_RTS_MAX_VALUE)); 519 || (vwrq->value > MRVDRV_RTS_MAX_VALUE));
526 vwrq->fixed = 1; 520 vwrq->fixed = 1;
527 521
528 LEAVE(); 522out:
529 return 0; 523 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
524 return ret;
530} 525}
531 526
532static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info, 527static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
@@ -537,7 +532,7 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
537 wlan_private *priv = dev->priv; 532 wlan_private *priv = dev->priv;
538 wlan_adapter *adapter = priv->adapter; 533 wlan_adapter *adapter = priv->adapter;
539 534
540 ENTER(); 535 lbs_deb_enter(LBS_DEB_WEXT);
541 536
542 if (vwrq->disabled) { 537 if (vwrq->disabled) {
543 adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE; 538 adapter->fragthsd = fthr = MRVDRV_FRAG_MAX_VALUE;
@@ -551,7 +546,8 @@ static int wlan_set_frag(struct net_device *dev, struct iw_request_info *info,
551 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib, 546 ret = libertas_prepare_and_send_command(priv, cmd_802_11_snmp_mib,
552 cmd_act_set, cmd_option_waitforrsp, 547 cmd_act_set, cmd_option_waitforrsp,
553 OID_802_11_FRAGMENTATION_THRESHOLD, &fthr); 548 OID_802_11_FRAGMENTATION_THRESHOLD, &fthr);
554 LEAVE(); 549
550 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
555 return ret; 551 return ret;
556} 552}
557 553
@@ -562,24 +558,23 @@ static int wlan_get_frag(struct net_device *dev, struct iw_request_info *info,
562 wlan_private *priv = dev->priv; 558 wlan_private *priv = dev->priv;
563 wlan_adapter *adapter = priv->adapter; 559 wlan_adapter *adapter = priv->adapter;
564 560
565 ENTER(); 561 lbs_deb_enter(LBS_DEB_WEXT);
566 562
567 adapter->fragthsd = 0; 563 adapter->fragthsd = 0;
568 ret = libertas_prepare_and_send_command(priv, 564 ret = libertas_prepare_and_send_command(priv,
569 cmd_802_11_snmp_mib, 565 cmd_802_11_snmp_mib,
570 cmd_act_get, cmd_option_waitforrsp, 566 cmd_act_get, cmd_option_waitforrsp,
571 OID_802_11_FRAGMENTATION_THRESHOLD, NULL); 567 OID_802_11_FRAGMENTATION_THRESHOLD, NULL);
572 if (ret) { 568 if (ret)
573 LEAVE(); 569 goto out;
574 return ret;
575 }
576 570
577 vwrq->value = adapter->fragthsd; 571 vwrq->value = adapter->fragthsd;
578 vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE) 572 vwrq->disabled = ((vwrq->value < MRVDRV_FRAG_MIN_VALUE)
579 || (vwrq->value > MRVDRV_FRAG_MAX_VALUE)); 573 || (vwrq->value > MRVDRV_FRAG_MAX_VALUE));
580 vwrq->fixed = 1; 574 vwrq->fixed = 1;
581 575
582 LEAVE(); 576out:
577 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
583 return ret; 578 return ret;
584} 579}
585 580
@@ -589,11 +584,11 @@ static int wlan_get_mode(struct net_device *dev,
589 wlan_private *priv = dev->priv; 584 wlan_private *priv = dev->priv;
590 wlan_adapter *adapter = priv->adapter; 585 wlan_adapter *adapter = priv->adapter;
591 586
592 ENTER(); 587 lbs_deb_enter(LBS_DEB_WEXT);
593 588
594 *uwrq = adapter->mode; 589 *uwrq = adapter->mode;
595 590
596 LEAVE(); 591 lbs_deb_leave(LBS_DEB_WEXT);
597 return 0; 592 return 0;
598} 593}
599 594
@@ -605,19 +600,17 @@ static int wlan_get_txpow(struct net_device *dev,
605 wlan_private *priv = dev->priv; 600 wlan_private *priv = dev->priv;
606 wlan_adapter *adapter = priv->adapter; 601 wlan_adapter *adapter = priv->adapter;
607 602
608 ENTER(); 603 lbs_deb_enter(LBS_DEB_WEXT);
609 604
610 ret = libertas_prepare_and_send_command(priv, 605 ret = libertas_prepare_and_send_command(priv,
611 cmd_802_11_rf_tx_power, 606 cmd_802_11_rf_tx_power,
612 cmd_act_tx_power_opt_get, 607 cmd_act_tx_power_opt_get,
613 cmd_option_waitforrsp, 0, NULL); 608 cmd_option_waitforrsp, 0, NULL);
614 609
615 if (ret) { 610 if (ret)
616 LEAVE(); 611 goto out;
617 return ret;
618 }
619 612
620 lbs_pr_debug(1, "TXPOWER GET %d dbm.\n", adapter->txpowerlevel); 613 lbs_deb_wext("tx power level %d dbm\n", adapter->txpowerlevel);
621 vwrq->value = adapter->txpowerlevel; 614 vwrq->value = adapter->txpowerlevel;
622 vwrq->fixed = 1; 615 vwrq->fixed = 1;
623 if (adapter->radioon) { 616 if (adapter->radioon) {
@@ -627,8 +620,9 @@ static int wlan_get_txpow(struct net_device *dev,
627 vwrq->disabled = 1; 620 vwrq->disabled = 1;
628 } 621 }
629 622
630 LEAVE(); 623out:
631 return 0; 624 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
625 return ret;
632} 626}
633 627
634static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info, 628static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
@@ -638,7 +632,7 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
638 wlan_private *priv = dev->priv; 632 wlan_private *priv = dev->priv;
639 wlan_adapter *adapter = priv->adapter; 633 wlan_adapter *adapter = priv->adapter;
640 634
641 ENTER(); 635 lbs_deb_enter(LBS_DEB_WEXT);
642 636
643 if (vwrq->flags == IW_RETRY_LIMIT) { 637 if (vwrq->flags == IW_RETRY_LIMIT) {
644 /* The MAC has a 4-bit Total_Tx_Count register 638 /* The MAC has a 4-bit Total_Tx_Count register
@@ -656,16 +650,15 @@ static int wlan_set_retry(struct net_device *dev, struct iw_request_info *info,
656 cmd_option_waitforrsp, 650 cmd_option_waitforrsp,
657 OID_802_11_TX_RETRYCOUNT, NULL); 651 OID_802_11_TX_RETRYCOUNT, NULL);
658 652
659 if (ret) { 653 if (ret)
660 LEAVE(); 654 goto out;
661 return ret;
662 }
663 } else { 655 } else {
664 return -EOPNOTSUPP; 656 return -EOPNOTSUPP;
665 } 657 }
666 658
667 LEAVE(); 659out:
668 return 0; 660 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
661 return ret;
669} 662}
670 663
671static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info, 664static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
@@ -675,16 +668,16 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
675 wlan_adapter *adapter = priv->adapter; 668 wlan_adapter *adapter = priv->adapter;
676 int ret = 0; 669 int ret = 0;
677 670
678 ENTER(); 671 lbs_deb_enter(LBS_DEB_WEXT);
672
679 adapter->txretrycount = 0; 673 adapter->txretrycount = 0;
680 ret = libertas_prepare_and_send_command(priv, 674 ret = libertas_prepare_and_send_command(priv,
681 cmd_802_11_snmp_mib, 675 cmd_802_11_snmp_mib,
682 cmd_act_get, cmd_option_waitforrsp, 676 cmd_act_get, cmd_option_waitforrsp,
683 OID_802_11_TX_RETRYCOUNT, NULL); 677 OID_802_11_TX_RETRYCOUNT, NULL);
684 if (ret) { 678 if (ret)
685 LEAVE(); 679 goto out;
686 return ret; 680
687 }
688 vwrq->disabled = 0; 681 vwrq->disabled = 0;
689 if (!vwrq->flags) { 682 if (!vwrq->flags) {
690 vwrq->flags = IW_RETRY_LIMIT; 683 vwrq->flags = IW_RETRY_LIMIT;
@@ -692,8 +685,9 @@ static int wlan_get_retry(struct net_device *dev, struct iw_request_info *info,
692 vwrq->value = adapter->txretrycount - 1; 685 vwrq->value = adapter->txretrycount - 1;
693 } 686 }
694 687
695 LEAVE(); 688out:
696 return 0; 689 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
690 return ret;
697} 691}
698 692
699static inline void sort_channels(struct iw_freq *freq, int num) 693static inline void sort_channels(struct iw_freq *freq, int num)
@@ -747,7 +741,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
747 741
748 u8 flag = 0; 742 u8 flag = 0;
749 743
750 ENTER(); 744 lbs_deb_enter(LBS_DEB_WEXT);
751 745
752 dwrq->length = sizeof(struct iw_range); 746 dwrq->length = sizeof(struct iw_range);
753 memset(range, 0, sizeof(struct iw_range)); 747 memset(range, 0, sizeof(struct iw_range));
@@ -763,7 +757,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
763 range->bitrate[i] = (rates[i] & 0x7f) * 500000; 757 range->bitrate[i] = (rates[i] & 0x7f) * 500000;
764 } 758 }
765 range->num_bitrates = i; 759 range->num_bitrates = i;
766 lbs_pr_debug(1, "IW_MAX_BITRATES=%d num_bitrates=%d\n", IW_MAX_BITRATES, 760 lbs_deb_wext("IW_MAX_BITRATES %d, num_bitrates %d\n", IW_MAX_BITRATES,
767 range->num_bitrates); 761 range->num_bitrates);
768 762
769 range->num_frequency = 0; 763 range->num_frequency = 0;
@@ -776,18 +770,17 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
776 &adapter->parsed_region_chan; 770 &adapter->parsed_region_chan;
777 771
778 if (parsed_region_chan == NULL) { 772 if (parsed_region_chan == NULL) {
779 lbs_pr_debug(1, "11D:parsed_region_chan is NULL\n"); 773 lbs_deb_wext("11d: parsed_region_chan is NULL\n");
780 LEAVE(); 774 goto out;
781 return 0;
782 } 775 }
783 band = parsed_region_chan->band; 776 band = parsed_region_chan->band;
784 lbs_pr_debug(1, "band=%d NoOfChan=%d\n", band, 777 lbs_deb_wext("band %d, nr_char %d\n", band,
785 parsed_region_chan->nr_chan); 778 parsed_region_chan->nr_chan);
786 779
787 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) 780 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
788 && (i < parsed_region_chan->nr_chan); i++) { 781 && (i < parsed_region_chan->nr_chan); i++) {
789 chan_no = parsed_region_chan->chanpwr[i].chan; 782 chan_no = parsed_region_chan->chanpwr[i].chan;
790 lbs_pr_debug(1, "chan_no=%d\n", chan_no); 783 lbs_deb_wext("chan_no %d\n", chan_no);
791 range->freq[range->num_frequency].i = (long)chan_no; 784 range->freq[range->num_frequency].i = (long)chan_no;
792 range->freq[range->num_frequency].m = 785 range->freq[range->num_frequency].m =
793 (long)libertas_chan_2_freq(chan_no, band) * 100000; 786 (long)libertas_chan_2_freq(chan_no, band) * 100000;
@@ -816,7 +809,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
816 } 809 }
817 } 810 }
818 811
819 lbs_pr_debug(1, "IW_MAX_FREQUENCIES=%d num_frequency=%d\n", 812 lbs_deb_wext("IW_MAX_FREQUENCIES %d, num_frequency %d\n",
820 IW_MAX_FREQUENCIES, range->num_frequency); 813 IW_MAX_FREQUENCIES, range->num_frequency);
821 814
822 range->num_channels = range->num_frequency; 815 range->num_channels = range->num_frequency;
@@ -911,7 +904,8 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
911 | IW_ENC_CAPA_CIPHER_CCMP; 904 | IW_ENC_CAPA_CIPHER_CCMP;
912 } 905 }
913 906
914 LEAVE(); 907out:
908 lbs_deb_leave(LBS_DEB_WEXT);
915 return 0; 909 return 0;
916} 910}
917 911
@@ -921,7 +915,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
921 wlan_private *priv = dev->priv; 915 wlan_private *priv = dev->priv;
922 wlan_adapter *adapter = priv->adapter; 916 wlan_adapter *adapter = priv->adapter;
923 917
924 ENTER(); 918 lbs_deb_enter(LBS_DEB_WEXT);
925 919
926 /* PS is currently supported only in Infrastructure mode 920 /* PS is currently supported only in Infrastructure mode
927 * Remove this check if it is to be supported in IBSS mode also 921 * Remove this check if it is to be supported in IBSS mode also
@@ -937,11 +931,11 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
937 } 931 }
938 932
939 if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { 933 if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
940 lbs_pr_debug(1, 934 lbs_deb_wext(
941 "Setting power timeout command is not supported\n"); 935 "setting power timeout is not supported\n");
942 return -EINVAL; 936 return -EINVAL;
943 } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) { 937 } else if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
944 lbs_pr_debug(1, "Setting power period command is not supported\n"); 938 lbs_deb_wext("setting power period not supported\n");
945 return -EINVAL; 939 return -EINVAL;
946 } 940 }
947 941
@@ -955,7 +949,7 @@ static int wlan_set_power(struct net_device *dev, struct iw_request_info *info,
955 libertas_ps_sleep(priv, cmd_option_waitforrsp); 949 libertas_ps_sleep(priv, cmd_option_waitforrsp);
956 } 950 }
957 951
958 LEAVE(); 952 lbs_deb_leave(LBS_DEB_WEXT);
959 return 0; 953 return 0;
960} 954}
961 955
@@ -966,19 +960,20 @@ static int wlan_get_power(struct net_device *dev, struct iw_request_info *info,
966 wlan_adapter *adapter = priv->adapter; 960 wlan_adapter *adapter = priv->adapter;
967 int mode; 961 int mode;
968 962
969 ENTER(); 963 lbs_deb_enter(LBS_DEB_WEXT);
970 964
971 mode = adapter->psmode; 965 mode = adapter->psmode;
972 966
973 if ((vwrq->disabled = (mode == wlan802_11powermodecam)) 967 if ((vwrq->disabled = (mode == wlan802_11powermodecam))
974 || adapter->connect_status == libertas_disconnected) { 968 || adapter->connect_status == libertas_disconnected)
975 LEAVE(); 969 {
976 return 0; 970 goto out;
977 } 971 }
978 972
979 vwrq->value = 0; 973 vwrq->value = 0;
980 974
981 LEAVE(); 975out:
976 lbs_deb_leave(LBS_DEB_WEXT);
982 return 0; 977 return 0;
983} 978}
984 979
@@ -1133,7 +1128,7 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1133 u8 rssi; 1128 u8 rssi;
1134 u32 tx_retries; 1129 u32 tx_retries;
1135 1130
1136 ENTER(); 1131 lbs_deb_enter(LBS_DEB_WEXT);
1137 1132
1138 priv->wstats.status = adapter->mode; 1133 priv->wstats.status = adapter->mode;
1139 1134
@@ -1153,8 +1148,8 @@ static struct iw_statistics *wlan_get_wireless_stats(struct net_device *dev)
1153 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]); 1148 CAL_NF(adapter->NF[TYPE_BEACON][TYPE_NOAVG]);
1154 } 1149 }
1155 1150
1156 lbs_pr_debug(1, "Signal Level = %#x\n", priv->wstats.qual.level); 1151 lbs_deb_wext("signal level %#x\n", priv->wstats.qual.level);
1157 lbs_pr_debug(1, "Noise = %#x\n", priv->wstats.qual.noise); 1152 lbs_deb_wext("noise %#x\n", priv->wstats.qual.noise);
1158 1153
1159 rssi = priv->wstats.qual.level - priv->wstats.qual.noise; 1154 rssi = priv->wstats.qual.level - priv->wstats.qual.noise;
1160 if (rssi < 15) 1155 if (rssi < 15)
@@ -1217,7 +1212,7 @@ out:
1217 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID; 1212 IW_QUAL_QUAL_INVALID | IW_QUAL_LEVEL_INVALID;
1218 } 1213 }
1219 1214
1220 LEAVE (); 1215 lbs_deb_leave(LBS_DEB_WEXT);
1221 return &priv->wstats; 1216 return &priv->wstats;
1222 1217
1223 1218
@@ -1232,7 +1227,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1232 int rc = -EINPROGRESS; /* Call commit handler */ 1227 int rc = -EINPROGRESS; /* Call commit handler */
1233 struct chan_freq_power *cfp; 1228 struct chan_freq_power *cfp;
1234 1229
1235 ENTER(); 1230 lbs_deb_enter(LBS_DEB_WEXT);
1236 1231
1237 /* 1232 /*
1238 * If setting by frequency, convert to a channel 1233 * If setting by frequency, convert to a channel
@@ -1244,7 +1239,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1244 1239
1245 cfp = find_cfp_by_band_and_freq(adapter, 0, f); 1240 cfp = find_cfp_by_band_and_freq(adapter, 0, f);
1246 if (!cfp) { 1241 if (!cfp) {
1247 lbs_pr_debug(1, "Invalid freq=%ld\n", f); 1242 lbs_deb_wext("invalid freq %ld\n", f);
1248 return -EINVAL; 1243 return -EINVAL;
1249 } 1244 }
1250 1245
@@ -1275,7 +1270,7 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1275 * command to set WEP in firmware 1270 * command to set WEP in firmware
1276 */ 1271 */
1277 if (adapter->secinfo.wep_enabled) { 1272 if (adapter->secinfo.wep_enabled) {
1278 lbs_pr_debug(1, "set_freq: WEP enabled\n"); 1273 lbs_deb_wext("set_freq: WEP enabled\n");
1279 ret = libertas_prepare_and_send_command(priv, 1274 ret = libertas_prepare_and_send_command(priv,
1280 cmd_802_11_set_wep, 1275 cmd_802_11_set_wep,
1281 cmd_act_add, 1276 cmd_act_add,
@@ -1284,8 +1279,8 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1284 NULL); 1279 NULL);
1285 1280
1286 if (ret) { 1281 if (ret) {
1287 LEAVE(); 1282 rc = ret;
1288 return ret; 1283 goto out;
1289 } 1284 }
1290 1285
1291 adapter->currentpacketfilter |= 1286 adapter->currentpacketfilter |=
@@ -1299,7 +1294,8 @@ static int wlan_set_freq(struct net_device *dev, struct iw_request_info *info,
1299 } 1294 }
1300 } 1295 }
1301 1296
1302 LEAVE(); 1297out:
1298 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", rc);
1303 return rc; 1299 return rc;
1304} 1300}
1305 1301
@@ -1346,9 +1342,9 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
1346 u8 rates[WLAN_SUPPORTED_RATES]; 1342 u8 rates[WLAN_SUPPORTED_RATES];
1347 u8 *rate; 1343 u8 *rate;
1348 1344
1349 ENTER(); 1345 lbs_deb_enter(LBS_DEB_WEXT);
1350 1346
1351 lbs_pr_debug(1, "Vwrq->value = %d\n", vwrq->value); 1347 lbs_deb_wext("vwrq->value %d\n", vwrq->value);
1352 1348
1353 if (vwrq->value == -1) { 1349 if (vwrq->value == -1) {
1354 action = cmd_act_set_tx_auto; // Auto 1350 action = cmd_act_set_tx_auto; // Auto
@@ -1365,15 +1361,15 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
1365 get_active_data_rates(adapter, rates); 1361 get_active_data_rates(adapter, rates);
1366 rate = rates; 1362 rate = rates;
1367 while (*rate) { 1363 while (*rate) {
1368 lbs_pr_debug(1, "Rate=0x%X Wanted=0x%X\n", *rate, 1364 lbs_deb_wext("rate=0x%X, wanted data_rate 0x%X\n", *rate,
1369 data_rate); 1365 data_rate);
1370 if ((*rate & 0x7f) == (data_rate & 0x7f)) 1366 if ((*rate & 0x7f) == (data_rate & 0x7f))
1371 break; 1367 break;
1372 rate++; 1368 rate++;
1373 } 1369 }
1374 if (!*rate) { 1370 if (!*rate) {
1375 lbs_pr_alert( "The fixed data rate 0x%X is out " 1371 lbs_pr_alert("fixed data rate 0x%X out "
1376 "of range.\n", data_rate); 1372 "of range\n", data_rate);
1377 return -EINVAL; 1373 return -EINVAL;
1378 } 1374 }
1379 1375
@@ -1385,7 +1381,7 @@ static int wlan_set_rate(struct net_device *dev, struct iw_request_info *info,
1385 ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate, 1381 ret = libertas_prepare_and_send_command(priv, cmd_802_11_data_rate,
1386 action, cmd_option_waitforrsp, 0, NULL); 1382 action, cmd_option_waitforrsp, 0, NULL);
1387 1383
1388 LEAVE(); 1384 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1389 return ret; 1385 return ret;
1390} 1386}
1391 1387
@@ -1395,7 +1391,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
1395 wlan_private *priv = dev->priv; 1391 wlan_private *priv = dev->priv;
1396 wlan_adapter *adapter = priv->adapter; 1392 wlan_adapter *adapter = priv->adapter;
1397 1393
1398 ENTER(); 1394 lbs_deb_enter(LBS_DEB_WEXT);
1399 1395
1400 if (adapter->is_datarate_auto) { 1396 if (adapter->is_datarate_auto) {
1401 vwrq->fixed = 0; 1397 vwrq->fixed = 0;
@@ -1405,7 +1401,7 @@ static int wlan_get_rate(struct net_device *dev, struct iw_request_info *info,
1405 1401
1406 vwrq->value = adapter->datarate * 500000; 1402 vwrq->value = adapter->datarate * 500000;
1407 1403
1408 LEAVE(); 1404 lbs_deb_leave(LBS_DEB_WEXT);
1409 return 0; 1405 return 0;
1410} 1406}
1411 1407
@@ -1417,12 +1413,12 @@ static int wlan_set_mode(struct net_device *dev,
1417 wlan_adapter *adapter = priv->adapter; 1413 wlan_adapter *adapter = priv->adapter;
1418 struct assoc_request * assoc_req; 1414 struct assoc_request * assoc_req;
1419 1415
1420 ENTER(); 1416 lbs_deb_enter(LBS_DEB_WEXT);
1421 1417
1422 if ( (*uwrq != IW_MODE_ADHOC) 1418 if ( (*uwrq != IW_MODE_ADHOC)
1423 && (*uwrq != IW_MODE_INFRA) 1419 && (*uwrq != IW_MODE_INFRA)
1424 && (*uwrq != IW_MODE_AUTO)) { 1420 && (*uwrq != IW_MODE_AUTO)) {
1425 lbs_pr_debug(1, "Invalid mode: 0x%x\n", *uwrq); 1421 lbs_deb_wext("Invalid mode: 0x%x\n", *uwrq);
1426 ret = -EINVAL; 1422 ret = -EINVAL;
1427 goto out; 1423 goto out;
1428 } 1424 }
@@ -1436,12 +1432,12 @@ static int wlan_set_mode(struct net_device *dev,
1436 assoc_req->mode = *uwrq; 1432 assoc_req->mode = *uwrq;
1437 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags); 1433 set_bit(ASSOC_FLAG_MODE, &assoc_req->flags);
1438 wlan_postpone_association_work(priv); 1434 wlan_postpone_association_work(priv);
1439 lbs_pr_debug(1, "Switching to mode: 0x%x\n", *uwrq); 1435 lbs_deb_wext("Switching to mode: 0x%x\n", *uwrq);
1440 } 1436 }
1441 mutex_unlock(&adapter->lock); 1437 mutex_unlock(&adapter->lock);
1442 1438
1443out: 1439out:
1444 LEAVE(); 1440 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1445 return ret; 1441 return ret;
1446} 1442}
1447 1443
@@ -1463,9 +1459,9 @@ static int wlan_get_encode(struct net_device *dev,
1463 wlan_adapter *adapter = priv->adapter; 1459 wlan_adapter *adapter = priv->adapter;
1464 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; 1460 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
1465 1461
1466 ENTER(); 1462 lbs_deb_enter(LBS_DEB_WEXT);
1467 1463
1468 lbs_pr_debug(1, "flags=0x%x index=%d length=%d wep_tx_keyidx=%d\n", 1464 lbs_deb_wext("flags 0x%x, index %d, length %d, wep_tx_keyidx %d\n",
1469 dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx); 1465 dwrq->flags, index, dwrq->length, adapter->wep_tx_keyidx);
1470 1466
1471 dwrq->flags = 0; 1467 dwrq->flags = 0;
@@ -1521,13 +1517,13 @@ static int wlan_get_encode(struct net_device *dev,
1521 1517
1522 dwrq->flags |= IW_ENCODE_NOKEY; 1518 dwrq->flags |= IW_ENCODE_NOKEY;
1523 1519
1524 lbs_pr_debug(1, "key:%02x:%02x:%02x:%02x:%02x:%02x keylen=%d\n", 1520 lbs_deb_wext("key: " MAC_FMT ", keylen %d\n",
1525 extra[0], extra[1], extra[2], 1521 extra[0], extra[1], extra[2],
1526 extra[3], extra[4], extra[5], dwrq->length); 1522 extra[3], extra[4], extra[5], dwrq->length);
1527 1523
1528 lbs_pr_debug(1, "Return flags=0x%x\n", dwrq->flags); 1524 lbs_deb_wext("return flags 0x%x\n", dwrq->flags);
1529 1525
1530 LEAVE(); 1526 lbs_deb_leave(LBS_DEB_WEXT);
1531 return 0; 1527 return 0;
1532} 1528}
1533 1529
@@ -1547,20 +1543,21 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
1547 u16 index, 1543 u16 index,
1548 int set_tx_key) 1544 int set_tx_key)
1549{ 1545{
1546 int ret = 0;
1550 struct WLAN_802_11_KEY *pkey; 1547 struct WLAN_802_11_KEY *pkey;
1551 1548
1552 ENTER(); 1549 lbs_deb_enter(LBS_DEB_WEXT);
1553 1550
1554 /* Paranoid validation of key index */ 1551 /* Paranoid validation of key index */
1555 if (index > 3) { 1552 if (index > 3) {
1556 LEAVE(); 1553 ret = -EINVAL;
1557 return -EINVAL; 1554 goto out;
1558 } 1555 }
1559 1556
1560 /* validate max key length */ 1557 /* validate max key length */
1561 if (key_length > KEY_LEN_WEP_104) { 1558 if (key_length > KEY_LEN_WEP_104) {
1562 LEAVE(); 1559 ret = -EINVAL;
1563 return -EINVAL; 1560 goto out;
1564 } 1561 }
1565 1562
1566 pkey = &assoc_req->wep_keys[index]; 1563 pkey = &assoc_req->wep_keys[index];
@@ -1578,17 +1575,18 @@ static int wlan_set_wep_key(struct assoc_request *assoc_req,
1578 if (set_tx_key) { 1575 if (set_tx_key) {
1579 /* Ensure the chosen key is valid */ 1576 /* Ensure the chosen key is valid */
1580 if (!pkey->len) { 1577 if (!pkey->len) {
1581 lbs_pr_debug(1, "key not set, so cannot enable it\n"); 1578 lbs_deb_wext("key not set, so cannot enable it\n");
1582 LEAVE(); 1579 ret = -EINVAL;
1583 return -EINVAL; 1580 goto out;
1584 } 1581 }
1585 assoc_req->wep_tx_keyidx = index; 1582 assoc_req->wep_tx_keyidx = index;
1586 } 1583 }
1587 1584
1588 assoc_req->secinfo.wep_enabled = 1; 1585 assoc_req->secinfo.wep_enabled = 1;
1589 1586
1590 LEAVE(); 1587out:
1591 return 0; 1588 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1589 return ret;
1592} 1590}
1593 1591
1594static int validate_key_index(u16 def_index, u16 raw_index, 1592static int validate_key_index(u16 def_index, u16 raw_index,
@@ -1644,7 +1642,7 @@ static int wlan_set_encode(struct net_device *dev,
1644 struct assoc_request * assoc_req; 1642 struct assoc_request * assoc_req;
1645 u16 is_default = 0, index = 0, set_tx_key = 0; 1643 u16 is_default = 0, index = 0, set_tx_key = 0;
1646 1644
1647 ENTER(); 1645 lbs_deb_enter(LBS_DEB_WEXT);
1648 1646
1649 mutex_lock(&adapter->lock); 1647 mutex_lock(&adapter->lock);
1650 assoc_req = wlan_get_association_request(adapter); 1648 assoc_req = wlan_get_association_request(adapter);
@@ -1696,7 +1694,7 @@ out:
1696 } 1694 }
1697 mutex_unlock(&adapter->lock); 1695 mutex_unlock(&adapter->lock);
1698 1696
1699 LEAVE(); 1697 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1700 return ret; 1698 return ret;
1701} 1699}
1702 1700
@@ -1720,7 +1718,7 @@ static int wlan_get_encodeext(struct net_device *dev,
1720 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; 1718 struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
1721 int index, max_key_len; 1719 int index, max_key_len;
1722 1720
1723 ENTER(); 1721 lbs_deb_enter(LBS_DEB_WEXT);
1724 1722
1725 max_key_len = dwrq->length - sizeof(*ext); 1723 max_key_len = dwrq->length - sizeof(*ext);
1726 if (max_key_len < 0) 1724 if (max_key_len < 0)
@@ -1783,7 +1781,7 @@ static int wlan_get_encodeext(struct net_device *dev,
1783 ret = 0; 1781 ret = 0;
1784 1782
1785out: 1783out:
1786 LEAVE(); 1784 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1787 return ret; 1785 return ret;
1788} 1786}
1789 1787
@@ -1808,7 +1806,7 @@ static int wlan_set_encodeext(struct net_device *dev,
1808 int alg = ext->alg; 1806 int alg = ext->alg;
1809 struct assoc_request * assoc_req; 1807 struct assoc_request * assoc_req;
1810 1808
1811 ENTER(); 1809 lbs_deb_enter(LBS_DEB_WEXT);
1812 1810
1813 mutex_lock(&adapter->lock); 1811 mutex_lock(&adapter->lock);
1814 assoc_req = wlan_get_association_request(adapter); 1812 assoc_req = wlan_get_association_request(adapter);
@@ -1863,8 +1861,8 @@ static int wlan_set_encodeext(struct net_device *dev,
1863 && (ext->key_len != KEY_LEN_WPA_TKIP)) 1861 && (ext->key_len != KEY_LEN_WPA_TKIP))
1864 || ((alg == IW_ENCODE_ALG_CCMP) 1862 || ((alg == IW_ENCODE_ALG_CCMP)
1865 && (ext->key_len != KEY_LEN_WPA_AES))) { 1863 && (ext->key_len != KEY_LEN_WPA_AES))) {
1866 lbs_pr_debug(1, "Invalid size %d for key of alg" 1864 lbs_deb_wext("invalid size %d for key of alg"
1867 "type %d.\n", 1865 "type %d\n",
1868 ext->key_len, 1866 ext->key_len,
1869 alg); 1867 alg);
1870 ret = -EINVAL; 1868 ret = -EINVAL;
@@ -1913,7 +1911,7 @@ out:
1913 } 1911 }
1914 mutex_unlock(&adapter->lock); 1912 mutex_unlock(&adapter->lock);
1915 1913
1916 LEAVE(); 1914 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1917 return ret; 1915 return ret;
1918} 1916}
1919 1917
@@ -1928,7 +1926,7 @@ static int wlan_set_genie(struct net_device *dev,
1928 int ret = 0; 1926 int ret = 0;
1929 struct assoc_request * assoc_req; 1927 struct assoc_request * assoc_req;
1930 1928
1931 ENTER(); 1929 lbs_deb_enter(LBS_DEB_WEXT);
1932 1930
1933 mutex_lock(&adapter->lock); 1931 mutex_lock(&adapter->lock);
1934 assoc_req = wlan_get_association_request(adapter); 1932 assoc_req = wlan_get_association_request(adapter);
@@ -1960,7 +1958,7 @@ out:
1960 } 1958 }
1961 mutex_unlock(&adapter->lock); 1959 mutex_unlock(&adapter->lock);
1962 1960
1963 LEAVE(); 1961 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1964 return ret; 1962 return ret;
1965} 1963}
1966 1964
@@ -1969,27 +1967,28 @@ static int wlan_get_genie(struct net_device *dev,
1969 struct iw_point *dwrq, 1967 struct iw_point *dwrq,
1970 char *extra) 1968 char *extra)
1971{ 1969{
1970 int ret = 0;
1972 wlan_private *priv = dev->priv; 1971 wlan_private *priv = dev->priv;
1973 wlan_adapter *adapter = priv->adapter; 1972 wlan_adapter *adapter = priv->adapter;
1974 1973
1975 ENTER(); 1974 lbs_deb_enter(LBS_DEB_WEXT);
1976 1975
1977 if (adapter->wpa_ie_len == 0) { 1976 if (adapter->wpa_ie_len == 0) {
1978 dwrq->length = 0; 1977 dwrq->length = 0;
1979 LEAVE(); 1978 goto out;
1980 return 0;
1981 } 1979 }
1982 1980
1983 if (dwrq->length < adapter->wpa_ie_len) { 1981 if (dwrq->length < adapter->wpa_ie_len) {
1984 LEAVE(); 1982 ret = -E2BIG;
1985 return -E2BIG; 1983 goto out;
1986 } 1984 }
1987 1985
1988 dwrq->length = adapter->wpa_ie_len; 1986 dwrq->length = adapter->wpa_ie_len;
1989 memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len); 1987 memcpy(extra, &adapter->wpa_ie[0], adapter->wpa_ie_len);
1990 1988
1991 LEAVE(); 1989out:
1992 return 0; 1990 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
1991 return ret;
1993} 1992}
1994 1993
1995 1994
@@ -2004,7 +2003,7 @@ static int wlan_set_auth(struct net_device *dev,
2004 int ret = 0; 2003 int ret = 0;
2005 int updated = 0; 2004 int updated = 0;
2006 2005
2007 ENTER(); 2006 lbs_deb_enter(LBS_DEB_WEXT);
2008 2007
2009 mutex_lock(&adapter->lock); 2008 mutex_lock(&adapter->lock);
2010 assoc_req = wlan_get_association_request(adapter); 2009 assoc_req = wlan_get_association_request(adapter);
@@ -2096,7 +2095,7 @@ out:
2096 } 2095 }
2097 mutex_unlock(&adapter->lock); 2096 mutex_unlock(&adapter->lock);
2098 2097
2099 LEAVE(); 2098 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2100 return ret; 2099 return ret;
2101} 2100}
2102 2101
@@ -2105,10 +2104,11 @@ static int wlan_get_auth(struct net_device *dev,
2105 struct iw_param *dwrq, 2104 struct iw_param *dwrq,
2106 char *extra) 2105 char *extra)
2107{ 2106{
2107 int ret = 0;
2108 wlan_private *priv = dev->priv; 2108 wlan_private *priv = dev->priv;
2109 wlan_adapter *adapter = priv->adapter; 2109 wlan_adapter *adapter = priv->adapter;
2110 2110
2111 ENTER(); 2111 lbs_deb_enter(LBS_DEB_WEXT);
2112 2112
2113 switch (dwrq->flags & IW_AUTH_INDEX) { 2113 switch (dwrq->flags & IW_AUTH_INDEX) {
2114 case IW_AUTH_WPA_VERSION: 2114 case IW_AUTH_WPA_VERSION:
@@ -2138,12 +2138,11 @@ static int wlan_get_auth(struct net_device *dev,
2138 break; 2138 break;
2139 2139
2140 default: 2140 default:
2141 LEAVE(); 2141 ret = -EOPNOTSUPP;
2142 return -EOPNOTSUPP;
2143 } 2142 }
2144 2143
2145 LEAVE(); 2144 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2146 return 0; 2145 return ret;
2147} 2146}
2148 2147
2149 2148
@@ -2156,7 +2155,7 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
2156 2155
2157 u16 dbm; 2156 u16 dbm;
2158 2157
2159 ENTER(); 2158 lbs_deb_enter(LBS_DEB_WEXT);
2160 2159
2161 if (vwrq->disabled) { 2160 if (vwrq->disabled) {
2162 wlan_radio_ioctl(priv, RADIO_OFF); 2161 wlan_radio_ioctl(priv, RADIO_OFF);
@@ -2177,14 +2176,14 @@ static int wlan_set_txpow(struct net_device *dev, struct iw_request_info *info,
2177 if (vwrq->fixed == 0) 2176 if (vwrq->fixed == 0)
2178 dbm = 0xffff; 2177 dbm = 0xffff;
2179 2178
2180 lbs_pr_debug(1, "<1>TXPOWER SET %d dbm.\n", dbm); 2179 lbs_deb_wext("txpower set %d dbm\n", dbm);
2181 2180
2182 ret = libertas_prepare_and_send_command(priv, 2181 ret = libertas_prepare_and_send_command(priv,
2183 cmd_802_11_rf_tx_power, 2182 cmd_802_11_rf_tx_power,
2184 cmd_act_tx_power_opt_set_low, 2183 cmd_act_tx_power_opt_set_low,
2185 cmd_option_waitforrsp, 0, (void *)&dbm); 2184 cmd_option_waitforrsp, 0, (void *)&dbm);
2186 2185
2187 LEAVE(); 2186 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2188 return ret; 2187 return ret;
2189} 2188}
2190 2189
@@ -2194,7 +2193,8 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
2194 wlan_private *priv = dev->priv; 2193 wlan_private *priv = dev->priv;
2195 wlan_adapter *adapter = priv->adapter; 2194 wlan_adapter *adapter = priv->adapter;
2196 2195
2197 ENTER(); 2196 lbs_deb_enter(LBS_DEB_WEXT);
2197
2198 /* 2198 /*
2199 * Note : if dwrq->flags != 0, we should get the relevant SSID from 2199 * Note : if dwrq->flags != 0, we should get the relevant SSID from
2200 * the SSID list... 2200 * the SSID list...
@@ -2224,7 +2224,7 @@ static int wlan_get_essid(struct net_device *dev, struct iw_request_info *info,
2224 2224
2225 dwrq->flags = 1; /* active */ 2225 dwrq->flags = 1; /* active */
2226 2226
2227 LEAVE(); 2227 lbs_deb_leave(LBS_DEB_WEXT);
2228 return 0; 2228 return 0;
2229} 2229}
2230 2230
@@ -2238,7 +2238,7 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
2238 struct assoc_request * assoc_req; 2238 struct assoc_request * assoc_req;
2239 int ssid_len = dwrq->length; 2239 int ssid_len = dwrq->length;
2240 2240
2241 ENTER(); 2241 lbs_deb_enter(LBS_DEB_WEXT);
2242 2242
2243 /* 2243 /*
2244 * WE-20 and earlier NULL pad the end of the SSID and increment 2244 * WE-20 and earlier NULL pad the end of the SSID and increment
@@ -2264,7 +2264,7 @@ static int wlan_set_essid(struct net_device *dev, struct iw_request_info *info,
2264 ssid.ssidlength = ssid_len; 2264 ssid.ssidlength = ssid_len;
2265 } 2265 }
2266 2266
2267 lbs_pr_debug(1, "Requested new SSID = %s\n", 2267 lbs_deb_wext("requested new SSID '%s'\n",
2268 (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any"); 2268 (ssid.ssidlength > 0) ? (char *)ssid.ssid : "any");
2269 2269
2270out: 2270out:
@@ -2289,7 +2289,7 @@ out:
2289 2289
2290 mutex_unlock(&adapter->lock); 2290 mutex_unlock(&adapter->lock);
2291 2291
2292 LEAVE(); 2292 lbs_deb_leave_args(LBS_DEB_WEXT, "ret %d", ret);
2293 return ret; 2293 return ret;
2294} 2294}
2295 2295
@@ -2310,12 +2310,12 @@ static int wlan_set_wap(struct net_device *dev, struct iw_request_info *info,
2310 struct assoc_request * assoc_req; 2310 struct assoc_request * assoc_req;
2311 int ret = 0; 2311 int ret = 0;
2312 2312
2313 ENTER(); 2313 lbs_deb_enter(LBS_DEB_WEXT);
2314 2314
2315 if (awrq->sa_family != ARPHRD_ETHER) 2315 if (awrq->sa_family != ARPHRD_ETHER)
2316 return -EINVAL; 2316 return -EINVAL;
2317 2317
2318 lbs_pr_debug(1, "ASSOC: WAP: sa_data: " MAC_FMT "\n", MAC_ARG(awrq->sa_data)); 2318 lbs_deb_wext("ASSOC: WAP: sa_data " MAC_FMT "\n", MAC_ARG(awrq->sa_data));
2319 2319
2320 mutex_lock(&adapter->lock); 2320 mutex_lock(&adapter->lock);
2321 2321