aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cmd.c
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/libertas/cmd.c
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/libertas/cmd.c')
-rw-r--r--drivers/net/wireless/libertas/cmd.c249
1 files changed, 124 insertions, 125 deletions
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}