aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/libertas/debugfs.c')
-rw-r--r--drivers/net/wireless/libertas/debugfs.c334
1 files changed, 162 insertions, 172 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c
index debefb6eab77..b62ebca9ab6d 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -103,7 +103,6 @@ static ssize_t libertas_sleepparams_write(struct file *file,
103 wlan_private *priv = file->private_data; 103 wlan_private *priv = file->private_data;
104 ssize_t buf_size, res; 104 ssize_t buf_size, res;
105 int p1, p2, p3, p4, p5, p6; 105 int p1, p2, p3, p4, p5, p6;
106 struct sleep_params sp;
107 unsigned long addr = get_zeroed_page(GFP_KERNEL); 106 unsigned long addr = get_zeroed_page(GFP_KERNEL);
108 char *buf = (char *)addr; 107 char *buf = (char *)addr;
109 108
@@ -117,14 +116,12 @@ static ssize_t libertas_sleepparams_write(struct file *file,
117 res = -EFAULT; 116 res = -EFAULT;
118 goto out_unlock; 117 goto out_unlock;
119 } 118 }
120 sp.sp_error = p1; 119 priv->adapter->sp.sp_error = p1;
121 sp.sp_offset = p2; 120 priv->adapter->sp.sp_offset = p2;
122 sp.sp_stabletime = p3; 121 priv->adapter->sp.sp_stabletime = p3;
123 sp.sp_calcontrol = p4; 122 priv->adapter->sp.sp_calcontrol = p4;
124 sp.sp_extsleepclk = p5; 123 priv->adapter->sp.sp_extsleepclk = p5;
125 sp.sp_reserved = p6; 124 priv->adapter->sp.sp_reserved = p6;
126
127 memcpy(&priv->adapter->sp, &sp, sizeof(struct sleep_params));
128 125
129 res = libertas_prepare_and_send_command(priv, 126 res = libertas_prepare_and_send_command(priv,
130 cmd_802_11_sleep_params, 127 cmd_802_11_sleep_params,
@@ -408,8 +405,8 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf,
408 (*cmdnode)->cmdflags |= CMD_F_HOSTCMD; 405 (*cmdnode)->cmdflags |= CMD_F_HOSTCMD;
409 (*cmdnode)->cmdwaitqwoken = 0; 406 (*cmdnode)->cmdwaitqwoken = 0;
410 *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr; 407 *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr;
411 (*cmd)->command = cmd_802_11_subscribe_event; 408 (*cmd)->command = cpu_to_le16(cmd_802_11_subscribe_event);
412 (*cmd)->seqnum = ++priv->adapter->seqnum; 409 (*cmd)->seqnum = cpu_to_le16(++priv->adapter->seqnum);
413 (*cmd)->result = 0; 410 (*cmd)->result = 0;
414 return 0; 411 return 0;
415} 412}
@@ -435,26 +432,25 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
435 } 432 }
436 433
437 event = &pcmdptr->params.subscribe_event; 434 event = &pcmdptr->params.subscribe_event;
438 event->action = cmd_act_get; 435 event->action = cpu_to_le16(cmd_act_get);
439 pcmdptr->size = 436 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
440 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
441 libertas_queue_cmd(adapter, pcmdnode, 1); 437 libertas_queue_cmd(adapter, pcmdnode, 1);
442 wake_up_interruptible(&priv->mainthread.waitq); 438 wake_up_interruptible(&priv->mainthread.waitq);
443 439
444 /* Sleep until response is generated by FW */ 440 /* Sleep until response is generated by FW */
445 wait_event_interruptible(pcmdnode->cmdwait_q, 441 wait_event_interruptible(pcmdnode->cmdwait_q,
446 pcmdnode->cmdwaitqwoken); 442 pcmdnode->cmdwaitqwoken);
447 443
448 pcmdptr = response_buf; 444 pcmdptr = response_buf;
449 if (pcmdptr->result) { 445 if (pcmdptr->result) {
450 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 446 lbs_pr_err("%s: fail, result=%d\n", __func__,
451 pcmdptr->result); 447 le16_to_cpu(pcmdptr->result));
452 kfree(response_buf); 448 kfree(response_buf);
453 free_page(addr); 449 free_page(addr);
454 return 0; 450 return 0;
455 } 451 }
456 452
457 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 453 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
458 lbs_pr_err("command response incorrect!\n"); 454 lbs_pr_err("command response incorrect!\n");
459 kfree(response_buf); 455 kfree(response_buf);
460 free_page(addr); 456 free_page(addr);
@@ -462,17 +458,17 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf,
462 } 458 }
463 459
464 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 460 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
465 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 461 event = (void *)(response_buf + S_DS_GEN);
466 while (cmd_len < pcmdptr->size) { 462 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
467 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 463 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
468 switch(header->type) { 464 switch (header->type) {
469 struct mrvlietypes_rssithreshold *Lowrssi; 465 struct mrvlietypes_rssithreshold *Lowrssi;
470 case TLV_TYPE_RSSI_LOW: 466 case __constant_cpu_to_le16(TLV_TYPE_RSSI_LOW):
471 Lowrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); 467 Lowrssi = (void *)(response_buf + cmd_len);
472 pos += snprintf(buf+pos, len-pos, "%d %d %d\n", 468 pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
473 Lowrssi->rssivalue, 469 Lowrssi->rssivalue,
474 Lowrssi->rssifreq, 470 Lowrssi->rssifreq,
475 (event->events & 0x0001)?1:0); 471 (event->events & cpu_to_le16(0x0001))?1:0);
476 default: 472 default:
477 cmd_len += sizeof(struct mrvlietypes_snrthreshold); 473 cmd_len += sizeof(struct mrvlietypes_snrthreshold);
478 break; 474 break;
@@ -500,21 +496,20 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
500 return res; 496 return res;
501 497
502 event = &pcmdptr->params.subscribe_event; 498 event = &pcmdptr->params.subscribe_event;
503 event->action = cmd_act_get; 499 event->action = cpu_to_le16(cmd_act_get);
504 pcmdptr->size = 500 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
505 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
506 libertas_queue_cmd(adapter, pcmdnode, 1); 501 libertas_queue_cmd(adapter, pcmdnode, 1);
507 wake_up_interruptible(&priv->mainthread.waitq); 502 wake_up_interruptible(&priv->mainthread.waitq);
508 503
509 /* Sleep until response is generated by FW */ 504 /* Sleep until response is generated by FW */
510 wait_event_interruptible(pcmdnode->cmdwait_q, 505 wait_event_interruptible(pcmdnode->cmdwait_q,
511 pcmdnode->cmdwaitqwoken); 506 pcmdnode->cmdwaitqwoken);
512 507
513 pcmdptr = response_buf; 508 pcmdptr = response_buf;
514 509
515 if (pcmdptr->result) { 510 if (pcmdptr->result) {
516 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 511 lbs_pr_err("%s: fail, result=%d\n", __func__,
517 pcmdptr->result); 512 le16_to_cpu(pcmdptr->result));
518 kfree(response_buf); 513 kfree(response_buf);
519 return 0; 514 return 0;
520 } 515 }
@@ -526,7 +521,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv)
526 } 521 }
527 522
528 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 523 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN);
529 event_bitmap = event->events; 524 event_bitmap = le16_to_cpu(event->events);
530 kfree(response_buf); 525 kfree(response_buf);
531 return event_bitmap; 526 return event_bitmap;
532} 527}
@@ -567,7 +562,7 @@ static ssize_t libertas_lowrssi_write(struct file *file,
567 goto out_unlock; 562 goto out_unlock;
568 563
569 event = &pcmdptr->params.subscribe_event; 564 event = &pcmdptr->params.subscribe_event;
570 event->action = cmd_act_set; 565 event->action = cpu_to_le16(cmd_act_set);
571 pcmdptr->size = cpu_to_le16(S_DS_GEN + 566 pcmdptr->size = cpu_to_le16(S_DS_GEN +
572 sizeof(struct cmd_ds_802_11_subscribe_event) + 567 sizeof(struct cmd_ds_802_11_subscribe_event) +
573 sizeof(struct mrvlietypes_rssithreshold)); 568 sizeof(struct mrvlietypes_rssithreshold));
@@ -576,30 +571,30 @@ static ssize_t libertas_lowrssi_write(struct file *file,
576 ptr = (u8*) pcmdptr+cmd_len; 571 ptr = (u8*) pcmdptr+cmd_len;
577 rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); 572 rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
578 rssi_threshold->header.type = cpu_to_le16(0x0104); 573 rssi_threshold->header.type = cpu_to_le16(0x0104);
579 rssi_threshold->header.len = 2; 574 rssi_threshold->header.len = cpu_to_le16(2);
580 rssi_threshold->rssivalue = cpu_to_le16(value); 575 rssi_threshold->rssivalue = value;
581 rssi_threshold->rssifreq = cpu_to_le16(freq); 576 rssi_threshold->rssifreq = freq;
582 event_bitmap |= subscribed ? 0x0001 : 0x0; 577 event_bitmap |= subscribed ? 0x0001 : 0x0;
583 event->events = event_bitmap; 578 event->events = cpu_to_le16(event_bitmap);
584 579
585 libertas_queue_cmd(adapter, pcmdnode, 1); 580 libertas_queue_cmd(adapter, pcmdnode, 1);
586 wake_up_interruptible(&priv->mainthread.waitq); 581 wake_up_interruptible(&priv->mainthread.waitq);
587 582
588 /* Sleep until response is generated by FW */ 583 /* Sleep until response is generated by FW */
589 wait_event_interruptible(pcmdnode->cmdwait_q, 584 wait_event_interruptible(pcmdnode->cmdwait_q,
590 pcmdnode->cmdwaitqwoken); 585 pcmdnode->cmdwaitqwoken);
591 586
592 pcmdptr = response_buf; 587 pcmdptr = response_buf;
593 588
594 if (pcmdptr->result) { 589 if (pcmdptr->result) {
595 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 590 lbs_pr_err("%s: fail, result=%d\n", __func__,
596 pcmdptr->result); 591 le16_to_cpu(pcmdptr->result));
597 kfree(response_buf); 592 kfree(response_buf);
598 free_page(addr); 593 free_page(addr);
599 return 0; 594 return 0;
600 } 595 }
601 596
602 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 597 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
603 lbs_pr_err("command response incorrect!\n"); 598 lbs_pr_err("command response incorrect!\n");
604 kfree(response_buf); 599 kfree(response_buf);
605 free_page(addr); 600 free_page(addr);
@@ -633,27 +628,26 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
633 } 628 }
634 629
635 event = &pcmdptr->params.subscribe_event; 630 event = &pcmdptr->params.subscribe_event;
636 event->action = cmd_act_get; 631 event->action = cpu_to_le16(cmd_act_get);
637 pcmdptr->size = 632 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
638 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
639 libertas_queue_cmd(adapter, pcmdnode, 1); 633 libertas_queue_cmd(adapter, pcmdnode, 1);
640 wake_up_interruptible(&priv->mainthread.waitq); 634 wake_up_interruptible(&priv->mainthread.waitq);
641 635
642 /* Sleep until response is generated by FW */ 636 /* Sleep until response is generated by FW */
643 wait_event_interruptible(pcmdnode->cmdwait_q, 637 wait_event_interruptible(pcmdnode->cmdwait_q,
644 pcmdnode->cmdwaitqwoken); 638 pcmdnode->cmdwaitqwoken);
645 639
646 pcmdptr = response_buf; 640 pcmdptr = response_buf;
647 641
648 if (pcmdptr->result) { 642 if (pcmdptr->result) {
649 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 643 lbs_pr_err("%s: fail, result=%d\n", __func__,
650 pcmdptr->result); 644 le16_to_cpu(pcmdptr->result));
651 kfree(response_buf); 645 kfree(response_buf);
652 free_page(addr); 646 free_page(addr);
653 return 0; 647 return 0;
654 } 648 }
655 649
656 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 650 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
657 lbs_pr_err("command response incorrect!\n"); 651 lbs_pr_err("command response incorrect!\n");
658 kfree(response_buf); 652 kfree(response_buf);
659 free_page(addr); 653 free_page(addr);
@@ -661,17 +655,17 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf,
661 } 655 }
662 656
663 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 657 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
664 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 658 event = (void *)(response_buf + S_DS_GEN);
665 while (cmd_len < pcmdptr->size) { 659 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
666 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 660 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
667 switch(header->type) { 661 switch (header->type) {
668 struct mrvlietypes_snrthreshold *LowSnr; 662 struct mrvlietypes_snrthreshold *LowSnr;
669 case TLV_TYPE_SNR_LOW: 663 case __constant_cpu_to_le16(TLV_TYPE_SNR_LOW):
670 LowSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); 664 LowSnr = (void *)(response_buf + cmd_len);
671 pos += snprintf(buf+pos, len-pos, "%d %d %d\n", 665 pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
672 LowSnr->snrvalue, 666 LowSnr->snrvalue,
673 LowSnr->snrfreq, 667 LowSnr->snrfreq,
674 (event->events & 0x0002)?1:0); 668 (event->events & cpu_to_le16(0x0002))?1:0);
675 default: 669 default:
676 cmd_len += sizeof(struct mrvlietypes_snrthreshold); 670 cmd_len += sizeof(struct mrvlietypes_snrthreshold);
677 break; 671 break;
@@ -721,7 +715,7 @@ static ssize_t libertas_lowsnr_write(struct file *file,
721 goto out_unlock; 715 goto out_unlock;
722 716
723 event = &pcmdptr->params.subscribe_event; 717 event = &pcmdptr->params.subscribe_event;
724 event->action = cmd_act_set; 718 event->action = cpu_to_le16(cmd_act_set);
725 pcmdptr->size = cpu_to_le16(S_DS_GEN + 719 pcmdptr->size = cpu_to_le16(S_DS_GEN +
726 sizeof(struct cmd_ds_802_11_subscribe_event) + 720 sizeof(struct cmd_ds_802_11_subscribe_event) +
727 sizeof(struct mrvlietypes_snrthreshold)); 721 sizeof(struct mrvlietypes_snrthreshold));
@@ -729,30 +723,30 @@ static ssize_t libertas_lowsnr_write(struct file *file,
729 ptr = (u8*) pcmdptr+cmd_len; 723 ptr = (u8*) pcmdptr+cmd_len;
730 snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); 724 snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
731 snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW); 725 snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW);
732 snr_threshold->header.len = 2; 726 snr_threshold->header.len = cpu_to_le16(2);
733 snr_threshold->snrvalue = cpu_to_le16(value); 727 snr_threshold->snrvalue = value;
734 snr_threshold->snrfreq = cpu_to_le16(freq); 728 snr_threshold->snrfreq = freq;
735 event_bitmap |= subscribed ? 0x0002 : 0x0; 729 event_bitmap |= subscribed ? 0x0002 : 0x0;
736 event->events = event_bitmap; 730 event->events = cpu_to_le16(event_bitmap);
737 731
738 libertas_queue_cmd(adapter, pcmdnode, 1); 732 libertas_queue_cmd(adapter, pcmdnode, 1);
739 wake_up_interruptible(&priv->mainthread.waitq); 733 wake_up_interruptible(&priv->mainthread.waitq);
740 734
741 /* Sleep until response is generated by FW */ 735 /* Sleep until response is generated by FW */
742 wait_event_interruptible(pcmdnode->cmdwait_q, 736 wait_event_interruptible(pcmdnode->cmdwait_q,
743 pcmdnode->cmdwaitqwoken); 737 pcmdnode->cmdwaitqwoken);
744 738
745 pcmdptr = response_buf; 739 pcmdptr = response_buf;
746 740
747 if (pcmdptr->result) { 741 if (pcmdptr->result) {
748 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 742 lbs_pr_err("%s: fail, result=%d\n", __func__,
749 pcmdptr->result); 743 le16_to_cpu(pcmdptr->result));
750 kfree(response_buf); 744 kfree(response_buf);
751 free_page(addr); 745 free_page(addr);
752 return 0; 746 return 0;
753 } 747 }
754 748
755 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 749 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
756 lbs_pr_err("command response incorrect!\n"); 750 lbs_pr_err("command response incorrect!\n");
757 kfree(response_buf); 751 kfree(response_buf);
758 free_page(addr); 752 free_page(addr);
@@ -787,27 +781,26 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
787 } 781 }
788 782
789 event = &pcmdptr->params.subscribe_event; 783 event = &pcmdptr->params.subscribe_event;
790 event->action = cmd_act_get; 784 event->action = cpu_to_le16(cmd_act_get);
791 pcmdptr->size = 785 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
792 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
793 libertas_queue_cmd(adapter, pcmdnode, 1); 786 libertas_queue_cmd(adapter, pcmdnode, 1);
794 wake_up_interruptible(&priv->mainthread.waitq); 787 wake_up_interruptible(&priv->mainthread.waitq);
795 788
796 /* Sleep until response is generated by FW */ 789 /* Sleep until response is generated by FW */
797 wait_event_interruptible(pcmdnode->cmdwait_q, 790 wait_event_interruptible(pcmdnode->cmdwait_q,
798 pcmdnode->cmdwaitqwoken); 791 pcmdnode->cmdwaitqwoken);
799 792
800 pcmdptr = response_buf; 793 pcmdptr = response_buf;
801 794
802 if (pcmdptr->result) { 795 if (pcmdptr->result) {
803 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 796 lbs_pr_err("%s: fail, result=%d\n", __func__,
804 pcmdptr->result); 797 le16_to_cpu(pcmdptr->result));
805 kfree(response_buf); 798 kfree(response_buf);
806 free_page(addr); 799 free_page(addr);
807 return 0; 800 return 0;
808 } 801 }
809 802
810 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 803 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
811 lbs_pr_err("command response incorrect!\n"); 804 lbs_pr_err("command response incorrect!\n");
812 kfree(response_buf); 805 kfree(response_buf);
813 free_page(addr); 806 free_page(addr);
@@ -815,17 +808,17 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf,
815 } 808 }
816 809
817 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 810 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
818 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 811 event = (void *)(response_buf + S_DS_GEN);
819 while (cmd_len < pcmdptr->size) { 812 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
820 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 813 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
821 switch(header->type) { 814 switch (header->type) {
822 struct mrvlietypes_failurecount *failcount; 815 struct mrvlietypes_failurecount *failcount;
823 case TLV_TYPE_FAILCOUNT: 816 case __constant_cpu_to_le16(TLV_TYPE_FAILCOUNT):
824 failcount = (struct mrvlietypes_failurecount *)(response_buf + cmd_len); 817 failcount = (void *)(response_buf + cmd_len);
825 pos += snprintf(buf+pos, len-pos, "%d %d %d\n", 818 pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
826 failcount->failvalue, 819 failcount->failvalue,
827 failcount->Failfreq, 820 failcount->Failfreq,
828 (event->events & 0x0004)?1:0); 821 (event->events & cpu_to_le16(0x0004))?1:0);
829 default: 822 default:
830 cmd_len += sizeof(struct mrvlietypes_failurecount); 823 cmd_len += sizeof(struct mrvlietypes_failurecount);
831 break; 824 break;
@@ -874,7 +867,7 @@ static ssize_t libertas_failcount_write(struct file *file,
874 goto out_unlock; 867 goto out_unlock;
875 868
876 event = &pcmdptr->params.subscribe_event; 869 event = &pcmdptr->params.subscribe_event;
877 event->action = cmd_act_set; 870 event->action = cpu_to_le16(cmd_act_set);
878 pcmdptr->size = cpu_to_le16(S_DS_GEN + 871 pcmdptr->size = cpu_to_le16(S_DS_GEN +
879 sizeof(struct cmd_ds_802_11_subscribe_event) + 872 sizeof(struct cmd_ds_802_11_subscribe_event) +
880 sizeof(struct mrvlietypes_failurecount)); 873 sizeof(struct mrvlietypes_failurecount));
@@ -882,30 +875,30 @@ static ssize_t libertas_failcount_write(struct file *file,
882 ptr = (u8*) pcmdptr+cmd_len; 875 ptr = (u8*) pcmdptr+cmd_len;
883 failcount = (struct mrvlietypes_failurecount *)(ptr); 876 failcount = (struct mrvlietypes_failurecount *)(ptr);
884 failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT); 877 failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT);
885 failcount->header.len = 2; 878 failcount->header.len = cpu_to_le16(2);
886 failcount->failvalue = cpu_to_le16(value); 879 failcount->failvalue = value;
887 failcount->Failfreq = cpu_to_le16(freq); 880 failcount->Failfreq = freq;
888 event_bitmap |= subscribed ? 0x0004 : 0x0; 881 event_bitmap |= subscribed ? 0x0004 : 0x0;
889 event->events = event_bitmap; 882 event->events = cpu_to_le16(event_bitmap);
890 883
891 libertas_queue_cmd(adapter, pcmdnode, 1); 884 libertas_queue_cmd(adapter, pcmdnode, 1);
892 wake_up_interruptible(&priv->mainthread.waitq); 885 wake_up_interruptible(&priv->mainthread.waitq);
893 886
894 /* Sleep until response is generated by FW */ 887 /* Sleep until response is generated by FW */
895 wait_event_interruptible(pcmdnode->cmdwait_q, 888 wait_event_interruptible(pcmdnode->cmdwait_q,
896 pcmdnode->cmdwaitqwoken); 889 pcmdnode->cmdwaitqwoken);
897 890
898 pcmdptr = (struct cmd_ds_command *)response_buf; 891 pcmdptr = (struct cmd_ds_command *)response_buf;
899 892
900 if (pcmdptr->result) { 893 if (pcmdptr->result) {
901 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 894 lbs_pr_err("%s: fail, result=%d\n", __func__,
902 pcmdptr->result); 895 le16_to_cpu(pcmdptr->result));
903 kfree(response_buf); 896 kfree(response_buf);
904 free_page(addr); 897 free_page(addr);
905 return 0; 898 return 0;
906 } 899 }
907 900
908 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 901 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
909 lbs_pr_err("command response incorrect!\n"); 902 lbs_pr_err("command response incorrect!\n");
910 kfree(response_buf); 903 kfree(response_buf);
911 free_page(addr); 904 free_page(addr);
@@ -939,27 +932,26 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
939 } 932 }
940 933
941 event = &pcmdptr->params.subscribe_event; 934 event = &pcmdptr->params.subscribe_event;
942 event->action = cmd_act_get; 935 event->action = cpu_to_le16(cmd_act_get);
943 pcmdptr->size = 936 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
944 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
945 libertas_queue_cmd(adapter, pcmdnode, 1); 937 libertas_queue_cmd(adapter, pcmdnode, 1);
946 wake_up_interruptible(&priv->mainthread.waitq); 938 wake_up_interruptible(&priv->mainthread.waitq);
947 939
948 /* Sleep until response is generated by FW */ 940 /* Sleep until response is generated by FW */
949 wait_event_interruptible(pcmdnode->cmdwait_q, 941 wait_event_interruptible(pcmdnode->cmdwait_q,
950 pcmdnode->cmdwaitqwoken); 942 pcmdnode->cmdwaitqwoken);
951 943
952 pcmdptr = response_buf; 944 pcmdptr = response_buf;
953 945
954 if (pcmdptr->result) { 946 if (pcmdptr->result) {
955 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 947 lbs_pr_err("%s: fail, result=%d\n", __func__,
956 pcmdptr->result); 948 le16_to_cpu(pcmdptr->result));
957 free_page(addr); 949 free_page(addr);
958 kfree(response_buf); 950 kfree(response_buf);
959 return 0; 951 return 0;
960 } 952 }
961 953
962 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 954 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
963 lbs_pr_err("command response incorrect!\n"); 955 lbs_pr_err("command response incorrect!\n");
964 free_page(addr); 956 free_page(addr);
965 kfree(response_buf); 957 kfree(response_buf);
@@ -967,16 +959,16 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf,
967 } 959 }
968 960
969 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 961 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
970 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 962 event = (void *)(response_buf + S_DS_GEN);
971 while (cmd_len < pcmdptr->size) { 963 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
972 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 964 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
973 switch(header->type) { 965 switch (header->type) {
974 struct mrvlietypes_beaconsmissed *bcnmiss; 966 struct mrvlietypes_beaconsmissed *bcnmiss;
975 case TLV_TYPE_BCNMISS: 967 case __constant_cpu_to_le16(TLV_TYPE_BCNMISS):
976 bcnmiss = (struct mrvlietypes_beaconsmissed *)(response_buf + cmd_len); 968 bcnmiss = (void *)(response_buf + cmd_len);
977 pos += snprintf(buf+pos, len-pos, "%d N/A %d\n", 969 pos += snprintf(buf+pos, len-pos, "%d N/A %d\n",
978 bcnmiss->beaconmissed, 970 bcnmiss->beaconmissed,
979 (event->events & 0x0008)?1:0); 971 (event->events & cpu_to_le16(0x0008))?1:0);
980 default: 972 default:
981 cmd_len += sizeof(struct mrvlietypes_beaconsmissed); 973 cmd_len += sizeof(struct mrvlietypes_beaconsmissed);
982 break; 974 break;
@@ -1026,7 +1018,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
1026 goto out_unlock; 1018 goto out_unlock;
1027 1019
1028 event = &pcmdptr->params.subscribe_event; 1020 event = &pcmdptr->params.subscribe_event;
1029 event->action = cmd_act_set; 1021 event->action = cpu_to_le16(cmd_act_set);
1030 pcmdptr->size = cpu_to_le16(S_DS_GEN + 1022 pcmdptr->size = cpu_to_le16(S_DS_GEN +
1031 sizeof(struct cmd_ds_802_11_subscribe_event) + 1023 sizeof(struct cmd_ds_802_11_subscribe_event) +
1032 sizeof(struct mrvlietypes_beaconsmissed)); 1024 sizeof(struct mrvlietypes_beaconsmissed));
@@ -1034,29 +1026,29 @@ static ssize_t libertas_bcnmiss_write(struct file *file,
1034 ptr = (u8*) pcmdptr+cmd_len; 1026 ptr = (u8*) pcmdptr+cmd_len;
1035 bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr); 1027 bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr);
1036 bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS); 1028 bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS);
1037 bcnmiss->header.len = 2; 1029 bcnmiss->header.len = cpu_to_le16(2);
1038 bcnmiss->beaconmissed = cpu_to_le16(value); 1030 bcnmiss->beaconmissed = value;
1039 event_bitmap |= subscribed ? 0x0008 : 0x0; 1031 event_bitmap |= subscribed ? 0x0008 : 0x0;
1040 event->events = event_bitmap; 1032 event->events = cpu_to_le16(event_bitmap);
1041 1033
1042 libertas_queue_cmd(adapter, pcmdnode, 1); 1034 libertas_queue_cmd(adapter, pcmdnode, 1);
1043 wake_up_interruptible(&priv->mainthread.waitq); 1035 wake_up_interruptible(&priv->mainthread.waitq);
1044 1036
1045 /* Sleep until response is generated by FW */ 1037 /* Sleep until response is generated by FW */
1046 wait_event_interruptible(pcmdnode->cmdwait_q, 1038 wait_event_interruptible(pcmdnode->cmdwait_q,
1047 pcmdnode->cmdwaitqwoken); 1039 pcmdnode->cmdwaitqwoken);
1048 1040
1049 pcmdptr = response_buf; 1041 pcmdptr = response_buf;
1050 1042
1051 if (pcmdptr->result) { 1043 if (pcmdptr->result) {
1052 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 1044 lbs_pr_err("%s: fail, result=%d\n", __func__,
1053 pcmdptr->result); 1045 le16_to_cpu(pcmdptr->result));
1054 kfree(response_buf); 1046 kfree(response_buf);
1055 free_page(addr); 1047 free_page(addr);
1056 return 0; 1048 return 0;
1057 } 1049 }
1058 1050
1059 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 1051 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
1060 lbs_pr_err("command response incorrect!\n"); 1052 lbs_pr_err("command response incorrect!\n");
1061 free_page(addr); 1053 free_page(addr);
1062 kfree(response_buf); 1054 kfree(response_buf);
@@ -1090,27 +1082,26 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
1090 } 1082 }
1091 1083
1092 event = &pcmdptr->params.subscribe_event; 1084 event = &pcmdptr->params.subscribe_event;
1093 event->action = cmd_act_get; 1085 event->action = cpu_to_le16(cmd_act_get);
1094 pcmdptr->size = 1086 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
1095 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
1096 libertas_queue_cmd(adapter, pcmdnode, 1); 1087 libertas_queue_cmd(adapter, pcmdnode, 1);
1097 wake_up_interruptible(&priv->mainthread.waitq); 1088 wake_up_interruptible(&priv->mainthread.waitq);
1098 1089
1099 /* Sleep until response is generated by FW */ 1090 /* Sleep until response is generated by FW */
1100 wait_event_interruptible(pcmdnode->cmdwait_q, 1091 wait_event_interruptible(pcmdnode->cmdwait_q,
1101 pcmdnode->cmdwaitqwoken); 1092 pcmdnode->cmdwaitqwoken);
1102 1093
1103 pcmdptr = response_buf; 1094 pcmdptr = response_buf;
1104 1095
1105 if (pcmdptr->result) { 1096 if (pcmdptr->result) {
1106 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 1097 lbs_pr_err("%s: fail, result=%d\n", __func__,
1107 pcmdptr->result); 1098 le16_to_cpu(pcmdptr->result));
1108 kfree(response_buf); 1099 kfree(response_buf);
1109 free_page(addr); 1100 free_page(addr);
1110 return 0; 1101 return 0;
1111 } 1102 }
1112 1103
1113 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 1104 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
1114 lbs_pr_err("command response incorrect!\n"); 1105 lbs_pr_err("command response incorrect!\n");
1115 kfree(response_buf); 1106 kfree(response_buf);
1116 free_page(addr); 1107 free_page(addr);
@@ -1118,17 +1109,17 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf,
1118 } 1109 }
1119 1110
1120 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 1111 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
1121 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 1112 event = (void *)(response_buf + S_DS_GEN);
1122 while (cmd_len < pcmdptr->size) { 1113 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
1123 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 1114 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
1124 switch(header->type) { 1115 switch (header->type) {
1125 struct mrvlietypes_rssithreshold *Highrssi; 1116 struct mrvlietypes_rssithreshold *Highrssi;
1126 case TLV_TYPE_RSSI_HIGH: 1117 case __constant_cpu_to_le16(TLV_TYPE_RSSI_HIGH):
1127 Highrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); 1118 Highrssi = (void *)(response_buf + cmd_len);
1128 pos += snprintf(buf+pos, len-pos, "%d %d %d\n", 1119 pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
1129 Highrssi->rssivalue, 1120 Highrssi->rssivalue,
1130 Highrssi->rssifreq, 1121 Highrssi->rssifreq,
1131 (event->events & 0x0010)?1:0); 1122 (event->events & cpu_to_le16(0x0010))?1:0);
1132 default: 1123 default:
1133 cmd_len += sizeof(struct mrvlietypes_snrthreshold); 1124 cmd_len += sizeof(struct mrvlietypes_snrthreshold);
1134 break; 1125 break;
@@ -1178,7 +1169,7 @@ static ssize_t libertas_highrssi_write(struct file *file,
1178 goto out_unlock; 1169 goto out_unlock;
1179 1170
1180 event = &pcmdptr->params.subscribe_event; 1171 event = &pcmdptr->params.subscribe_event;
1181 event->action = cmd_act_set; 1172 event->action = cpu_to_le16(cmd_act_set);
1182 pcmdptr->size = cpu_to_le16(S_DS_GEN + 1173 pcmdptr->size = cpu_to_le16(S_DS_GEN +
1183 sizeof(struct cmd_ds_802_11_subscribe_event) + 1174 sizeof(struct cmd_ds_802_11_subscribe_event) +
1184 sizeof(struct mrvlietypes_rssithreshold)); 1175 sizeof(struct mrvlietypes_rssithreshold));
@@ -1186,29 +1177,29 @@ static ssize_t libertas_highrssi_write(struct file *file,
1186 ptr = (u8*) pcmdptr+cmd_len; 1177 ptr = (u8*) pcmdptr+cmd_len;
1187 rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); 1178 rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr);
1188 rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH); 1179 rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH);
1189 rssi_threshold->header.len = 2; 1180 rssi_threshold->header.len = cpu_to_le16(2);
1190 rssi_threshold->rssivalue = cpu_to_le16(value); 1181 rssi_threshold->rssivalue = value;
1191 rssi_threshold->rssifreq = cpu_to_le16(freq); 1182 rssi_threshold->rssifreq = freq;
1192 event_bitmap |= subscribed ? 0x0010 : 0x0; 1183 event_bitmap |= subscribed ? 0x0010 : 0x0;
1193 event->events = event_bitmap; 1184 event->events = cpu_to_le16(event_bitmap);
1194 1185
1195 libertas_queue_cmd(adapter, pcmdnode, 1); 1186 libertas_queue_cmd(adapter, pcmdnode, 1);
1196 wake_up_interruptible(&priv->mainthread.waitq); 1187 wake_up_interruptible(&priv->mainthread.waitq);
1197 1188
1198 /* Sleep until response is generated by FW */ 1189 /* Sleep until response is generated by FW */
1199 wait_event_interruptible(pcmdnode->cmdwait_q, 1190 wait_event_interruptible(pcmdnode->cmdwait_q,
1200 pcmdnode->cmdwaitqwoken); 1191 pcmdnode->cmdwaitqwoken);
1201 1192
1202 pcmdptr = response_buf; 1193 pcmdptr = response_buf;
1203 1194
1204 if (pcmdptr->result) { 1195 if (pcmdptr->result) {
1205 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 1196 lbs_pr_err("%s: fail, result=%d\n", __func__,
1206 pcmdptr->result); 1197 le16_to_cpu(pcmdptr->result));
1207 kfree(response_buf); 1198 kfree(response_buf);
1208 return 0; 1199 return 0;
1209 } 1200 }
1210 1201
1211 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 1202 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
1212 lbs_pr_err("command response incorrect!\n"); 1203 lbs_pr_err("command response incorrect!\n");
1213 kfree(response_buf); 1204 kfree(response_buf);
1214 return 0; 1205 return 0;
@@ -1241,27 +1232,26 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
1241 } 1232 }
1242 1233
1243 event = &pcmdptr->params.subscribe_event; 1234 event = &pcmdptr->params.subscribe_event;
1244 event->action = cmd_act_get; 1235 event->action = cpu_to_le16(cmd_act_get);
1245 pcmdptr->size = 1236 pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN);
1246 cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN);
1247 libertas_queue_cmd(adapter, pcmdnode, 1); 1237 libertas_queue_cmd(adapter, pcmdnode, 1);
1248 wake_up_interruptible(&priv->mainthread.waitq); 1238 wake_up_interruptible(&priv->mainthread.waitq);
1249 1239
1250 /* Sleep until response is generated by FW */ 1240 /* Sleep until response is generated by FW */
1251 wait_event_interruptible(pcmdnode->cmdwait_q, 1241 wait_event_interruptible(pcmdnode->cmdwait_q,
1252 pcmdnode->cmdwaitqwoken); 1242 pcmdnode->cmdwaitqwoken);
1253 1243
1254 pcmdptr = response_buf; 1244 pcmdptr = response_buf;
1255 1245
1256 if (pcmdptr->result) { 1246 if (pcmdptr->result) {
1257 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 1247 lbs_pr_err("%s: fail, result=%d\n", __func__,
1258 pcmdptr->result); 1248 le16_to_cpu(pcmdptr->result));
1259 kfree(response_buf); 1249 kfree(response_buf);
1260 free_page(addr); 1250 free_page(addr);
1261 return 0; 1251 return 0;
1262 } 1252 }
1263 1253
1264 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 1254 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
1265 lbs_pr_err("command response incorrect!\n"); 1255 lbs_pr_err("command response incorrect!\n");
1266 kfree(response_buf); 1256 kfree(response_buf);
1267 free_page(addr); 1257 free_page(addr);
@@ -1269,17 +1259,17 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf,
1269 } 1259 }
1270 1260
1271 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); 1261 cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event);
1272 event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); 1262 event = (void *)(response_buf + S_DS_GEN);
1273 while (cmd_len < pcmdptr->size) { 1263 while (cmd_len < le16_to_cpu(pcmdptr->size)) {
1274 struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); 1264 struct mrvlietypesheader *header = (void *)(response_buf + cmd_len);
1275 switch(header->type) { 1265 switch (header->type) {
1276 struct mrvlietypes_snrthreshold *HighSnr; 1266 struct mrvlietypes_snrthreshold *HighSnr;
1277 case TLV_TYPE_SNR_HIGH: 1267 case __constant_cpu_to_le16(TLV_TYPE_SNR_HIGH):
1278 HighSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); 1268 HighSnr = (void *)(response_buf + cmd_len);
1279 pos += snprintf(buf+pos, len-pos, "%d %d %d\n", 1269 pos += snprintf(buf+pos, len-pos, "%d %d %d\n",
1280 HighSnr->snrvalue, 1270 HighSnr->snrvalue,
1281 HighSnr->snrfreq, 1271 HighSnr->snrfreq,
1282 (event->events & 0x0020)?1:0); 1272 (event->events & cpu_to_le16(0x0020))?1:0);
1283 default: 1273 default:
1284 cmd_len += sizeof(struct mrvlietypes_snrthreshold); 1274 cmd_len += sizeof(struct mrvlietypes_snrthreshold);
1285 break; 1275 break;
@@ -1329,7 +1319,7 @@ static ssize_t libertas_highsnr_write(struct file *file,
1329 goto out_unlock; 1319 goto out_unlock;
1330 1320
1331 event = &pcmdptr->params.subscribe_event; 1321 event = &pcmdptr->params.subscribe_event;
1332 event->action = cmd_act_set; 1322 event->action = cpu_to_le16(cmd_act_set);
1333 pcmdptr->size = cpu_to_le16(S_DS_GEN + 1323 pcmdptr->size = cpu_to_le16(S_DS_GEN +
1334 sizeof(struct cmd_ds_802_11_subscribe_event) + 1324 sizeof(struct cmd_ds_802_11_subscribe_event) +
1335 sizeof(struct mrvlietypes_snrthreshold)); 1325 sizeof(struct mrvlietypes_snrthreshold));
@@ -1337,30 +1327,30 @@ static ssize_t libertas_highsnr_write(struct file *file,
1337 ptr = (u8*) pcmdptr+cmd_len; 1327 ptr = (u8*) pcmdptr+cmd_len;
1338 snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); 1328 snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr);
1339 snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH); 1329 snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH);
1340 snr_threshold->header.len = 2; 1330 snr_threshold->header.len = cpu_to_le16(2);
1341 snr_threshold->snrvalue = cpu_to_le16(value); 1331 snr_threshold->snrvalue = value;
1342 snr_threshold->snrfreq = cpu_to_le16(freq); 1332 snr_threshold->snrfreq = freq;
1343 event_bitmap |= subscribed ? 0x0020 : 0x0; 1333 event_bitmap |= subscribed ? 0x0020 : 0x0;
1344 event->events = event_bitmap; 1334 event->events = cpu_to_le16(event_bitmap);
1345 1335
1346 libertas_queue_cmd(adapter, pcmdnode, 1); 1336 libertas_queue_cmd(adapter, pcmdnode, 1);
1347 wake_up_interruptible(&priv->mainthread.waitq); 1337 wake_up_interruptible(&priv->mainthread.waitq);
1348 1338
1349 /* Sleep until response is generated by FW */ 1339 /* Sleep until response is generated by FW */
1350 wait_event_interruptible(pcmdnode->cmdwait_q, 1340 wait_event_interruptible(pcmdnode->cmdwait_q,
1351 pcmdnode->cmdwaitqwoken); 1341 pcmdnode->cmdwaitqwoken);
1352 1342
1353 pcmdptr = response_buf; 1343 pcmdptr = response_buf;
1354 1344
1355 if (pcmdptr->result) { 1345 if (pcmdptr->result) {
1356 lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, 1346 lbs_pr_err("%s: fail, result=%d\n", __func__,
1357 pcmdptr->result); 1347 le16_to_cpu(pcmdptr->result));
1358 kfree(response_buf); 1348 kfree(response_buf);
1359 free_page(addr); 1349 free_page(addr);
1360 return 0; 1350 return 0;
1361 } 1351 }
1362 1352
1363 if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { 1353 if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) {
1364 lbs_pr_err("command response incorrect!\n"); 1354 lbs_pr_err("command response incorrect!\n");
1365 kfree(response_buf); 1355 kfree(response_buf);
1366 free_page(addr); 1356 free_page(addr);