aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/wlan-ng/hfa384x.h376
-rw-r--r--drivers/staging/wlan-ng/hfa384x_usb.c322
-rw-r--r--drivers/staging/wlan-ng/p80211conv.c21
-rw-r--r--drivers/staging/wlan-ng/p80211conv.h4
-rw-r--r--drivers/staging/wlan-ng/p80211hdr.h3
-rw-r--r--drivers/staging/wlan-ng/p80211meta.h1
-rw-r--r--drivers/staging/wlan-ng/p80211mgmt.h42
-rw-r--r--drivers/staging/wlan-ng/p80211msg.h1
-rw-r--r--drivers/staging/wlan-ng/p80211netdev.c84
-rw-r--r--drivers/staging/wlan-ng/p80211netdev.h44
-rw-r--r--drivers/staging/wlan-ng/p80211req.c20
-rw-r--r--drivers/staging/wlan-ng/p80211req.h2
-rw-r--r--drivers/staging/wlan-ng/p80211types.h7
-rw-r--r--drivers/staging/wlan-ng/p80211wep.c197
-rw-r--r--drivers/staging/wlan-ng/p80211wext.c143
-rw-r--r--drivers/staging/wlan-ng/prism2fw.c868
-rw-r--r--drivers/staging/wlan-ng/prism2mgmt.c117
-rw-r--r--drivers/staging/wlan-ng/prism2mgmt.h48
-rw-r--r--drivers/staging/wlan-ng/prism2mib.c158
-rw-r--r--drivers/staging/wlan-ng/prism2sta.c268
-rw-r--r--drivers/staging/wlan-ng/prism2usb.c5
21 files changed, 1326 insertions, 1405 deletions
diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h
index 24d8708ec12..46cce8159e5 100644
--- a/drivers/staging/wlan-ng/hfa384x.h
+++ b/drivers/staging/wlan-ng/hfa384x.h
@@ -63,9 +63,9 @@
63/*--- Mins & Maxs -----------------------------------*/ 63/*--- Mins & Maxs -----------------------------------*/
64#define HFA384x_PORTID_MAX ((u16)7) 64#define HFA384x_PORTID_MAX ((u16)7)
65#define HFA384x_NUMPORTS_MAX ((u16)(HFA384x_PORTID_MAX+1)) 65#define HFA384x_NUMPORTS_MAX ((u16)(HFA384x_PORTID_MAX+1))
66#define HFA384x_PDR_LEN_MAX ((u16)512) /* in bytes, from EK */ 66#define HFA384x_PDR_LEN_MAX ((u16)512) /* in bytes, from EK */
67#define HFA384x_PDA_RECS_MAX ((u16)200) /* a guess */ 67#define HFA384x_PDA_RECS_MAX ((u16)200) /* a guess */
68#define HFA384x_PDA_LEN_MAX ((u16)1024) /* in bytes, from EK */ 68#define HFA384x_PDA_LEN_MAX ((u16)1024) /* in bytes, from EK */
69#define HFA384x_SCANRESULT_MAX ((u16)31) 69#define HFA384x_SCANRESULT_MAX ((u16)31)
70#define HFA384x_HSCANRESULT_MAX ((u16)31) 70#define HFA384x_HSCANRESULT_MAX ((u16)31)
71#define HFA384x_CHINFORESULT_MAX ((u16)16) 71#define HFA384x_CHINFORESULT_MAX ((u16)16)
@@ -630,7 +630,7 @@ typedef struct hfa384x_ScanResultSub {
630typedef struct hfa384x_ScanResult { 630typedef struct hfa384x_ScanResult {
631 u16 rsvd; 631 u16 rsvd;
632 u16 scanreason; 632 u16 scanreason;
633 hfa384x_ScanResultSub_t result[HFA384x_SCANRESULT_MAX]; 633 hfa384x_ScanResultSub_t result[HFA384x_SCANRESULT_MAX];
634} __attribute__ ((packed)) hfa384x_ScanResult_t; 634} __attribute__ ((packed)) hfa384x_ScanResult_t;
635 635
636/*-- Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/ 636/*-- Inquiry Frame, Diagnose: ChInfo Results & Subfields--*/
@@ -646,7 +646,7 @@ typedef struct hfa384x_ChInfoResultSub {
646 646
647typedef struct hfa384x_ChInfoResult { 647typedef struct hfa384x_ChInfoResult {
648 u16 scanchannels; 648 u16 scanchannels;
649 hfa384x_ChInfoResultSub_t result[HFA384x_CHINFORESULT_MAX]; 649 hfa384x_ChInfoResultSub_t result[HFA384x_CHINFORESULT_MAX];
650} __attribute__ ((packed)) hfa384x_ChInfoResult_t; 650} __attribute__ ((packed)) hfa384x_ChInfoResult_t;
651 651
652/*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/ 652/*-- Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
@@ -666,7 +666,7 @@ typedef struct hfa384x_HScanResultSub {
666typedef struct hfa384x_HScanResult { 666typedef struct hfa384x_HScanResult {
667 u16 nresult; 667 u16 nresult;
668 u16 rsvd; 668 u16 rsvd;
669 hfa384x_HScanResultSub_t result[HFA384x_HSCANRESULT_MAX]; 669 hfa384x_HScanResultSub_t result[HFA384x_HSCANRESULT_MAX];
670} __attribute__ ((packed)) hfa384x_HScanResult_t; 670} __attribute__ ((packed)) hfa384x_HScanResult_t;
671 671
672/*-- Unsolicited Frame, MAC Mgmt: LinkStatus --*/ 672/*-- Unsolicited Frame, MAC Mgmt: LinkStatus --*/
@@ -887,241 +887,205 @@ typedef union hfa384x_usbin {
887PD record structures. 887PD record structures.
888--------------------------------------------------------------------*/ 888--------------------------------------------------------------------*/
889 889
890typedef struct hfa384x_pdr_pcb_partnum 890typedef struct hfa384x_pdr_pcb_partnum {
891{ 891 u8 num[8];
892 u8 num[8];
893} __attribute__ ((packed)) hfa384x_pdr_pcb_partnum_t; 892} __attribute__ ((packed)) hfa384x_pdr_pcb_partnum_t;
894 893
895typedef struct hfa384x_pdr_pcb_tracenum 894typedef struct hfa384x_pdr_pcb_tracenum {
896{ 895 u8 num[8];
897 u8 num[8];
898} __attribute__ ((packed)) hfa384x_pdr_pcb_tracenum_t; 896} __attribute__ ((packed)) hfa384x_pdr_pcb_tracenum_t;
899 897
900typedef struct hfa384x_pdr_nic_serial 898typedef struct hfa384x_pdr_nic_serial {
901{ 899 u8 num[12];
902 u8 num[12];
903} __attribute__ ((packed)) hfa384x_pdr_nic_serial_t; 900} __attribute__ ((packed)) hfa384x_pdr_nic_serial_t;
904 901
905typedef struct hfa384x_pdr_mkk_measurements 902typedef struct hfa384x_pdr_mkk_measurements {
906{ 903 double carrier_freq;
907 double carrier_freq; 904 double occupied_band;
908 double occupied_band; 905 double power_density;
909 double power_density; 906 double tx_spur_f1;
910 double tx_spur_f1; 907 double tx_spur_f2;
911 double tx_spur_f2; 908 double tx_spur_f3;
912 double tx_spur_f3; 909 double tx_spur_f4;
913 double tx_spur_f4; 910 double tx_spur_l1;
914 double tx_spur_l1; 911 double tx_spur_l2;
915 double tx_spur_l2; 912 double tx_spur_l3;
916 double tx_spur_l3; 913 double tx_spur_l4;
917 double tx_spur_l4; 914 double rx_spur_f1;
918 double rx_spur_f1; 915 double rx_spur_f2;
919 double rx_spur_f2; 916 double rx_spur_l1;
920 double rx_spur_l1; 917 double rx_spur_l2;
921 double rx_spur_l2;
922} __attribute__ ((packed)) hfa384x_pdr_mkk_measurements_t; 918} __attribute__ ((packed)) hfa384x_pdr_mkk_measurements_t;
923 919
924typedef struct hfa384x_pdr_nic_ramsize 920typedef struct hfa384x_pdr_nic_ramsize {
925{ 921 u8 size[12]; /* units of KB */
926 u8 size[12]; /* units of KB */
927} __attribute__ ((packed)) hfa384x_pdr_nic_ramsize_t; 922} __attribute__ ((packed)) hfa384x_pdr_nic_ramsize_t;
928 923
929typedef struct hfa384x_pdr_mfisuprange 924typedef struct hfa384x_pdr_mfisuprange {
930{ 925 u16 id;
931 u16 id; 926 u16 variant;
932 u16 variant; 927 u16 bottom;
933 u16 bottom; 928 u16 top;
934 u16 top;
935} __attribute__ ((packed)) hfa384x_pdr_mfisuprange_t; 929} __attribute__ ((packed)) hfa384x_pdr_mfisuprange_t;
936 930
937typedef struct hfa384x_pdr_cfisuprange 931typedef struct hfa384x_pdr_cfisuprange {
938{ 932 u16 id;
939 u16 id; 933 u16 variant;
940 u16 variant; 934 u16 bottom;
941 u16 bottom; 935 u16 top;
942 u16 top;
943} __attribute__ ((packed)) hfa384x_pdr_cfisuprange_t; 936} __attribute__ ((packed)) hfa384x_pdr_cfisuprange_t;
944 937
945typedef struct hfa384x_pdr_nicid 938typedef struct hfa384x_pdr_nicid {
946{ 939 u16 id;
947 u16 id; 940 u16 variant;
948 u16 variant; 941 u16 major;
949 u16 major; 942 u16 minor;
950 u16 minor;
951} __attribute__ ((packed)) hfa384x_pdr_nicid_t; 943} __attribute__ ((packed)) hfa384x_pdr_nicid_t;
952 944
953 945typedef struct hfa384x_pdr_refdac_measurements {
954typedef struct hfa384x_pdr_refdac_measurements 946 u16 value[0];
955{
956 u16 value[0];
957} __attribute__ ((packed)) hfa384x_pdr_refdac_measurements_t; 947} __attribute__ ((packed)) hfa384x_pdr_refdac_measurements_t;
958 948
959typedef struct hfa384x_pdr_vgdac_measurements 949typedef struct hfa384x_pdr_vgdac_measurements {
960{ 950 u16 value[0];
961 u16 value[0];
962} __attribute__ ((packed)) hfa384x_pdr_vgdac_measurements_t; 951} __attribute__ ((packed)) hfa384x_pdr_vgdac_measurements_t;
963 952
964typedef struct hfa384x_pdr_level_comp_measurements 953typedef struct hfa384x_pdr_level_comp_measurements {
965{ 954 u16 value[0];
966 u16 value[0];
967} __attribute__ ((packed)) hfa384x_pdr_level_compc_measurements_t; 955} __attribute__ ((packed)) hfa384x_pdr_level_compc_measurements_t;
968 956
969typedef struct hfa384x_pdr_mac_address 957typedef struct hfa384x_pdr_mac_address {
970{ 958 u8 addr[6];
971 u8 addr[6];
972} __attribute__ ((packed)) hfa384x_pdr_mac_address_t; 959} __attribute__ ((packed)) hfa384x_pdr_mac_address_t;
973 960
974typedef struct hfa384x_pdr_mkk_callname 961typedef struct hfa384x_pdr_mkk_callname {
975{ 962 u8 callname[8];
976 u8 callname[8];
977} __attribute__ ((packed)) hfa384x_pdr_mkk_callname_t; 963} __attribute__ ((packed)) hfa384x_pdr_mkk_callname_t;
978 964
979typedef struct hfa384x_pdr_regdomain 965typedef struct hfa384x_pdr_regdomain {
980{ 966 u16 numdomains;
981 u16 numdomains; 967 u16 domain[5];
982 u16 domain[5];
983} __attribute__ ((packed)) hfa384x_pdr_regdomain_t; 968} __attribute__ ((packed)) hfa384x_pdr_regdomain_t;
984 969
985typedef struct hfa384x_pdr_allowed_channel 970typedef struct hfa384x_pdr_allowed_channel {
986{ 971 u16 ch_bitmap;
987 u16 ch_bitmap;
988} __attribute__ ((packed)) hfa384x_pdr_allowed_channel_t; 972} __attribute__ ((packed)) hfa384x_pdr_allowed_channel_t;
989 973
990typedef struct hfa384x_pdr_default_channel 974typedef struct hfa384x_pdr_default_channel {
991{ 975 u16 channel;
992 u16 channel;
993} __attribute__ ((packed)) hfa384x_pdr_default_channel_t; 976} __attribute__ ((packed)) hfa384x_pdr_default_channel_t;
994 977
995typedef struct hfa384x_pdr_privacy_option 978typedef struct hfa384x_pdr_privacy_option {
996{ 979 u16 available;
997 u16 available;
998} __attribute__ ((packed)) hfa384x_pdr_privacy_option_t; 980} __attribute__ ((packed)) hfa384x_pdr_privacy_option_t;
999 981
1000typedef struct hfa384x_pdr_temptype 982typedef struct hfa384x_pdr_temptype {
1001{ 983 u16 type;
1002 u16 type;
1003} __attribute__ ((packed)) hfa384x_pdr_temptype_t; 984} __attribute__ ((packed)) hfa384x_pdr_temptype_t;
1004 985
1005typedef struct hfa384x_pdr_refdac_setup 986typedef struct hfa384x_pdr_refdac_setup {
1006{ 987 u16 ch_value[14];
1007 u16 ch_value[14];
1008} __attribute__ ((packed)) hfa384x_pdr_refdac_setup_t; 988} __attribute__ ((packed)) hfa384x_pdr_refdac_setup_t;
1009 989
1010typedef struct hfa384x_pdr_vgdac_setup 990typedef struct hfa384x_pdr_vgdac_setup {
1011{ 991 u16 ch_value[14];
1012 u16 ch_value[14];
1013} __attribute__ ((packed)) hfa384x_pdr_vgdac_setup_t; 992} __attribute__ ((packed)) hfa384x_pdr_vgdac_setup_t;
1014 993
1015typedef struct hfa384x_pdr_level_comp_setup 994typedef struct hfa384x_pdr_level_comp_setup {
1016{ 995 u16 ch_value[14];
1017 u16 ch_value[14];
1018} __attribute__ ((packed)) hfa384x_pdr_level_comp_setup_t; 996} __attribute__ ((packed)) hfa384x_pdr_level_comp_setup_t;
1019 997
1020typedef struct hfa384x_pdr_trimdac_setup 998typedef struct hfa384x_pdr_trimdac_setup {
1021{ 999 u16 trimidac;
1022 u16 trimidac; 1000 u16 trimqdac;
1023 u16 trimqdac;
1024} __attribute__ ((packed)) hfa384x_pdr_trimdac_setup_t; 1001} __attribute__ ((packed)) hfa384x_pdr_trimdac_setup_t;
1025 1002
1026typedef struct hfa384x_pdr_ifr_setting 1003typedef struct hfa384x_pdr_ifr_setting {
1027{ 1004 u16 value[3];
1028 u16 value[3];
1029} __attribute__ ((packed)) hfa384x_pdr_ifr_setting_t; 1005} __attribute__ ((packed)) hfa384x_pdr_ifr_setting_t;
1030 1006
1031typedef struct hfa384x_pdr_rfr_setting 1007typedef struct hfa384x_pdr_rfr_setting {
1032{ 1008 u16 value[3];
1033 u16 value[3];
1034} __attribute__ ((packed)) hfa384x_pdr_rfr_setting_t; 1009} __attribute__ ((packed)) hfa384x_pdr_rfr_setting_t;
1035 1010
1036typedef struct hfa384x_pdr_hfa3861_baseline 1011typedef struct hfa384x_pdr_hfa3861_baseline {
1037{ 1012 u16 value[50];
1038 u16 value[50];
1039} __attribute__ ((packed)) hfa384x_pdr_hfa3861_baseline_t; 1013} __attribute__ ((packed)) hfa384x_pdr_hfa3861_baseline_t;
1040 1014
1041typedef struct hfa384x_pdr_hfa3861_shadow 1015typedef struct hfa384x_pdr_hfa3861_shadow {
1042{ 1016 u32 value[32];
1043 u32 value[32];
1044} __attribute__ ((packed)) hfa384x_pdr_hfa3861_shadow_t; 1017} __attribute__ ((packed)) hfa384x_pdr_hfa3861_shadow_t;
1045 1018
1046typedef struct hfa384x_pdr_hfa3861_ifrf 1019typedef struct hfa384x_pdr_hfa3861_ifrf {
1047{ 1020 u32 value[20];
1048 u32 value[20];
1049} __attribute__ ((packed)) hfa384x_pdr_hfa3861_ifrf_t; 1021} __attribute__ ((packed)) hfa384x_pdr_hfa3861_ifrf_t;
1050 1022
1051typedef struct hfa384x_pdr_hfa3861_chcalsp 1023typedef struct hfa384x_pdr_hfa3861_chcalsp {
1052{ 1024 u16 value[14];
1053 u16 value[14];
1054} __attribute__ ((packed)) hfa384x_pdr_hfa3861_chcalsp_t; 1025} __attribute__ ((packed)) hfa384x_pdr_hfa3861_chcalsp_t;
1055 1026
1056typedef struct hfa384x_pdr_hfa3861_chcali 1027typedef struct hfa384x_pdr_hfa3861_chcali {
1057{ 1028 u16 value[17];
1058 u16 value[17];
1059} __attribute__ ((packed)) hfa384x_pdr_hfa3861_chcali_t; 1029} __attribute__ ((packed)) hfa384x_pdr_hfa3861_chcali_t;
1060 1030
1061typedef struct hfa384x_pdr_hfa3861_nic_config 1031typedef struct hfa384x_pdr_hfa3861_nic_config {
1062{ 1032 u16 config_bitmap;
1063 u16 config_bitmap;
1064} __attribute__ ((packed)) hfa384x_pdr_nic_config_t; 1033} __attribute__ ((packed)) hfa384x_pdr_nic_config_t;
1065 1034
1066typedef struct hfa384x_pdr_hfo_delay 1035typedef struct hfa384x_pdr_hfo_delay {
1067{ 1036 u8 hfo_delay;
1068 u8 hfo_delay;
1069} __attribute__ ((packed)) hfa384x_hfo_delay_t; 1037} __attribute__ ((packed)) hfa384x_hfo_delay_t;
1070 1038
1071typedef struct hfa384x_pdr_hfa3861_manf_testsp 1039typedef struct hfa384x_pdr_hfa3861_manf_testsp {
1072{ 1040 u16 value[30];
1073 u16 value[30];
1074} __attribute__ ((packed)) hfa384x_pdr_hfa3861_manf_testsp_t; 1041} __attribute__ ((packed)) hfa384x_pdr_hfa3861_manf_testsp_t;
1075 1042
1076typedef struct hfa384x_pdr_hfa3861_manf_testi 1043typedef struct hfa384x_pdr_hfa3861_manf_testi {
1077{ 1044 u16 value[30];
1078 u16 value[30];
1079} __attribute__ ((packed)) hfa384x_pdr_hfa3861_manf_testi_t; 1045} __attribute__ ((packed)) hfa384x_pdr_hfa3861_manf_testi_t;
1080 1046
1081typedef struct hfa384x_end_of_pda 1047typedef struct hfa384x_end_of_pda {
1082{ 1048 u16 crc;
1083 u16 crc;
1084} __attribute__ ((packed)) hfa384x_pdr_end_of_pda_t; 1049} __attribute__ ((packed)) hfa384x_pdr_end_of_pda_t;
1085 1050
1086typedef struct hfa384x_pdrec 1051typedef struct hfa384x_pdrec {
1087{ 1052 u16 len; /* in words */
1088 u16 len; /* in words */ 1053 u16 code;
1089 u16 code;
1090 union pdr { 1054 union pdr {
1091 hfa384x_pdr_pcb_partnum_t pcb_partnum; 1055 hfa384x_pdr_pcb_partnum_t pcb_partnum;
1092 hfa384x_pdr_pcb_tracenum_t pcb_tracenum; 1056 hfa384x_pdr_pcb_tracenum_t pcb_tracenum;
1093 hfa384x_pdr_nic_serial_t nic_serial; 1057 hfa384x_pdr_nic_serial_t nic_serial;
1094 hfa384x_pdr_mkk_measurements_t mkk_measurements; 1058 hfa384x_pdr_mkk_measurements_t mkk_measurements;
1095 hfa384x_pdr_nic_ramsize_t nic_ramsize; 1059 hfa384x_pdr_nic_ramsize_t nic_ramsize;
1096 hfa384x_pdr_mfisuprange_t mfisuprange; 1060 hfa384x_pdr_mfisuprange_t mfisuprange;
1097 hfa384x_pdr_cfisuprange_t cfisuprange; 1061 hfa384x_pdr_cfisuprange_t cfisuprange;
1098 hfa384x_pdr_nicid_t nicid; 1062 hfa384x_pdr_nicid_t nicid;
1099 hfa384x_pdr_refdac_measurements_t refdac_measurements; 1063 hfa384x_pdr_refdac_measurements_t refdac_measurements;
1100 hfa384x_pdr_vgdac_measurements_t vgdac_measurements; 1064 hfa384x_pdr_vgdac_measurements_t vgdac_measurements;
1101 hfa384x_pdr_level_compc_measurements_t level_compc_measurements; 1065 hfa384x_pdr_level_compc_measurements_t level_compc_measurements;
1102 hfa384x_pdr_mac_address_t mac_address; 1066 hfa384x_pdr_mac_address_t mac_address;
1103 hfa384x_pdr_mkk_callname_t mkk_callname; 1067 hfa384x_pdr_mkk_callname_t mkk_callname;
1104 hfa384x_pdr_regdomain_t regdomain; 1068 hfa384x_pdr_regdomain_t regdomain;
1105 hfa384x_pdr_allowed_channel_t allowed_channel; 1069 hfa384x_pdr_allowed_channel_t allowed_channel;
1106 hfa384x_pdr_default_channel_t default_channel; 1070 hfa384x_pdr_default_channel_t default_channel;
1107 hfa384x_pdr_privacy_option_t privacy_option; 1071 hfa384x_pdr_privacy_option_t privacy_option;
1108 hfa384x_pdr_temptype_t temptype; 1072 hfa384x_pdr_temptype_t temptype;
1109 hfa384x_pdr_refdac_setup_t refdac_setup; 1073 hfa384x_pdr_refdac_setup_t refdac_setup;
1110 hfa384x_pdr_vgdac_setup_t vgdac_setup; 1074 hfa384x_pdr_vgdac_setup_t vgdac_setup;
1111 hfa384x_pdr_level_comp_setup_t level_comp_setup; 1075 hfa384x_pdr_level_comp_setup_t level_comp_setup;
1112 hfa384x_pdr_trimdac_setup_t trimdac_setup; 1076 hfa384x_pdr_trimdac_setup_t trimdac_setup;
1113 hfa384x_pdr_ifr_setting_t ifr_setting; 1077 hfa384x_pdr_ifr_setting_t ifr_setting;
1114 hfa384x_pdr_rfr_setting_t rfr_setting; 1078 hfa384x_pdr_rfr_setting_t rfr_setting;
1115 hfa384x_pdr_hfa3861_baseline_t hfa3861_baseline; 1079 hfa384x_pdr_hfa3861_baseline_t hfa3861_baseline;
1116 hfa384x_pdr_hfa3861_shadow_t hfa3861_shadow; 1080 hfa384x_pdr_hfa3861_shadow_t hfa3861_shadow;
1117 hfa384x_pdr_hfa3861_ifrf_t hfa3861_ifrf; 1081 hfa384x_pdr_hfa3861_ifrf_t hfa3861_ifrf;
1118 hfa384x_pdr_hfa3861_chcalsp_t hfa3861_chcalsp; 1082 hfa384x_pdr_hfa3861_chcalsp_t hfa3861_chcalsp;
1119 hfa384x_pdr_hfa3861_chcali_t hfa3861_chcali; 1083 hfa384x_pdr_hfa3861_chcali_t hfa3861_chcali;
1120 hfa384x_pdr_nic_config_t nic_config; 1084 hfa384x_pdr_nic_config_t nic_config;
1121 hfa384x_hfo_delay_t hfo_delay; 1085 hfa384x_hfo_delay_t hfo_delay;
1122 hfa384x_pdr_hfa3861_manf_testsp_t hfa3861_manf_testsp; 1086 hfa384x_pdr_hfa3861_manf_testsp_t hfa3861_manf_testsp;
1123 hfa384x_pdr_hfa3861_manf_testi_t hfa3861_manf_testi; 1087 hfa384x_pdr_hfa3861_manf_testi_t hfa3861_manf_testi;
1124 hfa384x_pdr_end_of_pda_t end_of_pda; 1088 hfa384x_pdr_end_of_pda_t end_of_pda;
1125 1089
1126 } data; 1090 } data;
1127} __attribute__ ((packed)) hfa384x_pdrec_t; 1091} __attribute__ ((packed)) hfa384x_pdrec_t;
@@ -1169,7 +1133,7 @@ struct hfa384x;
1169 1133
1170typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *); 1134typedef void (*ctlx_cmdcb_t) (struct hfa384x *, const struct hfa384x_usbctlx *);
1171 1135
1172typedef void (*ctlx_usercb_t) (struct hfa384x *hw, 1136typedef void (*ctlx_usercb_t) (struct hfa384x * hw,
1173 void *ctlxresult, void *usercb_data); 1137 void *ctlxresult, void *usercb_data);
1174 1138
1175typedef struct hfa384x_usbctlx { 1139typedef struct hfa384x_usbctlx {
@@ -1356,25 +1320,25 @@ typedef struct hfa384x {
1356 1320
1357} hfa384x_t; 1321} hfa384x_t;
1358 1322
1359void hfa384x_create(hfa384x_t *hw, struct usb_device *usb); 1323void hfa384x_create(hfa384x_t * hw, struct usb_device *usb);
1360void hfa384x_destroy(hfa384x_t *hw); 1324void hfa384x_destroy(hfa384x_t * hw);
1361 1325
1362int 1326int
1363hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis); 1327hfa384x_corereset(hfa384x_t * hw, int holdtime, int settletime, int genesis);
1364int hfa384x_drvr_commtallies(hfa384x_t *hw); 1328int hfa384x_drvr_commtallies(hfa384x_t * hw);
1365int hfa384x_drvr_disable(hfa384x_t *hw, u16 macport); 1329int hfa384x_drvr_disable(hfa384x_t * hw, u16 macport);
1366int hfa384x_drvr_enable(hfa384x_t *hw, u16 macport); 1330int hfa384x_drvr_enable(hfa384x_t * hw, u16 macport);
1367int hfa384x_drvr_flashdl_enable(hfa384x_t *hw); 1331int hfa384x_drvr_flashdl_enable(hfa384x_t * hw);
1368int hfa384x_drvr_flashdl_disable(hfa384x_t *hw); 1332int hfa384x_drvr_flashdl_disable(hfa384x_t * hw);
1369int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len); 1333int hfa384x_drvr_flashdl_write(hfa384x_t * hw, u32 daddr, void *buf, u32 len);
1370int hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len); 1334int hfa384x_drvr_getconfig(hfa384x_t * hw, u16 rid, void *buf, u16 len);
1371int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr); 1335int hfa384x_drvr_ramdl_enable(hfa384x_t * hw, u32 exeaddr);
1372int hfa384x_drvr_ramdl_disable(hfa384x_t *hw); 1336int hfa384x_drvr_ramdl_disable(hfa384x_t * hw);
1373int hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len); 1337int hfa384x_drvr_ramdl_write(hfa384x_t * hw, u32 daddr, void *buf, u32 len);
1374int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len); 1338int hfa384x_drvr_readpda(hfa384x_t * hw, void *buf, unsigned int len);
1375int hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len); 1339int hfa384x_drvr_setconfig(hfa384x_t * hw, u16 rid, void *buf, u16 len);
1376 1340
1377static inline int hfa384x_drvr_getconfig16(hfa384x_t *hw, u16 rid, void *val) 1341static inline int hfa384x_drvr_getconfig16(hfa384x_t * hw, u16 rid, void *val)
1378{ 1342{
1379 int result = 0; 1343 int result = 0;
1380 result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16)); 1344 result = hfa384x_drvr_getconfig(hw, rid, val, sizeof(u16));
@@ -1383,44 +1347,44 @@ static inline int hfa384x_drvr_getconfig16(hfa384x_t *hw, u16 rid, void *val)
1383 return result; 1347 return result;
1384} 1348}
1385 1349
1386static inline int hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val) 1350static inline int hfa384x_drvr_setconfig16(hfa384x_t * hw, u16 rid, u16 val)
1387{ 1351{
1388 u16 value = cpu_to_le16(val); 1352 u16 value = cpu_to_le16(val);
1389 return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value)); 1353 return hfa384x_drvr_setconfig(hw, rid, &value, sizeof(value));
1390} 1354}
1391 1355
1392int 1356int
1393hfa384x_drvr_getconfig_async(hfa384x_t *hw, 1357hfa384x_drvr_getconfig_async(hfa384x_t * hw,
1394 u16 rid, ctlx_usercb_t usercb, void *usercb_data); 1358 u16 rid, ctlx_usercb_t usercb, void *usercb_data);
1395 1359
1396int 1360int
1397hfa384x_drvr_setconfig_async(hfa384x_t *hw, 1361hfa384x_drvr_setconfig_async(hfa384x_t * hw,
1398 u16 rid, 1362 u16 rid,
1399 void *buf, 1363 void *buf,
1400 u16 len, ctlx_usercb_t usercb, void *usercb_data); 1364 u16 len, ctlx_usercb_t usercb, void *usercb_data);
1401 1365
1402static inline int 1366static inline int
1403hfa384x_drvr_setconfig16_async(hfa384x_t *hw, u16 rid, u16 val) 1367hfa384x_drvr_setconfig16_async(hfa384x_t * hw, u16 rid, u16 val)
1404{ 1368{
1405 u16 value = cpu_to_le16(val); 1369 u16 value = cpu_to_le16(val);
1406 return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value), 1370 return hfa384x_drvr_setconfig_async(hw, rid, &value, sizeof(value),
1407 NULL, NULL); 1371 NULL, NULL);
1408} 1372}
1409 1373
1410int hfa384x_drvr_start(hfa384x_t *hw); 1374int hfa384x_drvr_start(hfa384x_t * hw);
1411int hfa384x_drvr_stop(hfa384x_t *hw); 1375int hfa384x_drvr_stop(hfa384x_t * hw);
1412int 1376int
1413hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, 1377hfa384x_drvr_txframe(hfa384x_t * hw, struct sk_buff *skb,
1414 p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep); 1378 p80211_hdr_t * p80211_hdr, p80211_metawep_t * p80211_wep);
1415void hfa384x_tx_timeout(wlandevice_t *wlandev); 1379void hfa384x_tx_timeout(wlandevice_t * wlandev);
1416 1380
1417int hfa384x_cmd_initialize(hfa384x_t *hw); 1381int hfa384x_cmd_initialize(hfa384x_t * hw);
1418int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport); 1382int hfa384x_cmd_enable(hfa384x_t * hw, u16 macport);
1419int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport); 1383int hfa384x_cmd_disable(hfa384x_t * hw, u16 macport);
1420int hfa384x_cmd_allocate(hfa384x_t *hw, u16 len); 1384int hfa384x_cmd_allocate(hfa384x_t * hw, u16 len);
1421int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable); 1385int hfa384x_cmd_monitor(hfa384x_t * hw, u16 enable);
1422int 1386int
1423hfa384x_cmd_download(hfa384x_t *hw, 1387hfa384x_cmd_download(hfa384x_t * hw,
1424 u16 mode, u16 lowaddr, u16 highaddr, u16 codelen); 1388 u16 mode, u16 lowaddr, u16 highaddr, u16 codelen);
1425 1389
1426#endif /* __KERNEL__ */ 1390#endif /* __KERNEL__ */
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index be297b9cac3..51d9e520d52 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -110,7 +110,6 @@
110* -------------------------------------------------------------------- 110* --------------------------------------------------------------------
111*/ 111*/
112 112
113
114#include <linux/module.h> 113#include <linux/module.h>
115#include <linux/kernel.h> 114#include <linux/kernel.h>
116#include <linux/sched.h> 115#include <linux/sched.h>
@@ -161,13 +160,13 @@ static void dbprint_urb(struct urb *urb);
161#endif 160#endif
162 161
163static void 162static void
164hfa384x_int_rxmonitor(wlandevice_t *wlandev, hfa384x_usb_rxfrm_t *rxfrm); 163hfa384x_int_rxmonitor(wlandevice_t * wlandev, hfa384x_usb_rxfrm_t * rxfrm);
165 164
166static void hfa384x_usb_defer(struct work_struct *data); 165static void hfa384x_usb_defer(struct work_struct *data);
167 166
168static int submit_rx_urb(hfa384x_t *hw, gfp_t flags); 167static int submit_rx_urb(hfa384x_t * hw, gfp_t flags);
169 168
170static int submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t flags); 169static int submit_tx_urb(hfa384x_t * hw, struct urb *tx_urb, gfp_t flags);
171 170
172/*---------------------------------------------------*/ 171/*---------------------------------------------------*/
173/* Callbacks */ 172/* Callbacks */
@@ -176,22 +175,22 @@ static void hfa384x_ctlxout_callback(struct urb *urb);
176static void hfa384x_usbin_callback(struct urb *urb); 175static void hfa384x_usbin_callback(struct urb *urb);
177 176
178static void 177static void
179hfa384x_usbin_txcompl(wlandevice_t *wlandev, hfa384x_usbin_t *usbin); 178hfa384x_usbin_txcompl(wlandevice_t * wlandev, hfa384x_usbin_t * usbin);
180 179
181static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb); 180static void hfa384x_usbin_rx(wlandevice_t * wlandev, struct sk_buff *skb);
182 181
183static void hfa384x_usbin_info(wlandevice_t *wlandev, hfa384x_usbin_t *usbin); 182static void hfa384x_usbin_info(wlandevice_t * wlandev, hfa384x_usbin_t * usbin);
184 183
185static void 184static void
186hfa384x_usbout_tx(wlandevice_t *wlandev, hfa384x_usbout_t *usbout); 185hfa384x_usbout_tx(wlandevice_t * wlandev, hfa384x_usbout_t * usbout);
187 186
188static void hfa384x_usbin_ctlx(hfa384x_t *hw, hfa384x_usbin_t *usbin, 187static void hfa384x_usbin_ctlx(hfa384x_t * hw, hfa384x_usbin_t * usbin,
189 int urb_status); 188 int urb_status);
190 189
191/*---------------------------------------------------*/ 190/*---------------------------------------------------*/
192/* Functions to support the prism2 usb command queue */ 191/* Functions to support the prism2 usb command queue */
193 192
194static void hfa384x_usbctlxq_run(hfa384x_t *hw); 193static void hfa384x_usbctlxq_run(hfa384x_t * hw);
195 194
196static void hfa384x_usbctlx_reqtimerfn(unsigned long data); 195static void hfa384x_usbctlx_reqtimerfn(unsigned long data);
197 196
@@ -203,9 +202,9 @@ static void hfa384x_usbctlx_completion_task(unsigned long data);
203 202
204static void hfa384x_usbctlx_reaper_task(unsigned long data); 203static void hfa384x_usbctlx_reaper_task(unsigned long data);
205 204
206static int hfa384x_usbctlx_submit(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx); 205static int hfa384x_usbctlx_submit(hfa384x_t * hw, hfa384x_usbctlx_t * ctlx);
207 206
208static void unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx); 207static void unlocked_usbctlx_complete(hfa384x_t * hw, hfa384x_usbctlx_t * ctlx);
209 208
210struct usbctlx_completor { 209struct usbctlx_completor {
211 int (*complete) (struct usbctlx_completor *); 210 int (*complete) (struct usbctlx_completor *);
@@ -213,35 +212,35 @@ struct usbctlx_completor {
213typedef struct usbctlx_completor usbctlx_completor_t; 212typedef struct usbctlx_completor usbctlx_completor_t;
214 213
215static int 214static int
216hfa384x_usbctlx_complete_sync(hfa384x_t *hw, 215hfa384x_usbctlx_complete_sync(hfa384x_t * hw,
217 hfa384x_usbctlx_t *ctlx, 216 hfa384x_usbctlx_t * ctlx,
218 usbctlx_completor_t *completor); 217 usbctlx_completor_t * completor);
219 218
220static int 219static int
221unlocked_usbctlx_cancel_async(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx); 220unlocked_usbctlx_cancel_async(hfa384x_t * hw, hfa384x_usbctlx_t * ctlx);
222 221
223static void hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx); 222static void hfa384x_cb_status(hfa384x_t * hw, const hfa384x_usbctlx_t * ctlx);
224 223
225static void hfa384x_cb_rrid(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx); 224static void hfa384x_cb_rrid(hfa384x_t * hw, const hfa384x_usbctlx_t * ctlx);
226 225
227static int 226static int
228usbctlx_get_status(const hfa384x_usb_cmdresp_t *cmdresp, 227usbctlx_get_status(const hfa384x_usb_cmdresp_t * cmdresp,
229 hfa384x_cmdresult_t *result); 228 hfa384x_cmdresult_t * result);
230 229
231static void 230static void
232usbctlx_get_rridresult(const hfa384x_usb_rridresp_t *rridresp, 231usbctlx_get_rridresult(const hfa384x_usb_rridresp_t * rridresp,
233 hfa384x_rridresult_t *result); 232 hfa384x_rridresult_t * result);
234 233
235/*---------------------------------------------------*/ 234/*---------------------------------------------------*/
236/* Low level req/resp CTLX formatters and submitters */ 235/* Low level req/resp CTLX formatters and submitters */
237static int 236static int
238hfa384x_docmd(hfa384x_t *hw, 237hfa384x_docmd(hfa384x_t * hw,
239 CMD_MODE mode, 238 CMD_MODE mode,
240 hfa384x_metacmd_t *cmd, 239 hfa384x_metacmd_t * cmd,
241 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data); 240 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data);
242 241
243static int 242static int
244hfa384x_dorrid(hfa384x_t *hw, 243hfa384x_dorrid(hfa384x_t * hw,
245 CMD_MODE mode, 244 CMD_MODE mode,
246 u16 rid, 245 u16 rid,
247 void *riddata, 246 void *riddata,
@@ -249,7 +248,7 @@ hfa384x_dorrid(hfa384x_t *hw,
249 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data); 248 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data);
250 249
251static int 250static int
252hfa384x_dowrid(hfa384x_t *hw, 251hfa384x_dowrid(hfa384x_t * hw,
253 CMD_MODE mode, 252 CMD_MODE mode,
254 u16 rid, 253 u16 rid,
255 void *riddata, 254 void *riddata,
@@ -257,7 +256,7 @@ hfa384x_dowrid(hfa384x_t *hw,
257 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data); 256 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data);
258 257
259static int 258static int
260hfa384x_dormem(hfa384x_t *hw, 259hfa384x_dormem(hfa384x_t * hw,
261 CMD_MODE mode, 260 CMD_MODE mode,
262 u16 page, 261 u16 page,
263 u16 offset, 262 u16 offset,
@@ -266,7 +265,7 @@ hfa384x_dormem(hfa384x_t *hw,
266 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data); 265 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data);
267 266
268static int 267static int
269hfa384x_dowmem(hfa384x_t *hw, 268hfa384x_dowmem(hfa384x_t * hw,
270 CMD_MODE mode, 269 CMD_MODE mode,
271 u16 page, 270 u16 page,
272 u16 offset, 271 u16 offset,
@@ -291,7 +290,7 @@ static inline const char *ctlxstr(CTLX_STATE s)
291 return ctlx_str[s]; 290 return ctlx_str[s];
292}; 291};
293 292
294static inline hfa384x_usbctlx_t *get_active_ctlx(hfa384x_t *hw) 293static inline hfa384x_usbctlx_t *get_active_ctlx(hfa384x_t * hw)
295{ 294{
296 return list_entry(hw->ctlxq.active.next, hfa384x_usbctlx_t, list); 295 return list_entry(hw->ctlxq.active.next, hfa384x_usbctlx_t, list);
297} 296}
@@ -303,21 +302,19 @@ void dbprint_urb(struct urb *urb)
303 pr_debug("urb->status=0x%08x\n", urb->status); 302 pr_debug("urb->status=0x%08x\n", urb->status);
304 pr_debug("urb->transfer_flags=0x%08x\n", urb->transfer_flags); 303 pr_debug("urb->transfer_flags=0x%08x\n", urb->transfer_flags);
305 pr_debug("urb->transfer_buffer=0x%08x\n", 304 pr_debug("urb->transfer_buffer=0x%08x\n",
306 (unsigned int)urb->transfer_buffer); 305 (unsigned int)urb->transfer_buffer);
307 pr_debug("urb->transfer_buffer_length=0x%08x\n", 306 pr_debug("urb->transfer_buffer_length=0x%08x\n",
308 urb->transfer_buffer_length); 307 urb->transfer_buffer_length);
309 pr_debug("urb->actual_length=0x%08x\n", urb->actual_length); 308 pr_debug("urb->actual_length=0x%08x\n", urb->actual_length);
310 pr_debug("urb->bandwidth=0x%08x\n", urb->bandwidth); 309 pr_debug("urb->bandwidth=0x%08x\n", urb->bandwidth);
311 pr_debug("urb->setup_packet(ctl)=0x%08x\n", 310 pr_debug("urb->setup_packet(ctl)=0x%08x\n",
312 (unsigned int)urb->setup_packet); 311 (unsigned int)urb->setup_packet);
313 pr_debug("urb->start_frame(iso/irq)=0x%08x\n", 312 pr_debug("urb->start_frame(iso/irq)=0x%08x\n", urb->start_frame);
314 urb->start_frame);
315 pr_debug("urb->interval(irq)=0x%08x\n", urb->interval); 313 pr_debug("urb->interval(irq)=0x%08x\n", urb->interval);
316 pr_debug("urb->error_count(iso)=0x%08x\n", urb->error_count); 314 pr_debug("urb->error_count(iso)=0x%08x\n", urb->error_count);
317 pr_debug("urb->timeout=0x%08x\n", urb->timeout); 315 pr_debug("urb->timeout=0x%08x\n", urb->timeout);
318 pr_debug("urb->context=0x%08x\n", (unsigned int)urb->context); 316 pr_debug("urb->context=0x%08x\n", (unsigned int)urb->context);
319 pr_debug("urb->complete=0x%08x\n", 317 pr_debug("urb->complete=0x%08x\n", (unsigned int)urb->complete);
320 (unsigned int)urb->complete);
321} 318}
322#endif 319#endif
323 320
@@ -337,7 +334,7 @@ void dbprint_urb(struct urb *urb)
337* Call context: 334* Call context:
338* Any 335* Any
339----------------------------------------------------------------*/ 336----------------------------------------------------------------*/
340static int submit_rx_urb(hfa384x_t *hw, gfp_t memflags) 337static int submit_rx_urb(hfa384x_t * hw, gfp_t memflags)
341{ 338{
342 struct sk_buff *skb; 339 struct sk_buff *skb;
343 int result; 340 int result;
@@ -398,7 +395,7 @@ done:
398* Call context: 395* Call context:
399* Any 396* Any
400----------------------------------------------------------------*/ 397----------------------------------------------------------------*/
401static int submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t memflags) 398static int submit_tx_urb(hfa384x_t * hw, struct urb *tx_urb, gfp_t memflags)
402{ 399{
403 struct net_device *netdev = hw->wlandev->netdev; 400 struct net_device *netdev = hw->wlandev->netdev;
404 int result; 401 int result;
@@ -535,7 +532,7 @@ static void hfa384x_usb_defer(struct work_struct *data)
535* Call context: 532* Call context:
536* process 533* process
537----------------------------------------------------------------*/ 534----------------------------------------------------------------*/
538void hfa384x_create(hfa384x_t *hw, struct usb_device *usb) 535void hfa384x_create(hfa384x_t * hw, struct usb_device *usb)
539{ 536{
540 memset(hw, 0, sizeof(hfa384x_t)); 537 memset(hw, 0, sizeof(hfa384x_t));
541 hw->usb = usb; 538 hw->usb = usb;
@@ -611,7 +608,7 @@ void hfa384x_create(hfa384x_t *hw, struct usb_device *usb)
611* Call context: 608* Call context:
612* process 609* process
613----------------------------------------------------------------*/ 610----------------------------------------------------------------*/
614void hfa384x_destroy(hfa384x_t *hw) 611void hfa384x_destroy(hfa384x_t * hw)
615{ 612{
616 struct sk_buff *skb; 613 struct sk_buff *skb;
617 614
@@ -633,7 +630,7 @@ static hfa384x_usbctlx_t *usbctlx_alloc(void)
633{ 630{
634 hfa384x_usbctlx_t *ctlx; 631 hfa384x_usbctlx_t *ctlx;
635 632
636 ctlx = kmalloc(sizeof(*ctlx), in_interrupt() ? GFP_ATOMIC : GFP_KERNEL); 633 ctlx = kmalloc(sizeof(*ctlx), in_interrupt()? GFP_ATOMIC : GFP_KERNEL);
637 if (ctlx != NULL) { 634 if (ctlx != NULL) {
638 memset(ctlx, 0, sizeof(*ctlx)); 635 memset(ctlx, 0, sizeof(*ctlx));
639 init_completion(&ctlx->done); 636 init_completion(&ctlx->done);
@@ -643,8 +640,8 @@ static hfa384x_usbctlx_t *usbctlx_alloc(void)
643} 640}
644 641
645static int 642static int
646usbctlx_get_status(const hfa384x_usb_cmdresp_t *cmdresp, 643usbctlx_get_status(const hfa384x_usb_cmdresp_t * cmdresp,
647 hfa384x_cmdresult_t *result) 644 hfa384x_cmdresult_t * result)
648{ 645{
649 result->status = le16_to_cpu(cmdresp->status); 646 result->status = le16_to_cpu(cmdresp->status);
650 result->resp0 = le16_to_cpu(cmdresp->resp0); 647 result->resp0 = le16_to_cpu(cmdresp->resp0);
@@ -652,15 +649,15 @@ usbctlx_get_status(const hfa384x_usb_cmdresp_t *cmdresp,
652 result->resp2 = le16_to_cpu(cmdresp->resp2); 649 result->resp2 = le16_to_cpu(cmdresp->resp2);
653 650
654 pr_debug("cmdresult:status=0x%04x " 651 pr_debug("cmdresult:status=0x%04x "
655 "resp0=0x%04x resp1=0x%04x resp2=0x%04x\n", 652 "resp0=0x%04x resp1=0x%04x resp2=0x%04x\n",
656 result->status, result->resp0, result->resp1, result->resp2); 653 result->status, result->resp0, result->resp1, result->resp2);
657 654
658 return result->status & HFA384x_STATUS_RESULT; 655 return result->status & HFA384x_STATUS_RESULT;
659} 656}
660 657
661static void 658static void
662usbctlx_get_rridresult(const hfa384x_usb_rridresp_t *rridresp, 659usbctlx_get_rridresult(const hfa384x_usb_rridresp_t * rridresp,
663 hfa384x_rridresult_t *result) 660 hfa384x_rridresult_t * result)
664{ 661{
665 result->rid = le16_to_cpu(rridresp->rid); 662 result->rid = le16_to_cpu(rridresp->rid);
666 result->riddata = rridresp->data; 663 result->riddata = rridresp->data;
@@ -681,7 +678,7 @@ struct usbctlx_cmd_completor {
681}; 678};
682typedef struct usbctlx_cmd_completor usbctlx_cmd_completor_t; 679typedef struct usbctlx_cmd_completor usbctlx_cmd_completor_t;
683 680
684static int usbctlx_cmd_completor_fn(usbctlx_completor_t *head) 681static int usbctlx_cmd_completor_fn(usbctlx_completor_t * head)
685{ 682{
686 usbctlx_cmd_completor_t *complete = (usbctlx_cmd_completor_t *) head; 683 usbctlx_cmd_completor_t *complete = (usbctlx_cmd_completor_t *) head;
687 return usbctlx_get_status(complete->cmdresp, complete->result); 684 return usbctlx_get_status(complete->cmdresp, complete->result);
@@ -715,7 +712,7 @@ struct usbctlx_rrid_completor {
715}; 712};
716typedef struct usbctlx_rrid_completor usbctlx_rrid_completor_t; 713typedef struct usbctlx_rrid_completor usbctlx_rrid_completor_t;
717 714
718static int usbctlx_rrid_completor_fn(usbctlx_completor_t *head) 715static int usbctlx_rrid_completor_fn(usbctlx_completor_t * head)
719{ 716{
720 usbctlx_rrid_completor_t *complete = (usbctlx_rrid_completor_t *) head; 717 usbctlx_rrid_completor_t *complete = (usbctlx_rrid_completor_t *) head;
721 hfa384x_rridresult_t rridresult; 718 hfa384x_rridresult_t rridresult;
@@ -736,7 +733,7 @@ static int usbctlx_rrid_completor_fn(usbctlx_completor_t *head)
736} 733}
737 734
738static inline usbctlx_completor_t *init_rrid_completor(usbctlx_rrid_completor_t 735static inline usbctlx_completor_t *init_rrid_completor(usbctlx_rrid_completor_t
739 *completor, 736 * completor,
740 const 737 const
741 hfa384x_usb_rridresp_t * 738 hfa384x_usb_rridresp_t *
742 rridresp, void *riddata, 739 rridresp, void *riddata,
@@ -776,7 +773,7 @@ struct usbctlx_rmem_completor {
776}; 773};
777typedef struct usbctlx_rmem_completor usbctlx_rmem_completor_t; 774typedef struct usbctlx_rmem_completor usbctlx_rmem_completor_t;
778 775
779static int usbctlx_rmem_completor_fn(usbctlx_completor_t *head) 776static int usbctlx_rmem_completor_fn(usbctlx_completor_t * head)
780{ 777{
781 usbctlx_rmem_completor_t *complete = (usbctlx_rmem_completor_t *) head; 778 usbctlx_rmem_completor_t *complete = (usbctlx_rmem_completor_t *) head;
782 779
@@ -786,9 +783,9 @@ static int usbctlx_rmem_completor_fn(usbctlx_completor_t *head)
786} 783}
787 784
788static inline usbctlx_completor_t *init_rmem_completor(usbctlx_rmem_completor_t 785static inline usbctlx_completor_t *init_rmem_completor(usbctlx_rmem_completor_t
789 *completor, 786 * completor,
790 hfa384x_usb_rmemresp_t 787 hfa384x_usb_rmemresp_t
791 *rmemresp, void *data, 788 * rmemresp, void *data,
792 unsigned int len) 789 unsigned int len)
793{ 790{
794 completor->head.complete = usbctlx_rmem_completor_fn; 791 completor->head.complete = usbctlx_rmem_completor_fn;
@@ -819,7 +816,7 @@ static inline usbctlx_completor_t *init_rmem_completor(usbctlx_rmem_completor_t
819* Call context: 816* Call context:
820* interrupt 817* interrupt
821----------------------------------------------------------------*/ 818----------------------------------------------------------------*/
822static void hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx) 819static void hfa384x_cb_status(hfa384x_t * hw, const hfa384x_usbctlx_t * ctlx)
823{ 820{
824 if (ctlx->usercb != NULL) { 821 if (ctlx->usercb != NULL) {
825 hfa384x_cmdresult_t cmdresult; 822 hfa384x_cmdresult_t cmdresult;
@@ -856,15 +853,14 @@ static void hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
856* Call context: 853* Call context:
857* interrupt 854* interrupt
858----------------------------------------------------------------*/ 855----------------------------------------------------------------*/
859static void hfa384x_cb_rrid(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx) 856static void hfa384x_cb_rrid(hfa384x_t * hw, const hfa384x_usbctlx_t * ctlx)
860{ 857{
861 if (ctlx->usercb != NULL) { 858 if (ctlx->usercb != NULL) {
862 hfa384x_rridresult_t rridresult; 859 hfa384x_rridresult_t rridresult;
863 860
864 if (ctlx->state != CTLX_COMPLETE) { 861 if (ctlx->state != CTLX_COMPLETE) {
865 memset(&rridresult, 0, sizeof(rridresult)); 862 memset(&rridresult, 0, sizeof(rridresult));
866 rridresult.rid = 863 rridresult.rid = le16_to_cpu(ctlx->outbuf.rridreq.rid);
867 le16_to_cpu(ctlx->outbuf.rridreq.rid);
868 } else { 864 } else {
869 usbctlx_get_rridresult(&ctlx->inbuf.rridresp, 865 usbctlx_get_rridresult(&ctlx->inbuf.rridresp,
870 &rridresult); 866 &rridresult);
@@ -874,21 +870,21 @@ static void hfa384x_cb_rrid(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
874 } 870 }
875} 871}
876 872
877static inline int hfa384x_docmd_wait(hfa384x_t *hw, hfa384x_metacmd_t *cmd) 873static inline int hfa384x_docmd_wait(hfa384x_t * hw, hfa384x_metacmd_t * cmd)
878{ 874{
879 return hfa384x_docmd(hw, DOWAIT, cmd, NULL, NULL, NULL); 875 return hfa384x_docmd(hw, DOWAIT, cmd, NULL, NULL, NULL);
880} 876}
881 877
882static inline int 878static inline int
883hfa384x_docmd_async(hfa384x_t *hw, 879hfa384x_docmd_async(hfa384x_t * hw,
884 hfa384x_metacmd_t *cmd, 880 hfa384x_metacmd_t * cmd,
885 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data) 881 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data)
886{ 882{
887 return hfa384x_docmd(hw, DOASYNC, cmd, cmdcb, usercb, usercb_data); 883 return hfa384x_docmd(hw, DOASYNC, cmd, cmdcb, usercb, usercb_data);
888} 884}
889 885
890static inline int 886static inline int
891hfa384x_dorrid_wait(hfa384x_t *hw, u16 rid, void *riddata, 887hfa384x_dorrid_wait(hfa384x_t * hw, u16 rid, void *riddata,
892 unsigned int riddatalen) 888 unsigned int riddatalen)
893{ 889{
894 return hfa384x_dorrid(hw, DOWAIT, 890 return hfa384x_dorrid(hw, DOWAIT,
@@ -896,7 +892,7 @@ hfa384x_dorrid_wait(hfa384x_t *hw, u16 rid, void *riddata,
896} 892}
897 893
898static inline int 894static inline int
899hfa384x_dorrid_async(hfa384x_t *hw, 895hfa384x_dorrid_async(hfa384x_t * hw,
900 u16 rid, void *riddata, unsigned int riddatalen, 896 u16 rid, void *riddata, unsigned int riddatalen,
901 ctlx_cmdcb_t cmdcb, 897 ctlx_cmdcb_t cmdcb,
902 ctlx_usercb_t usercb, void *usercb_data) 898 ctlx_usercb_t usercb, void *usercb_data)
@@ -907,7 +903,7 @@ hfa384x_dorrid_async(hfa384x_t *hw,
907} 903}
908 904
909static inline int 905static inline int
910hfa384x_dowrid_wait(hfa384x_t *hw, u16 rid, void *riddata, 906hfa384x_dowrid_wait(hfa384x_t * hw, u16 rid, void *riddata,
911 unsigned int riddatalen) 907 unsigned int riddatalen)
912{ 908{
913 return hfa384x_dowrid(hw, DOWAIT, 909 return hfa384x_dowrid(hw, DOWAIT,
@@ -915,7 +911,7 @@ hfa384x_dowrid_wait(hfa384x_t *hw, u16 rid, void *riddata,
915} 911}
916 912
917static inline int 913static inline int
918hfa384x_dowrid_async(hfa384x_t *hw, 914hfa384x_dowrid_async(hfa384x_t * hw,
919 u16 rid, void *riddata, unsigned int riddatalen, 915 u16 rid, void *riddata, unsigned int riddatalen,
920 ctlx_cmdcb_t cmdcb, 916 ctlx_cmdcb_t cmdcb,
921 ctlx_usercb_t usercb, void *usercb_data) 917 ctlx_usercb_t usercb, void *usercb_data)
@@ -926,7 +922,7 @@ hfa384x_dowrid_async(hfa384x_t *hw,
926} 922}
927 923
928static inline int 924static inline int
929hfa384x_dormem_wait(hfa384x_t *hw, 925hfa384x_dormem_wait(hfa384x_t * hw,
930 u16 page, u16 offset, void *data, unsigned int len) 926 u16 page, u16 offset, void *data, unsigned int len)
931{ 927{
932 return hfa384x_dormem(hw, DOWAIT, 928 return hfa384x_dormem(hw, DOWAIT,
@@ -934,7 +930,7 @@ hfa384x_dormem_wait(hfa384x_t *hw,
934} 930}
935 931
936static inline int 932static inline int
937hfa384x_dormem_async(hfa384x_t *hw, 933hfa384x_dormem_async(hfa384x_t * hw,
938 u16 page, u16 offset, void *data, unsigned int len, 934 u16 page, u16 offset, void *data, unsigned int len,
939 ctlx_cmdcb_t cmdcb, 935 ctlx_cmdcb_t cmdcb,
940 ctlx_usercb_t usercb, void *usercb_data) 936 ctlx_usercb_t usercb, void *usercb_data)
@@ -945,7 +941,7 @@ hfa384x_dormem_async(hfa384x_t *hw,
945} 941}
946 942
947static inline int 943static inline int
948hfa384x_dowmem_wait(hfa384x_t *hw, 944hfa384x_dowmem_wait(hfa384x_t * hw,
949 u16 page, u16 offset, void *data, unsigned int len) 945 u16 page, u16 offset, void *data, unsigned int len)
950{ 946{
951 return hfa384x_dowmem(hw, DOWAIT, 947 return hfa384x_dowmem(hw, DOWAIT,
@@ -953,7 +949,7 @@ hfa384x_dowmem_wait(hfa384x_t *hw,
953} 949}
954 950
955static inline int 951static inline int
956hfa384x_dowmem_async(hfa384x_t *hw, 952hfa384x_dowmem_async(hfa384x_t * hw,
957 u16 page, 953 u16 page,
958 u16 offset, 954 u16 offset,
959 void *data, 955 void *data,
@@ -985,7 +981,7 @@ hfa384x_dowmem_async(hfa384x_t *hw,
985* Call context: 981* Call context:
986* process 982* process
987----------------------------------------------------------------*/ 983----------------------------------------------------------------*/
988int hfa384x_cmd_initialize(hfa384x_t *hw) 984int hfa384x_cmd_initialize(hfa384x_t * hw)
989{ 985{
990 int result = 0; 986 int result = 0;
991 int i; 987 int i;
@@ -999,10 +995,10 @@ int hfa384x_cmd_initialize(hfa384x_t *hw)
999 result = hfa384x_docmd_wait(hw, &cmd); 995 result = hfa384x_docmd_wait(hw, &cmd);
1000 996
1001 pr_debug("cmdresp.init: " 997 pr_debug("cmdresp.init: "
1002 "status=0x%04x, resp0=0x%04x, " 998 "status=0x%04x, resp0=0x%04x, "
1003 "resp1=0x%04x, resp2=0x%04x\n", 999 "resp1=0x%04x, resp2=0x%04x\n",
1004 cmd.result.status, 1000 cmd.result.status,
1005 cmd.result.resp0, cmd.result.resp1, cmd.result.resp2); 1001 cmd.result.resp0, cmd.result.resp1, cmd.result.resp2);
1006 if (result == 0) { 1002 if (result == 0) {
1007 for (i = 0; i < HFA384x_NUMPORTS_MAX; i++) 1003 for (i = 0; i < HFA384x_NUMPORTS_MAX; i++)
1008 hw->port_enabled[i] = 0; 1004 hw->port_enabled[i] = 0;
@@ -1033,7 +1029,7 @@ int hfa384x_cmd_initialize(hfa384x_t *hw)
1033* Call context: 1029* Call context:
1034* process 1030* process
1035----------------------------------------------------------------*/ 1031----------------------------------------------------------------*/
1036int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport) 1032int hfa384x_cmd_disable(hfa384x_t * hw, u16 macport)
1037{ 1033{
1038 int result = 0; 1034 int result = 0;
1039 hfa384x_metacmd_t cmd; 1035 hfa384x_metacmd_t cmd;
@@ -1069,7 +1065,7 @@ int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport)
1069* Call context: 1065* Call context:
1070* process 1066* process
1071----------------------------------------------------------------*/ 1067----------------------------------------------------------------*/
1072int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport) 1068int hfa384x_cmd_enable(hfa384x_t * hw, u16 macport)
1073{ 1069{
1074 int result = 0; 1070 int result = 0;
1075 hfa384x_metacmd_t cmd; 1071 hfa384x_metacmd_t cmd;
@@ -1114,7 +1110,7 @@ int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport)
1114* Call context: 1110* Call context:
1115* process 1111* process
1116----------------------------------------------------------------*/ 1112----------------------------------------------------------------*/
1117int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable) 1113int hfa384x_cmd_monitor(hfa384x_t * hw, u16 enable)
1118{ 1114{
1119 int result = 0; 1115 int result = 0;
1120 hfa384x_metacmd_t cmd; 1116 hfa384x_metacmd_t cmd;
@@ -1168,15 +1164,14 @@ int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable)
1168* Call context: 1164* Call context:
1169* process 1165* process
1170----------------------------------------------------------------*/ 1166----------------------------------------------------------------*/
1171int hfa384x_cmd_download(hfa384x_t *hw, u16 mode, u16 lowaddr, 1167int hfa384x_cmd_download(hfa384x_t * hw, u16 mode, u16 lowaddr,
1172 u16 highaddr, u16 codelen) 1168 u16 highaddr, u16 codelen)
1173{ 1169{
1174 int result = 0; 1170 int result = 0;
1175 hfa384x_metacmd_t cmd; 1171 hfa384x_metacmd_t cmd;
1176 1172
1177 pr_debug( 1173 pr_debug("mode=%d, lowaddr=0x%04x, highaddr=0x%04x, codelen=%d\n",
1178 "mode=%d, lowaddr=0x%04x, highaddr=0x%04x, codelen=%d\n", 1174 mode, lowaddr, highaddr, codelen);
1179 mode, lowaddr, highaddr, codelen);
1180 1175
1181 cmd.cmd = (HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DOWNLD) | 1176 cmd.cmd = (HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DOWNLD) |
1182 HFA384x_CMD_PROGMODE_SET(mode)); 1177 HFA384x_CMD_PROGMODE_SET(mode));
@@ -1213,7 +1208,7 @@ int hfa384x_cmd_download(hfa384x_t *hw, u16 mode, u16 lowaddr,
1213* Call context: 1208* Call context:
1214* process 1209* process
1215----------------------------------------------------------------*/ 1210----------------------------------------------------------------*/
1216int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis) 1211int hfa384x_corereset(hfa384x_t * hw, int holdtime, int settletime, int genesis)
1217{ 1212{
1218 int result = 0; 1213 int result = 0;
1219 1214
@@ -1250,9 +1245,9 @@ int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis)
1250* Call context: 1245* Call context:
1251* process 1246* process
1252----------------------------------------------------------------*/ 1247----------------------------------------------------------------*/
1253static int hfa384x_usbctlx_complete_sync(hfa384x_t *hw, 1248static int hfa384x_usbctlx_complete_sync(hfa384x_t * hw,
1254 hfa384x_usbctlx_t *ctlx, 1249 hfa384x_usbctlx_t * ctlx,
1255 usbctlx_completor_t *completor) 1250 usbctlx_completor_t * completor)
1256{ 1251{
1257 unsigned long flags; 1252 unsigned long flags;
1258 int result; 1253 int result;
@@ -1366,9 +1361,9 @@ cleanup:
1366* process 1361* process
1367----------------------------------------------------------------*/ 1362----------------------------------------------------------------*/
1368static int 1363static int
1369hfa384x_docmd(hfa384x_t *hw, 1364hfa384x_docmd(hfa384x_t * hw,
1370 CMD_MODE mode, 1365 CMD_MODE mode,
1371 hfa384x_metacmd_t *cmd, 1366 hfa384x_metacmd_t * cmd,
1372 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data) 1367 ctlx_cmdcb_t cmdcb, ctlx_usercb_t usercb, void *usercb_data)
1373{ 1368{
1374 int result; 1369 int result;
@@ -1390,8 +1385,8 @@ hfa384x_docmd(hfa384x_t *hw,
1390 ctlx->outbufsize = sizeof(ctlx->outbuf.cmdreq); 1385 ctlx->outbufsize = sizeof(ctlx->outbuf.cmdreq);
1391 1386
1392 pr_debug("cmdreq: cmd=0x%04x " 1387 pr_debug("cmdreq: cmd=0x%04x "
1393 "parm0=0x%04x parm1=0x%04x parm2=0x%04x\n", 1388 "parm0=0x%04x parm1=0x%04x parm2=0x%04x\n",
1394 cmd->cmd, cmd->parm0, cmd->parm1, cmd->parm2); 1389 cmd->cmd, cmd->parm0, cmd->parm1, cmd->parm2);
1395 1390
1396 ctlx->reapable = mode; 1391 ctlx->reapable = mode;
1397 ctlx->cmdcb = cmdcb; 1392 ctlx->cmdcb = cmdcb;
@@ -1455,7 +1450,7 @@ done:
1455* process (DOWAIT or DOASYNC) 1450* process (DOWAIT or DOASYNC)
1456----------------------------------------------------------------*/ 1451----------------------------------------------------------------*/
1457static int 1452static int
1458hfa384x_dorrid(hfa384x_t *hw, 1453hfa384x_dorrid(hfa384x_t * hw,
1459 CMD_MODE mode, 1454 CMD_MODE mode,
1460 u16 rid, 1455 u16 rid,
1461 void *riddata, 1456 void *riddata,
@@ -1536,7 +1531,7 @@ done:
1536* process (DOWAIT or DOASYNC) 1531* process (DOWAIT or DOASYNC)
1537----------------------------------------------------------------*/ 1532----------------------------------------------------------------*/
1538static int 1533static int
1539hfa384x_dowrid(hfa384x_t *hw, 1534hfa384x_dowrid(hfa384x_t * hw,
1540 CMD_MODE mode, 1535 CMD_MODE mode,
1541 u16 rid, 1536 u16 rid,
1542 void *riddata, 1537 void *riddata,
@@ -1555,9 +1550,8 @@ hfa384x_dowrid(hfa384x_t *hw,
1555 /* Initialize the command */ 1550 /* Initialize the command */
1556 ctlx->outbuf.wridreq.type = cpu_to_le16(HFA384x_USB_WRIDREQ); 1551 ctlx->outbuf.wridreq.type = cpu_to_le16(HFA384x_USB_WRIDREQ);
1557 ctlx->outbuf.wridreq.frmlen = cpu_to_le16((sizeof 1552 ctlx->outbuf.wridreq.frmlen = cpu_to_le16((sizeof
1558 (ctlx->outbuf.wridreq. 1553 (ctlx->outbuf.wridreq.rid) +
1559 rid) + riddatalen + 1554 riddatalen + 1) / 2);
1560 1) / 2);
1561 ctlx->outbuf.wridreq.rid = cpu_to_le16(rid); 1555 ctlx->outbuf.wridreq.rid = cpu_to_le16(rid);
1562 memcpy(ctlx->outbuf.wridreq.data, riddata, riddatalen); 1556 memcpy(ctlx->outbuf.wridreq.data, riddata, riddatalen);
1563 1557
@@ -1624,7 +1618,7 @@ done:
1624* process (DOWAIT or DOASYNC) 1618* process (DOWAIT or DOASYNC)
1625----------------------------------------------------------------*/ 1619----------------------------------------------------------------*/
1626static int 1620static int
1627hfa384x_dormem(hfa384x_t *hw, 1621hfa384x_dormem(hfa384x_t * hw,
1628 CMD_MODE mode, 1622 CMD_MODE mode,
1629 u16 page, 1623 u16 page,
1630 u16 offset, 1624 u16 offset,
@@ -1645,20 +1639,18 @@ hfa384x_dormem(hfa384x_t *hw,
1645 ctlx->outbuf.rmemreq.type = cpu_to_le16(HFA384x_USB_RMEMREQ); 1639 ctlx->outbuf.rmemreq.type = cpu_to_le16(HFA384x_USB_RMEMREQ);
1646 ctlx->outbuf.rmemreq.frmlen = 1640 ctlx->outbuf.rmemreq.frmlen =
1647 cpu_to_le16(sizeof(ctlx->outbuf.rmemreq.offset) + 1641 cpu_to_le16(sizeof(ctlx->outbuf.rmemreq.offset) +
1648 sizeof(ctlx->outbuf.rmemreq.page) + len); 1642 sizeof(ctlx->outbuf.rmemreq.page) + len);
1649 ctlx->outbuf.rmemreq.offset = cpu_to_le16(offset); 1643 ctlx->outbuf.rmemreq.offset = cpu_to_le16(offset);
1650 ctlx->outbuf.rmemreq.page = cpu_to_le16(page); 1644 ctlx->outbuf.rmemreq.page = cpu_to_le16(page);
1651 1645
1652 ctlx->outbufsize = sizeof(ctlx->outbuf.rmemreq); 1646 ctlx->outbufsize = sizeof(ctlx->outbuf.rmemreq);
1653 1647
1654 pr_debug( 1648 pr_debug("type=0x%04x frmlen=%d offset=0x%04x page=0x%04x\n",
1655 "type=0x%04x frmlen=%d offset=0x%04x page=0x%04x\n", 1649 ctlx->outbuf.rmemreq.type,
1656 ctlx->outbuf.rmemreq.type, 1650 ctlx->outbuf.rmemreq.frmlen,
1657 ctlx->outbuf.rmemreq.frmlen, 1651 ctlx->outbuf.rmemreq.offset, ctlx->outbuf.rmemreq.page);
1658 ctlx->outbuf.rmemreq.offset, ctlx->outbuf.rmemreq.page);
1659 1652
1660 pr_debug("pktsize=%zd\n", 1653 pr_debug("pktsize=%zd\n", ROUNDUP64(sizeof(ctlx->outbuf.rmemreq)));
1661 ROUNDUP64(sizeof(ctlx->outbuf.rmemreq)));
1662 1654
1663 ctlx->reapable = mode; 1655 ctlx->reapable = mode;
1664 ctlx->cmdcb = cmdcb; 1656 ctlx->cmdcb = cmdcb;
@@ -1717,7 +1709,7 @@ done:
1717* process (DOWAIT or DOASYNC) 1709* process (DOWAIT or DOASYNC)
1718----------------------------------------------------------------*/ 1710----------------------------------------------------------------*/
1719static int 1711static int
1720hfa384x_dowmem(hfa384x_t *hw, 1712hfa384x_dowmem(hfa384x_t * hw,
1721 CMD_MODE mode, 1713 CMD_MODE mode,
1722 u16 page, 1714 u16 page,
1723 u16 offset, 1715 u16 offset,
@@ -1728,8 +1720,7 @@ hfa384x_dowmem(hfa384x_t *hw,
1728 int result; 1720 int result;
1729 hfa384x_usbctlx_t *ctlx; 1721 hfa384x_usbctlx_t *ctlx;
1730 1722
1731 pr_debug("page=0x%04x offset=0x%04x len=%d\n", 1723 pr_debug("page=0x%04x offset=0x%04x len=%d\n", page, offset, len);
1732 page, offset, len);
1733 1724
1734 ctlx = usbctlx_alloc(); 1725 ctlx = usbctlx_alloc();
1735 if (ctlx == NULL) { 1726 if (ctlx == NULL) {
@@ -1741,7 +1732,7 @@ hfa384x_dowmem(hfa384x_t *hw,
1741 ctlx->outbuf.wmemreq.type = cpu_to_le16(HFA384x_USB_WMEMREQ); 1732 ctlx->outbuf.wmemreq.type = cpu_to_le16(HFA384x_USB_WMEMREQ);
1742 ctlx->outbuf.wmemreq.frmlen = 1733 ctlx->outbuf.wmemreq.frmlen =
1743 cpu_to_le16(sizeof(ctlx->outbuf.wmemreq.offset) + 1734 cpu_to_le16(sizeof(ctlx->outbuf.wmemreq.offset) +
1744 sizeof(ctlx->outbuf.wmemreq.page) + len); 1735 sizeof(ctlx->outbuf.wmemreq.page) + len);
1745 ctlx->outbuf.wmemreq.offset = cpu_to_le16(offset); 1736 ctlx->outbuf.wmemreq.offset = cpu_to_le16(offset);
1746 ctlx->outbuf.wmemreq.page = cpu_to_le16(page); 1737 ctlx->outbuf.wmemreq.page = cpu_to_le16(page);
1747 memcpy(ctlx->outbuf.wmemreq.data, data, len); 1738 memcpy(ctlx->outbuf.wmemreq.data, data, len);
@@ -1792,7 +1783,7 @@ done:
1792* Call context: 1783* Call context:
1793* process 1784* process
1794----------------------------------------------------------------*/ 1785----------------------------------------------------------------*/
1795int hfa384x_drvr_commtallies(hfa384x_t *hw) 1786int hfa384x_drvr_commtallies(hfa384x_t * hw)
1796{ 1787{
1797 hfa384x_metacmd_t cmd; 1788 hfa384x_metacmd_t cmd;
1798 1789
@@ -1828,7 +1819,7 @@ int hfa384x_drvr_commtallies(hfa384x_t *hw)
1828* Call context: 1819* Call context:
1829* process 1820* process
1830----------------------------------------------------------------*/ 1821----------------------------------------------------------------*/
1831int hfa384x_drvr_disable(hfa384x_t *hw, u16 macport) 1822int hfa384x_drvr_disable(hfa384x_t * hw, u16 macport)
1832{ 1823{
1833 int result = 0; 1824 int result = 0;
1834 1825
@@ -1866,7 +1857,7 @@ int hfa384x_drvr_disable(hfa384x_t *hw, u16 macport)
1866* Call context: 1857* Call context:
1867* process 1858* process
1868----------------------------------------------------------------*/ 1859----------------------------------------------------------------*/
1869int hfa384x_drvr_enable(hfa384x_t *hw, u16 macport) 1860int hfa384x_drvr_enable(hfa384x_t * hw, u16 macport)
1870{ 1861{
1871 int result = 0; 1862 int result = 0;
1872 1863
@@ -1903,7 +1894,7 @@ int hfa384x_drvr_enable(hfa384x_t *hw, u16 macport)
1903* Call context: 1894* Call context:
1904* process 1895* process
1905----------------------------------------------------------------*/ 1896----------------------------------------------------------------*/
1906int hfa384x_drvr_flashdl_enable(hfa384x_t *hw) 1897int hfa384x_drvr_flashdl_enable(hfa384x_t * hw)
1907{ 1898{
1908 int result = 0; 1899 int result = 0;
1909 int i; 1900 int i;
@@ -1961,7 +1952,7 @@ int hfa384x_drvr_flashdl_enable(hfa384x_t *hw)
1961* Call context: 1952* Call context:
1962* process 1953* process
1963----------------------------------------------------------------*/ 1954----------------------------------------------------------------*/
1964int hfa384x_drvr_flashdl_disable(hfa384x_t *hw) 1955int hfa384x_drvr_flashdl_disable(hfa384x_t * hw)
1965{ 1956{
1966 /* Check that we're already in the download state */ 1957 /* Check that we're already in the download state */
1967 if (hw->dlstate != HFA384x_DLSTATE_FLASHENABLED) 1958 if (hw->dlstate != HFA384x_DLSTATE_FLASHENABLED)
@@ -2006,7 +1997,7 @@ int hfa384x_drvr_flashdl_disable(hfa384x_t *hw)
2006* Call context: 1997* Call context:
2007* process 1998* process
2008----------------------------------------------------------------*/ 1999----------------------------------------------------------------*/
2009int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len) 2000int hfa384x_drvr_flashdl_write(hfa384x_t * hw, u32 daddr, void *buf, u32 len)
2010{ 2001{
2011 int result = 0; 2002 int result = 0;
2012 u32 dlbufaddr; 2003 u32 dlbufaddr;
@@ -2035,9 +2026,8 @@ int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len)
2035 /* NOTE: dlbuffer RID stores the address in AUX format */ 2026 /* NOTE: dlbuffer RID stores the address in AUX format */
2036 dlbufaddr = 2027 dlbufaddr =
2037 HFA384x_ADDR_AUX_MKFLAT(hw->bufinfo.page, hw->bufinfo.offset); 2028 HFA384x_ADDR_AUX_MKFLAT(hw->bufinfo.page, hw->bufinfo.offset);
2038 pr_debug( 2029 pr_debug("dlbuf.page=0x%04x dlbuf.offset=0x%04x dlbufaddr=0x%08x\n",
2039 "dlbuf.page=0x%04x dlbuf.offset=0x%04x dlbufaddr=0x%08x\n", 2030 hw->bufinfo.page, hw->bufinfo.offset, dlbufaddr);
2040 hw->bufinfo.page, hw->bufinfo.offset, dlbufaddr);
2041 2031
2042#if 0 2032#if 0
2043 printk(KERN_WARNING "dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr, 2033 printk(KERN_WARNING "dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr,
@@ -2153,7 +2143,7 @@ exit_proc:
2153* Call context: 2143* Call context:
2154* process 2144* process
2155----------------------------------------------------------------*/ 2145----------------------------------------------------------------*/
2156int hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len) 2146int hfa384x_drvr_getconfig(hfa384x_t * hw, u16 rid, void *buf, u16 len)
2157{ 2147{
2158 int result; 2148 int result;
2159 2149
@@ -2190,7 +2180,7 @@ int hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len)
2190 * Any 2180 * Any
2191 ----------------------------------------------------------------*/ 2181 ----------------------------------------------------------------*/
2192int 2182int
2193hfa384x_drvr_getconfig_async(hfa384x_t *hw, 2183hfa384x_drvr_getconfig_async(hfa384x_t * hw,
2194 u16 rid, ctlx_usercb_t usercb, void *usercb_data) 2184 u16 rid, ctlx_usercb_t usercb, void *usercb_data)
2195{ 2185{
2196 return hfa384x_dorrid_async(hw, rid, NULL, 0, 2186 return hfa384x_dorrid_async(hw, rid, NULL, 0,
@@ -2221,7 +2211,7 @@ hfa384x_drvr_getconfig_async(hfa384x_t *hw,
2221 * process 2211 * process
2222 ----------------------------------------------------------------*/ 2212 ----------------------------------------------------------------*/
2223int 2213int
2224hfa384x_drvr_setconfig_async(hfa384x_t *hw, 2214hfa384x_drvr_setconfig_async(hfa384x_t * hw,
2225 u16 rid, 2215 u16 rid,
2226 void *buf, 2216 void *buf,
2227 u16 len, ctlx_usercb_t usercb, void *usercb_data) 2217 u16 len, ctlx_usercb_t usercb, void *usercb_data)
@@ -2248,7 +2238,7 @@ hfa384x_drvr_setconfig_async(hfa384x_t *hw,
2248* Call context: 2238* Call context:
2249* process 2239* process
2250----------------------------------------------------------------*/ 2240----------------------------------------------------------------*/
2251int hfa384x_drvr_ramdl_disable(hfa384x_t *hw) 2241int hfa384x_drvr_ramdl_disable(hfa384x_t * hw)
2252{ 2242{
2253 /* Check that we're already in the download state */ 2243 /* Check that we're already in the download state */
2254 if (hw->dlstate != HFA384x_DLSTATE_RAMENABLED) 2244 if (hw->dlstate != HFA384x_DLSTATE_RAMENABLED)
@@ -2288,7 +2278,7 @@ int hfa384x_drvr_ramdl_disable(hfa384x_t *hw)
2288* Call context: 2278* Call context:
2289* process 2279* process
2290----------------------------------------------------------------*/ 2280----------------------------------------------------------------*/
2291int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr) 2281int hfa384x_drvr_ramdl_enable(hfa384x_t * hw, u32 exeaddr)
2292{ 2282{
2293 int result = 0; 2283 int result = 0;
2294 u16 lowaddr; 2284 u16 lowaddr;
@@ -2323,9 +2313,8 @@ int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr)
2323 /* Set the download state */ 2313 /* Set the download state */
2324 hw->dlstate = HFA384x_DLSTATE_RAMENABLED; 2314 hw->dlstate = HFA384x_DLSTATE_RAMENABLED;
2325 } else { 2315 } else {
2326 pr_debug( 2316 pr_debug("cmd_download(0x%04x, 0x%04x) failed, result=%d.\n",
2327 "cmd_download(0x%04x, 0x%04x) failed, result=%d.\n", 2317 lowaddr, hiaddr, result);
2328 lowaddr, hiaddr, result);
2329 } 2318 }
2330 2319
2331 return result; 2320 return result;
@@ -2357,7 +2346,7 @@ int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr)
2357* Call context: 2346* Call context:
2358* process 2347* process
2359----------------------------------------------------------------*/ 2348----------------------------------------------------------------*/
2360int hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len) 2349int hfa384x_drvr_ramdl_write(hfa384x_t * hw, u32 daddr, void *buf, u32 len)
2361{ 2350{
2362 int result = 0; 2351 int result = 0;
2363 int nwrites; 2352 int nwrites;
@@ -2436,7 +2425,7 @@ int hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len)
2436* Call context: 2425* Call context:
2437* process or non-card interrupt. 2426* process or non-card interrupt.
2438----------------------------------------------------------------*/ 2427----------------------------------------------------------------*/
2439int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len) 2428int hfa384x_drvr_readpda(hfa384x_t * hw, void *buf, unsigned int len)
2440{ 2429{
2441 int result = 0; 2430 int result = 0;
2442 u16 *pda = buf; 2431 u16 *pda = buf;
@@ -2542,7 +2531,7 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len)
2542* Call context: 2531* Call context:
2543* process 2532* process
2544----------------------------------------------------------------*/ 2533----------------------------------------------------------------*/
2545int hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len) 2534int hfa384x_drvr_setconfig(hfa384x_t * hw, u16 rid, void *buf, u16 len)
2546{ 2535{
2547 return hfa384x_dowrid_wait(hw, rid, buf, len); 2536 return hfa384x_dowrid_wait(hw, rid, buf, len);
2548} 2537}
@@ -2567,7 +2556,7 @@ int hfa384x_drvr_setconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len)
2567* process 2556* process
2568----------------------------------------------------------------*/ 2557----------------------------------------------------------------*/
2569 2558
2570int hfa384x_drvr_start(hfa384x_t *hw) 2559int hfa384x_drvr_start(hfa384x_t * hw)
2571{ 2560{
2572 int result, result1, result2; 2561 int result, result1, result2;
2573 u16 status; 2562 u16 status;
@@ -2629,11 +2618,10 @@ int hfa384x_drvr_start(hfa384x_t *hw)
2629 usb_kill_urb(&hw->rx_urb); 2618 usb_kill_urb(&hw->rx_urb);
2630 goto done; 2619 goto done;
2631 } else { 2620 } else {
2632 pr_debug( 2621 pr_debug("First cmd_initialize() failed (result %d),\n",
2633 "First cmd_initialize() failed (result %d),\n", 2622 result1);
2634 result1); 2623 pr_debug
2635 pr_debug( 2624 ("but second attempt succeeded. All should be ok\n");
2636 "but second attempt succeeded. All should be ok\n");
2637 } 2625 }
2638 } else if (result2 != 0) { 2626 } else if (result2 != 0) {
2639 printk(KERN_WARNING 2627 printk(KERN_WARNING
@@ -2669,7 +2657,7 @@ done:
2669* Call context: 2657* Call context:
2670* process 2658* process
2671----------------------------------------------------------------*/ 2659----------------------------------------------------------------*/
2672int hfa384x_drvr_stop(hfa384x_t *hw) 2660int hfa384x_drvr_stop(hfa384x_t * hw)
2673{ 2661{
2674 int result = 0; 2662 int result = 0;
2675 int i; 2663 int i;
@@ -2720,9 +2708,9 @@ int hfa384x_drvr_stop(hfa384x_t *hw)
2720* Call context: 2708* Call context:
2721* interrupt 2709* interrupt
2722----------------------------------------------------------------*/ 2710----------------------------------------------------------------*/
2723int hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, 2711int hfa384x_drvr_txframe(hfa384x_t * hw, struct sk_buff *skb,
2724 p80211_hdr_t *p80211_hdr, 2712 p80211_hdr_t * p80211_hdr,
2725 p80211_metawep_t *p80211_wep) 2713 p80211_metawep_t * p80211_wep)
2726{ 2714{
2727 int usbpktlen = sizeof(hfa384x_tx_frame_t); 2715 int usbpktlen = sizeof(hfa384x_tx_frame_t);
2728 int result; 2716 int result;
@@ -2813,7 +2801,7 @@ exit:
2813 return result; 2801 return result;
2814} 2802}
2815 2803
2816void hfa384x_tx_timeout(wlandevice_t *wlandev) 2804void hfa384x_tx_timeout(wlandevice_t * wlandev)
2817{ 2805{
2818 hfa384x_t *hw = wlandev->priv; 2806 hfa384x_t *hw = wlandev->priv;
2819 unsigned long flags; 2807 unsigned long flags;
@@ -2962,8 +2950,8 @@ static void hfa384x_usbctlx_completion_task(unsigned long data)
2962* Call context: 2950* Call context:
2963* Either process or interrupt, but presumably interrupt 2951* Either process or interrupt, but presumably interrupt
2964----------------------------------------------------------------*/ 2952----------------------------------------------------------------*/
2965static int unlocked_usbctlx_cancel_async(hfa384x_t *hw, 2953static int unlocked_usbctlx_cancel_async(hfa384x_t * hw,
2966 hfa384x_usbctlx_t *ctlx) 2954 hfa384x_usbctlx_t * ctlx)
2967{ 2955{
2968 int ret; 2956 int ret;
2969 2957
@@ -3012,7 +3000,7 @@ static int unlocked_usbctlx_cancel_async(hfa384x_t *hw,
3012* Call context: 3000* Call context:
3013* Either, assume interrupt 3001* Either, assume interrupt
3014----------------------------------------------------------------*/ 3002----------------------------------------------------------------*/
3015static void unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx) 3003static void unlocked_usbctlx_complete(hfa384x_t * hw, hfa384x_usbctlx_t * ctlx)
3016{ 3004{
3017 /* Timers have been stopped, and ctlx should be in 3005 /* Timers have been stopped, and ctlx should be in
3018 * a terminal state. Retire it from the "active" 3006 * a terminal state. Retire it from the "active"
@@ -3029,8 +3017,7 @@ static void unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx)
3029 3017
3030 default: 3018 default:
3031 printk(KERN_ERR "CTLX[%d] not in a terminating state(%s)\n", 3019 printk(KERN_ERR "CTLX[%d] not in a terminating state(%s)\n",
3032 le16_to_cpu(ctlx->outbuf.type), 3020 le16_to_cpu(ctlx->outbuf.type), ctlxstr(ctlx->state));
3033 ctlxstr(ctlx->state));
3034 break; 3021 break;
3035 } /* switch */ 3022 } /* switch */
3036} 3023}
@@ -3051,7 +3038,7 @@ static void unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx)
3051* Call context: 3038* Call context:
3052* any 3039* any
3053----------------------------------------------------------------*/ 3040----------------------------------------------------------------*/
3054static void hfa384x_usbctlxq_run(hfa384x_t *hw) 3041static void hfa384x_usbctlxq_run(hfa384x_t * hw)
3055{ 3042{
3056 unsigned long flags; 3043 unsigned long flags;
3057 3044
@@ -3225,14 +3212,13 @@ static void hfa384x_usbin_callback(struct urb *urb)
3225 3212
3226 case -ENOENT: 3213 case -ENOENT:
3227 case -ECONNRESET: 3214 case -ECONNRESET:
3228 pr_debug("status=%d, urb explicitly unlinked.\n", 3215 pr_debug("status=%d, urb explicitly unlinked.\n", urb->status);
3229 urb->status);
3230 action = ABORT; 3216 action = ABORT;
3231 break; 3217 break;
3232 3218
3233 default: 3219 default:
3234 pr_debug("urb status=%d, transfer flags=0x%x\n", 3220 pr_debug("urb status=%d, transfer flags=0x%x\n",
3235 urb->status, urb->transfer_flags); 3221 urb->status, urb->transfer_flags);
3236 ++(wlandev->linux_stats.rx_errors); 3222 ++(wlandev->linux_stats.rx_errors);
3237 action = RESUBMIT; 3223 action = RESUBMIT;
3238 break; 3224 break;
@@ -3292,18 +3278,17 @@ static void hfa384x_usbin_callback(struct urb *urb)
3292 3278
3293 case HFA384x_USB_BUFAVAIL: 3279 case HFA384x_USB_BUFAVAIL:
3294 pr_debug("Received BUFAVAIL packet, frmlen=%d\n", 3280 pr_debug("Received BUFAVAIL packet, frmlen=%d\n",
3295 usbin->bufavail.frmlen); 3281 usbin->bufavail.frmlen);
3296 break; 3282 break;
3297 3283
3298 case HFA384x_USB_ERROR: 3284 case HFA384x_USB_ERROR:
3299 pr_debug("Received USB_ERROR packet, errortype=%d\n", 3285 pr_debug("Received USB_ERROR packet, errortype=%d\n",
3300 usbin->usberror.errortype); 3286 usbin->usberror.errortype);
3301 break; 3287 break;
3302 3288
3303 default: 3289 default:
3304 pr_debug( 3290 pr_debug("Unrecognized USBIN packet, type=%x, status=%d\n",
3305 "Unrecognized USBIN packet, type=%x, status=%d\n", 3291 usbin->type, urb_status);
3306 usbin->type, urb_status);
3307 break; 3292 break;
3308 } /* switch */ 3293 } /* switch */
3309 3294
@@ -3333,7 +3318,7 @@ exit:
3333* Call context: 3318* Call context:
3334* interrupt 3319* interrupt
3335----------------------------------------------------------------*/ 3320----------------------------------------------------------------*/
3336static void hfa384x_usbin_ctlx(hfa384x_t *hw, hfa384x_usbin_t *usbin, 3321static void hfa384x_usbin_ctlx(hfa384x_t * hw, hfa384x_usbin_t * usbin,
3337 int urb_status) 3322 int urb_status)
3338{ 3323{
3339 hfa384x_usbctlx_t *ctlx; 3324 hfa384x_usbctlx_t *ctlx;
@@ -3399,8 +3384,8 @@ retry:
3399 * our request has been acknowledged. Odd, 3384 * our request has been acknowledged. Odd,
3400 * but our OUT URB is still alive... 3385 * but our OUT URB is still alive...
3401 */ 3386 */
3402 pr_debug( 3387 pr_debug
3403 "Causality violation: please reboot Universe, or email linux-wlan-devel@lists.linux-wlan.com\n"); 3388 ("Causality violation: please reboot Universe, or email linux-wlan-devel@lists.linux-wlan.com\n");
3404 ctlx->state = CTLX_RESP_COMPLETE; 3389 ctlx->state = CTLX_RESP_COMPLETE;
3405 break; 3390 break;
3406 3391
@@ -3454,8 +3439,8 @@ unlock:
3454* Call context: 3439* Call context:
3455* interrupt 3440* interrupt
3456----------------------------------------------------------------*/ 3441----------------------------------------------------------------*/
3457static void hfa384x_usbin_txcompl(wlandevice_t *wlandev, 3442static void hfa384x_usbin_txcompl(wlandevice_t * wlandev,
3458 hfa384x_usbin_t *usbin) 3443 hfa384x_usbin_t * usbin)
3459{ 3444{
3460 u16 status; 3445 u16 status;
3461 3446
@@ -3485,7 +3470,7 @@ static void hfa384x_usbin_txcompl(wlandevice_t *wlandev,
3485* Call context: 3470* Call context:
3486* interrupt 3471* interrupt
3487----------------------------------------------------------------*/ 3472----------------------------------------------------------------*/
3488static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb) 3473static void hfa384x_usbin_rx(wlandevice_t * wlandev, struct sk_buff *skb)
3489{ 3474{
3490 hfa384x_usbin_t *usbin = (hfa384x_usbin_t *) skb->data; 3475 hfa384x_usbin_t *usbin = (hfa384x_usbin_t *) skb->data;
3491 hfa384x_t *hw = wlandev->priv; 3476 hfa384x_t *hw = wlandev->priv;
@@ -3552,8 +3537,7 @@ static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb)
3552 hfa384x_int_rxmonitor(wlandev, &usbin->rxfrm); 3537 hfa384x_int_rxmonitor(wlandev, &usbin->rxfrm);
3553 dev_kfree_skb(skb); 3538 dev_kfree_skb(skb);
3554 } else { 3539 } else {
3555 pr_debug( 3540 pr_debug("Received monitor frame: FCSerr set\n");
3556 "Received monitor frame: FCSerr set\n");
3557 } 3541 }
3558 break; 3542 break;
3559 3543
@@ -3589,8 +3573,8 @@ done:
3589* Call context: 3573* Call context:
3590* interrupt 3574* interrupt
3591----------------------------------------------------------------*/ 3575----------------------------------------------------------------*/
3592static void hfa384x_int_rxmonitor(wlandevice_t *wlandev, 3576static void hfa384x_int_rxmonitor(wlandevice_t * wlandev,
3593 hfa384x_usb_rxfrm_t *rxfrm) 3577 hfa384x_usb_rxfrm_t * rxfrm)
3594{ 3578{
3595 hfa384x_rx_frame_t *rxdesc = &(rxfrm->desc); 3579 hfa384x_rx_frame_t *rxdesc = &(rxfrm->desc);
3596 unsigned int hdrlen = 0; 3580 unsigned int hdrlen = 0;
@@ -3615,7 +3599,7 @@ static void hfa384x_int_rxmonitor(wlandevice_t *wlandev,
3615 (sizeof(p80211_caphdr_t) + 3599 (sizeof(p80211_caphdr_t) +
3616 WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)) { 3600 WLAN_HDR_A4_LEN + WLAN_DATA_MAXLEN + WLAN_CRC_LEN)) {
3617 pr_debug("overlen frm: len=%zd\n", 3601 pr_debug("overlen frm: len=%zd\n",
3618 skblen - sizeof(p80211_caphdr_t)); 3602 skblen - sizeof(p80211_caphdr_t));
3619 } 3603 }
3620 3604
3621 if ((skb = dev_alloc_skb(skblen)) == NULL) { 3605 if ((skb = dev_alloc_skb(skblen)) == NULL) {
@@ -4071,7 +4055,7 @@ static void hfa384x_usb_throttlefn(unsigned long data)
4071* Call context: 4055* Call context:
4072* process or interrupt 4056* process or interrupt
4073----------------------------------------------------------------*/ 4057----------------------------------------------------------------*/
4074static int hfa384x_usbctlx_submit(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx) 4058static int hfa384x_usbctlx_submit(hfa384x_t * hw, hfa384x_usbctlx_t * ctlx)
4075{ 4059{
4076 unsigned long flags; 4060 unsigned long flags;
4077 int ret; 4061 int ret;
@@ -4112,7 +4096,7 @@ static int hfa384x_usbctlx_submit(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx)
4112* Call context: 4096* Call context:
4113* interrupt 4097* interrupt
4114----------------------------------------------------------------*/ 4098----------------------------------------------------------------*/
4115static void hfa384x_usbout_tx(wlandevice_t *wlandev, hfa384x_usbout_t *usbout) 4099static void hfa384x_usbout_tx(wlandevice_t * wlandev, hfa384x_usbout_t * usbout)
4116{ 4100{
4117 prism2sta_ev_alloc(wlandev); 4101 prism2sta_ev_alloc(wlandev);
4118} 4102}
@@ -4171,15 +4155,13 @@ static int hfa384x_isgood_pdrcode(u16 pdrcode)
4171 default: 4155 default:
4172 if (pdrcode < 0x1000) { 4156 if (pdrcode < 0x1000) {
4173 /* code is OK, but we don't know exactly what it is */ 4157 /* code is OK, but we don't know exactly what it is */
4174 pr_debug( 4158 pr_debug("Encountered unknown PDR#=0x%04x, "
4175 "Encountered unknown PDR#=0x%04x, " 4159 "assuming it's ok.\n", pdrcode);
4176 "assuming it's ok.\n", pdrcode);
4177 return 1; 4160 return 1;
4178 } else { 4161 } else {
4179 /* bad code */ 4162 /* bad code */
4180 pr_debug( 4163 pr_debug("Encountered unknown PDR#=0x%04x, "
4181 "Encountered unknown PDR#=0x%04x, " 4164 "(>=0x1000), assuming it's bad.\n", pdrcode);
4182 "(>=0x1000), assuming it's bad.\n", pdrcode);
4183 return 0; 4165 return 0;
4184 } 4166 }
4185 break; 4167 break;
diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c
index 44266b8618c..8b4f3960d9b 100644
--- a/drivers/staging/wlan-ng/p80211conv.c
+++ b/drivers/staging/wlan-ng/p80211conv.c
@@ -102,9 +102,9 @@ static u8 oui_8021h[] = { 0x00, 0x00, 0xf8 };
102* Call context: 102* Call context:
103* May be called in interrupt or non-interrupt context 103* May be called in interrupt or non-interrupt context
104----------------------------------------------------------------*/ 104----------------------------------------------------------------*/
105int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, 105int skb_ether_to_p80211(wlandevice_t * wlandev, u32 ethconv,
106 struct sk_buff *skb, p80211_hdr_t *p80211_hdr, 106 struct sk_buff *skb, p80211_hdr_t * p80211_hdr,
107 p80211_metawep_t *p80211_wep) 107 p80211_metawep_t * p80211_wep)
108{ 108{
109 109
110 u16 fc; 110 u16 fc;
@@ -209,8 +209,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv,
209 209
210 if ((foo = wep_encrypt(wlandev, skb->data, p80211_wep->data, 210 if ((foo = wep_encrypt(wlandev, skb->data, p80211_wep->data,
211 skb->len, 211 skb->len,
212 (wlandev-> 212 (wlandev->hostwep &
213 hostwep & HOSTWEP_DEFAULTKEY_MASK), 213 HOSTWEP_DEFAULTKEY_MASK),
214 p80211_wep->iv, p80211_wep->icv))) { 214 p80211_wep->iv, p80211_wep->icv))) {
215 printk(KERN_WARNING 215 printk(KERN_WARNING
216 "Host en-WEP failed, dropping frame (%d).\n", 216 "Host en-WEP failed, dropping frame (%d).\n",
@@ -230,8 +230,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv,
230} 230}
231 231
232/* jkriegl: from orinoco, modified */ 232/* jkriegl: from orinoco, modified */
233static void orinoco_spy_gather(wlandevice_t *wlandev, char *mac, 233static void orinoco_spy_gather(wlandevice_t * wlandev, char *mac,
234 p80211_rxmeta_t *rxmeta) 234 p80211_rxmeta_t * rxmeta)
235{ 235{
236 int i; 236 int i;
237 237
@@ -272,7 +272,7 @@ static void orinoco_spy_gather(wlandevice_t *wlandev, char *mac,
272* Call context: 272* Call context:
273* May be called in interrupt or non-interrupt context 273* May be called in interrupt or non-interrupt context
274----------------------------------------------------------------*/ 274----------------------------------------------------------------*/
275int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, 275int skb_p80211_to_ether(wlandevice_t * wlandev, u32 ethconv,
276 struct sk_buff *skb) 276 struct sk_buff *skb)
277{ 277{
278 netdevice_t *netdev = wlandev->netdev; 278 netdevice_t *netdev = wlandev->netdev;
@@ -329,9 +329,8 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
329 skb->data + payload_offset + 329 skb->data + payload_offset +
330 payload_length - 4))) { 330 payload_length - 4))) {
331 /* de-wep failed, drop skb. */ 331 /* de-wep failed, drop skb. */
332 pr_debug( 332 pr_debug("Host de-WEP failed, dropping frame (%d).\n",
333 "Host de-WEP failed, dropping frame (%d).\n", 333 foo);
334 foo);
335 wlandev->rx.decrypt_err++; 334 wlandev->rx.decrypt_err++;
336 return 2; 335 return 2;
337 } 336 }
diff --git a/drivers/staging/wlan-ng/p80211conv.h b/drivers/staging/wlan-ng/p80211conv.h
index 6fe163be24f..0c62df19fa7 100644
--- a/drivers/staging/wlan-ng/p80211conv.h
+++ b/drivers/staging/wlan-ng/p80211conv.h
@@ -153,8 +153,8 @@ struct wlandevice;
153int skb_p80211_to_ether(struct wlandevice *wlandev, u32 ethconv, 153int skb_p80211_to_ether(struct wlandevice *wlandev, u32 ethconv,
154 struct sk_buff *skb); 154 struct sk_buff *skb);
155int skb_ether_to_p80211(struct wlandevice *wlandev, u32 ethconv, 155int skb_ether_to_p80211(struct wlandevice *wlandev, u32 ethconv,
156 struct sk_buff *skb, p80211_hdr_t *p80211_hdr, 156 struct sk_buff *skb, p80211_hdr_t * p80211_hdr,
157 p80211_metawep_t *p80211_wep); 157 p80211_metawep_t * p80211_wep);
158 158
159int p80211_stt_findproto(u16 proto); 159int p80211_stt_findproto(u16 proto);
160 160
diff --git a/drivers/staging/wlan-ng/p80211hdr.h b/drivers/staging/wlan-ng/p80211hdr.h
index ded47751769..1703c923947 100644
--- a/drivers/staging/wlan-ng/p80211hdr.h
+++ b/drivers/staging/wlan-ng/p80211hdr.h
@@ -68,8 +68,6 @@
68/*================================================================*/ 68/*================================================================*/
69/* Project Includes */ 69/* Project Includes */
70 70
71
72
73/*================================================================*/ 71/*================================================================*/
74/* Constants */ 72/* Constants */
75 73
@@ -188,7 +186,6 @@ typedef union p80211_hdr {
188 p80211_hdr_a4_t a4; 186 p80211_hdr_a4_t a4;
189} __attribute__ ((packed)) p80211_hdr_t; 187} __attribute__ ((packed)) p80211_hdr_t;
190 188
191
192/* Frame and header length macros */ 189/* Frame and header length macros */
193 190
194#define WLAN_CTL_FRAMELEN(fstype) (\ 191#define WLAN_CTL_FRAMELEN(fstype) (\
diff --git a/drivers/staging/wlan-ng/p80211meta.h b/drivers/staging/wlan-ng/p80211meta.h
index 2f3c9fc3358..c1a677be8de 100644
--- a/drivers/staging/wlan-ng/p80211meta.h
+++ b/drivers/staging/wlan-ng/p80211meta.h
@@ -60,7 +60,6 @@
60/*================================================================*/ 60/*================================================================*/
61/* Project Includes */ 61/* Project Includes */
62 62
63
64/*================================================================*/ 63/*================================================================*/
65/* Types */ 64/* Types */
66 65
diff --git a/drivers/staging/wlan-ng/p80211mgmt.h b/drivers/staging/wlan-ng/p80211mgmt.h
index 6235fe7f235..c925a45b188 100644
--- a/drivers/staging/wlan-ng/p80211mgmt.h
+++ b/drivers/staging/wlan-ng/p80211mgmt.h
@@ -103,12 +103,10 @@
103/*================================================================*/ 103/*================================================================*/
104/* Project Includes */ 104/* Project Includes */
105 105
106
107#ifndef _P80211HDR_H 106#ifndef _P80211HDR_H
108#include "p80211hdr.h" 107#include "p80211hdr.h"
109#endif 108#endif
110 109
111
112/*================================================================*/ 110/*================================================================*/
113/* Constants */ 111/* Constants */
114 112
@@ -504,25 +502,25 @@ typedef struct wlan_fr_deauthen {
504 502
505} wlan_fr_deauthen_t; 503} wlan_fr_deauthen_t;
506 504
507void wlan_mgmt_encode_beacon(wlan_fr_beacon_t *f); 505void wlan_mgmt_encode_beacon(wlan_fr_beacon_t * f);
508void wlan_mgmt_decode_beacon(wlan_fr_beacon_t *f); 506void wlan_mgmt_decode_beacon(wlan_fr_beacon_t * f);
509void wlan_mgmt_encode_disassoc(wlan_fr_disassoc_t *f); 507void wlan_mgmt_encode_disassoc(wlan_fr_disassoc_t * f);
510void wlan_mgmt_decode_disassoc(wlan_fr_disassoc_t *f); 508void wlan_mgmt_decode_disassoc(wlan_fr_disassoc_t * f);
511void wlan_mgmt_encode_assocreq(wlan_fr_assocreq_t *f); 509void wlan_mgmt_encode_assocreq(wlan_fr_assocreq_t * f);
512void wlan_mgmt_decode_assocreq(wlan_fr_assocreq_t *f); 510void wlan_mgmt_decode_assocreq(wlan_fr_assocreq_t * f);
513void wlan_mgmt_encode_assocresp(wlan_fr_assocresp_t *f); 511void wlan_mgmt_encode_assocresp(wlan_fr_assocresp_t * f);
514void wlan_mgmt_decode_assocresp(wlan_fr_assocresp_t *f); 512void wlan_mgmt_decode_assocresp(wlan_fr_assocresp_t * f);
515void wlan_mgmt_encode_reassocreq(wlan_fr_reassocreq_t *f); 513void wlan_mgmt_encode_reassocreq(wlan_fr_reassocreq_t * f);
516void wlan_mgmt_decode_reassocreq(wlan_fr_reassocreq_t *f); 514void wlan_mgmt_decode_reassocreq(wlan_fr_reassocreq_t * f);
517void wlan_mgmt_encode_reassocresp(wlan_fr_reassocresp_t *f); 515void wlan_mgmt_encode_reassocresp(wlan_fr_reassocresp_t * f);
518void wlan_mgmt_decode_reassocresp(wlan_fr_reassocresp_t *f); 516void wlan_mgmt_decode_reassocresp(wlan_fr_reassocresp_t * f);
519void wlan_mgmt_encode_probereq(wlan_fr_probereq_t *f); 517void wlan_mgmt_encode_probereq(wlan_fr_probereq_t * f);
520void wlan_mgmt_decode_probereq(wlan_fr_probereq_t *f); 518void wlan_mgmt_decode_probereq(wlan_fr_probereq_t * f);
521void wlan_mgmt_encode_proberesp(wlan_fr_proberesp_t *f); 519void wlan_mgmt_encode_proberesp(wlan_fr_proberesp_t * f);
522void wlan_mgmt_decode_proberesp(wlan_fr_proberesp_t *f); 520void wlan_mgmt_decode_proberesp(wlan_fr_proberesp_t * f);
523void wlan_mgmt_encode_authen(wlan_fr_authen_t *f); 521void wlan_mgmt_encode_authen(wlan_fr_authen_t * f);
524void wlan_mgmt_decode_authen(wlan_fr_authen_t *f); 522void wlan_mgmt_decode_authen(wlan_fr_authen_t * f);
525void wlan_mgmt_encode_deauthen(wlan_fr_deauthen_t *f); 523void wlan_mgmt_encode_deauthen(wlan_fr_deauthen_t * f);
526void wlan_mgmt_decode_deauthen(wlan_fr_deauthen_t *f); 524void wlan_mgmt_decode_deauthen(wlan_fr_deauthen_t * f);
527 525
528#endif /* _P80211MGMT_H */ 526#endif /* _P80211MGMT_H */
diff --git a/drivers/staging/wlan-ng/p80211msg.h b/drivers/staging/wlan-ng/p80211msg.h
index f15a5d921f3..4ac77274eef 100644
--- a/drivers/staging/wlan-ng/p80211msg.h
+++ b/drivers/staging/wlan-ng/p80211msg.h
@@ -51,7 +51,6 @@
51/*================================================================*/ 51/*================================================================*/
52/* Project Includes */ 52/* Project Includes */
53 53
54
55#define WLAN_DEVNAMELEN_MAX 16 54#define WLAN_DEVNAMELEN_MAX 16
56 55
57/*--------------------------------------------------------------------*/ 56/*--------------------------------------------------------------------*/
diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index ef8e459214b..90f499e00dc 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -94,18 +94,18 @@
94static void p80211netdev_rx_bh(unsigned long arg); 94static void p80211netdev_rx_bh(unsigned long arg);
95 95
96/* netdevice method functions */ 96/* netdevice method functions */
97static int p80211knetdev_init(netdevice_t *netdev); 97static int p80211knetdev_init(netdevice_t * netdev);
98static struct net_device_stats *p80211knetdev_get_stats(netdevice_t *netdev); 98static struct net_device_stats *p80211knetdev_get_stats(netdevice_t * netdev);
99static int p80211knetdev_open(netdevice_t *netdev); 99static int p80211knetdev_open(netdevice_t * netdev);
100static int p80211knetdev_stop(netdevice_t *netdev); 100static int p80211knetdev_stop(netdevice_t * netdev);
101static int p80211knetdev_hard_start_xmit(struct sk_buff *skb, 101static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
102 netdevice_t *netdev); 102 netdevice_t * netdev);
103static void p80211knetdev_set_multicast_list(netdevice_t *dev); 103static void p80211knetdev_set_multicast_list(netdevice_t * dev);
104static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, 104static int p80211knetdev_do_ioctl(netdevice_t * dev, struct ifreq *ifr,
105 int cmd); 105 int cmd);
106static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr); 106static int p80211knetdev_set_mac_address(netdevice_t * dev, void *addr);
107static void p80211knetdev_tx_timeout(netdevice_t *netdev); 107static void p80211knetdev_tx_timeout(netdevice_t * netdev);
108static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc); 108static int p80211_rx_typedrop(wlandevice_t * wlandev, u16 fc);
109 109
110int wlan_watchdog = 5000; 110int wlan_watchdog = 5000;
111module_param(wlan_watchdog, int, 0644); 111module_param(wlan_watchdog, int, 0644);
@@ -127,7 +127,7 @@ MODULE_PARM_DESC(wlan_wext_write, "enable write wireless extensions");
127* Returns: 127* Returns:
128* nothing 128* nothing
129----------------------------------------------------------------*/ 129----------------------------------------------------------------*/
130static int p80211knetdev_init(netdevice_t *netdev) 130static int p80211knetdev_init(netdevice_t * netdev)
131{ 131{
132 /* Called in response to register_netdev */ 132 /* Called in response to register_netdev */
133 /* This is usually the probe function, but the probe has */ 133 /* This is usually the probe function, but the probe has */
@@ -150,7 +150,7 @@ static int p80211knetdev_init(netdevice_t *netdev)
150* Returns: 150* Returns:
151* the address of the statistics structure 151* the address of the statistics structure
152----------------------------------------------------------------*/ 152----------------------------------------------------------------*/
153static struct net_device_stats *p80211knetdev_get_stats(netdevice_t *netdev) 153static struct net_device_stats *p80211knetdev_get_stats(netdevice_t * netdev)
154{ 154{
155 wlandevice_t *wlandev = netdev->ml_priv; 155 wlandevice_t *wlandev = netdev->ml_priv;
156 156
@@ -174,7 +174,7 @@ static struct net_device_stats *p80211knetdev_get_stats(netdevice_t *netdev)
174* Returns: 174* Returns:
175* zero on success, non-zero otherwise 175* zero on success, non-zero otherwise
176----------------------------------------------------------------*/ 176----------------------------------------------------------------*/
177static int p80211knetdev_open(netdevice_t *netdev) 177static int p80211knetdev_open(netdevice_t * netdev)
178{ 178{
179 int result = 0; /* success */ 179 int result = 0; /* success */
180 wlandevice_t *wlandev = netdev->ml_priv; 180 wlandevice_t *wlandev = netdev->ml_priv;
@@ -209,7 +209,7 @@ static int p80211knetdev_open(netdevice_t *netdev)
209* Returns: 209* Returns:
210* zero on success, non-zero otherwise 210* zero on success, non-zero otherwise
211----------------------------------------------------------------*/ 211----------------------------------------------------------------*/
212static int p80211knetdev_stop(netdevice_t *netdev) 212static int p80211knetdev_stop(netdevice_t * netdev)
213{ 213{
214 int result = 0; 214 int result = 0;
215 wlandevice_t *wlandev = netdev->ml_priv; 215 wlandevice_t *wlandev = netdev->ml_priv;
@@ -236,7 +236,7 @@ static int p80211knetdev_stop(netdevice_t *netdev)
236* Side effects: 236* Side effects:
237* 237*
238----------------------------------------------------------------*/ 238----------------------------------------------------------------*/
239void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb) 239void p80211netdev_rx(wlandevice_t * wlandev, struct sk_buff *skb)
240{ 240{
241 /* Enqueue for post-irq processing */ 241 /* Enqueue for post-irq processing */
242 skb_queue_tail(&wlandev->nsd_rxq, skb); 242 skb_queue_tail(&wlandev->nsd_rxq, skb);
@@ -345,7 +345,7 @@ static void p80211netdev_rx_bh(unsigned long arg)
345* zero on success, non-zero on failure. 345* zero on success, non-zero on failure.
346----------------------------------------------------------------*/ 346----------------------------------------------------------------*/
347static int p80211knetdev_hard_start_xmit(struct sk_buff *skb, 347static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
348 netdevice_t *netdev) 348 netdevice_t * netdev)
349{ 349{
350 int result = 0; 350 int result = 0;
351 int txresult = -1; 351 int txresult = -1;
@@ -409,7 +409,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
409 &p80211_wep) != 0) { 409 &p80211_wep) != 0) {
410 /* convert failed */ 410 /* convert failed */
411 pr_debug("ether_to_80211(%d) failed.\n", 411 pr_debug("ether_to_80211(%d) failed.\n",
412 wlandev->ethconv); 412 wlandev->ethconv);
413 result = 1; 413 result = 1;
414 goto failed; 414 goto failed;
415 } 415 }
@@ -472,7 +472,7 @@ failed:
472* Returns: 472* Returns:
473* nothing 473* nothing
474----------------------------------------------------------------*/ 474----------------------------------------------------------------*/
475static void p80211knetdev_set_multicast_list(netdevice_t *dev) 475static void p80211knetdev_set_multicast_list(netdevice_t * dev)
476{ 476{
477 wlandevice_t *wlandev = dev->ml_priv; 477 wlandevice_t *wlandev = dev->ml_priv;
478 478
@@ -485,7 +485,7 @@ static void p80211knetdev_set_multicast_list(netdevice_t *dev)
485 485
486#ifdef SIOCETHTOOL 486#ifdef SIOCETHTOOL
487 487
488static int p80211netdev_ethtool(wlandevice_t *wlandev, void __user *useraddr) 488static int p80211netdev_ethtool(wlandevice_t * wlandev, void __user * useraddr)
489{ 489{
490 u32 ethcmd; 490 u32 ethcmd;
491 struct ethtool_drvinfo info; 491 struct ethtool_drvinfo info;
@@ -557,7 +557,7 @@ static int p80211netdev_ethtool(wlandevice_t *wlandev, void __user *useraddr)
557* Process thread (ioctl caller). TODO: SMP support may require 557* Process thread (ioctl caller). TODO: SMP support may require
558* locks. 558* locks.
559----------------------------------------------------------------*/ 559----------------------------------------------------------------*/
560static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) 560static int p80211knetdev_do_ioctl(netdevice_t * dev, struct ifreq *ifr, int cmd)
561{ 561{
562 int result = 0; 562 int result = 0;
563 p80211ioctl_req_t *req = (p80211ioctl_req_t *) ifr; 563 p80211ioctl_req_t *req = (p80211ioctl_req_t *) ifr;
@@ -634,7 +634,7 @@ bail:
634* 634*
635* by: Collin R. Mulliner <collin@mulliner.org> 635* by: Collin R. Mulliner <collin@mulliner.org>
636----------------------------------------------------------------*/ 636----------------------------------------------------------------*/
637static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr) 637static int p80211knetdev_set_mac_address(netdevice_t * dev, void *addr)
638{ 638{
639 struct sockaddr *new_addr = addr; 639 struct sockaddr *new_addr = addr;
640 p80211msg_dot11req_mibset_t dot11req; 640 p80211msg_dot11req_mibset_t dot11req;
@@ -649,7 +649,7 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr)
649 649
650 /* Set up some convenience pointers. */ 650 /* Set up some convenience pointers. */
651 mibattr = &dot11req.mibattribute; 651 mibattr = &dot11req.mibattribute;
652 macaddr = (p80211item_pstr6_t *)&mibattr->data; 652 macaddr = (p80211item_pstr6_t *) & mibattr->data;
653 resultcode = &dot11req.resultcode; 653 resultcode = &dot11req.resultcode;
654 654
655 /* Set up a dot11req_mibset */ 655 /* Set up a dot11req_mibset */
@@ -677,7 +677,7 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr)
677 resultcode->data = 0; 677 resultcode->data = 0;
678 678
679 /* now fire the request */ 679 /* now fire the request */
680 result = p80211req_dorequest(dev->ml_priv, (u8 *)&dot11req); 680 result = p80211req_dorequest(dev->ml_priv, (u8 *) & dot11req);
681 681
682 /* If the request wasn't successful, report an error and don't 682 /* If the request wasn't successful, report an error and don't
683 * change the netdev address 683 * change the netdev address
@@ -694,7 +694,7 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr)
694 return result; 694 return result;
695} 695}
696 696
697static int wlan_change_mtu(netdevice_t *dev, int new_mtu) 697static int wlan_change_mtu(netdevice_t * dev, int new_mtu)
698{ 698{
699 /* 2312 is max 802.11 payload, 20 is overhead, (ether + llc +snap) 699 /* 2312 is max 802.11 payload, 20 is overhead, (ether + llc +snap)
700 and another 8 for wep. */ 700 and another 8 for wep. */
@@ -707,17 +707,17 @@ static int wlan_change_mtu(netdevice_t *dev, int new_mtu)
707} 707}
708 708
709static const struct net_device_ops p80211_netdev_ops = { 709static const struct net_device_ops p80211_netdev_ops = {
710 .ndo_init = p80211knetdev_init, 710 .ndo_init = p80211knetdev_init,
711 .ndo_open = p80211knetdev_open, 711 .ndo_open = p80211knetdev_open,
712 .ndo_stop = p80211knetdev_stop, 712 .ndo_stop = p80211knetdev_stop,
713 .ndo_get_stats = p80211knetdev_get_stats, 713 .ndo_get_stats = p80211knetdev_get_stats,
714 .ndo_start_xmit = p80211knetdev_hard_start_xmit, 714 .ndo_start_xmit = p80211knetdev_hard_start_xmit,
715 .ndo_set_multicast_list = p80211knetdev_set_multicast_list, 715 .ndo_set_multicast_list = p80211knetdev_set_multicast_list,
716 .ndo_do_ioctl = p80211knetdev_do_ioctl, 716 .ndo_do_ioctl = p80211knetdev_do_ioctl,
717 .ndo_set_mac_address = p80211knetdev_set_mac_address, 717 .ndo_set_mac_address = p80211knetdev_set_mac_address,
718 .ndo_tx_timeout = p80211knetdev_tx_timeout, 718 .ndo_tx_timeout = p80211knetdev_tx_timeout,
719 .ndo_change_mtu = wlan_change_mtu, 719 .ndo_change_mtu = wlan_change_mtu,
720 .ndo_validate_addr = eth_validate_addr, 720 .ndo_validate_addr = eth_validate_addr,
721}; 721};
722 722
723/*---------------------------------------------------------------- 723/*----------------------------------------------------------------
@@ -742,7 +742,7 @@ static const struct net_device_ops p80211_netdev_ops = {
742* compiled drivers, this function will be called in the 742* compiled drivers, this function will be called in the
743* context of the kernel startup code. 743* context of the kernel startup code.
744----------------------------------------------------------------*/ 744----------------------------------------------------------------*/
745int wlan_setup(wlandevice_t *wlandev) 745int wlan_setup(wlandevice_t * wlandev)
746{ 746{
747 int result = 0; 747 int result = 0;
748 netdevice_t *dev; 748 netdevice_t *dev;
@@ -800,7 +800,7 @@ int wlan_setup(wlandevice_t *wlandev)
800* compiled drivers, this function will be called in the 800* compiled drivers, this function will be called in the
801* context of the kernel startup code. 801* context of the kernel startup code.
802----------------------------------------------------------------*/ 802----------------------------------------------------------------*/
803int wlan_unsetup(wlandevice_t *wlandev) 803int wlan_unsetup(wlandevice_t * wlandev)
804{ 804{
805 int result = 0; 805 int result = 0;
806 806
@@ -836,7 +836,7 @@ int wlan_unsetup(wlandevice_t *wlandev)
836* Call Context: 836* Call Context:
837* Can be either interrupt or not. 837* Can be either interrupt or not.
838----------------------------------------------------------------*/ 838----------------------------------------------------------------*/
839int register_wlandev(wlandevice_t *wlandev) 839int register_wlandev(wlandevice_t * wlandev)
840{ 840{
841 int i = 0; 841 int i = 0;
842 842
@@ -864,7 +864,7 @@ int register_wlandev(wlandevice_t *wlandev)
864* Call Context: 864* Call Context:
865* Can be either interrupt or not. 865* Can be either interrupt or not.
866----------------------------------------------------------------*/ 866----------------------------------------------------------------*/
867int unregister_wlandev(wlandevice_t *wlandev) 867int unregister_wlandev(wlandevice_t * wlandev)
868{ 868{
869 struct sk_buff *skb; 869 struct sk_buff *skb;
870 870
@@ -907,7 +907,7 @@ int unregister_wlandev(wlandevice_t *wlandev)
907* Call context: 907* Call context:
908* Usually interrupt. 908* Usually interrupt.
909----------------------------------------------------------------*/ 909----------------------------------------------------------------*/
910void p80211netdev_hwremoved(wlandevice_t *wlandev) 910void p80211netdev_hwremoved(wlandevice_t * wlandev)
911{ 911{
912 wlandev->hwremoved = 1; 912 wlandev->hwremoved = 1;
913 if (wlandev->state == WLAN_DEVICE_OPEN) 913 if (wlandev->state == WLAN_DEVICE_OPEN)
@@ -937,7 +937,7 @@ void p80211netdev_hwremoved(wlandevice_t *wlandev)
937* Call context: 937* Call context:
938* interrupt 938* interrupt
939----------------------------------------------------------------*/ 939----------------------------------------------------------------*/
940static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc) 940static int p80211_rx_typedrop(wlandevice_t * wlandev, u16 fc)
941{ 941{
942 u16 ftype; 942 u16 ftype;
943 u16 fstype; 943 u16 fstype;
@@ -1095,7 +1095,7 @@ static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc)
1095 return drop; 1095 return drop;
1096} 1096}
1097 1097
1098static void p80211knetdev_tx_timeout(netdevice_t *netdev) 1098static void p80211knetdev_tx_timeout(netdevice_t * netdev)
1099{ 1099{
1100 wlandevice_t *wlandev = netdev->ml_priv; 1100 wlandevice_t *wlandev = netdev->ml_priv;
1101 1101
diff --git a/drivers/staging/wlan-ng/p80211netdev.h b/drivers/staging/wlan-ng/p80211netdev.h
index 94a91b910b2..f4fcd2b11c4 100644
--- a/drivers/staging/wlan-ng/p80211netdev.h
+++ b/drivers/staging/wlan-ng/p80211netdev.h
@@ -182,16 +182,16 @@ typedef struct wlandevice {
182 unsigned int ethconv; 182 unsigned int ethconv;
183 183
184 /* device methods (init by MSD, used by p80211 */ 184 /* device methods (init by MSD, used by p80211 */
185 int (*open) (struct wlandevice *wlandev); 185 int (*open) (struct wlandevice * wlandev);
186 int (*close) (struct wlandevice *wlandev); 186 int (*close) (struct wlandevice * wlandev);
187 void (*reset) (struct wlandevice *wlandev); 187 void (*reset) (struct wlandevice * wlandev);
188 int (*txframe) (struct wlandevice *wlandev, struct sk_buff *skb, 188 int (*txframe) (struct wlandevice * wlandev, struct sk_buff * skb,
189 p80211_hdr_t *p80211_hdr, 189 p80211_hdr_t * p80211_hdr,
190 p80211_metawep_t *p80211_wep); 190 p80211_metawep_t * p80211_wep);
191 int (*mlmerequest) (struct wlandevice *wlandev, p80211msg_t *msg); 191 int (*mlmerequest) (struct wlandevice * wlandev, p80211msg_t * msg);
192 int (*set_multicast_list) (struct wlandevice *wlandev, 192 int (*set_multicast_list) (struct wlandevice * wlandev,
193 netdevice_t *dev); 193 netdevice_t * dev);
194 void (*tx_timeout) (struct wlandevice *wlandev); 194 void (*tx_timeout) (struct wlandevice * wlandev);
195 195
196 /* 802.11 State */ 196 /* 802.11 State */
197 u8 bssid[WLAN_BSSID_LEN]; 197 u8 bssid[WLAN_BSSID_LEN];
@@ -230,16 +230,16 @@ typedef struct wlandevice {
230} wlandevice_t; 230} wlandevice_t;
231 231
232/* WEP stuff */ 232/* WEP stuff */
233int wep_change_key(wlandevice_t *wlandev, int keynum, u8 *key, int keylen); 233int wep_change_key(wlandevice_t * wlandev, int keynum, u8 * key, int keylen);
234int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override, 234int wep_decrypt(wlandevice_t * wlandev, u8 * buf, u32 len, int key_override,
235 u8 *iv, u8 *icv); 235 u8 * iv, u8 * icv);
236int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum, 236int wep_encrypt(wlandevice_t * wlandev, u8 * buf, u8 * dst, u32 len, int keynum,
237 u8 *iv, u8 *icv); 237 u8 * iv, u8 * icv);
238 238
239int wlan_setup(wlandevice_t *wlandev); 239int wlan_setup(wlandevice_t * wlandev);
240int wlan_unsetup(wlandevice_t *wlandev); 240int wlan_unsetup(wlandevice_t * wlandev);
241int register_wlandev(wlandevice_t *wlandev); 241int register_wlandev(wlandevice_t * wlandev);
242int unregister_wlandev(wlandevice_t *wlandev); 242int unregister_wlandev(wlandevice_t * wlandev);
243void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb); 243void p80211netdev_rx(wlandevice_t * wlandev, struct sk_buff *skb);
244void p80211netdev_hwremoved(wlandevice_t *wlandev); 244void p80211netdev_hwremoved(wlandevice_t * wlandev);
245#endif 245#endif
diff --git a/drivers/staging/wlan-ng/p80211req.c b/drivers/staging/wlan-ng/p80211req.c
index 15ecba6e469..584c4193ad8 100644
--- a/drivers/staging/wlan-ng/p80211req.c
+++ b/drivers/staging/wlan-ng/p80211req.c
@@ -73,9 +73,9 @@
73#include "p80211metastruct.h" 73#include "p80211metastruct.h"
74#include "p80211req.h" 74#include "p80211req.h"
75 75
76static void p80211req_handlemsg(wlandevice_t *wlandev, p80211msg_t *msg); 76static void p80211req_handlemsg(wlandevice_t * wlandev, p80211msg_t * msg);
77static int p80211req_mibset_mibget(wlandevice_t *wlandev, 77static int p80211req_mibset_mibget(wlandevice_t * wlandev,
78 p80211msg_dot11req_mibget_t *mib_msg, 78 p80211msg_dot11req_mibget_t * mib_msg,
79 int isget); 79 int isget);
80 80
81/*---------------------------------------------------------------- 81/*----------------------------------------------------------------
@@ -94,7 +94,7 @@ static int p80211req_mibset_mibget(wlandevice_t *wlandev,
94* Potentially blocks the caller, so it's a good idea to 94* Potentially blocks the caller, so it's a good idea to
95* not call this function from an interrupt context. 95* not call this function from an interrupt context.
96----------------------------------------------------------------*/ 96----------------------------------------------------------------*/
97int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf) 97int p80211req_dorequest(wlandevice_t * wlandev, u8 * msgbuf)
98{ 98{
99 int result = 0; 99 int result = 0;
100 p80211msg_t *msg = (p80211msg_t *) msgbuf; 100 p80211msg_t *msg = (p80211msg_t *) msgbuf;
@@ -129,7 +129,7 @@ int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf)
129 wlandev->mlmerequest(wlandev, msg); 129 wlandev->mlmerequest(wlandev, msg);
130 130
131 clear_bit(1, &(wlandev->request_pending)); 131 clear_bit(1, &(wlandev->request_pending));
132 return result; /* if result==0, msg->status still may contain an err */ 132 return result; /* if result==0, msg->status still may contain an err */
133} 133}
134 134
135/*---------------------------------------------------------------- 135/*----------------------------------------------------------------
@@ -150,7 +150,7 @@ int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf)
150* Call context: 150* Call context:
151* Process thread 151* Process thread
152----------------------------------------------------------------*/ 152----------------------------------------------------------------*/
153static void p80211req_handlemsg(wlandevice_t *wlandev, p80211msg_t *msg) 153static void p80211req_handlemsg(wlandevice_t * wlandev, p80211msg_t * msg)
154{ 154{
155 switch (msg->msgcode) { 155 switch (msg->msgcode) {
156 156
@@ -180,8 +180,8 @@ static void p80211req_handlemsg(wlandevice_t *wlandev, p80211msg_t *msg)
180 return; 180 return;
181} 181}
182 182
183static int p80211req_mibset_mibget(wlandevice_t *wlandev, 183static int p80211req_mibset_mibget(wlandevice_t * wlandev,
184 p80211msg_dot11req_mibget_t *mib_msg, 184 p80211msg_dot11req_mibget_t * mib_msg,
185 int isget) 185 int isget)
186{ 186{
187 p80211itemd_t *mibitem = (p80211itemd_t *) mib_msg->mibattribute.data; 187 p80211itemd_t *mibitem = (p80211itemd_t *) mib_msg->mibattribute.data;
@@ -243,8 +243,8 @@ static int p80211req_mibset_mibget(wlandevice_t *wlandev,
243 u32 *data = (u32 *) mibitem->data; 243 u32 *data = (u32 *) mibitem->data;
244 244
245 if (isget) { 245 if (isget) {
246 if (wlandev-> 246 if (wlandev->hostwep &
247 hostwep & HOSTWEP_EXCLUDEUNENCRYPTED) 247 HOSTWEP_EXCLUDEUNENCRYPTED)
248 *data = P80211ENUM_truth_true; 248 *data = P80211ENUM_truth_true;
249 else 249 else
250 *data = P80211ENUM_truth_false; 250 *data = P80211ENUM_truth_false;
diff --git a/drivers/staging/wlan-ng/p80211req.h b/drivers/staging/wlan-ng/p80211req.h
index a95a45a6814..5d9176762ba 100644
--- a/drivers/staging/wlan-ng/p80211req.h
+++ b/drivers/staging/wlan-ng/p80211req.h
@@ -48,6 +48,6 @@
48#ifndef _LINUX_P80211REQ_H 48#ifndef _LINUX_P80211REQ_H
49#define _LINUX_P80211REQ_H 49#define _LINUX_P80211REQ_H
50 50
51int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf); 51int p80211req_dorequest(wlandevice_t * wlandev, u8 * msgbuf);
52 52
53#endif 53#endif
diff --git a/drivers/staging/wlan-ng/p80211types.h b/drivers/staging/wlan-ng/p80211types.h
index a22437ceddc..043da1e5607 100644
--- a/drivers/staging/wlan-ng/p80211types.h
+++ b/drivers/staging/wlan-ng/p80211types.h
@@ -61,7 +61,6 @@
61/* Project Includes */ 61/* Project Includes */
62/*================================================================*/ 62/*================================================================*/
63 63
64
65/*----------------------------------------------------------------*/ 64/*----------------------------------------------------------------*/
66/* The following constants are indexes into the Mib Category List */ 65/* The following constants are indexes into the Mib Category List */
67/* and the Message Category List */ 66/* and the Message Category List */
@@ -345,11 +344,11 @@ struct catlistitem;
345/* metadata items. Some components may choose to use more, */ 344/* metadata items. Some components may choose to use more, */
346/* less or different metadata items. */ 345/* less or different metadata items. */
347 346
348typedef void (*p80211_totext_t) (struct catlistitem *, u32 did, u8 *itembuf, 347typedef void (*p80211_totext_t) (struct catlistitem *, u32 did, u8 * itembuf,
349 char *textbuf); 348 char *textbuf);
350typedef void (*p80211_fromtext_t) (struct catlistitem *, u32 did, u8 *itembuf, 349typedef void (*p80211_fromtext_t) (struct catlistitem *, u32 did, u8 * itembuf,
351 char *textbuf); 350 char *textbuf);
352typedef u32(*p80211_valid_t) (struct catlistitem *, u32 did, u8 *itembuf); 351typedef u32(*p80211_valid_t) (struct catlistitem *, u32 did, u8 * itembuf);
353 352
354/*----------------------------------------------------------------*/ 353/*----------------------------------------------------------------*/
355/* Enumeration Lists */ 354/* Enumeration Lists */
diff --git a/drivers/staging/wlan-ng/p80211wep.c b/drivers/staging/wlan-ng/p80211wep.c
index ad052377ffd..f0b4275ab22 100644
--- a/drivers/staging/wlan-ng/p80211wep.c
+++ b/drivers/staging/wlan-ng/p80211wep.c
@@ -48,8 +48,6 @@
48/*================================================================*/ 48/*================================================================*/
49/* System Includes */ 49/* System Includes */
50 50
51
52
53#include <linux/netdevice.h> 51#include <linux/netdevice.h>
54#include <linux/wireless.h> 52#include <linux/wireless.h>
55#include <linux/slab.h> 53#include <linux/slab.h>
@@ -76,58 +74,58 @@
76/* Local Static Definitions */ 74/* Local Static Definitions */
77 75
78static const u32 wep_crc32_table[256] = { 76static const u32 wep_crc32_table[256] = {
79 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 77 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
80 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, 78 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
81 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 79 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L,
82 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 80 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL,
83 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, 81 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L,
84 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, 82 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L,
85 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, 83 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L,
86 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, 84 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL,
87 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, 85 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L,
88 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, 86 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL,
89 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 87 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L,
90 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 88 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L,
91 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, 89 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L,
92 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, 90 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL,
93 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, 91 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL,
94 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, 92 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L,
95 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, 93 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL,
96 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, 94 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L,
97 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, 95 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L,
98 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, 96 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L,
99 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, 97 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL,
100 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, 98 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L,
101 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, 99 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L,
102 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, 100 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL,
103 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, 101 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L,
104 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, 102 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L,
105 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, 103 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L,
106 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, 104 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L,
107 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, 105 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L,
108 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, 106 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL,
109 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, 107 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL,
110 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, 108 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L,
111 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, 109 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L,
112 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, 110 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL,
113 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, 111 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL,
114 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, 112 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L,
115 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, 113 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL,
116 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, 114 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L,
117 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, 115 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL,
118 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, 116 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L,
119 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, 117 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL,
120 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, 118 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L,
121 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, 119 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L,
122 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, 120 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL,
123 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, 121 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L,
124 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, 122 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L,
125 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, 123 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L,
126 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, 124 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L,
127 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, 125 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L,
128 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, 126 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L,
129 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, 127 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL,
130 0x2d02ef8dL 128 0x2d02ef8dL
131}; 129};
132 130
133/*================================================================*/ 131/*================================================================*/
@@ -138,17 +136,24 @@ static const u32 wep_crc32_table[256] = {
138 136
139/* keylen in bytes! */ 137/* keylen in bytes! */
140 138
141int wep_change_key(wlandevice_t *wlandev, int keynum, u8* key, int keylen) 139int wep_change_key(wlandevice_t * wlandev, int keynum, u8 * key, int keylen)
142{ 140{
143 if (keylen < 0) return -1; 141 if (keylen < 0)
144 if (keylen >= MAX_KEYLEN) return -1; 142 return -1;
145 if (key == NULL) return -1; 143 if (keylen >= MAX_KEYLEN)
146 if (keynum < 0) return -1; 144 return -1;
147 if (keynum >= NUM_WEPKEYS) return -1; 145 if (key == NULL)
148 146 return -1;
147 if (keynum < 0)
148 return -1;
149 if (keynum >= NUM_WEPKEYS)
150 return -1;
149 151
150#ifdef WEP_DEBUG 152#ifdef WEP_DEBUG
151 printk(KERN_DEBUG "WEP key %d len %d = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", keynum, keylen, key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7]); 153 printk(KERN_DEBUG
154 "WEP key %d len %d = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
155 keynum, keylen, key[0], key[1], key[2], key[3], key[4], key[5],
156 key[6], key[7]);
152#endif 157#endif
153 158
154 wlandev->wep_keylens[keynum] = keylen; 159 wlandev->wep_keylens[keynum] = keylen;
@@ -161,14 +166,16 @@ int wep_change_key(wlandevice_t *wlandev, int keynum, u8* key, int keylen)
161 4-byte IV at start of buffer, 4-byte ICV at end of buffer. 166 4-byte IV at start of buffer, 4-byte ICV at end of buffer.
162 if successful, buf start is payload begin, length -= 8; 167 if successful, buf start is payload begin, length -= 8;
163 */ 168 */
164int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override, u8 *iv, u8 *icv) 169int wep_decrypt(wlandevice_t * wlandev, u8 * buf, u32 len, int key_override,
170 u8 * iv, u8 * icv)
165{ 171{
166 u32 i, j, k, crc, keylen; 172 u32 i, j, k, crc, keylen;
167 u8 s[256], key[64], c_crc[4]; 173 u8 s[256], key[64], c_crc[4];
168 u8 keyidx; 174 u8 keyidx;
169 175
170 /* Needs to be at least 8 bytes of payload */ 176 /* Needs to be at least 8 bytes of payload */
171 if (len <= 0) return -1; 177 if (len <= 0)
178 return -1;
172 179
173 /* initialize the first bytes of the key from the IV */ 180 /* initialize the first bytes of the key from the IV */
174 key[0] = iv[0]; 181 key[0] = iv[0];
@@ -179,19 +186,24 @@ int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override, u8 *i
179 if (key_override >= 0) 186 if (key_override >= 0)
180 keyidx = key_override; 187 keyidx = key_override;
181 188
182 if (keyidx >= NUM_WEPKEYS) return -2; 189 if (keyidx >= NUM_WEPKEYS)
190 return -2;
183 191
184 keylen = wlandev->wep_keylens[keyidx]; 192 keylen = wlandev->wep_keylens[keyidx];
185 193
186 if (keylen == 0) return -3; 194 if (keylen == 0)
195 return -3;
187 196
188 /* copy the rest of the key over from the designated key */ 197 /* copy the rest of the key over from the designated key */
189 memcpy(key+3, wlandev->wep_keys[keyidx], keylen); 198 memcpy(key + 3, wlandev->wep_keys[keyidx], keylen);
190 199
191 keylen+=3; /* add in IV bytes */ 200 keylen += 3; /* add in IV bytes */
192 201
193#ifdef WEP_DEBUG 202#ifdef WEP_DEBUG
194 printk(KERN_DEBUG "D %d: %02x %02x %02x (%d %d) %02x:%02x:%02x:%02x:%02x\n", len, key[0], key[1], key[2], keyidx, keylen, key[3], key[4], key[5], key[6], key[7]); 203 printk(KERN_DEBUG
204 "D %d: %02x %02x %02x (%d %d) %02x:%02x:%02x:%02x:%02x\n", len,
205 key[0], key[1], key[2], keyidx, keylen, key[3], key[4], key[5],
206 key[6], key[7]);
195#endif 207#endif
196 208
197 /* set up the RC4 state */ 209 /* set up the RC4 state */
@@ -200,16 +212,16 @@ int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override, u8 *i
200 j = 0; 212 j = 0;
201 for (i = 0; i < 256; i++) { 213 for (i = 0; i < 256; i++) {
202 j = (j + s[i] + key[i % keylen]) & 0xff; 214 j = (j + s[i] + key[i % keylen]) & 0xff;
203 swap(i,j); 215 swap(i, j);
204 } 216 }
205 217
206 /* Apply the RC4 to the data, update the CRC32 */ 218 /* Apply the RC4 to the data, update the CRC32 */
207 crc = ~0; 219 crc = ~0;
208 i = j = 0; 220 i = j = 0;
209 for (k = 0; k < len; k++) { 221 for (k = 0; k < len; k++) {
210 i = (i+1) & 0xff; 222 i = (i + 1) & 0xff;
211 j = (j+s[i]) & 0xff; 223 j = (j + s[i]) & 0xff;
212 swap(i,j); 224 swap(i, j);
213 buf[k] ^= s[(s[i] + s[j]) & 0xff]; 225 buf[k] ^= s[(s[i] + s[j]) & 0xff];
214 crc = wep_crc32_table[(crc ^ buf[k]) & 0xff] ^ (crc >> 8); 226 crc = wep_crc32_table[(crc ^ buf[k]) & 0xff] ^ (crc >> 8);
215 } 227 }
@@ -223,28 +235,32 @@ int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override, u8 *i
223 235
224 for (k = 0; k < 4; k++) { 236 for (k = 0; k < 4; k++) {
225 i = (i + 1) & 0xff; 237 i = (i + 1) & 0xff;
226 j = (j+s[i]) & 0xff; 238 j = (j + s[i]) & 0xff;
227 swap(i,j); 239 swap(i, j);
228 if ((c_crc[k] ^ s[(s[i] + s[j]) & 0xff]) != icv[k]) 240 if ((c_crc[k] ^ s[(s[i] + s[j]) & 0xff]) != icv[k])
229 return -(4 | (k << 4)) ; /* ICV mismatch */ 241 return -(4 | (k << 4)); /* ICV mismatch */
230 } 242 }
231 243
232 return 0; 244 return 0;
233} 245}
234 246
235/* encrypts in-place. */ 247/* encrypts in-place. */
236int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum, u8 *iv, u8 *icv) 248int wep_encrypt(wlandevice_t * wlandev, u8 * buf, u8 * dst, u32 len, int keynum,
249 u8 * iv, u8 * icv)
237{ 250{
238 u32 i, j, k, crc, keylen; 251 u32 i, j, k, crc, keylen;
239 u8 s[256], key[64]; 252 u8 s[256], key[64];
240 253
241 /* no point in WEPping an empty frame */ 254 /* no point in WEPping an empty frame */
242 if (len <= 0) return -1; 255 if (len <= 0)
256 return -1;
243 257
244 /* we need to have a real key.. */ 258 /* we need to have a real key.. */
245 if (keynum >= NUM_WEPKEYS) return -2; 259 if (keynum >= NUM_WEPKEYS)
260 return -2;
246 keylen = wlandev->wep_keylens[keynum]; 261 keylen = wlandev->wep_keylens[keynum];
247 if (keylen <= 0) return -3; 262 if (keylen <= 0)
263 return -3;
248 264
249 /* use a random IV. And skip known weak ones. */ 265 /* use a random IV. And skip known weak ones. */
250 get_random_bytes(iv, 3); 266 get_random_bytes(iv, 3);
@@ -258,12 +274,15 @@ int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum, u8
258 key[2] = iv[2]; 274 key[2] = iv[2];
259 275
260 /* copy the rest of the key over from the designated key */ 276 /* copy the rest of the key over from the designated key */
261 memcpy(key+3, wlandev->wep_keys[keynum], keylen); 277 memcpy(key + 3, wlandev->wep_keys[keynum], keylen);
262 278
263 keylen+=3; /* add in IV bytes */ 279 keylen += 3; /* add in IV bytes */
264 280
265#ifdef WEP_DEBUG 281#ifdef WEP_DEBUG
266 printk(KERN_DEBUG "E %d (%d/%d %d) %02x %02x %02x %02x:%02x:%02x:%02x:%02x\n", len, iv[3], keynum, keylen, key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7]); 282 printk(KERN_DEBUG
283 "E %d (%d/%d %d) %02x %02x %02x %02x:%02x:%02x:%02x:%02x\n", len,
284 iv[3], keynum, keylen, key[0], key[1], key[2], key[3], key[4],
285 key[5], key[6], key[7]);
267#endif 286#endif
268 287
269 /* set up the RC4 state */ 288 /* set up the RC4 state */
@@ -272,7 +291,7 @@ int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum, u8
272 j = 0; 291 j = 0;
273 for (i = 0; i < 256; i++) { 292 for (i = 0; i < 256; i++) {
274 j = (j + s[i] + key[i % keylen]) & 0xff; 293 j = (j + s[i] + key[i % keylen]) & 0xff;
275 swap(i,j); 294 swap(i, j);
276 } 295 }
277 296
278 /* Update CRC32 then apply RC4 to the data */ 297 /* Update CRC32 then apply RC4 to the data */
@@ -280,9 +299,9 @@ int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum, u8
280 i = j = 0; 299 i = j = 0;
281 for (k = 0; k < len; k++) { 300 for (k = 0; k < len; k++) {
282 crc = wep_crc32_table[(crc ^ buf[k]) & 0xff] ^ (crc >> 8); 301 crc = wep_crc32_table[(crc ^ buf[k]) & 0xff] ^ (crc >> 8);
283 i = (i+1) & 0xff; 302 i = (i + 1) & 0xff;
284 j = (j+s[i]) & 0xff; 303 j = (j + s[i]) & 0xff;
285 swap(i,j); 304 swap(i, j);
286 dst[k] = buf[k] ^ s[(s[i] + s[j]) & 0xff]; 305 dst[k] = buf[k] ^ s[(s[i] + s[j]) & 0xff];
287 } 306 }
288 crc = ~crc; 307 crc = ~crc;
@@ -295,8 +314,8 @@ int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum, u8
295 314
296 for (k = 0; k < 4; k++) { 315 for (k = 0; k < 4; k++) {
297 i = (i + 1) & 0xff; 316 i = (i + 1) & 0xff;
298 j = (j+s[i]) & 0xff; 317 j = (j + s[i]) & 0xff;
299 swap(i,j); 318 swap(i, j);
300 icv[k] ^= s[(s[i] + s[j]) & 0xff]; 319 icv[k] ^= s[(s[i] + s[j]) & 0xff];
301 } 320 }
302 321
diff --git a/drivers/staging/wlan-ng/p80211wext.c b/drivers/staging/wlan-ng/p80211wext.c
index e73123b26df..984e45d9f70 100644
--- a/drivers/staging/wlan-ng/p80211wext.c
+++ b/drivers/staging/wlan-ng/p80211wext.c
@@ -37,8 +37,6 @@
37/*================================================================*/ 37/*================================================================*/
38/* System Includes */ 38/* System Includes */
39 39
40
41
42#include <linux/kernel.h> 40#include <linux/kernel.h>
43#include <linux/sched.h> 41#include <linux/sched.h>
44#include <linux/types.h> 42#include <linux/types.h>
@@ -68,10 +66,10 @@
68#include "p80211ioctl.h" 66#include "p80211ioctl.h"
69#include "p80211req.h" 67#include "p80211req.h"
70 68
71static int p80211wext_giwrate(netdevice_t *dev, 69static int p80211wext_giwrate(netdevice_t * dev,
72 struct iw_request_info *info, 70 struct iw_request_info *info,
73 struct iw_param *rrq, char *extra); 71 struct iw_param *rrq, char *extra);
74static int p80211wext_giwessid(netdevice_t *dev, 72static int p80211wext_giwessid(netdevice_t * dev,
75 struct iw_request_info *info, 73 struct iw_request_info *info,
76 struct iw_point *data, char *essid); 74 struct iw_point *data, char *essid);
77 75
@@ -132,7 +130,7 @@ static int qual_as_percent(int snr)
132 return 100; 130 return 100;
133} 131}
134 132
135static int p80211wext_dorequest(wlandevice_t *wlandev, u32 did, u32 data) 133static int p80211wext_dorequest(wlandevice_t * wlandev, u32 did, u32 data)
136{ 134{
137 p80211msg_dot11req_mibset_t msg; 135 p80211msg_dot11req_mibset_t msg;
138 p80211item_uint32_t mibitem; 136 p80211item_uint32_t mibitem;
@@ -142,12 +140,12 @@ static int p80211wext_dorequest(wlandevice_t *wlandev, u32 did, u32 data)
142 mibitem.did = did; 140 mibitem.did = did;
143 mibitem.data = data; 141 mibitem.data = data;
144 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 142 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
145 result = p80211req_dorequest(wlandev, (u8 *)&msg); 143 result = p80211req_dorequest(wlandev, (u8 *) & msg);
146 144
147 return result; 145 return result;
148} 146}
149 147
150static int p80211wext_autojoin(wlandevice_t *wlandev) 148static int p80211wext_autojoin(wlandevice_t * wlandev)
151{ 149{
152 p80211msg_lnxreq_autojoin_t msg; 150 p80211msg_lnxreq_autojoin_t msg;
153 struct iw_point data; 151 struct iw_point data;
@@ -179,7 +177,7 @@ static int p80211wext_autojoin(wlandevice_t *wlandev)
179 memcpy(msg.ssid.data.data, ssid, data.length); 177 memcpy(msg.ssid.data.data, ssid, data.length);
180 msg.ssid.data.len = data.length; 178 msg.ssid.data.len = data.length;
181 179
182 result = p80211req_dorequest(wlandev, (u8 *)&msg); 180 result = p80211req_dorequest(wlandev, (u8 *) & msg);
183 181
184 if (result) { 182 if (result) {
185 err = -EFAULT; 183 err = -EFAULT;
@@ -216,7 +214,7 @@ struct iw_statistics *p80211wext_get_wireless_stats(netdevice_t * dev)
216 if (wlandev->mlmerequest == NULL) 214 if (wlandev->mlmerequest == NULL)
217 return NULL; 215 return NULL;
218 216
219 retval = wlandev->mlmerequest(wlandev, (p80211msg_t *)&quality); 217 retval = wlandev->mlmerequest(wlandev, (p80211msg_t *) & quality);
220 218
221 wstats->qual.qual = qual_as_percent(quality.link.data); /* overall link quality */ 219 wstats->qual.qual = qual_as_percent(quality.link.data); /* overall link quality */
222 wstats->qual.level = quality.level.data; /* instant signal level */ 220 wstats->qual.level = quality.level.data; /* instant signal level */
@@ -234,7 +232,7 @@ struct iw_statistics *p80211wext_get_wireless_stats(netdevice_t * dev)
234 return wstats; 232 return wstats;
235} 233}
236 234
237static int p80211wext_giwname(netdevice_t *dev, 235static int p80211wext_giwname(netdevice_t * dev,
238 struct iw_request_info *info, 236 struct iw_request_info *info,
239 char *name, char *extra) 237 char *name, char *extra)
240{ 238{
@@ -263,7 +261,7 @@ exit:
263 return err; 261 return err;
264} 262}
265 263
266static int p80211wext_giwfreq(netdevice_t *dev, 264static int p80211wext_giwfreq(netdevice_t * dev,
267 struct iw_request_info *info, 265 struct iw_request_info *info,
268 struct iw_freq *freq, char *extra) 266 struct iw_freq *freq, char *extra)
269{ 267{
@@ -276,7 +274,7 @@ static int p80211wext_giwfreq(netdevice_t *dev,
276 msg.msgcode = DIDmsg_dot11req_mibget; 274 msg.msgcode = DIDmsg_dot11req_mibget;
277 mibitem.did = DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel; 275 mibitem.did = DIDmib_dot11phy_dot11PhyDSSSTable_dot11CurrentChannel;
278 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 276 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
279 result = p80211req_dorequest(wlandev, (u8 *)&msg); 277 result = p80211req_dorequest(wlandev, (u8 *) & msg);
280 278
281 if (result) { 279 if (result) {
282 err = -EFAULT; 280 err = -EFAULT;
@@ -298,7 +296,7 @@ exit:
298 return err; 296 return err;
299} 297}
300 298
301static int p80211wext_siwfreq(netdevice_t *dev, 299static int p80211wext_siwfreq(netdevice_t * dev,
302 struct iw_request_info *info, 300 struct iw_request_info *info,
303 struct iw_freq *freq, char *extra) 301 struct iw_freq *freq, char *extra)
304{ 302{
@@ -323,7 +321,7 @@ static int p80211wext_siwfreq(netdevice_t *dev,
323 mibitem.data = p80211_mhz_to_channel(freq->m); 321 mibitem.data = p80211_mhz_to_channel(freq->m);
324 322
325 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 323 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
326 result = p80211req_dorequest(wlandev, (u8 *)&msg); 324 result = p80211req_dorequest(wlandev, (u8 *) & msg);
327 325
328 if (result) { 326 if (result) {
329 err = -EFAULT; 327 err = -EFAULT;
@@ -334,9 +332,9 @@ exit:
334 return err; 332 return err;
335} 333}
336 334
337static int p80211wext_giwmode(netdevice_t *dev, 335static int p80211wext_giwmode(netdevice_t * dev,
338 struct iw_request_info *info, 336 struct iw_request_info *info,
339 __u32 *mode, char *extra) 337 __u32 * mode, char *extra)
340{ 338{
341 wlandevice_t *wlandev = dev->ml_priv; 339 wlandevice_t *wlandev = dev->ml_priv;
342 340
@@ -358,9 +356,9 @@ static int p80211wext_giwmode(netdevice_t *dev,
358 return 0; 356 return 0;
359} 357}
360 358
361static int p80211wext_siwmode(netdevice_t *dev, 359static int p80211wext_siwmode(netdevice_t * dev,
362 struct iw_request_info *info, 360 struct iw_request_info *info,
363 __u32 *mode, char *extra) 361 __u32 * mode, char *extra)
364{ 362{
365 wlandevice_t *wlandev = dev->ml_priv; 363 wlandevice_t *wlandev = dev->ml_priv;
366 p80211item_uint32_t mibitem; 364 p80211item_uint32_t mibitem;
@@ -404,7 +402,7 @@ static int p80211wext_siwmode(netdevice_t *dev,
404 mibitem.did = DIDmib_p2_p2Static_p2CnfPortType; 402 mibitem.did = DIDmib_p2_p2Static_p2CnfPortType;
405 mibitem.data = (*mode == IW_MODE_ADHOC) ? 0 : 1; 403 mibitem.data = (*mode == IW_MODE_ADHOC) ? 0 : 1;
406 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 404 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
407 result = p80211req_dorequest(wlandev, (u8 *)&msg); 405 result = p80211req_dorequest(wlandev, (u8 *) & msg);
408 406
409 if (result) 407 if (result)
410 err = -EFAULT; 408 err = -EFAULT;
@@ -413,7 +411,7 @@ exit:
413 return err; 411 return err;
414} 412}
415 413
416static int p80211wext_giwrange(netdevice_t *dev, 414static int p80211wext_giwrange(netdevice_t * dev,
417 struct iw_request_info *info, 415 struct iw_request_info *info,
418 struct iw_point *data, char *extra) 416 struct iw_point *data, char *extra)
419{ 417{
@@ -482,7 +480,7 @@ static int p80211wext_giwrange(netdevice_t *dev,
482 return 0; 480 return 0;
483} 481}
484 482
485static int p80211wext_giwap(netdevice_t *dev, 483static int p80211wext_giwap(netdevice_t * dev,
486 struct iw_request_info *info, 484 struct iw_request_info *info,
487 struct sockaddr *ap_addr, char *extra) 485 struct sockaddr *ap_addr, char *extra)
488{ 486{
@@ -495,7 +493,7 @@ static int p80211wext_giwap(netdevice_t *dev,
495 return 0; 493 return 0;
496} 494}
497 495
498static int p80211wext_giwencode(netdevice_t *dev, 496static int p80211wext_giwencode(netdevice_t * dev,
499 struct iw_request_info *info, 497 struct iw_request_info *info,
500 struct iw_point *erq, char *key) 498 struct iw_point *erq, char *key)
501{ 499{
@@ -536,7 +534,7 @@ exit:
536 return err; 534 return err;
537} 535}
538 536
539static int p80211wext_siwencode(netdevice_t *dev, 537static int p80211wext_siwencode(netdevice_t * dev,
540 struct iw_request_info *info, 538 struct iw_request_info *info,
541 struct iw_point *erq, char *key) 539 struct iw_point *erq, char *key)
542{ 540{
@@ -626,7 +624,7 @@ static int p80211wext_siwencode(netdevice_t *dev,
626 624
627 msg.msgcode = DIDmsg_dot11req_mibset; 625 msg.msgcode = DIDmsg_dot11req_mibset;
628 memcpy(&msg.mibattribute.data, &pstr, sizeof(pstr)); 626 memcpy(&msg.mibattribute.data, &pstr, sizeof(pstr));
629 result = p80211req_dorequest(wlandev, (u8 *)&msg); 627 result = p80211req_dorequest(wlandev, (u8 *) & msg);
630 628
631 if (result) { 629 if (result) {
632 err = -EFAULT; 630 err = -EFAULT;
@@ -683,7 +681,7 @@ exit:
683 return err; 681 return err;
684} 682}
685 683
686static int p80211wext_giwessid(netdevice_t *dev, 684static int p80211wext_giwessid(netdevice_t * dev,
687 struct iw_request_info *info, 685 struct iw_request_info *info,
688 struct iw_point *data, char *essid) 686 struct iw_point *data, char *essid)
689{ 687{
@@ -706,7 +704,7 @@ static int p80211wext_giwessid(netdevice_t *dev,
706 return 0; 704 return 0;
707} 705}
708 706
709static int p80211wext_siwessid(netdevice_t *dev, 707static int p80211wext_siwessid(netdevice_t * dev,
710 struct iw_request_info *info, 708 struct iw_request_info *info,
711 struct iw_point *data, char *essid) 709 struct iw_point *data, char *essid)
712{ 710{
@@ -742,7 +740,7 @@ static int p80211wext_siwessid(netdevice_t *dev,
742 msg.ssid.data.len = length; 740 msg.ssid.data.len = length;
743 741
744 pr_debug("autojoin_ssid for %s \n", essid); 742 pr_debug("autojoin_ssid for %s \n", essid);
745 result = p80211req_dorequest(wlandev, (u8 *)&msg); 743 result = p80211req_dorequest(wlandev, (u8 *) & msg);
746 pr_debug("autojoin_ssid %d\n", result); 744 pr_debug("autojoin_ssid %d\n", result);
747 745
748 if (result) { 746 if (result) {
@@ -754,7 +752,7 @@ exit:
754 return err; 752 return err;
755} 753}
756 754
757static int p80211wext_siwcommit(netdevice_t *dev, 755static int p80211wext_siwcommit(netdevice_t * dev,
758 struct iw_request_info *info, 756 struct iw_request_info *info,
759 struct iw_point *data, char *essid) 757 struct iw_point *data, char *essid)
760{ 758{
@@ -773,7 +771,7 @@ exit:
773 return err; 771 return err;
774} 772}
775 773
776static int p80211wext_giwrate(netdevice_t *dev, 774static int p80211wext_giwrate(netdevice_t * dev,
777 struct iw_request_info *info, 775 struct iw_request_info *info,
778 struct iw_param *rrq, char *extra) 776 struct iw_param *rrq, char *extra)
779{ 777{
@@ -786,7 +784,7 @@ static int p80211wext_giwrate(netdevice_t *dev,
786 msg.msgcode = DIDmsg_dot11req_mibget; 784 msg.msgcode = DIDmsg_dot11req_mibget;
787 mibitem.did = DIDmib_p2_p2MAC_p2CurrentTxRate; 785 mibitem.did = DIDmib_p2_p2MAC_p2CurrentTxRate;
788 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 786 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
789 result = p80211req_dorequest(wlandev, (u8 *)&msg); 787 result = p80211req_dorequest(wlandev, (u8 *) & msg);
790 788
791 if (result) { 789 if (result) {
792 err = -EFAULT; 790 err = -EFAULT;
@@ -824,7 +822,7 @@ exit:
824 return err; 822 return err;
825} 823}
826 824
827static int p80211wext_giwrts(netdevice_t *dev, 825static int p80211wext_giwrts(netdevice_t * dev,
828 struct iw_request_info *info, 826 struct iw_request_info *info,
829 struct iw_param *rts, char *extra) 827 struct iw_param *rts, char *extra)
830{ 828{
@@ -837,7 +835,7 @@ static int p80211wext_giwrts(netdevice_t *dev,
837 msg.msgcode = DIDmsg_dot11req_mibget; 835 msg.msgcode = DIDmsg_dot11req_mibget;
838 mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold; 836 mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11RTSThreshold;
839 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 837 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
840 result = p80211req_dorequest(wlandev, (u8 *)&msg); 838 result = p80211req_dorequest(wlandev, (u8 *) & msg);
841 839
842 if (result) { 840 if (result) {
843 err = -EFAULT; 841 err = -EFAULT;
@@ -854,7 +852,7 @@ exit:
854 return err; 852 return err;
855} 853}
856 854
857static int p80211wext_siwrts(netdevice_t *dev, 855static int p80211wext_siwrts(netdevice_t * dev,
858 struct iw_request_info *info, 856 struct iw_request_info *info,
859 struct iw_param *rts, char *extra) 857 struct iw_param *rts, char *extra)
860{ 858{
@@ -877,7 +875,7 @@ static int p80211wext_siwrts(netdevice_t *dev,
877 mibitem.data = rts->value; 875 mibitem.data = rts->value;
878 876
879 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 877 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
880 result = p80211req_dorequest(wlandev, (u8 *)&msg); 878 result = p80211req_dorequest(wlandev, (u8 *) & msg);
881 879
882 if (result) { 880 if (result) {
883 err = -EFAULT; 881 err = -EFAULT;
@@ -888,7 +886,7 @@ exit:
888 return err; 886 return err;
889} 887}
890 888
891static int p80211wext_giwfrag(netdevice_t *dev, 889static int p80211wext_giwfrag(netdevice_t * dev,
892 struct iw_request_info *info, 890 struct iw_request_info *info,
893 struct iw_param *frag, char *extra) 891 struct iw_param *frag, char *extra)
894{ 892{
@@ -902,7 +900,7 @@ static int p80211wext_giwfrag(netdevice_t *dev,
902 mibitem.did = 900 mibitem.did =
903 DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold; 901 DIDmib_dot11mac_dot11OperationTable_dot11FragmentationThreshold;
904 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 902 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
905 result = p80211req_dorequest(wlandev, (u8 *)&msg); 903 result = p80211req_dorequest(wlandev, (u8 *) & msg);
906 904
907 if (result) { 905 if (result) {
908 err = -EFAULT; 906 err = -EFAULT;
@@ -919,7 +917,7 @@ exit:
919 return err; 917 return err;
920} 918}
921 919
922static int p80211wext_siwfrag(netdevice_t *dev, 920static int p80211wext_siwfrag(netdevice_t * dev,
923 struct iw_request_info *info, 921 struct iw_request_info *info,
924 struct iw_param *frag, char *extra) 922 struct iw_param *frag, char *extra)
925{ 923{
@@ -944,7 +942,7 @@ static int p80211wext_siwfrag(netdevice_t *dev,
944 mibitem.data = frag->value; 942 mibitem.data = frag->value;
945 943
946 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 944 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
947 result = p80211req_dorequest(wlandev, (u8 *)&msg); 945 result = p80211req_dorequest(wlandev, (u8 *) & msg);
948 946
949 if (result) { 947 if (result) {
950 err = -EFAULT; 948 err = -EFAULT;
@@ -963,7 +961,7 @@ exit:
963#define IW_RETRY_SHORT IW_RETRY_MIN 961#define IW_RETRY_SHORT IW_RETRY_MIN
964#endif 962#endif
965 963
966static int p80211wext_giwretry(netdevice_t *dev, 964static int p80211wext_giwretry(netdevice_t * dev,
967 struct iw_request_info *info, 965 struct iw_request_info *info,
968 struct iw_param *rrq, char *extra) 966 struct iw_param *rrq, char *extra)
969{ 967{
@@ -978,7 +976,7 @@ static int p80211wext_giwretry(netdevice_t *dev,
978 mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit; 976 mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11ShortRetryLimit;
979 977
980 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 978 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
981 result = p80211req_dorequest(wlandev, (u8 *)&msg); 979 result = p80211req_dorequest(wlandev, (u8 *) & msg);
982 980
983 if (result) { 981 if (result) {
984 err = -EFAULT; 982 err = -EFAULT;
@@ -992,7 +990,7 @@ static int p80211wext_giwretry(netdevice_t *dev,
992 mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit; 990 mibitem.did = DIDmib_dot11mac_dot11OperationTable_dot11LongRetryLimit;
993 991
994 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 992 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
995 result = p80211req_dorequest(wlandev, (u8 *)&msg); 993 result = p80211req_dorequest(wlandev, (u8 *) & msg);
996 994
997 if (result) { 995 if (result) {
998 err = -EFAULT; 996 err = -EFAULT;
@@ -1007,7 +1005,7 @@ static int p80211wext_giwretry(netdevice_t *dev,
1007 DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime; 1005 DIDmib_dot11mac_dot11OperationTable_dot11MaxTransmitMSDULifetime;
1008 1006
1009 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 1007 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
1010 result = p80211req_dorequest(wlandev, (u8 *)&msg); 1008 result = p80211req_dorequest(wlandev, (u8 *) & msg);
1011 1009
1012 if (result) { 1010 if (result) {
1013 err = -EFAULT; 1011 err = -EFAULT;
@@ -1040,7 +1038,7 @@ exit:
1040 1038
1041} 1039}
1042 1040
1043static int p80211wext_siwretry(netdevice_t *dev, 1041static int p80211wext_siwretry(netdevice_t * dev,
1044 struct iw_request_info *info, 1042 struct iw_request_info *info,
1045 struct iw_param *rrq, char *extra) 1043 struct iw_param *rrq, char *extra)
1046{ 1044{
@@ -1068,7 +1066,7 @@ static int p80211wext_siwretry(netdevice_t *dev,
1068 mibitem.data = rrq->value /= 1024; 1066 mibitem.data = rrq->value /= 1024;
1069 1067
1070 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 1068 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
1071 result = p80211req_dorequest(wlandev, (u8 *)&msg); 1069 result = p80211req_dorequest(wlandev, (u8 *) & msg);
1072 1070
1073 if (result) { 1071 if (result) {
1074 err = -EFAULT; 1072 err = -EFAULT;
@@ -1082,7 +1080,7 @@ static int p80211wext_siwretry(netdevice_t *dev,
1082 1080
1083 memcpy(&msg.mibattribute.data, &mibitem, 1081 memcpy(&msg.mibattribute.data, &mibitem,
1084 sizeof(mibitem)); 1082 sizeof(mibitem));
1085 result = p80211req_dorequest(wlandev, (u8 *)&msg); 1083 result = p80211req_dorequest(wlandev, (u8 *) & msg);
1086 1084
1087 if (result) { 1085 if (result) {
1088 err = -EFAULT; 1086 err = -EFAULT;
@@ -1097,7 +1095,7 @@ static int p80211wext_siwretry(netdevice_t *dev,
1097 1095
1098 memcpy(&msg.mibattribute.data, &mibitem, 1096 memcpy(&msg.mibattribute.data, &mibitem,
1099 sizeof(mibitem)); 1097 sizeof(mibitem));
1100 result = p80211req_dorequest(wlandev, (u8 *)&msg); 1098 result = p80211req_dorequest(wlandev, (u8 *) & msg);
1101 1099
1102 if (result) { 1100 if (result) {
1103 err = -EFAULT; 1101 err = -EFAULT;
@@ -1111,7 +1109,7 @@ exit:
1111 1109
1112} 1110}
1113 1111
1114static int p80211wext_siwtxpow(netdevice_t *dev, 1112static int p80211wext_siwtxpow(netdevice_t * dev,
1115 struct iw_request_info *info, 1113 struct iw_request_info *info,
1116 struct iw_param *rrq, char *extra) 1114 struct iw_param *rrq, char *extra)
1117{ 1115{
@@ -1134,7 +1132,7 @@ static int p80211wext_siwtxpow(netdevice_t *dev,
1134 else 1132 else
1135 mibitem.data = rrq->value; 1133 mibitem.data = rrq->value;
1136 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 1134 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
1137 result = p80211req_dorequest(wlandev, (u8 *)&msg); 1135 result = p80211req_dorequest(wlandev, (u8 *) & msg);
1138 1136
1139 if (result) { 1137 if (result) {
1140 err = -EFAULT; 1138 err = -EFAULT;
@@ -1145,7 +1143,7 @@ exit:
1145 return err; 1143 return err;
1146} 1144}
1147 1145
1148static int p80211wext_giwtxpow(netdevice_t *dev, 1146static int p80211wext_giwtxpow(netdevice_t * dev,
1149 struct iw_request_info *info, 1147 struct iw_request_info *info,
1150 struct iw_param *rrq, char *extra) 1148 struct iw_param *rrq, char *extra)
1151{ 1149{
@@ -1160,7 +1158,7 @@ static int p80211wext_giwtxpow(netdevice_t *dev,
1160 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel; 1158 DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel;
1161 1159
1162 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem)); 1160 memcpy(&msg.mibattribute.data, &mibitem, sizeof(mibitem));
1163 result = p80211req_dorequest(wlandev, (u8 *)&msg); 1161 result = p80211req_dorequest(wlandev, (u8 *) & msg);
1164 1162
1165 if (result) { 1163 if (result) {
1166 err = -EFAULT; 1164 err = -EFAULT;
@@ -1180,7 +1178,7 @@ exit:
1180 return err; 1178 return err;
1181} 1179}
1182 1180
1183static int p80211wext_siwspy(netdevice_t *dev, 1181static int p80211wext_siwspy(netdevice_t * dev,
1184 struct iw_request_info *info, 1182 struct iw_request_info *info,
1185 struct iw_point *srq, char *extra) 1183 struct iw_point *srq, char *extra)
1186{ 1184{
@@ -1215,7 +1213,7 @@ static int p80211wext_siwspy(netdevice_t *dev,
1215} 1213}
1216 1214
1217/* jkriegl: from orinoco, modified */ 1215/* jkriegl: from orinoco, modified */
1218static int p80211wext_giwspy(netdevice_t *dev, 1216static int p80211wext_giwspy(netdevice_t * dev,
1219 struct iw_request_info *info, 1217 struct iw_request_info *info,
1220 struct iw_point *srq, char *extra) 1218 struct iw_point *srq, char *extra)
1221{ 1219{
@@ -1275,7 +1273,7 @@ static int prism2_result2err(int prism2_result)
1275 return err; 1273 return err;
1276} 1274}
1277 1275
1278static int p80211wext_siwscan(netdevice_t *dev, 1276static int p80211wext_siwscan(netdevice_t * dev,
1279 struct iw_request_info *info, 1277 struct iw_request_info *info,
1280 struct iw_point *srq, char *extra) 1278 struct iw_point *srq, char *extra)
1281{ 1279{
@@ -1308,7 +1306,7 @@ static int p80211wext_siwscan(netdevice_t *dev,
1308 msg.maxchanneltime.data = 250; 1306 msg.maxchanneltime.data = 250;
1309 msg.minchanneltime.data = 200; 1307 msg.minchanneltime.data = 200;
1310 1308
1311 result = p80211req_dorequest(wlandev, (u8 *)&msg); 1309 result = p80211req_dorequest(wlandev, (u8 *) & msg);
1312 if (result) 1310 if (result)
1313 err = prism2_result2err(msg.resultcode.data); 1311 err = prism2_result2err(msg.resultcode.data);
1314 1312
@@ -1322,7 +1320,7 @@ exit:
1322 */ 1320 */
1323static char *wext_translate_bss(struct iw_request_info *info, char *current_ev, 1321static char *wext_translate_bss(struct iw_request_info *info, char *current_ev,
1324 char *end_buf, 1322 char *end_buf,
1325 p80211msg_dot11req_scan_results_t *bss) 1323 p80211msg_dot11req_scan_results_t * bss)
1326{ 1324{
1327 struct iw_event iwe; /* Temporary buffer */ 1325 struct iw_event iwe; /* Temporary buffer */
1328 1326
@@ -1406,7 +1404,7 @@ static char *wext_translate_bss(struct iw_request_info *info, char *current_ev,
1406 return current_ev; 1404 return current_ev;
1407} 1405}
1408 1406
1409static int p80211wext_giwscan(netdevice_t *dev, 1407static int p80211wext_giwscan(netdevice_t * dev,
1410 struct iw_request_info *info, 1408 struct iw_request_info *info,
1411 struct iw_point *srq, char *extra) 1409 struct iw_point *srq, char *extra)
1412{ 1410{
@@ -1427,7 +1425,7 @@ static int p80211wext_giwscan(netdevice_t *dev,
1427 msg.msgcode = DIDmsg_dot11req_scan_results; 1425 msg.msgcode = DIDmsg_dot11req_scan_results;
1428 msg.bssindex.data = i; 1426 msg.bssindex.data = i;
1429 1427
1430 result = p80211req_dorequest(wlandev, (u8 *)&msg); 1428 result = p80211req_dorequest(wlandev, (u8 *) & msg);
1431 if ((result != 0) || 1429 if ((result != 0) ||
1432 (msg.resultcode.data != P80211ENUM_resultcode_success)) { 1430 (msg.resultcode.data != P80211ENUM_resultcode_success)) {
1433 break; 1431 break;
@@ -1466,7 +1464,7 @@ static int p80211wext_set_encodeext(struct net_device *dev,
1466 int idx = encoding->flags & IW_ENCODE_INDEX; 1464 int idx = encoding->flags & IW_ENCODE_INDEX;
1467 1465
1468 pr_debug("set_encode_ext flags[%d] alg[%d] keylen[%d]\n", 1466 pr_debug("set_encode_ext flags[%d] alg[%d] keylen[%d]\n",
1469 ext->ext_flags, (int)ext->alg, (int)ext->key_len); 1467 ext->ext_flags, (int)ext->alg, (int)ext->key_len);
1470 1468
1471 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { 1469 if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) {
1472 /* set default key ? I'm not sure if this the the correct thing to do here */ 1470 /* set default key ? I'm not sure if this the the correct thing to do here */
@@ -1502,7 +1500,7 @@ static int p80211wext_set_encodeext(struct net_device *dev,
1502 memcpy(wlandev->wep_keys[idx], ext->key, ext->key_len); 1500 memcpy(wlandev->wep_keys[idx], ext->key, ext->key_len);
1503 1501
1504 memset(&msg, 0, sizeof(msg)); 1502 memset(&msg, 0, sizeof(msg));
1505 pstr = (p80211item_pstr32_t *)&msg.mibattribute.data; 1503 pstr = (p80211item_pstr32_t *) & msg.mibattribute.data;
1506 memcpy(pstr->data.data, ext->key, ext->key_len); 1504 memcpy(pstr->data.data, ext->key, ext->key_len);
1507 pstr->data.len = ext->key_len; 1505 pstr->data.len = ext->key_len;
1508 switch (idx) { 1506 switch (idx) {
@@ -1526,7 +1524,7 @@ static int p80211wext_set_encodeext(struct net_device *dev,
1526 break; 1524 break;
1527 } 1525 }
1528 msg.msgcode = DIDmsg_dot11req_mibset; 1526 msg.msgcode = DIDmsg_dot11req_mibset;
1529 result = p80211req_dorequest(wlandev, (u8 *)&msg); 1527 result = p80211req_dorequest(wlandev, (u8 *) & msg);
1530 pr_debug("result (%d)\n", result); 1528 pr_debug("result (%d)\n", result);
1531 } 1529 }
1532 return result; 1530 return result;
@@ -1546,12 +1544,11 @@ static int p80211wext_get_encodeext(struct net_device *dev,
1546 int idx; 1544 int idx;
1547 1545
1548 pr_debug("get_encode_ext flags[%d] alg[%d] keylen[%d]\n", 1546 pr_debug("get_encode_ext flags[%d] alg[%d] keylen[%d]\n",
1549 ext->ext_flags, (int)ext->alg, (int)ext->key_len); 1547 ext->ext_flags, (int)ext->alg, (int)ext->key_len);
1550 1548
1551 max_len = encoding->length - sizeof(*ext); 1549 max_len = encoding->length - sizeof(*ext);
1552 if (max_len <= 0) { 1550 if (max_len <= 0) {
1553 pr_debug("get_encodeext max_len [%d] invalid\n", 1551 pr_debug("get_encodeext max_len [%d] invalid\n", max_len);
1554 max_len);
1555 result = -EINVAL; 1552 result = -EINVAL;
1556 goto exit; 1553 goto exit;
1557 } 1554 }
@@ -1561,8 +1558,8 @@ static int p80211wext_get_encodeext(struct net_device *dev,
1561 1558
1562 if (idx) { 1559 if (idx) {
1563 if (idx < 1 || idx > NUM_WEPKEYS) { 1560 if (idx < 1 || idx > NUM_WEPKEYS) {
1564 pr_debug( 1561 pr_debug("get_encode_ext invalid key index [%d]\n",
1565 "get_encode_ext invalid key index [%d]\n", idx); 1562 idx);
1566 result = -EINVAL; 1563 result = -EINVAL;
1567 goto exit; 1564 goto exit;
1568 } 1565 }
@@ -1593,8 +1590,7 @@ static int p80211_wext_set_iwauth(struct net_device *dev,
1593 struct iw_param *param = &wrqu->param; 1590 struct iw_param *param = &wrqu->param;
1594 int result = 0; 1591 int result = 0;
1595 1592
1596 pr_debug("set_iwauth flags[%d]\n", 1593 pr_debug("set_iwauth flags[%d]\n", (int)param->flags & IW_AUTH_INDEX);
1597 (int)param->flags & IW_AUTH_INDEX);
1598 1594
1599 switch (param->flags & IW_AUTH_INDEX) { 1595 switch (param->flags & IW_AUTH_INDEX) {
1600 case IW_AUTH_DROP_UNENCRYPTED: 1596 case IW_AUTH_DROP_UNENCRYPTED:
@@ -1635,8 +1631,7 @@ static int p80211_wext_set_iwauth(struct net_device *dev,
1635 wlandev->hostwep |= HOSTWEP_SHAREDKEY; 1631 wlandev->hostwep |= HOSTWEP_SHAREDKEY;
1636 } else { 1632 } else {
1637 /* don't know what to do know */ 1633 /* don't know what to do know */
1638 pr_debug("unknown AUTH_ALG (%d)\n", 1634 pr_debug("unknown AUTH_ALG (%d)\n", param->value);
1639 param->value);
1640 result = -EINVAL; 1635 result = -EINVAL;
1641 } 1636 }
1642 break; 1637 break;
@@ -1657,8 +1652,7 @@ static int p80211_wext_get_iwauth(struct net_device *dev,
1657 struct iw_param *param = &wrqu->param; 1652 struct iw_param *param = &wrqu->param;
1658 int result = 0; 1653 int result = 0;
1659 1654
1660 pr_debug("get_iwauth flags[%d]\n", 1655 pr_debug("get_iwauth flags[%d]\n", (int)param->flags & IW_AUTH_INDEX);
1661 (int)param->flags & IW_AUTH_INDEX);
1662 1656
1663 switch (param->flags & IW_AUTH_INDEX) { 1657 switch (param->flags & IW_AUTH_INDEX) {
1664 case IW_AUTH_DROP_UNENCRYPTED: 1658 case IW_AUTH_DROP_UNENCRYPTED:
@@ -1673,9 +1667,8 @@ static int p80211_wext_get_iwauth(struct net_device *dev,
1673 1667
1674 case IW_AUTH_80211_AUTH_ALG: 1668 case IW_AUTH_80211_AUTH_ALG:
1675 param->value = 1669 param->value =
1676 wlandev-> 1670 wlandev->hostwep & HOSTWEP_SHAREDKEY ?
1677 hostwep & HOSTWEP_SHAREDKEY ? IW_AUTH_ALG_SHARED_KEY : 1671 IW_AUTH_ALG_SHARED_KEY : IW_AUTH_ALG_OPEN_SYSTEM;
1678 IW_AUTH_ALG_OPEN_SYSTEM;
1679 break; 1672 break;
1680 1673
1681 default: 1674 default:
@@ -1755,7 +1748,7 @@ struct iw_handler_def p80211wext_handler_def = {
1755 .get_wireless_stats = p80211wext_get_wireless_stats 1748 .get_wireless_stats = p80211wext_get_wireless_stats
1756}; 1749};
1757 1750
1758int p80211wext_event_associated(wlandevice_t *wlandev, int assoc) 1751int p80211wext_event_associated(wlandevice_t * wlandev, int assoc)
1759{ 1752{
1760 union iwreq_data data; 1753 union iwreq_data data;
1761 1754
diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c
index 48bfb8331dd..608b234b6a4 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -50,7 +50,6 @@
50#include <linux/sort.h> 50#include <linux/sort.h>
51#include <linux/firmware.h> 51#include <linux/firmware.h>
52 52
53
54/*================================================================*/ 53/*================================================================*/
55/* Local Constants */ 54/* Local Constants */
56 55
@@ -125,89 +124,80 @@
125 : "cc"); \ 124 : "cc"); \
126 __v; })) 125 __v; }))
127 126
128
129
130/*================================================================*/ 127/*================================================================*/
131/* Local Types */ 128/* Local Types */
132 129
133typedef struct s3datarec 130typedef struct s3datarec {
134{ 131 u32 len;
135 u32 len; 132 u32 addr;
136 u32 addr; 133 u8 checksum;
137 u8 checksum; 134 u8 *data;
138 u8 *data;
139} s3datarec_t; 135} s3datarec_t;
140 136
141typedef struct s3plugrec 137typedef struct s3plugrec {
142{ 138 u32 itemcode;
143 u32 itemcode; 139 u32 addr;
144 u32 addr; 140 u32 len;
145 u32 len;
146} s3plugrec_t; 141} s3plugrec_t;
147 142
148typedef struct s3crcrec 143typedef struct s3crcrec {
149{ 144 u32 addr;
150 u32 addr; 145 u32 len;
151 u32 len; 146 unsigned int dowrite;
152 unsigned int dowrite;
153} s3crcrec_t; 147} s3crcrec_t;
154 148
155typedef struct s3inforec 149typedef struct s3inforec {
156{ 150 u16 len;
157 u16 len; 151 u16 type;
158 u16 type;
159 union { 152 union {
160 hfa384x_compident_t version; 153 hfa384x_compident_t version;
161 hfa384x_caplevel_t compat; 154 hfa384x_caplevel_t compat;
162 u16 buildseq; 155 u16 buildseq;
163 hfa384x_compident_t platform; 156 hfa384x_compident_t platform;
164 } info; 157 } info;
165} s3inforec_t; 158} s3inforec_t;
166 159
167typedef struct pda 160typedef struct pda {
168{ 161 u8 buf[HFA384x_PDA_LEN_MAX];
169 u8 buf[HFA384x_PDA_LEN_MAX]; 162 hfa384x_pdrec_t *rec[HFA384x_PDA_RECS_MAX];
170 hfa384x_pdrec_t *rec[HFA384x_PDA_RECS_MAX]; 163 unsigned int nrec;
171 unsigned int nrec;
172} pda_t; 164} pda_t;
173 165
174typedef struct imgchunk 166typedef struct imgchunk {
175{ 167 u32 addr; /* start address */
176 u32 addr; /* start address */ 168 u32 len; /* in bytes */
177 u32 len; /* in bytes */ 169 u16 crc; /* CRC value (if it falls at a chunk boundary) */
178 u16 crc; /* CRC value (if it falls at a chunk boundary) */ 170 u8 *data;
179 u8 *data;
180} imgchunk_t; 171} imgchunk_t;
181 172
182/*================================================================*/ 173/*================================================================*/
183/* Local Static Definitions */ 174/* Local Static Definitions */
184 175
185
186/*----------------------------------------------------------------*/ 176/*----------------------------------------------------------------*/
187/* s-record image processing */ 177/* s-record image processing */
188 178
189/* Data records */ 179/* Data records */
190unsigned int ns3data = 0; 180unsigned int ns3data = 0;
191s3datarec_t s3data[S3DATA_MAX]; 181s3datarec_t s3data[S3DATA_MAX];
192 182
193/* Plug records */ 183/* Plug records */
194unsigned int ns3plug = 0; 184unsigned int ns3plug = 0;
195s3plugrec_t s3plug[S3PLUG_MAX]; 185s3plugrec_t s3plug[S3PLUG_MAX];
196 186
197/* CRC records */ 187/* CRC records */
198unsigned int ns3crc = 0; 188unsigned int ns3crc = 0;
199s3crcrec_t s3crc[S3CRC_MAX]; 189s3crcrec_t s3crc[S3CRC_MAX];
200 190
201/* Info records */ 191/* Info records */
202unsigned int ns3info = 0; 192unsigned int ns3info = 0;
203s3inforec_t s3info[S3INFO_MAX]; 193s3inforec_t s3info[S3INFO_MAX];
204 194
205/* S7 record (there _better_ be only one) */ 195/* S7 record (there _better_ be only one) */
206u32 startaddr; 196u32 startaddr;
207 197
208/* Load image chunks */ 198/* Load image chunks */
209unsigned int nfchunks; 199unsigned int nfchunks;
210imgchunk_t fchunk[CHUNKS_MAX]; 200imgchunk_t fchunk[CHUNKS_MAX];
211 201
212/* Note that for the following pdrec_t arrays, the len and code */ 202/* Note that for the following pdrec_t arrays, the len and code */
213/* fields are stored in HOST byte order. The mkpdrlist() function */ 203/* fields are stored in HOST byte order. The mkpdrlist() function */
@@ -215,36 +205,35 @@ imgchunk_t fchunk[CHUNKS_MAX];
215/*----------------------------------------------------------------*/ 205/*----------------------------------------------------------------*/
216/* PDA, built from [card|newfile]+[addfile1+addfile2...] */ 206/* PDA, built from [card|newfile]+[addfile1+addfile2...] */
217 207
218pda_t pda; 208pda_t pda;
219hfa384x_compident_t nicid; 209hfa384x_compident_t nicid;
220hfa384x_caplevel_t rfid; 210hfa384x_caplevel_t rfid;
221hfa384x_caplevel_t macid; 211hfa384x_caplevel_t macid;
222hfa384x_caplevel_t priid; 212hfa384x_caplevel_t priid;
223
224 213
225/*================================================================*/ 214/*================================================================*/
226/* Local Function Declarations */ 215/* Local Function Declarations */
227 216
228int prism2_fwapply(char *rfptr, int rfsize, wlandevice_t *wlandev); 217int prism2_fwapply(char *rfptr, int rfsize, wlandevice_t * wlandev);
229int read_srecfile(char *rfptr, int rfsize); 218int read_srecfile(char *rfptr, int rfsize);
230int mkimage(imgchunk_t *clist, unsigned int *ccnt); 219int mkimage(imgchunk_t * clist, unsigned int *ccnt);
231int read_cardpda(pda_t *pda, wlandevice_t *wlandev); 220int read_cardpda(pda_t * pda, wlandevice_t * wlandev);
232int mkpdrlist( pda_t *pda); 221int mkpdrlist(pda_t * pda);
233int s3datarec_compare(const void *p1, const void *p2); 222int s3datarec_compare(const void *p1, const void *p2);
234int plugimage( imgchunk_t *fchunk, unsigned int nfchunks, 223int plugimage(imgchunk_t * fchunk, unsigned int nfchunks,
235 s3plugrec_t* s3plug, unsigned int ns3plug, pda_t *pda); 224 s3plugrec_t * s3plug, unsigned int ns3plug, pda_t * pda);
236int crcimage( imgchunk_t *fchunk, unsigned int nfchunks, 225int crcimage(imgchunk_t * fchunk, unsigned int nfchunks,
237 s3crcrec_t *s3crc, unsigned int ns3crc); 226 s3crcrec_t * s3crc, unsigned int ns3crc);
238int writeimage(wlandevice_t *wlandev, imgchunk_t *fchunk, unsigned int nfchunks); 227int writeimage(wlandevice_t * wlandev, imgchunk_t * fchunk,
239void free_chunks(imgchunk_t *fchunk, unsigned int *nfchunks); 228 unsigned int nfchunks);
240void free_srecs(void); 229void free_chunks(imgchunk_t * fchunk, unsigned int *nfchunks);
241 230void free_srecs(void);
242int validate_identity(void); 231
232int validate_identity(void);
243 233
244/*================================================================*/ 234/*================================================================*/
245/* Function Definitions */ 235/* Function Definitions */
246 236
247
248/*---------------------------------------------------------------- 237/*----------------------------------------------------------------
249* prism2_fwtry 238* prism2_fwtry
250* 239*
@@ -258,13 +247,13 @@ int validate_identity(void);
258* 0 - success 247* 0 - success
259* ~0 - failure 248* ~0 - failure
260----------------------------------------------------------------*/ 249----------------------------------------------------------------*/
261int prism2_fwtry(struct usb_device *udev, wlandevice_t *wlandev) 250int prism2_fwtry(struct usb_device *udev, wlandevice_t * wlandev)
262{ 251{
263 const struct firmware *fw_entry = NULL; 252 const struct firmware *fw_entry = NULL;
264 253
265 printk(KERN_INFO "prism2_usb: Checking for firmware %s\n", PRISM2_USB_FWFILE); 254 printk(KERN_INFO "prism2_usb: Checking for firmware %s\n",
266 if(request_firmware(&fw_entry, PRISM2_USB_FWFILE, &udev->dev) != 0) 255 PRISM2_USB_FWFILE);
267 { 256 if (request_firmware(&fw_entry, PRISM2_USB_FWFILE, &udev->dev) != 0) {
268 printk(KERN_INFO 257 printk(KERN_INFO
269 "prism2_usb: Firmware not available, but not essential\n"); 258 "prism2_usb: Firmware not available, but not essential\n");
270 printk(KERN_INFO 259 printk(KERN_INFO
@@ -272,14 +261,14 @@ int prism2_fwtry(struct usb_device *udev, wlandevice_t *wlandev)
272 return 1; 261 return 1;
273 } 262 }
274 263
275 printk(KERN_INFO "prism2_usb: %s will be processed, size %d\n", PRISM2_USB_FWFILE, fw_entry->size); 264 printk(KERN_INFO "prism2_usb: %s will be processed, size %d\n",
265 PRISM2_USB_FWFILE, fw_entry->size);
276 prism2_fwapply((char *)fw_entry->data, fw_entry->size, wlandev); 266 prism2_fwapply((char *)fw_entry->data, fw_entry->size, wlandev);
277 267
278 release_firmware(fw_entry); 268 release_firmware(fw_entry);
279 return 0; 269 return 0;
280} 270}
281 271
282
283/*---------------------------------------------------------------- 272/*----------------------------------------------------------------
284* prism2_fwapply 273* prism2_fwapply
285* 274*
@@ -294,12 +283,12 @@ int prism2_fwtry(struct usb_device *udev, wlandevice_t *wlandev)
294* 0 - success 283* 0 - success
295* ~0 - failure 284* ~0 - failure
296----------------------------------------------------------------*/ 285----------------------------------------------------------------*/
297int prism2_fwapply(char *rfptr, int rfsize, wlandevice_t *wlandev) 286int prism2_fwapply(char *rfptr, int rfsize, wlandevice_t * wlandev)
298{ 287{
299 signed int result = 0; 288 signed int result = 0;
300 p80211msg_dot11req_mibget_t getmsg; 289 p80211msg_dot11req_mibget_t getmsg;
301 p80211itemd_t *item; 290 p80211itemd_t *item;
302 u32 *data; 291 u32 *data;
303 292
304 /* Initialize the data structures */ 293 /* Initialize the data structures */
305 ns3data = 0; 294 ns3data = 0;
@@ -313,20 +302,19 @@ int prism2_fwapply(char *rfptr, int rfsize, wlandevice_t *wlandev)
313 startaddr = 0; 302 startaddr = 0;
314 303
315 nfchunks = 0; 304 nfchunks = 0;
316 memset( fchunk, 0, sizeof(fchunk)); 305 memset(fchunk, 0, sizeof(fchunk));
317 memset( &nicid, 0, sizeof(nicid)); 306 memset(&nicid, 0, sizeof(nicid));
318 memset( &rfid, 0, sizeof(rfid)); 307 memset(&rfid, 0, sizeof(rfid));
319 memset( &macid, 0, sizeof(macid)); 308 memset(&macid, 0, sizeof(macid));
320 memset( &priid, 0, sizeof(priid)); 309 memset(&priid, 0, sizeof(priid));
321 310
322 /* clear the pda and add an initial END record */ 311 /* clear the pda and add an initial END record */
323 memset(&pda, 0, sizeof(pda)); 312 memset(&pda, 0, sizeof(pda));
324 pda.rec[0] = (hfa384x_pdrec_t*)pda.buf; 313 pda.rec[0] = (hfa384x_pdrec_t *) pda.buf;
325 pda.rec[0]->len = cpu_to_le16(2); /* len in words */ /* len in words */ 314 pda.rec[0]->len = cpu_to_le16(2); /* len in words *//* len in words */
326 pda.rec[0]->code = cpu_to_le16(HFA384x_PDR_END_OF_PDA); 315 pda.rec[0]->code = cpu_to_le16(HFA384x_PDR_END_OF_PDA);
327 pda.nrec = 1; 316 pda.nrec = 1;
328 317
329
330 /*-----------------------------------------------------*/ 318 /*-----------------------------------------------------*/
331 /* Put card into fwload state */ 319 /* Put card into fwload state */
332 prism2sta_ifstate(wlandev, P80211ENUM_ifstate_fwload); 320 prism2sta_ifstate(wlandev, P80211ENUM_ifstate_fwload);
@@ -334,7 +322,7 @@ int prism2_fwapply(char *rfptr, int rfsize, wlandevice_t *wlandev)
334 /* Build the PDA we're going to use. */ 322 /* Build the PDA we're going to use. */
335 if (read_cardpda(&pda, wlandev)) { 323 if (read_cardpda(&pda, wlandev)) {
336 printk(KERN_ERR "load_cardpda failed, exiting.\n"); 324 printk(KERN_ERR "load_cardpda failed, exiting.\n");
337 return(1); 325 return (1);
338 } 326 }
339 327
340 /* read the card's PRI-SUP */ 328 /* read the card's PRI-SUP */
@@ -352,7 +340,7 @@ int prism2_fwapply(char *rfptr, int rfsize, wlandevice_t *wlandev)
352 item->did = DIDmib_p2_p2NIC_p2PRISupRange; 340 item->did = DIDmib_p2_p2NIC_p2PRISupRange;
353 item->status = P80211ENUM_msgitem_status_no_value; 341 item->status = P80211ENUM_msgitem_status_no_value;
354 342
355 data = (u32*) item->data; 343 data = (u32 *) item->data;
356 344
357 /* DIDmsg_dot11req_mibget */ 345 /* DIDmsg_dot11req_mibget */
358 prism2mgmt_mibset_mibget(wlandev, &getmsg); 346 prism2mgmt_mibset_mibget(wlandev, &getmsg);
@@ -367,53 +355,48 @@ int prism2_fwapply(char *rfptr, int rfsize, wlandevice_t *wlandev)
367 priid.bottom = *data++; 355 priid.bottom = *data++;
368 priid.top = *data++; 356 priid.top = *data++;
369 357
370
371 /* Read the S3 file */ 358 /* Read the S3 file */
372 result = read_srecfile(rfptr, rfsize); 359 result = read_srecfile(rfptr, rfsize);
373 if ( result ) { 360 if (result) {
374 printk(KERN_ERR "Failed to read the data exiting.\n"); 361 printk(KERN_ERR "Failed to read the data exiting.\n");
375 return(1); 362 return (1);
376 } 363 }
377 /* Sort the S3 data records */ 364 /* Sort the S3 data records */
378 sort( s3data, 365 sort(s3data, ns3data, sizeof(s3datarec_t), s3datarec_compare, NULL);
379 ns3data,
380 sizeof(s3datarec_t),
381 s3datarec_compare, NULL);
382 366
383 result = validate_identity(); 367 result = validate_identity();
384 368
385 if ( result ) { 369 if (result) {
386 printk(KERN_ERR "Incompatible firmware image.\n"); 370 printk(KERN_ERR "Incompatible firmware image.\n");
387 return(1); 371 return (1);
388 } 372 }
389 373
390 if (startaddr == 0x00000000) { 374 if (startaddr == 0x00000000) {
391 printk(KERN_ERR "Can't RAM download a Flash image!\n"); 375 printk(KERN_ERR "Can't RAM download a Flash image!\n");
392 return(1); 376 return (1);
393 } 377 }
394 378
395 /* Make the image chunks */ 379 /* Make the image chunks */
396 result = mkimage(fchunk, &nfchunks); 380 result = mkimage(fchunk, &nfchunks);
397 381
398 /* Do any plugging */ 382 /* Do any plugging */
399 result = plugimage(fchunk, nfchunks, s3plug, ns3plug, 383 result = plugimage(fchunk, nfchunks, s3plug, ns3plug, &pda);
400 &pda); 384 if (result) {
401 if ( result ) {
402 printk(KERN_ERR "Failed to plug data.\n"); 385 printk(KERN_ERR "Failed to plug data.\n");
403 return(1); 386 return (1);
404 } 387 }
405 388
406 /* Insert any CRCs */ 389 /* Insert any CRCs */
407 if (crcimage(fchunk, nfchunks, s3crc, ns3crc) ) { 390 if (crcimage(fchunk, nfchunks, s3crc, ns3crc)) {
408 printk(KERN_ERR "Failed to insert all CRCs\n"); 391 printk(KERN_ERR "Failed to insert all CRCs\n");
409 return(1); 392 return (1);
410 } 393 }
411 394
412 /* Write the image */ 395 /* Write the image */
413 result = writeimage(wlandev, fchunk, nfchunks); 396 result = writeimage(wlandev, fchunk, nfchunks);
414 if ( result ) { 397 if (result) {
415 printk(KERN_ERR "Failed to ramwrite image data.\n"); 398 printk(KERN_ERR "Failed to ramwrite image data.\n");
416 return(1); 399 return (1);
417 } 400 }
418 401
419 /* clear any allocated memory */ 402 /* clear any allocated memory */
@@ -425,7 +408,6 @@ int prism2_fwapply(char *rfptr, int rfsize, wlandevice_t *wlandev)
425 return result; 408 return result;
426} 409}
427 410
428
429/*---------------------------------------------------------------- 411/*----------------------------------------------------------------
430* crcimage 412* crcimage
431* 413*
@@ -443,59 +425,60 @@ int prism2_fwapply(char *rfptr, int rfsize, wlandevice_t *wlandev)
443* 0 success 425* 0 success
444* ~0 failure 426* ~0 failure
445----------------------------------------------------------------*/ 427----------------------------------------------------------------*/
446int crcimage(imgchunk_t *fchunk, unsigned int nfchunks, s3crcrec_t *s3crc, 428int crcimage(imgchunk_t * fchunk, unsigned int nfchunks, s3crcrec_t * s3crc,
447 unsigned int ns3crc) 429 unsigned int ns3crc)
448{ 430{
449 int result = 0; 431 int result = 0;
450 int i; 432 int i;
451 int c; 433 int c;
452 u32 crcstart; 434 u32 crcstart;
453 u32 crcend; 435 u32 crcend;
454 u32 cstart = 0; 436 u32 cstart = 0;
455 u32 cend; 437 u32 cend;
456 u8 *dest; 438 u8 *dest;
457 u32 chunkoff; 439 u32 chunkoff;
458 440
459 for ( i = 0; i < ns3crc; i++ ) { 441 for (i = 0; i < ns3crc; i++) {
460 if ( !s3crc[i].dowrite ) continue; 442 if (!s3crc[i].dowrite)
443 continue;
461 crcstart = s3crc[i].addr; 444 crcstart = s3crc[i].addr;
462 crcend = s3crc[i].addr + s3crc[i].len; 445 crcend = s3crc[i].addr + s3crc[i].len;
463 /* Find chunk */ 446 /* Find chunk */
464 for ( c = 0; c < nfchunks; c++) { 447 for (c = 0; c < nfchunks; c++) {
465 cstart = fchunk[c].addr; 448 cstart = fchunk[c].addr;
466 cend = fchunk[c].addr + fchunk[c].len; 449 cend = fchunk[c].addr + fchunk[c].len;
467 /* the line below does an address & len match search */ 450 /* the line below does an address & len match search */
468 /* unfortunately, I've found that the len fields of */ 451 /* unfortunately, I've found that the len fields of */
469 /* some crc records don't match with the length of */ 452 /* some crc records don't match with the length of */
470 /* the actual data, so we're not checking right */ 453 /* the actual data, so we're not checking right */
471 /* now */ 454 /* now */
472 /* if ( crcstart-2 >= cstart && crcend <= cend ) break;*/ 455 /* if ( crcstart-2 >= cstart && crcend <= cend ) break; */
473 456
474 /* note the -2 below, it's to make sure the chunk has */ 457 /* note the -2 below, it's to make sure the chunk has */
475 /* space for the CRC value */ 458 /* space for the CRC value */
476 if ( crcstart-2 >= cstart && crcstart < cend ) break; 459 if (crcstart - 2 >= cstart && crcstart < cend)
460 break;
477 } 461 }
478 if ( c >= nfchunks ) { 462 if (c >= nfchunks) {
479 printk(KERN_ERR 463 printk(KERN_ERR
480 "Failed to find chunk for " 464 "Failed to find chunk for "
481 "crcrec[%d], addr=0x%06x len=%d , " 465 "crcrec[%d], addr=0x%06x len=%d , "
482 "aborting crc.\n", 466 "aborting crc.\n",
483 i, s3crc[i].addr, s3crc[i].len); 467 i, s3crc[i].addr, s3crc[i].len);
484 return 1; 468 return 1;
485 } 469 }
486 470
487 /* Insert crc */ 471 /* Insert crc */
488 pr_debug("Adding crc @ 0x%06x\n", s3crc[i].addr-2); 472 pr_debug("Adding crc @ 0x%06x\n", s3crc[i].addr - 2);
489 chunkoff = crcstart - cstart - 2; 473 chunkoff = crcstart - cstart - 2;
490 dest = fchunk[c].data + chunkoff; 474 dest = fchunk[c].data + chunkoff;
491 *dest = 0xde; 475 *dest = 0xde;
492 *(dest+1) = 0xc0; 476 *(dest + 1) = 0xc0;
493 477
494 } 478 }
495 return result; 479 return result;
496} 480}
497 481
498
499/*---------------------------------------------------------------- 482/*----------------------------------------------------------------
500* free_chunks 483* free_chunks
501* 484*
@@ -507,20 +490,19 @@ int crcimage(imgchunk_t *fchunk, unsigned int nfchunks, s3crcrec_t *s3crc,
507* Returns: 490* Returns:
508* nothing 491* nothing
509----------------------------------------------------------------*/ 492----------------------------------------------------------------*/
510void free_chunks(imgchunk_t *fchunk, unsigned int *nfchunks) 493void free_chunks(imgchunk_t * fchunk, unsigned int *nfchunks)
511{ 494{
512 int i; 495 int i;
513 for ( i = 0; i < *nfchunks; i++) { 496 for (i = 0; i < *nfchunks; i++) {
514 if ( fchunk[i].data != NULL ) { 497 if (fchunk[i].data != NULL) {
515 kfree(fchunk[i].data); 498 kfree(fchunk[i].data);
516 } 499 }
517 } 500 }
518 *nfchunks = 0; 501 *nfchunks = 0;
519 memset( fchunk, 0, sizeof(fchunk)); 502 memset(fchunk, 0, sizeof(fchunk));
520 503
521} 504}
522 505
523
524/*---------------------------------------------------------------- 506/*----------------------------------------------------------------
525* free_srecs 507* free_srecs
526* 508*
@@ -535,7 +517,7 @@ void free_chunks(imgchunk_t *fchunk, unsigned int *nfchunks)
535void free_srecs(void) 517void free_srecs(void)
536{ 518{
537 int i; 519 int i;
538 for ( i = 0; i < ns3data; i++) { 520 for (i = 0; i < ns3data; i++) {
539 kfree(s3data[i].data); 521 kfree(s3data[i].data);
540 } 522 }
541 ns3data = 0; 523 ns3data = 0;
@@ -549,7 +531,6 @@ void free_srecs(void)
549 startaddr = 0; 531 startaddr = 0;
550} 532}
551 533
552
553/*---------------------------------------------------------------- 534/*----------------------------------------------------------------
554* mkimage 535* mkimage
555* 536*
@@ -564,25 +545,25 @@ void free_srecs(void)
564* 0 - success 545* 0 - success
565* ~0 - failure (probably an errno) 546* ~0 - failure (probably an errno)
566----------------------------------------------------------------*/ 547----------------------------------------------------------------*/
567int mkimage(imgchunk_t *clist, unsigned int *ccnt) 548int mkimage(imgchunk_t * clist, unsigned int *ccnt)
568{ 549{
569 int result = 0; 550 int result = 0;
570 int i; 551 int i;
571 int j; 552 int j;
572 int currchunk = 0; 553 int currchunk = 0;
573 u32 nextaddr = 0; 554 u32 nextaddr = 0;
574 u32 s3start; 555 u32 s3start;
575 u32 s3end; 556 u32 s3end;
576 u32 cstart = 0; 557 u32 cstart = 0;
577 u32 cend; 558 u32 cend;
578 u32 coffset; 559 u32 coffset;
579 560
580 /* There may already be data in the chunklist */ 561 /* There may already be data in the chunklist */
581 *ccnt = 0; 562 *ccnt = 0;
582 563
583 /* Establish the location and size of each chunk */ 564 /* Establish the location and size of each chunk */
584 for ( i = 0; i < ns3data; i++) { 565 for (i = 0; i < ns3data; i++) {
585 if ( s3data[i].addr == nextaddr ) { 566 if (s3data[i].addr == nextaddr) {
586 /* existing chunk, grow it */ 567 /* existing chunk, grow it */
587 clist[currchunk].len += s3data[i].len; 568 clist[currchunk].len += s3data[i].len;
588 nextaddr += s3data[i].len; 569 nextaddr += s3data[i].len;
@@ -595,9 +576,9 @@ int mkimage(imgchunk_t *clist, unsigned int *ccnt)
595 nextaddr = s3data[i].addr + s3data[i].len; 576 nextaddr = s3data[i].addr + s3data[i].len;
596 /* Expand the chunk if there is a CRC record at */ 577 /* Expand the chunk if there is a CRC record at */
597 /* their beginning bound */ 578 /* their beginning bound */
598 for ( j = 0; j < ns3crc; j++) { 579 for (j = 0; j < ns3crc; j++) {
599 if ( s3crc[j].dowrite && 580 if (s3crc[j].dowrite &&
600 s3crc[j].addr == clist[currchunk].addr ) { 581 s3crc[j].addr == clist[currchunk].addr) {
601 clist[currchunk].addr -= 2; 582 clist[currchunk].addr -= 2;
602 clist[currchunk].len += 2; 583 clist[currchunk].len += 2;
603 } 584 }
@@ -609,41 +590,41 @@ int mkimage(imgchunk_t *clist, unsigned int *ccnt)
609 /* if this proves false, we'll need to add code to coalesce. */ 590 /* if this proves false, we'll need to add code to coalesce. */
610 591
611 /* Allocate buffer space for chunks */ 592 /* Allocate buffer space for chunks */
612 for ( i = 0; i < *ccnt; i++) { 593 for (i = 0; i < *ccnt; i++) {
613 clist[i].data = kmalloc(clist[i].len, GFP_KERNEL); 594 clist[i].data = kmalloc(clist[i].len, GFP_KERNEL);
614 if ( clist[i].data == NULL ) { 595 if (clist[i].data == NULL) {
615 printk(KERN_ERR "failed to allocate image space, exitting.\n"); 596 printk(KERN_ERR
616 return(1); 597 "failed to allocate image space, exitting.\n");
598 return (1);
617 } 599 }
618 memset(clist[i].data, 0, clist[i].len); 600 memset(clist[i].data, 0, clist[i].len);
619 } 601 }
620 602
621
622 /* Display chunks */ 603 /* Display chunks */
623 for ( i = 0; i < *ccnt; i++) { 604 for (i = 0; i < *ccnt; i++) {
624 pr_debug("chunk[%d]: addr=0x%06x len=%d\n", 605 pr_debug("chunk[%d]: addr=0x%06x len=%d\n",
625 i, clist[i].addr, clist[i].len); 606 i, clist[i].addr, clist[i].len);
626 } 607 }
627 608
628 /* Copy srec data to chunks */ 609 /* Copy srec data to chunks */
629 for ( i = 0; i < ns3data; i++) { 610 for (i = 0; i < ns3data; i++) {
630 s3start = s3data[i].addr; 611 s3start = s3data[i].addr;
631 s3end = s3start + s3data[i].len - 1; 612 s3end = s3start + s3data[i].len - 1;
632 for ( j = 0; j < *ccnt; j++) { 613 for (j = 0; j < *ccnt; j++) {
633 cstart = clist[j].addr; 614 cstart = clist[j].addr;
634 cend = cstart + clist[j].len - 1; 615 cend = cstart + clist[j].len - 1;
635 if ( s3start >= cstart && s3end <= cend ) { 616 if (s3start >= cstart && s3end <= cend) {
636 break; 617 break;
637 } 618 }
638 } 619 }
639 if ( ((unsigned int)j) >= (*ccnt) ) { 620 if (((unsigned int)j) >= (*ccnt)) {
640 printk(KERN_ERR 621 printk(KERN_ERR
641 "s3rec(a=0x%06x,l=%d), no chunk match, exiting.\n", 622 "s3rec(a=0x%06x,l=%d), no chunk match, exiting.\n",
642 s3start, s3data[i].len); 623 s3start, s3data[i].len);
643 return(1); 624 return (1);
644 } 625 }
645 coffset = s3start - cstart; 626 coffset = s3start - cstart;
646 memcpy( clist[j].data + coffset, s3data[i].data, s3data[i].len); 627 memcpy(clist[j].data + coffset, s3data[i].data, s3data[i].len);
647 } 628 }
648 629
649 return result; 630 return result;
@@ -663,21 +644,19 @@ int mkimage(imgchunk_t *clist, unsigned int *ccnt)
663* 0 - success 644* 0 - success
664* ~0 - failure (probably an errno) 645* ~0 - failure (probably an errno)
665----------------------------------------------------------------*/ 646----------------------------------------------------------------*/
666int mkpdrlist( pda_t *pda) 647int mkpdrlist(pda_t * pda)
667{ 648{
668 int result = 0; 649 int result = 0;
669 u16 *pda16 = (u16*)pda->buf; 650 u16 *pda16 = (u16 *) pda->buf;
670 int curroff; /* in 'words' */ 651 int curroff; /* in 'words' */
671 652
672 pda->nrec = 0; 653 pda->nrec = 0;
673 curroff = 0; 654 curroff = 0;
674 while ( curroff < (HFA384x_PDA_LEN_MAX / 2) && 655 while (curroff < (HFA384x_PDA_LEN_MAX / 2) &&
675 le16_to_cpu(pda16[curroff + 1]) != 656 le16_to_cpu(pda16[curroff + 1]) != HFA384x_PDR_END_OF_PDA) {
676 HFA384x_PDR_END_OF_PDA ) { 657 pda->rec[pda->nrec] = (hfa384x_pdrec_t *) & (pda16[curroff]);
677 pda->rec[pda->nrec] = (hfa384x_pdrec_t*)&(pda16[curroff]);
678 658
679 if (le16_to_cpu(pda->rec[pda->nrec]->code) == 659 if (le16_to_cpu(pda->rec[pda->nrec]->code) == HFA384x_PDR_NICID) {
680 HFA384x_PDR_NICID) {
681 memcpy(&nicid, &pda->rec[pda->nrec]->data.nicid, 660 memcpy(&nicid, &pda->rec[pda->nrec]->data.nicid,
682 sizeof(nicid)); 661 sizeof(nicid));
683 nicid.id = le16_to_cpu(nicid.id); 662 nicid.id = le16_to_cpu(nicid.id);
@@ -686,7 +665,7 @@ int mkpdrlist( pda_t *pda)
686 nicid.minor = le16_to_cpu(nicid.minor); 665 nicid.minor = le16_to_cpu(nicid.minor);
687 } 666 }
688 if (le16_to_cpu(pda->rec[pda->nrec]->code) == 667 if (le16_to_cpu(pda->rec[pda->nrec]->code) ==
689 HFA384x_PDR_MFISUPRANGE) { 668 HFA384x_PDR_MFISUPRANGE) {
690 memcpy(&rfid, &pda->rec[pda->nrec]->data.mfisuprange, 669 memcpy(&rfid, &pda->rec[pda->nrec]->data.mfisuprange,
691 sizeof(rfid)); 670 sizeof(rfid));
692 rfid.id = le16_to_cpu(rfid.id); 671 rfid.id = le16_to_cpu(rfid.id);
@@ -695,7 +674,7 @@ int mkpdrlist( pda_t *pda)
695 rfid.top = le16_to_cpu(rfid.top); 674 rfid.top = le16_to_cpu(rfid.top);
696 } 675 }
697 if (le16_to_cpu(pda->rec[pda->nrec]->code) == 676 if (le16_to_cpu(pda->rec[pda->nrec]->code) ==
698 HFA384x_PDR_CFISUPRANGE) { 677 HFA384x_PDR_CFISUPRANGE) {
699 memcpy(&macid, &pda->rec[pda->nrec]->data.cfisuprange, 678 memcpy(&macid, &pda->rec[pda->nrec]->data.cfisuprange,
700 sizeof(macid)); 679 sizeof(macid));
701 macid.id = le16_to_cpu(macid.id); 680 macid.id = le16_to_cpu(macid.id);
@@ -708,21 +687,19 @@ int mkpdrlist( pda_t *pda)
708 curroff += le16_to_cpu(pda16[curroff]) + 1; 687 curroff += le16_to_cpu(pda16[curroff]) + 1;
709 688
710 } 689 }
711 if ( curroff >= (HFA384x_PDA_LEN_MAX / 2) ) { 690 if (curroff >= (HFA384x_PDA_LEN_MAX / 2)) {
712 printk(KERN_ERR 691 printk(KERN_ERR
713 "no end record found or invalid lengths in " 692 "no end record found or invalid lengths in "
714 "PDR data, exiting. %x %d\n", curroff, pda->nrec); 693 "PDR data, exiting. %x %d\n", curroff, pda->nrec);
715 return(1); 694 return (1);
716 } 695 }
717 if (le16_to_cpu(pda16[curroff + 1]) == HFA384x_PDR_END_OF_PDA ) { 696 if (le16_to_cpu(pda16[curroff + 1]) == HFA384x_PDR_END_OF_PDA) {
718 pda->rec[pda->nrec] = (hfa384x_pdrec_t*)&(pda16[curroff]); 697 pda->rec[pda->nrec] = (hfa384x_pdrec_t *) & (pda16[curroff]);
719 (pda->nrec)++; 698 (pda->nrec)++;
720 } 699 }
721 return result; 700 return result;
722} 701}
723 702
724
725
726/*---------------------------------------------------------------- 703/*----------------------------------------------------------------
727* plugimage 704* plugimage
728* 705*
@@ -740,39 +717,39 @@ int mkpdrlist( pda_t *pda)
740* 0 success 717* 0 success
741* ~0 failure 718* ~0 failure
742----------------------------------------------------------------*/ 719----------------------------------------------------------------*/
743int plugimage( imgchunk_t *fchunk, unsigned int nfchunks, 720int plugimage(imgchunk_t * fchunk, unsigned int nfchunks,
744 s3plugrec_t* s3plug, unsigned int ns3plug, pda_t *pda) 721 s3plugrec_t * s3plug, unsigned int ns3plug, pda_t * pda)
745{ 722{
746 int result = 0; 723 int result = 0;
747 int i; /* plug index */ 724 int i; /* plug index */
748 int j; /* index of PDR or -1 if fname plug */ 725 int j; /* index of PDR or -1 if fname plug */
749 int c; /* chunk index */ 726 int c; /* chunk index */
750 u32 pstart; 727 u32 pstart;
751 u32 pend; 728 u32 pend;
752 u32 cstart = 0; 729 u32 cstart = 0;
753 u32 cend; 730 u32 cend;
754 u32 chunkoff; 731 u32 chunkoff;
755 u8 *dest; 732 u8 *dest;
756 733
757 /* for each plug record */ 734 /* for each plug record */
758 for ( i = 0; i < ns3plug; i++) { 735 for (i = 0; i < ns3plug; i++) {
759 pstart = s3plug[i].addr; 736 pstart = s3plug[i].addr;
760 pend = s3plug[i].addr + s3plug[i].len; 737 pend = s3plug[i].addr + s3plug[i].len;
761 /* find the matching PDR (or filename) */ 738 /* find the matching PDR (or filename) */
762 if ( s3plug[i].itemcode != 0xffffffffUL ) { /* not filename */ 739 if (s3plug[i].itemcode != 0xffffffffUL) { /* not filename */
763 for ( j = 0; j < pda->nrec; j++) { 740 for (j = 0; j < pda->nrec; j++) {
764 if ( s3plug[i].itemcode == 741 if (s3plug[i].itemcode ==
765 le16_to_cpu(pda->rec[j]->code) ) break; 742 le16_to_cpu(pda->rec[j]->code))
743 break;
766 } 744 }
767 } else { 745 } else {
768 j = -1; 746 j = -1;
769 } 747 }
770 if ( j >= pda->nrec && j != -1 ) { /* if no matching PDR, fail */ 748 if (j >= pda->nrec && j != -1) { /* if no matching PDR, fail */
771 printk(KERN_WARNING 749 printk(KERN_WARNING
772 "warning: Failed to find PDR for " 750 "warning: Failed to find PDR for "
773 "plugrec 0x%04x.\n", 751 "plugrec 0x%04x.\n", s3plug[i].itemcode);
774 s3plug[i].itemcode); 752 continue; /* and move on to the next PDR */
775 continue; /* and move on to the next PDR */
776#if 0 753#if 0
777 /* MSM: They swear that unless it's the MAC address, 754 /* MSM: They swear that unless it's the MAC address,
778 * the serial number, or the TX calibration records, 755 * the serial number, or the TX calibration records,
@@ -787,27 +764,26 @@ int plugimage( imgchunk_t *fchunk, unsigned int nfchunks,
787 } 764 }
788 765
789 /* Validate plug len against PDR len */ 766 /* Validate plug len against PDR len */
790 if ( j != -1 && 767 if (j != -1 && s3plug[i].len < le16_to_cpu(pda->rec[j]->len)) {
791 s3plug[i].len < le16_to_cpu(pda->rec[j]->len) ) {
792 printk(KERN_ERR 768 printk(KERN_ERR
793 "error: Plug vs. PDR len mismatch for " 769 "error: Plug vs. PDR len mismatch for "
794 "plugrec 0x%04x, abort plugging.\n", 770 "plugrec 0x%04x, abort plugging.\n",
795 s3plug[i].itemcode); 771 s3plug[i].itemcode);
796 result = 1; 772 result = 1;
797 continue; 773 continue;
798 } 774 }
799 775
800 /* Validate plug address against chunk data and identify chunk */ 776 /* Validate plug address against chunk data and identify chunk */
801 for ( c = 0; c < nfchunks; c++) { 777 for (c = 0; c < nfchunks; c++) {
802 cstart = fchunk[c].addr; 778 cstart = fchunk[c].addr;
803 cend = fchunk[c].addr + fchunk[c].len; 779 cend = fchunk[c].addr + fchunk[c].len;
804 if ( pstart >= cstart && pend <= cend ) break; 780 if (pstart >= cstart && pend <= cend)
781 break;
805 } 782 }
806 if ( c >= nfchunks ) { 783 if (c >= nfchunks) {
807 printk(KERN_ERR 784 printk(KERN_ERR
808 "error: Failed to find image chunk for " 785 "error: Failed to find image chunk for "
809 "plugrec 0x%04x.\n", 786 "plugrec 0x%04x.\n", s3plug[i].itemcode);
810 s3plug[i].itemcode);
811 result = 1; 787 result = 1;
812 continue; 788 continue;
813 } 789 }
@@ -816,22 +792,21 @@ int plugimage( imgchunk_t *fchunk, unsigned int nfchunks,
816 chunkoff = pstart - cstart; 792 chunkoff = pstart - cstart;
817 dest = fchunk[c].data + chunkoff; 793 dest = fchunk[c].data + chunkoff;
818 pr_debug("Plugging item 0x%04x @ 0x%06x, len=%d, " 794 pr_debug("Plugging item 0x%04x @ 0x%06x, len=%d, "
819 "cnum=%d coff=0x%06x\n", 795 "cnum=%d coff=0x%06x\n",
820 s3plug[i].itemcode, pstart, s3plug[i].len, 796 s3plug[i].itemcode, pstart, s3plug[i].len,
821 c, chunkoff); 797 c, chunkoff);
822 798
823 if ( j == -1 ) { /* plug the filename */ 799 if (j == -1) { /* plug the filename */
824 memset(dest, 0, s3plug[i].len); 800 memset(dest, 0, s3plug[i].len);
825 strncpy(dest, PRISM2_USB_FWFILE, s3plug[i].len - 1); 801 strncpy(dest, PRISM2_USB_FWFILE, s3plug[i].len - 1);
826 } else { /* plug a PDR */ 802 } else { /* plug a PDR */
827 memcpy( dest, &(pda->rec[j]->data), s3plug[i].len); 803 memcpy(dest, &(pda->rec[j]->data), s3plug[i].len);
828 } 804 }
829 } 805 }
830 return result; 806 return result;
831 807
832} 808}
833 809
834
835/*---------------------------------------------------------------- 810/*----------------------------------------------------------------
836* read_cardpda 811* read_cardpda
837* 812*
@@ -850,10 +825,10 @@ int plugimage( imgchunk_t *fchunk, unsigned int nfchunks,
850* 0 - success 825* 0 - success
851* ~0 - failure (probably an errno) 826* ~0 - failure (probably an errno)
852----------------------------------------------------------------*/ 827----------------------------------------------------------------*/
853int read_cardpda(pda_t *pda, wlandevice_t *wlandev) 828int read_cardpda(pda_t * pda, wlandevice_t * wlandev)
854{ 829{
855 int result = 0; 830 int result = 0;
856 p80211msg_p2req_readpda_t msg; 831 p80211msg_p2req_readpda_t msg;
857 832
858 /* set up the msg */ 833 /* set up the msg */
859 msg.msgcode = DIDmsg_p2req_readpda; 834 msg.msgcode = DIDmsg_p2req_readpda;
@@ -866,10 +841,10 @@ int read_cardpda(pda_t *pda, wlandevice_t *wlandev)
866 msg.resultcode.len = sizeof(u32); 841 msg.resultcode.len = sizeof(u32);
867 msg.resultcode.status = P80211ENUM_msgitem_status_no_value; 842 msg.resultcode.status = P80211ENUM_msgitem_status_no_value;
868 843
869 if ( prism2mgmt_readpda(wlandev, &msg) != 0 ) { 844 if (prism2mgmt_readpda(wlandev, &msg) != 0) {
870 /* prism2mgmt_readpda prints an errno if appropriate */ 845 /* prism2mgmt_readpda prints an errno if appropriate */
871 result = -1; 846 result = -1;
872 } else if ( msg.resultcode.data == P80211ENUM_resultcode_success ) { 847 } else if (msg.resultcode.data == P80211ENUM_resultcode_success) {
873 memcpy(pda->buf, msg.pda.data, HFA384x_PDA_LEN_MAX); 848 memcpy(pda->buf, msg.pda.data, HFA384x_PDA_LEN_MAX);
874 result = mkpdrlist(pda); 849 result = mkpdrlist(pda);
875 } else { 850 } else {
@@ -880,7 +855,6 @@ int read_cardpda(pda_t *pda, wlandevice_t *wlandev)
880 return result; 855 return result;
881} 856}
882 857
883
884/*---------------------------------------------------------------- 858/*----------------------------------------------------------------
885* copy_line 859* copy_line
886* 860*
@@ -909,7 +883,6 @@ int copyline(char *from, char *to, char *limit)
909 return (c < SREC_LINE_MAX - 1) ? c + 1 : c; 883 return (c < SREC_LINE_MAX - 1) ? c + 1 : c;
910} 884}
911 885
912
913/*---------------------------------------------------------------- 886/*----------------------------------------------------------------
914* read_srecfile 887* read_srecfile
915* 888*
@@ -964,131 +937,159 @@ int copyline(char *from, char *to, char *limit)
964----------------------------------------------------------------*/ 937----------------------------------------------------------------*/
965int read_srecfile(char *rfptr, int rfsize) 938int read_srecfile(char *rfptr, int rfsize)
966{ 939{
967 int result = 0; 940 int result = 0;
968 char buf[SREC_LINE_MAX]; 941 char buf[SREC_LINE_MAX];
969 char tmpbuf[30]; 942 char tmpbuf[30];
970 s3datarec_t tmprec; 943 s3datarec_t tmprec;
971 int i, c; 944 int i, c;
972 int line = 0; 945 int line = 0;
973 u16 *tmpinfo; 946 u16 *tmpinfo;
974 char *endptr = rfptr + rfsize; 947 char *endptr = rfptr + rfsize;
975
976 948
977 pr_debug("Reading S-record file ...\n"); 949 pr_debug("Reading S-record file ...\n");
978 950
979 while ( (c = copyline(rfptr, buf, endptr)) >= 12 ) { 951 while ((c = copyline(rfptr, buf, endptr)) >= 12) {
980 rfptr = rfptr + c; 952 rfptr = rfptr + c;
981 line++; 953 line++;
982 if ( buf[0] != 'S' ) { 954 if (buf[0] != 'S') {
983 printk(KERN_ERR "%d warning: No initial \'S\'\n", line); 955 printk(KERN_ERR "%d warning: No initial \'S\'\n", line);
984 return 1; 956 return 1;
985 } 957 }
986 if ( buf[1] == '7' ) { /* S7 record, start address */ 958 if (buf[1] == '7') { /* S7 record, start address */
987 buf[12] = '\0'; 959 buf[12] = '\0';
988 startaddr = simple_strtoul(buf+4, NULL, 16); 960 startaddr = simple_strtoul(buf + 4, NULL, 16);
989 pr_debug(" S7 start addr, line=%d " 961 pr_debug(" S7 start addr, line=%d "
990 " addr=0x%08x\n", 962 " addr=0x%08x\n", line, startaddr);
991 line,
992 startaddr);
993 continue; 963 continue;
994 } else if ( buf[1] == '3') { 964 } else if (buf[1] == '3') {
995 /* Ok, it's an S3, parse and put it in the right array */ 965 /* Ok, it's an S3, parse and put it in the right array */
996 /* Record Length field (we only want datalen) */ 966 /* Record Length field (we only want datalen) */
997 memcpy(tmpbuf, buf+S3LEN_TXTOFFSET, S3LEN_TXTLEN); 967 memcpy(tmpbuf, buf + S3LEN_TXTOFFSET, S3LEN_TXTLEN);
998 tmpbuf[S3LEN_TXTLEN] = '\0'; 968 tmpbuf[S3LEN_TXTLEN] = '\0';
999 tmprec.len = simple_strtoul( tmpbuf, NULL, 16) - 4 - 1; /* 4=addr, 1=cksum */ 969 tmprec.len = simple_strtoul(tmpbuf, NULL, 16) - 4 - 1; /* 4=addr, 1=cksum */
1000 /* Address field */ 970 /* Address field */
1001 memcpy(tmpbuf, buf+S3ADDR_TXTOFFSET, S3ADDR_TXTLEN); 971 memcpy(tmpbuf, buf + S3ADDR_TXTOFFSET, S3ADDR_TXTLEN);
1002 tmpbuf[S3ADDR_TXTLEN] = '\0'; 972 tmpbuf[S3ADDR_TXTLEN] = '\0';
1003 tmprec.addr = simple_strtoul( tmpbuf, NULL, 16); 973 tmprec.addr = simple_strtoul(tmpbuf, NULL, 16);
1004 /* Checksum field */ 974 /* Checksum field */
1005 tmprec.checksum = simple_strtoul( buf+strlen(buf)-2, NULL, 16); 975 tmprec.checksum =
976 simple_strtoul(buf + strlen(buf) - 2, NULL, 16);
1006 977
1007 switch( tmprec.addr ) 978 switch (tmprec.addr) {
1008 {
1009 case S3ADDR_PLUG: 979 case S3ADDR_PLUG:
1010 memcpy(tmpbuf, buf+S3PLUG_ITEMCODE_TXTOFFSET, S3PLUG_ITEMCODE_TXTLEN); 980 memcpy(tmpbuf, buf + S3PLUG_ITEMCODE_TXTOFFSET,
981 S3PLUG_ITEMCODE_TXTLEN);
1011 tmpbuf[S3PLUG_ITEMCODE_TXTLEN] = '\0'; 982 tmpbuf[S3PLUG_ITEMCODE_TXTLEN] = '\0';
1012 s3plug[ns3plug].itemcode = simple_strtoul(tmpbuf,NULL,16); 983 s3plug[ns3plug].itemcode =
1013 s3plug[ns3plug].itemcode = bswap_32(s3plug[ns3plug].itemcode); 984 simple_strtoul(tmpbuf, NULL, 16);
985 s3plug[ns3plug].itemcode =
986 bswap_32(s3plug[ns3plug].itemcode);
1014 987
1015 memcpy(tmpbuf, buf+S3PLUG_ADDR_TXTOFFSET, S3PLUG_ADDR_TXTLEN); 988 memcpy(tmpbuf, buf + S3PLUG_ADDR_TXTOFFSET,
989 S3PLUG_ADDR_TXTLEN);
1016 tmpbuf[S3PLUG_ADDR_TXTLEN] = '\0'; 990 tmpbuf[S3PLUG_ADDR_TXTLEN] = '\0';
1017 s3plug[ns3plug].addr = simple_strtoul(tmpbuf,NULL,16); 991 s3plug[ns3plug].addr =
1018 s3plug[ns3plug].addr = bswap_32(s3plug[ns3plug].addr); 992 simple_strtoul(tmpbuf, NULL, 16);
993 s3plug[ns3plug].addr =
994 bswap_32(s3plug[ns3plug].addr);
1019 995
1020 memcpy(tmpbuf, buf+S3PLUG_LEN_TXTOFFSET, S3PLUG_LEN_TXTLEN); 996 memcpy(tmpbuf, buf + S3PLUG_LEN_TXTOFFSET,
997 S3PLUG_LEN_TXTLEN);
1021 tmpbuf[S3PLUG_LEN_TXTLEN] = '\0'; 998 tmpbuf[S3PLUG_LEN_TXTLEN] = '\0';
1022 s3plug[ns3plug].len = simple_strtoul(tmpbuf,NULL,16); 999 s3plug[ns3plug].len =
1023 s3plug[ns3plug].len = bswap_32(s3plug[ns3plug].len); 1000 simple_strtoul(tmpbuf, NULL, 16);
1001 s3plug[ns3plug].len =
1002 bswap_32(s3plug[ns3plug].len);
1024 1003
1025 pr_debug(" S3 plugrec, line=%d " 1004 pr_debug(" S3 plugrec, line=%d "
1026 "itemcode=0x%04x addr=0x%08x len=%d\n", 1005 "itemcode=0x%04x addr=0x%08x len=%d\n",
1027 line, 1006 line,
1028 s3plug[ns3plug].itemcode, 1007 s3plug[ns3plug].itemcode,
1029 s3plug[ns3plug].addr, 1008 s3plug[ns3plug].addr,
1030 s3plug[ns3plug].len); 1009 s3plug[ns3plug].len);
1031 1010
1032 ns3plug++; 1011 ns3plug++;
1033 if ( ns3plug == S3PLUG_MAX ) { 1012 if (ns3plug == S3PLUG_MAX) {
1034 printk(KERN_ERR "S3 plugrec limit reached - aborting\n"); 1013 printk(KERN_ERR
1014 "S3 plugrec limit reached - aborting\n");
1035 return 1; 1015 return 1;
1036 } 1016 }
1037 break; 1017 break;
1038 case S3ADDR_CRC: 1018 case S3ADDR_CRC:
1039 memcpy(tmpbuf, buf+S3CRC_ADDR_TXTOFFSET, S3CRC_ADDR_TXTLEN); 1019 memcpy(tmpbuf, buf + S3CRC_ADDR_TXTOFFSET,
1020 S3CRC_ADDR_TXTLEN);
1040 tmpbuf[S3CRC_ADDR_TXTLEN] = '\0'; 1021 tmpbuf[S3CRC_ADDR_TXTLEN] = '\0';
1041 s3crc[ns3crc].addr = simple_strtoul(tmpbuf,NULL,16); 1022 s3crc[ns3crc].addr =
1042 s3crc[ns3crc].addr = bswap_32(s3crc[ns3crc].addr); 1023 simple_strtoul(tmpbuf, NULL, 16);
1024 s3crc[ns3crc].addr =
1025 bswap_32(s3crc[ns3crc].addr);
1043 1026
1044 memcpy(tmpbuf, buf+S3CRC_LEN_TXTOFFSET, S3CRC_LEN_TXTLEN); 1027 memcpy(tmpbuf, buf + S3CRC_LEN_TXTOFFSET,
1028 S3CRC_LEN_TXTLEN);
1045 tmpbuf[S3CRC_LEN_TXTLEN] = '\0'; 1029 tmpbuf[S3CRC_LEN_TXTLEN] = '\0';
1046 s3crc[ns3crc].len = simple_strtoul(tmpbuf,NULL,16); 1030 s3crc[ns3crc].len =
1031 simple_strtoul(tmpbuf, NULL, 16);
1047 s3crc[ns3crc].len = bswap_32(s3crc[ns3crc].len); 1032 s3crc[ns3crc].len = bswap_32(s3crc[ns3crc].len);
1048 1033
1049 memcpy(tmpbuf, buf+S3CRC_DOWRITE_TXTOFFSET, S3CRC_DOWRITE_TXTLEN); 1034 memcpy(tmpbuf, buf + S3CRC_DOWRITE_TXTOFFSET,
1035 S3CRC_DOWRITE_TXTLEN);
1050 tmpbuf[S3CRC_DOWRITE_TXTLEN] = '\0'; 1036 tmpbuf[S3CRC_DOWRITE_TXTLEN] = '\0';
1051 s3crc[ns3crc].dowrite = simple_strtoul(tmpbuf,NULL,16); 1037 s3crc[ns3crc].dowrite =
1052 s3crc[ns3crc].dowrite = bswap_32(s3crc[ns3crc].dowrite); 1038 simple_strtoul(tmpbuf, NULL, 16);
1039 s3crc[ns3crc].dowrite =
1040 bswap_32(s3crc[ns3crc].dowrite);
1053 1041
1054 pr_debug(" S3 crcrec, line=%d " 1042 pr_debug(" S3 crcrec, line=%d "
1055 "addr=0x%08x len=%d write=0x%08x\n", 1043 "addr=0x%08x len=%d write=0x%08x\n",
1056 line, 1044 line,
1057 s3crc[ns3crc].addr, 1045 s3crc[ns3crc].addr,
1058 s3crc[ns3crc].len, 1046 s3crc[ns3crc].len,
1059 s3crc[ns3crc].dowrite); 1047 s3crc[ns3crc].dowrite);
1060 ns3crc++; 1048 ns3crc++;
1061 if ( ns3crc == S3CRC_MAX ) { 1049 if (ns3crc == S3CRC_MAX) {
1062 printk(KERN_ERR "S3 crcrec limit reached - aborting\n"); 1050 printk(KERN_ERR
1051 "S3 crcrec limit reached - aborting\n");
1063 return 1; 1052 return 1;
1064 } 1053 }
1065 break; 1054 break;
1066 case S3ADDR_INFO: 1055 case S3ADDR_INFO:
1067 memcpy(tmpbuf, buf+S3INFO_LEN_TXTOFFSET, S3INFO_LEN_TXTLEN); 1056 memcpy(tmpbuf, buf + S3INFO_LEN_TXTOFFSET,
1057 S3INFO_LEN_TXTLEN);
1068 tmpbuf[S3INFO_LEN_TXTLEN] = '\0'; 1058 tmpbuf[S3INFO_LEN_TXTLEN] = '\0';
1069 s3info[ns3info].len = simple_strtoul(tmpbuf,NULL,16); 1059 s3info[ns3info].len =
1070 s3info[ns3info].len = bswap_16(s3info[ns3info].len); 1060 simple_strtoul(tmpbuf, NULL, 16);
1061 s3info[ns3info].len =
1062 bswap_16(s3info[ns3info].len);
1071 1063
1072 memcpy(tmpbuf, buf+S3INFO_TYPE_TXTOFFSET, S3INFO_TYPE_TXTLEN); 1064 memcpy(tmpbuf, buf + S3INFO_TYPE_TXTOFFSET,
1065 S3INFO_TYPE_TXTLEN);
1073 tmpbuf[S3INFO_TYPE_TXTLEN] = '\0'; 1066 tmpbuf[S3INFO_TYPE_TXTLEN] = '\0';
1074 s3info[ns3info].type = simple_strtoul(tmpbuf,NULL,16); 1067 s3info[ns3info].type =
1075 s3info[ns3info].type = bswap_16(s3info[ns3info].type); 1068 simple_strtoul(tmpbuf, NULL, 16);
1069 s3info[ns3info].type =
1070 bswap_16(s3info[ns3info].type);
1076 1071
1077 pr_debug(" S3 inforec, line=%d " 1072 pr_debug(" S3 inforec, line=%d "
1078 "len=0x%04x type=0x%04x\n", 1073 "len=0x%04x type=0x%04x\n",
1079 line, 1074 line,
1080 s3info[ns3info].len, 1075 s3info[ns3info].len,
1081 s3info[ns3info].type); 1076 s3info[ns3info].type);
1082 if ( ((s3info[ns3info].len - 1) * sizeof(u16)) > sizeof(s3info[ns3info].info) ) { 1077 if (((s3info[ns3info].len - 1) * sizeof(u16)) >
1083 printk(KERN_ERR " S3 inforec length too long - aborting\n"); 1078 sizeof(s3info[ns3info].info)) {
1079 printk(KERN_ERR
1080 " S3 inforec length too long - aborting\n");
1084 return 1; 1081 return 1;
1085 } 1082 }
1086 1083
1087 tmpinfo = (u16*)&(s3info[ns3info].info.version); 1084 tmpinfo =
1085 (u16 *) & (s3info[ns3info].info.version);
1088 for (i = 0; i < s3info[ns3info].len - 1; i++) { 1086 for (i = 0; i < s3info[ns3info].len - 1; i++) {
1089 memcpy( tmpbuf, buf+S3INFO_DATA_TXTOFFSET+(i*4), 4); 1087 memcpy(tmpbuf,
1088 buf + S3INFO_DATA_TXTOFFSET +
1089 (i * 4), 4);
1090 tmpbuf[4] = '\0'; 1090 tmpbuf[4] = '\0';
1091 tmpinfo[i] = simple_strtoul(tmpbuf,NULL,16); 1091 tmpinfo[i] =
1092 simple_strtoul(tmpbuf, NULL, 16);
1092 tmpinfo[i] = bswap_16(tmpinfo[i]); 1093 tmpinfo[i] = bswap_16(tmpinfo[i]);
1093 } 1094 }
1094 pr_debug(" info="); 1095 pr_debug(" info=");
@@ -1098,8 +1099,9 @@ int read_srecfile(char *rfptr, int rfsize)
1098 pr_debug("\n"); 1099 pr_debug("\n");
1099 1100
1100 ns3info++; 1101 ns3info++;
1101 if ( ns3info == S3INFO_MAX ) { 1102 if (ns3info == S3INFO_MAX) {
1102 printk(KERN_ERR "S3 inforec limit reached - aborting\n"); 1103 printk(KERN_ERR
1104 "S3 inforec limit reached - aborting\n");
1103 return 1; 1105 return 1;
1104 } 1106 }
1105 break; 1107 break;
@@ -1107,27 +1109,33 @@ int read_srecfile(char *rfptr, int rfsize)
1107 s3data[ns3data].addr = tmprec.addr; 1109 s3data[ns3data].addr = tmprec.addr;
1108 s3data[ns3data].len = tmprec.len; 1110 s3data[ns3data].len = tmprec.len;
1109 s3data[ns3data].checksum = tmprec.checksum; 1111 s3data[ns3data].checksum = tmprec.checksum;
1110 s3data[ns3data].data = kmalloc(tmprec.len, GFP_KERNEL); 1112 s3data[ns3data].data =
1111 for ( i = 0; i < tmprec.len; i++) { 1113 kmalloc(tmprec.len, GFP_KERNEL);
1112 memcpy(tmpbuf, buf+S3DATA_TXTOFFSET+(i*2), 2); 1114 for (i = 0; i < tmprec.len; i++) {
1115 memcpy(tmpbuf,
1116 buf + S3DATA_TXTOFFSET + (i * 2),
1117 2);
1113 tmpbuf[2] = '\0'; 1118 tmpbuf[2] = '\0';
1114 s3data[ns3data].data[i] = simple_strtoul(tmpbuf, NULL, 16); 1119 s3data[ns3data].data[i] =
1120 simple_strtoul(tmpbuf, NULL, 16);
1115 } 1121 }
1116 ns3data++; 1122 ns3data++;
1117 if ( ns3data == S3DATA_MAX ) { 1123 if (ns3data == S3DATA_MAX) {
1118 printk(KERN_ERR "S3 datarec limit reached - aborting\n"); 1124 printk(KERN_ERR
1125 "S3 datarec limit reached - aborting\n");
1119 return 1; 1126 return 1;
1120 } 1127 }
1121 break; 1128 break;
1122 } 1129 }
1123 } else { 1130 } else {
1124 printk(KERN_WARNING "%d warning: Unknown S-record detected.\n", line); 1131 printk(KERN_WARNING
1132 "%d warning: Unknown S-record detected.\n",
1133 line);
1125 } 1134 }
1126 } 1135 }
1127 return result; 1136 return result;
1128} 1137}
1129 1138
1130
1131/*---------------------------------------------------------------- 1139/*----------------------------------------------------------------
1132* s3datarec_compare 1140* s3datarec_compare
1133* 1141*
@@ -1143,14 +1151,15 @@ int read_srecfile(char *rfptr, int rfsize)
1143----------------------------------------------------------------*/ 1151----------------------------------------------------------------*/
1144int s3datarec_compare(const void *p1, const void *p2) 1152int s3datarec_compare(const void *p1, const void *p2)
1145{ 1153{
1146 const s3datarec_t *s1 = p1; 1154 const s3datarec_t *s1 = p1;
1147 const s3datarec_t *s2 = p2; 1155 const s3datarec_t *s2 = p2;
1148 if ( s1->addr == s2->addr ) return 0; 1156 if (s1->addr == s2->addr)
1149 if ( s1->addr < s2->addr ) return -1; 1157 return 0;
1158 if (s1->addr < s2->addr)
1159 return -1;
1150 return 1; 1160 return 1;
1151} 1161}
1152 1162
1153
1154/*---------------------------------------------------------------- 1163/*----------------------------------------------------------------
1155* writeimage 1164* writeimage
1156* 1165*
@@ -1166,113 +1175,114 @@ int s3datarec_compare(const void *p1, const void *p2)
1166* 0 success 1175* 0 success
1167* ~0 failure 1176* ~0 failure
1168----------------------------------------------------------------*/ 1177----------------------------------------------------------------*/
1169int writeimage(wlandevice_t *wlandev, imgchunk_t *fchunk, unsigned int nfchunks) 1178int writeimage(wlandevice_t * wlandev, imgchunk_t * fchunk,
1179 unsigned int nfchunks)
1170{ 1180{
1171 int result = 0; 1181 int result = 0;
1172 p80211msg_p2req_ramdl_state_t rstatemsg; 1182 p80211msg_p2req_ramdl_state_t rstatemsg;
1173 p80211msg_p2req_ramdl_write_t rwritemsg; 1183 p80211msg_p2req_ramdl_write_t rwritemsg;
1174 p80211msg_t *msgp; 1184 p80211msg_t *msgp;
1175 u32 resultcode; 1185 u32 resultcode;
1176 int i; 1186 int i;
1177 int j; 1187 int j;
1178 unsigned int nwrites; 1188 unsigned int nwrites;
1179 u32 curroff; 1189 u32 curroff;
1180 u32 currlen; 1190 u32 currlen;
1181 u32 currdaddr; 1191 u32 currdaddr;
1182 1192
1183 /* Initialize the messages */ 1193 /* Initialize the messages */
1184 memset(&rstatemsg, 0, sizeof(rstatemsg)); 1194 memset(&rstatemsg, 0, sizeof(rstatemsg));
1185 strcpy(rstatemsg.devname, wlandev->name); 1195 strcpy(rstatemsg.devname, wlandev->name);
1186 rstatemsg.msgcode = DIDmsg_p2req_ramdl_state; 1196 rstatemsg.msgcode = DIDmsg_p2req_ramdl_state;
1187 rstatemsg.msglen = sizeof(rstatemsg); 1197 rstatemsg.msglen = sizeof(rstatemsg);
1188 rstatemsg.enable.did = DIDmsg_p2req_ramdl_state_enable; 1198 rstatemsg.enable.did = DIDmsg_p2req_ramdl_state_enable;
1189 rstatemsg.exeaddr.did = DIDmsg_p2req_ramdl_state_exeaddr; 1199 rstatemsg.exeaddr.did = DIDmsg_p2req_ramdl_state_exeaddr;
1190 rstatemsg.resultcode.did = DIDmsg_p2req_ramdl_state_resultcode; 1200 rstatemsg.resultcode.did = DIDmsg_p2req_ramdl_state_resultcode;
1191 rstatemsg.enable.status = P80211ENUM_msgitem_status_data_ok; 1201 rstatemsg.enable.status = P80211ENUM_msgitem_status_data_ok;
1192 rstatemsg.exeaddr.status = P80211ENUM_msgitem_status_data_ok; 1202 rstatemsg.exeaddr.status = P80211ENUM_msgitem_status_data_ok;
1193 rstatemsg.resultcode.status = P80211ENUM_msgitem_status_no_value; 1203 rstatemsg.resultcode.status = P80211ENUM_msgitem_status_no_value;
1194 rstatemsg.enable.len = sizeof(u32); 1204 rstatemsg.enable.len = sizeof(u32);
1195 rstatemsg.exeaddr.len = sizeof(u32); 1205 rstatemsg.exeaddr.len = sizeof(u32);
1196 rstatemsg.resultcode.len = sizeof(u32); 1206 rstatemsg.resultcode.len = sizeof(u32);
1197 1207
1198 memset(&rwritemsg, 0, sizeof(rwritemsg)); 1208 memset(&rwritemsg, 0, sizeof(rwritemsg));
1199 strcpy(rwritemsg.devname, wlandev->name); 1209 strcpy(rwritemsg.devname, wlandev->name);
1200 rwritemsg.msgcode = DIDmsg_p2req_ramdl_write; 1210 rwritemsg.msgcode = DIDmsg_p2req_ramdl_write;
1201 rwritemsg.msglen = sizeof(rwritemsg); 1211 rwritemsg.msglen = sizeof(rwritemsg);
1202 rwritemsg.addr.did = DIDmsg_p2req_ramdl_write_addr; 1212 rwritemsg.addr.did = DIDmsg_p2req_ramdl_write_addr;
1203 rwritemsg.len.did = DIDmsg_p2req_ramdl_write_len; 1213 rwritemsg.len.did = DIDmsg_p2req_ramdl_write_len;
1204 rwritemsg.data.did = DIDmsg_p2req_ramdl_write_data; 1214 rwritemsg.data.did = DIDmsg_p2req_ramdl_write_data;
1205 rwritemsg.resultcode.did = DIDmsg_p2req_ramdl_write_resultcode; 1215 rwritemsg.resultcode.did = DIDmsg_p2req_ramdl_write_resultcode;
1206 rwritemsg.addr.status = P80211ENUM_msgitem_status_data_ok; 1216 rwritemsg.addr.status = P80211ENUM_msgitem_status_data_ok;
1207 rwritemsg.len.status = P80211ENUM_msgitem_status_data_ok; 1217 rwritemsg.len.status = P80211ENUM_msgitem_status_data_ok;
1208 rwritemsg.data.status = P80211ENUM_msgitem_status_data_ok; 1218 rwritemsg.data.status = P80211ENUM_msgitem_status_data_ok;
1209 rwritemsg.resultcode.status = P80211ENUM_msgitem_status_no_value; 1219 rwritemsg.resultcode.status = P80211ENUM_msgitem_status_no_value;
1210 rwritemsg.addr.len = sizeof(u32); 1220 rwritemsg.addr.len = sizeof(u32);
1211 rwritemsg.len.len = sizeof(u32); 1221 rwritemsg.len.len = sizeof(u32);
1212 rwritemsg.data.len = WRITESIZE_MAX; 1222 rwritemsg.data.len = WRITESIZE_MAX;
1213 rwritemsg.resultcode.len = sizeof(u32); 1223 rwritemsg.resultcode.len = sizeof(u32);
1214 1224
1215 /* Send xxx_state(enable) */ 1225 /* Send xxx_state(enable) */
1216 pr_debug("Sending dl_state(enable) message.\n"); 1226 pr_debug("Sending dl_state(enable) message.\n");
1217 rstatemsg.enable.data = P80211ENUM_truth_true; 1227 rstatemsg.enable.data = P80211ENUM_truth_true;
1218 rstatemsg.exeaddr.data = startaddr; 1228 rstatemsg.exeaddr.data = startaddr;
1219 1229
1220 msgp = (p80211msg_t*)&rstatemsg; 1230 msgp = (p80211msg_t *) & rstatemsg;
1221 result = prism2mgmt_ramdl_state(wlandev, msgp); 1231 result = prism2mgmt_ramdl_state(wlandev, msgp);
1222 if ( result ) { 1232 if (result) {
1223 printk(KERN_ERR 1233 printk(KERN_ERR
1224 "writeimage state enable failed w/ result=%d, " 1234 "writeimage state enable failed w/ result=%d, "
1225 "aborting download\n", result); 1235 "aborting download\n", result);
1226 return result; 1236 return result;
1227 } 1237 }
1228 resultcode = rstatemsg.resultcode.data; 1238 resultcode = rstatemsg.resultcode.data;
1229 if ( resultcode != P80211ENUM_resultcode_success ) { 1239 if (resultcode != P80211ENUM_resultcode_success) {
1230 printk(KERN_ERR 1240 printk(KERN_ERR
1231 "writeimage()->xxxdl_state msg indicates failure, " 1241 "writeimage()->xxxdl_state msg indicates failure, "
1232 "w/ resultcode=%d, aborting download.\n", 1242 "w/ resultcode=%d, aborting download.\n", resultcode);
1233 resultcode);
1234 return 1; 1243 return 1;
1235 } 1244 }
1236 1245
1237 /* Now, loop through the data chunks and send WRITESIZE_MAX data */ 1246 /* Now, loop through the data chunks and send WRITESIZE_MAX data */
1238 for ( i = 0; i < nfchunks; i++) { 1247 for (i = 0; i < nfchunks; i++) {
1239 nwrites = fchunk[i].len / WRITESIZE_MAX; 1248 nwrites = fchunk[i].len / WRITESIZE_MAX;
1240 nwrites += (fchunk[i].len % WRITESIZE_MAX) ? 1 : 0; 1249 nwrites += (fchunk[i].len % WRITESIZE_MAX) ? 1 : 0;
1241 curroff = 0; 1250 curroff = 0;
1242 for ( j = 0; j < nwrites; j++) { 1251 for (j = 0; j < nwrites; j++) {
1243 currlen = 1252 currlen =
1244 (fchunk[i].len - (WRITESIZE_MAX * j)) > WRITESIZE_MAX ? 1253 (fchunk[i].len - (WRITESIZE_MAX * j)) >
1245 WRITESIZE_MAX : 1254 WRITESIZE_MAX ? WRITESIZE_MAX : (fchunk[i].len -
1246 (fchunk[i].len - (WRITESIZE_MAX * j)); 1255 (WRITESIZE_MAX *
1256 j));
1247 curroff = j * WRITESIZE_MAX; 1257 curroff = j * WRITESIZE_MAX;
1248 currdaddr = fchunk[i].addr + curroff; 1258 currdaddr = fchunk[i].addr + curroff;
1249 /* Setup the message */ 1259 /* Setup the message */
1250 rwritemsg.addr.data = currdaddr; 1260 rwritemsg.addr.data = currdaddr;
1251 rwritemsg.len.data = currlen; 1261 rwritemsg.len.data = currlen;
1252 memcpy(rwritemsg.data.data, 1262 memcpy(rwritemsg.data.data,
1253 fchunk[i].data + curroff, 1263 fchunk[i].data + curroff, currlen);
1254 currlen);
1255 1264
1256 /* Send flashdl_write(pda) */ 1265 /* Send flashdl_write(pda) */
1257 pr_debug("Sending xxxdl_write message addr=%06x len=%d.\n", 1266 pr_debug
1258 currdaddr, currlen); 1267 ("Sending xxxdl_write message addr=%06x len=%d.\n",
1268 currdaddr, currlen);
1259 1269
1260 msgp = (p80211msg_t*)&rwritemsg; 1270 msgp = (p80211msg_t *) & rwritemsg;
1261 result = prism2mgmt_ramdl_write(wlandev, msgp); 1271 result = prism2mgmt_ramdl_write(wlandev, msgp);
1262 1272
1263 /* Check the results */ 1273 /* Check the results */
1264 if ( result ) { 1274 if (result) {
1265 printk(KERN_ERR 1275 printk(KERN_ERR
1266 "writeimage chunk write failed w/ result=%d, " 1276 "writeimage chunk write failed w/ result=%d, "
1267 "aborting download\n", result); 1277 "aborting download\n", result);
1268 return result; 1278 return result;
1269 } 1279 }
1270 resultcode = rstatemsg.resultcode.data; 1280 resultcode = rstatemsg.resultcode.data;
1271 if ( resultcode != P80211ENUM_resultcode_success ) { 1281 if (resultcode != P80211ENUM_resultcode_success) {
1272 printk(KERN_ERR 1282 printk(KERN_ERR
1273 "writeimage()->xxxdl_write msg indicates failure, " 1283 "writeimage()->xxxdl_write msg indicates failure, "
1274 "w/ resultcode=%d, aborting download.\n", 1284 "w/ resultcode=%d, aborting download.\n",
1275 resultcode); 1285 resultcode);
1276 return 1; 1286 return 1;
1277 } 1287 }
1278 1288
@@ -1284,69 +1294,54 @@ int writeimage(wlandevice_t *wlandev, imgchunk_t *fchunk, unsigned int nfchunks)
1284 rstatemsg.enable.data = P80211ENUM_truth_false; 1294 rstatemsg.enable.data = P80211ENUM_truth_false;
1285 rstatemsg.exeaddr.data = 0; 1295 rstatemsg.exeaddr.data = 0;
1286 1296
1287 msgp = (p80211msg_t*)&rstatemsg; 1297 msgp = (p80211msg_t *) & rstatemsg;
1288 result = prism2mgmt_ramdl_state(wlandev, msgp); 1298 result = prism2mgmt_ramdl_state(wlandev, msgp);
1289 if ( result ) { 1299 if (result) {
1290 printk(KERN_ERR 1300 printk(KERN_ERR
1291 "writeimage state disable failed w/ result=%d, " 1301 "writeimage state disable failed w/ result=%d, "
1292 "aborting download\n", result); 1302 "aborting download\n", result);
1293 return result; 1303 return result;
1294 } 1304 }
1295 resultcode = rstatemsg.resultcode.data; 1305 resultcode = rstatemsg.resultcode.data;
1296 if ( resultcode != P80211ENUM_resultcode_success ) { 1306 if (resultcode != P80211ENUM_resultcode_success) {
1297 printk(KERN_ERR 1307 printk(KERN_ERR
1298 "writeimage()->xxxdl_state msg indicates failure, " 1308 "writeimage()->xxxdl_state msg indicates failure, "
1299 "w/ resultcode=%d, aborting download.\n", 1309 "w/ resultcode=%d, aborting download.\n", resultcode);
1300 resultcode);
1301 return 1; 1310 return 1;
1302 } 1311 }
1303 return result; 1312 return result;
1304} 1313}
1305 1314
1306
1307
1308int validate_identity(void) 1315int validate_identity(void)
1309{ 1316{
1310 int i; 1317 int i;
1311 int result = 1; 1318 int result = 1;
1312 1319
1313 pr_debug("NIC ID: %#x v%d.%d.%d\n", 1320 pr_debug("NIC ID: %#x v%d.%d.%d\n",
1314 nicid.id, 1321 nicid.id, nicid.major, nicid.minor, nicid.variant);
1315 nicid.major,
1316 nicid.minor,
1317 nicid.variant);
1318 pr_debug("MFI ID: %#x v%d %d->%d\n", 1322 pr_debug("MFI ID: %#x v%d %d->%d\n",
1319 rfid.id, 1323 rfid.id, rfid.variant, rfid.bottom, rfid.top);
1320 rfid.variant,
1321 rfid.bottom,
1322 rfid.top);
1323 pr_debug("CFI ID: %#x v%d %d->%d\n", 1324 pr_debug("CFI ID: %#x v%d %d->%d\n",
1324 macid.id, 1325 macid.id, macid.variant, macid.bottom, macid.top);
1325 macid.variant,
1326 macid.bottom,
1327 macid.top);
1328 pr_debug("PRI ID: %#x v%d %d->%d\n", 1326 pr_debug("PRI ID: %#x v%d %d->%d\n",
1329 priid.id, 1327 priid.id, priid.variant, priid.bottom, priid.top);
1330 priid.variant,
1331 priid.bottom,
1332 priid.top);
1333 1328
1334 for (i = 0 ; i < ns3info ; i ++) { 1329 for (i = 0; i < ns3info; i++) {
1335 switch (s3info[i].type) { 1330 switch (s3info[i].type) {
1336 case 1: 1331 case 1:
1337 pr_debug("Version: ID %#x %d.%d.%d\n", 1332 pr_debug("Version: ID %#x %d.%d.%d\n",
1338 s3info[i].info.version.id, 1333 s3info[i].info.version.id,
1339 s3info[i].info.version.major, 1334 s3info[i].info.version.major,
1340 s3info[i].info.version.minor, 1335 s3info[i].info.version.minor,
1341 s3info[i].info.version.variant); 1336 s3info[i].info.version.variant);
1342 break; 1337 break;
1343 case 2: 1338 case 2:
1344 pr_debug("Compat: Role %#x Id %#x v%d %d->%d\n", 1339 pr_debug("Compat: Role %#x Id %#x v%d %d->%d\n",
1345 s3info[i].info.compat.role, 1340 s3info[i].info.compat.role,
1346 s3info[i].info.compat.id, 1341 s3info[i].info.compat.id,
1347 s3info[i].info.compat.variant, 1342 s3info[i].info.compat.variant,
1348 s3info[i].info.compat.bottom, 1343 s3info[i].info.compat.bottom,
1349 s3info[i].info.compat.top); 1344 s3info[i].info.compat.top);
1350 1345
1351 /* MAC compat range */ 1346 /* MAC compat range */
1352 if ((s3info[i].info.compat.role == 1) && 1347 if ((s3info[i].info.compat.role == 1) &&
@@ -1360,8 +1355,9 @@ int validate_identity(void)
1360 /* PRI compat range */ 1355 /* PRI compat range */
1361 if ((s3info[i].info.compat.role == 1) && 1356 if ((s3info[i].info.compat.role == 1) &&
1362 (s3info[i].info.compat.id == 3)) { 1357 (s3info[i].info.compat.id == 3)) {
1363 if ((s3info[i].info.compat.bottom > priid.top) || 1358 if ((s3info[i].info.compat.bottom > priid.top)
1364 (s3info[i].info.compat.top < priid.bottom)){ 1359 || (s3info[i].info.compat.top <
1360 priid.bottom)) {
1365 result = 3; 1361 result = 3;
1366 } 1362 }
1367 } 1363 }
@@ -1373,15 +1369,15 @@ int validate_identity(void)
1373 1369
1374 break; 1370 break;
1375 case 3: 1371 case 3:
1376 pr_debug("Seq: %#x\n", s3info[i].info.buildseq); 1372 pr_debug("Seq: %#x\n", s3info[i].info.buildseq);
1377 1373
1378 break; 1374 break;
1379 case 4: 1375 case 4:
1380 pr_debug("Platform: ID %#x %d.%d.%d\n", 1376 pr_debug("Platform: ID %#x %d.%d.%d\n",
1381 s3info[i].info.version.id, 1377 s3info[i].info.version.id,
1382 s3info[i].info.version.major, 1378 s3info[i].info.version.major,
1383 s3info[i].info.version.minor, 1379 s3info[i].info.version.minor,
1384 s3info[i].info.version.variant); 1380 s3info[i].info.version.variant);
1385 1381
1386 if (nicid.id != s3info[i].info.version.id) 1382 if (nicid.id != s3info[i].info.version.id)
1387 continue; 1383 continue;
diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
index d2e5fccb629..465457653eb 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.c
+++ b/drivers/staging/wlan-ng/prism2mgmt.c
@@ -117,7 +117,7 @@
117* process thread (usually) 117* process thread (usually)
118* interrupt 118* interrupt
119----------------------------------------------------------------*/ 119----------------------------------------------------------------*/
120int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) 120int prism2mgmt_scan(wlandevice_t * wlandev, void *msgp)
121{ 121{
122 int result = 0; 122 int result = 0;
123 hfa384x_t *hw = wlandev->priv; 123 hfa384x_t *hw = wlandev->priv;
@@ -362,7 +362,7 @@ exit:
362* process thread (usually) 362* process thread (usually)
363* interrupt 363* interrupt
364----------------------------------------------------------------*/ 364----------------------------------------------------------------*/
365int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) 365int prism2mgmt_scan_results(wlandevice_t * wlandev, void *msgp)
366{ 366{
367 int result = 0; 367 int result = 0;
368 p80211msg_dot11req_scan_results_t *req; 368 p80211msg_dot11req_scan_results_t *req;
@@ -389,7 +389,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp)
389 389
390 if (req->bssindex.data >= count) { 390 if (req->bssindex.data >= count) {
391 pr_debug("requested index (%d) out of range (%d)\n", 391 pr_debug("requested index (%d) out of range (%d)\n",
392 req->bssindex.data, count); 392 req->bssindex.data, count);
393 result = 2; 393 result = 2;
394 req->resultcode.data = P80211ENUM_resultcode_invalid_parameters; 394 req->resultcode.data = P80211ENUM_resultcode_invalid_parameters;
395 goto exit; 395 goto exit;
@@ -511,7 +511,7 @@ exit:
511* process thread (usually) 511* process thread (usually)
512* interrupt 512* interrupt
513----------------------------------------------------------------*/ 513----------------------------------------------------------------*/
514int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) 514int prism2mgmt_start(wlandevice_t * wlandev, void *msgp)
515{ 515{
516 int result = 0; 516 int result = 0;
517 hfa384x_t *hw = wlandev->priv; 517 hfa384x_t *hw = wlandev->priv;
@@ -544,7 +544,7 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp)
544 /*** STATION ***/ 544 /*** STATION ***/
545 /* Set the REQUIRED config items */ 545 /* Set the REQUIRED config items */
546 /* SSID */ 546 /* SSID */
547 pstr = (p80211pstrd_t *)&(msg->ssid.data); 547 pstr = (p80211pstrd_t *) & (msg->ssid.data);
548 prism2mgmt_pstr2bytestr(p2bytestr, pstr); 548 prism2mgmt_pstr2bytestr(p2bytestr, pstr);
549 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFOWNSSID, 549 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFOWNSSID,
550 bytebuf, HFA384x_RID_CNFOWNSSID_LEN); 550 bytebuf, HFA384x_RID_CNFOWNSSID_LEN);
@@ -688,7 +688,7 @@ done:
688* Call context: 688* Call context:
689* process thread (usually) 689* process thread (usually)
690----------------------------------------------------------------*/ 690----------------------------------------------------------------*/
691int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp) 691int prism2mgmt_readpda(wlandevice_t * wlandev, void *msgp)
692{ 692{
693 hfa384x_t *hw = wlandev->priv; 693 hfa384x_t *hw = wlandev->priv;
694 p80211msg_p2req_readpda_t *msg = msgp; 694 p80211msg_p2req_readpda_t *msg = msgp;
@@ -754,7 +754,7 @@ int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp)
754* Call context: 754* Call context:
755* process thread (usually) 755* process thread (usually)
756----------------------------------------------------------------*/ 756----------------------------------------------------------------*/
757int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp) 757int prism2mgmt_ramdl_state(wlandevice_t * wlandev, void *msgp)
758{ 758{
759 hfa384x_t *hw = wlandev->priv; 759 hfa384x_t *hw = wlandev->priv;
760 p80211msg_p2req_ramdl_state_t *msg = msgp; 760 p80211msg_p2req_ramdl_state_t *msg = msgp;
@@ -810,7 +810,7 @@ int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp)
810* Call context: 810* Call context:
811* process thread (usually) 811* process thread (usually)
812----------------------------------------------------------------*/ 812----------------------------------------------------------------*/
813int prism2mgmt_ramdl_write(wlandevice_t *wlandev, void *msgp) 813int prism2mgmt_ramdl_write(wlandevice_t * wlandev, void *msgp)
814{ 814{
815 hfa384x_t *hw = wlandev->priv; 815 hfa384x_t *hw = wlandev->priv;
816 p80211msg_p2req_ramdl_write_t *msg = msgp; 816 p80211msg_p2req_ramdl_write_t *msg = msgp;
@@ -872,7 +872,7 @@ int prism2mgmt_ramdl_write(wlandevice_t *wlandev, void *msgp)
872* Call context: 872* Call context:
873* process thread (usually) 873* process thread (usually)
874----------------------------------------------------------------*/ 874----------------------------------------------------------------*/
875int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp) 875int prism2mgmt_flashdl_state(wlandevice_t * wlandev, void *msgp)
876{ 876{
877 int result = 0; 877 int result = 0;
878 hfa384x_t *hw = wlandev->priv; 878 hfa384x_t *hw = wlandev->priv;
@@ -943,7 +943,7 @@ int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp)
943* Call context: 943* Call context:
944* process thread (usually) 944* process thread (usually)
945----------------------------------------------------------------*/ 945----------------------------------------------------------------*/
946int prism2mgmt_flashdl_write(wlandevice_t *wlandev, void *msgp) 946int prism2mgmt_flashdl_write(wlandevice_t * wlandev, void *msgp)
947{ 947{
948 hfa384x_t *hw = wlandev->priv; 948 hfa384x_t *hw = wlandev->priv;
949 p80211msg_p2req_flashdl_write_t *msg = msgp; 949 p80211msg_p2req_flashdl_write_t *msg = msgp;
@@ -1004,7 +1004,7 @@ int prism2mgmt_flashdl_write(wlandevice_t *wlandev, void *msgp)
1004* process thread (usually) 1004* process thread (usually)
1005* interrupt 1005* interrupt
1006----------------------------------------------------------------*/ 1006----------------------------------------------------------------*/
1007int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp) 1007int prism2mgmt_autojoin(wlandevice_t * wlandev, void *msgp)
1008{ 1008{
1009 hfa384x_t *hw = wlandev->priv; 1009 hfa384x_t *hw = wlandev->priv;
1010 int result = 0; 1010 int result = 0;
@@ -1037,7 +1037,7 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp)
1037 1037
1038 /* Set the ssid */ 1038 /* Set the ssid */
1039 memset(bytebuf, 0, 256); 1039 memset(bytebuf, 0, 256);
1040 pstr = (p80211pstrd_t *)&(msg->ssid.data); 1040 pstr = (p80211pstrd_t *) & (msg->ssid.data);
1041 prism2mgmt_pstr2bytestr(p2bytestr, pstr); 1041 prism2mgmt_pstr2bytestr(p2bytestr, pstr);
1042 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFDESIREDSSID, 1042 result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFDESIREDSSID,
1043 bytebuf, 1043 bytebuf,
@@ -1075,7 +1075,7 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp)
1075* process thread (usually) 1075* process thread (usually)
1076* interrupt 1076* interrupt
1077----------------------------------------------------------------*/ 1077----------------------------------------------------------------*/
1078int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) 1078int prism2mgmt_wlansniff(wlandevice_t * wlandev, void *msgp)
1079{ 1079{
1080 int result = 0; 1080 int result = 0;
1081 p80211msg_lnxreq_wlansniff_t *msg = msgp; 1081 p80211msg_lnxreq_wlansniff_t *msg = msgp;
@@ -1096,17 +1096,16 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
1096 /* Disable monitor mode */ 1096 /* Disable monitor mode */
1097 result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_DISABLE); 1097 result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_DISABLE);
1098 if (result) { 1098 if (result) {
1099 pr_debug( 1099 pr_debug("failed to disable monitor mode, result=%d\n",
1100 "failed to disable monitor mode, result=%d\n", 1100 result);
1101 result);
1102 goto failed; 1101 goto failed;
1103 } 1102 }
1104 /* Disable port 0 */ 1103 /* Disable port 0 */
1105 result = hfa384x_drvr_disable(hw, 0); 1104 result = hfa384x_drvr_disable(hw, 0);
1106 if (result) { 1105 if (result) {
1107 pr_debug( 1106 pr_debug
1108 "failed to disable port 0 after sniffing, result=%d\n", 1107 ("failed to disable port 0 after sniffing, result=%d\n",
1109 result); 1108 result);
1110 goto failed; 1109 goto failed;
1111 } 1110 }
1112 /* Clear the driver state */ 1111 /* Clear the driver state */
@@ -1117,9 +1116,9 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
1117 HFA384x_RID_CNFWEPFLAGS, 1116 HFA384x_RID_CNFWEPFLAGS,
1118 hw->presniff_wepflags); 1117 hw->presniff_wepflags);
1119 if (result) { 1118 if (result) {
1120 pr_debug( 1119 pr_debug
1121 "failed to restore wepflags=0x%04x, result=%d\n", 1120 ("failed to restore wepflags=0x%04x, result=%d\n",
1122 hw->presniff_wepflags, result); 1121 hw->presniff_wepflags, result);
1123 goto failed; 1122 goto failed;
1124 } 1123 }
1125 1124
@@ -1130,18 +1129,18 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
1130 HFA384x_RID_CNFPORTTYPE, 1129 HFA384x_RID_CNFPORTTYPE,
1131 word); 1130 word);
1132 if (result) { 1131 if (result) {
1133 pr_debug( 1132 pr_debug
1134 "failed to restore porttype, result=%d\n", 1133 ("failed to restore porttype, result=%d\n",
1135 result); 1134 result);
1136 goto failed; 1135 goto failed;
1137 } 1136 }
1138 1137
1139 /* Enable the port */ 1138 /* Enable the port */
1140 result = hfa384x_drvr_enable(hw, 0); 1139 result = hfa384x_drvr_enable(hw, 0);
1141 if (result) { 1140 if (result) {
1142 pr_debug( 1141 pr_debug
1143 "failed to enable port to presniff setting, result=%d\n", 1142 ("failed to enable port to presniff setting, result=%d\n",
1144 result); 1143 result);
1145 goto failed; 1144 goto failed;
1146 } 1145 }
1147 } else { 1146 } else {
@@ -1161,40 +1160,42 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
1161 /* Save macport 0 state */ 1160 /* Save macport 0 state */
1162 result = hfa384x_drvr_getconfig16(hw, 1161 result = hfa384x_drvr_getconfig16(hw,
1163 HFA384x_RID_CNFPORTTYPE, 1162 HFA384x_RID_CNFPORTTYPE,
1164 &(hw-> 1163 &
1165 presniff_port_type)); 1164 (hw->
1165 presniff_port_type));
1166 if (result) { 1166 if (result) {
1167 pr_debug( 1167 pr_debug
1168 "failed to read porttype, result=%d\n", 1168 ("failed to read porttype, result=%d\n",
1169 result); 1169 result);
1170 goto failed; 1170 goto failed;
1171 } 1171 }
1172 /* Save the wepflags state */ 1172 /* Save the wepflags state */
1173 result = hfa384x_drvr_getconfig16(hw, 1173 result = hfa384x_drvr_getconfig16(hw,
1174 HFA384x_RID_CNFWEPFLAGS, 1174 HFA384x_RID_CNFWEPFLAGS,
1175 &(hw-> 1175 &
1176 presniff_wepflags)); 1176 (hw->
1177 presniff_wepflags));
1177 if (result) { 1178 if (result) {
1178 pr_debug( 1179 pr_debug
1179 "failed to read wepflags, result=%d\n", 1180 ("failed to read wepflags, result=%d\n",
1180 result); 1181 result);
1181 goto failed; 1182 goto failed;
1182 } 1183 }
1183 hfa384x_drvr_stop(hw); 1184 hfa384x_drvr_stop(hw);
1184 result = hfa384x_drvr_start(hw); 1185 result = hfa384x_drvr_start(hw);
1185 if (result) { 1186 if (result) {
1186 pr_debug( 1187 pr_debug
1187 "failed to restart the card for sniffing, result=%d\n", 1188 ("failed to restart the card for sniffing, result=%d\n",
1188 result); 1189 result);
1189 goto failed; 1190 goto failed;
1190 } 1191 }
1191 } else { 1192 } else {
1192 /* Disable the port */ 1193 /* Disable the port */
1193 result = hfa384x_drvr_disable(hw, 0); 1194 result = hfa384x_drvr_disable(hw, 0);
1194 if (result) { 1195 if (result) {
1195 pr_debug( 1196 pr_debug
1196 "failed to enable port for sniffing, result=%d\n", 1197 ("failed to enable port for sniffing, result=%d\n",
1197 result); 1198 result);
1198 goto failed; 1199 goto failed;
1199 } 1200 }
1200 } 1201 }
@@ -1210,9 +1211,8 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
1210 hw->sniff_channel = word; 1211 hw->sniff_channel = word;
1211 1212
1212 if (result) { 1213 if (result) {
1213 pr_debug( 1214 pr_debug("failed to set channel %d, result=%d\n",
1214 "failed to set channel %d, result=%d\n", 1215 word, result);
1215 word, result);
1216 goto failed; 1216 goto failed;
1217 } 1217 }
1218 1218
@@ -1224,9 +1224,9 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
1224 HFA384x_RID_CNFPORTTYPE, 1224 HFA384x_RID_CNFPORTTYPE,
1225 word); 1225 word);
1226 if (result) { 1226 if (result) {
1227 pr_debug( 1227 pr_debug
1228 "failed to set porttype %d, result=%d\n", 1228 ("failed to set porttype %d, result=%d\n",
1229 word, result); 1229 word, result);
1230 goto failed; 1230 goto failed;
1231 } 1231 }
1232 if ((msg->keepwepflags.status == 1232 if ((msg->keepwepflags.status ==
@@ -1243,9 +1243,9 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
1243 } 1243 }
1244 1244
1245 if (result) { 1245 if (result) {
1246 pr_debug( 1246 pr_debug
1247 "failed to set wepflags=0x%04x, result=%d\n", 1247 ("failed to set wepflags=0x%04x, result=%d\n",
1248 word, result); 1248 word, result);
1249 goto failed; 1249 goto failed;
1250 } 1250 }
1251 } 1251 }
@@ -1269,17 +1269,16 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp)
1269 /* Enable the port */ 1269 /* Enable the port */
1270 result = hfa384x_drvr_enable(hw, 0); 1270 result = hfa384x_drvr_enable(hw, 0);
1271 if (result) { 1271 if (result) {
1272 pr_debug( 1272 pr_debug
1273 "failed to enable port for sniffing, result=%d\n", 1273 ("failed to enable port for sniffing, result=%d\n",
1274 result); 1274 result);
1275 goto failed; 1275 goto failed;
1276 } 1276 }
1277 /* Enable monitor mode */ 1277 /* Enable monitor mode */
1278 result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_ENABLE); 1278 result = hfa384x_cmd_monitor(hw, HFA384x_MONITOR_ENABLE);
1279 if (result) { 1279 if (result) {
1280 pr_debug( 1280 pr_debug("failed to enable monitor mode, result=%d\n",
1281 "failed to enable monitor mode, result=%d\n", 1281 result);
1282 result);
1283 goto failed; 1282 goto failed;
1284 } 1283 }
1285 1284
diff --git a/drivers/staging/wlan-ng/prism2mgmt.h b/drivers/staging/wlan-ng/prism2mgmt.h
index 07eecebeb6c..bdf2b3e0325 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.h
+++ b/drivers/staging/wlan-ng/prism2mgmt.h
@@ -63,43 +63,43 @@
63extern int prism2_reset_holdtime; 63extern int prism2_reset_holdtime;
64extern int prism2_reset_settletime; 64extern int prism2_reset_settletime;
65 65
66u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate); 66u32 prism2sta_ifstate(wlandevice_t * wlandev, u32 ifstate);
67 67
68void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf); 68void prism2sta_ev_info(wlandevice_t * wlandev, hfa384x_InfFrame_t * inf);
69void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status); 69void prism2sta_ev_txexc(wlandevice_t * wlandev, u16 status);
70void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status); 70void prism2sta_ev_tx(wlandevice_t * wlandev, u16 status);
71void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb); 71void prism2sta_ev_rx(wlandevice_t * wlandev, struct sk_buff *skb);
72void prism2sta_ev_alloc(wlandevice_t *wlandev); 72void prism2sta_ev_alloc(wlandevice_t * wlandev);
73 73
74int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp); 74int prism2mgmt_mibset_mibget(wlandevice_t * wlandev, void *msgp);
75int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp); 75int prism2mgmt_scan(wlandevice_t * wlandev, void *msgp);
76int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp); 76int prism2mgmt_scan_results(wlandevice_t * wlandev, void *msgp);
77int prism2mgmt_start(wlandevice_t *wlandev, void *msgp); 77int prism2mgmt_start(wlandevice_t * wlandev, void *msgp);
78int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp); 78int prism2mgmt_wlansniff(wlandevice_t * wlandev, void *msgp);
79int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp); 79int prism2mgmt_readpda(wlandevice_t * wlandev, void *msgp);
80int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp); 80int prism2mgmt_ramdl_state(wlandevice_t * wlandev, void *msgp);
81int prism2mgmt_ramdl_write(wlandevice_t *wlandev, void *msgp); 81int prism2mgmt_ramdl_write(wlandevice_t * wlandev, void *msgp);
82int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp); 82int prism2mgmt_flashdl_state(wlandevice_t * wlandev, void *msgp);
83int prism2mgmt_flashdl_write(wlandevice_t *wlandev, void *msgp); 83int prism2mgmt_flashdl_write(wlandevice_t * wlandev, void *msgp);
84int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp); 84int prism2mgmt_autojoin(wlandevice_t * wlandev, void *msgp);
85 85
86/*--------------------------------------------------------------- 86/*---------------------------------------------------------------
87* conversion functions going between wlan message data types and 87* conversion functions going between wlan message data types and
88* Prism2 data types 88* Prism2 data types
89---------------------------------------------------------------*/ 89---------------------------------------------------------------*/
90/* byte area conversion functions*/ 90/* byte area conversion functions*/
91void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr); 91void prism2mgmt_pstr2bytearea(u8 * bytearea, p80211pstrd_t * pstr);
92void prism2mgmt_bytearea2pstr(u8 *bytearea, p80211pstrd_t *pstr, int len); 92void prism2mgmt_bytearea2pstr(u8 * bytearea, p80211pstrd_t * pstr, int len);
93 93
94/* byte string conversion functions*/ 94/* byte string conversion functions*/
95void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr); 95void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t * bytestr, p80211pstrd_t * pstr);
96void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr); 96void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t * bytestr, p80211pstrd_t * pstr);
97 97
98/* functions to convert Group Addresses */ 98/* functions to convert Group Addresses */
99void prism2mgmt_get_grpaddr(u32 did, p80211pstrd_t *pstr, hfa384x_t *priv); 99void prism2mgmt_get_grpaddr(u32 did, p80211pstrd_t * pstr, hfa384x_t * priv);
100int prism2mgmt_set_grpaddr(u32 did, 100int prism2mgmt_set_grpaddr(u32 did,
101 u8 *prism2buf, p80211pstrd_t *pstr, 101 u8 * prism2buf, p80211pstrd_t * pstr,
102 hfa384x_t *priv); 102 hfa384x_t * priv);
103int prism2mgmt_get_grpaddr_index(u32 did); 103int prism2mgmt_get_grpaddr_index(u32 did);
104 104
105void prism2sta_processing_defer(struct work_struct *data); 105void prism2sta_processing_defer(struct work_struct *data);
diff --git a/drivers/staging/wlan-ng/prism2mib.c b/drivers/staging/wlan-ng/prism2mib.c
index 7a082c17f54..f930254e1b3 100644
--- a/drivers/staging/wlan-ng/prism2mib.c
+++ b/drivers/staging/wlan-ng/prism2mib.c
@@ -86,65 +86,65 @@ typedef struct mibrec {
86 u16 parm1; 86 u16 parm1;
87 u16 parm2; 87 u16 parm2;
88 u16 parm3; 88 u16 parm3;
89 int (*func) (struct mibrec *mib, 89 int (*func) (struct mibrec * mib,
90 int isget, 90 int isget,
91 wlandevice_t *wlandev, 91 wlandevice_t * wlandev,
92 hfa384x_t *hw, 92 hfa384x_t * hw,
93 p80211msg_dot11req_mibset_t *msg, void *data); 93 p80211msg_dot11req_mibset_t * msg, void *data);
94} mibrec_t; 94} mibrec_t;
95 95
96static int prism2mib_bytearea2pstr(mibrec_t *mib, 96static int prism2mib_bytearea2pstr(mibrec_t * mib,
97 int isget, 97 int isget,
98 wlandevice_t *wlandev, 98 wlandevice_t * wlandev,
99 hfa384x_t *hw, 99 hfa384x_t * hw,
100 p80211msg_dot11req_mibset_t *msg, 100 p80211msg_dot11req_mibset_t * msg,
101 void *data); 101 void *data);
102 102
103static int prism2mib_uint32(mibrec_t *mib, 103static int prism2mib_uint32(mibrec_t * mib,
104 int isget, 104 int isget,
105 wlandevice_t *wlandev, 105 wlandevice_t * wlandev,
106 hfa384x_t *hw, 106 hfa384x_t * hw,
107 p80211msg_dot11req_mibset_t *msg, void *data); 107 p80211msg_dot11req_mibset_t * msg, void *data);
108 108
109static int prism2mib_flag(mibrec_t *mib, 109static int prism2mib_flag(mibrec_t * mib,
110 int isget, 110 int isget,
111 wlandevice_t *wlandev, 111 wlandevice_t * wlandev,
112 hfa384x_t *hw, 112 hfa384x_t * hw,
113 p80211msg_dot11req_mibset_t *msg, void *data); 113 p80211msg_dot11req_mibset_t * msg, void *data);
114 114
115static int prism2mib_wepdefaultkey(mibrec_t *mib, 115static int prism2mib_wepdefaultkey(mibrec_t * mib,
116 int isget, 116 int isget,
117 wlandevice_t *wlandev, 117 wlandevice_t * wlandev,
118 hfa384x_t *hw, 118 hfa384x_t * hw,
119 p80211msg_dot11req_mibset_t *msg, 119 p80211msg_dot11req_mibset_t * msg,
120 void *data); 120 void *data);
121 121
122static int prism2mib_privacyinvoked(mibrec_t *mib, 122static int prism2mib_privacyinvoked(mibrec_t * mib,
123 int isget, 123 int isget,
124 wlandevice_t *wlandev, 124 wlandevice_t * wlandev,
125 hfa384x_t *hw, 125 hfa384x_t * hw,
126 p80211msg_dot11req_mibset_t *msg, 126 p80211msg_dot11req_mibset_t * msg,
127 void *data); 127 void *data);
128 128
129static int prism2mib_excludeunencrypted(mibrec_t *mib, 129static int prism2mib_excludeunencrypted(mibrec_t * mib,
130 int isget, 130 int isget,
131 wlandevice_t *wlandev, 131 wlandevice_t * wlandev,
132 hfa384x_t *hw, 132 hfa384x_t * hw,
133 p80211msg_dot11req_mibset_t *msg, 133 p80211msg_dot11req_mibset_t * msg,
134 void *data); 134 void *data);
135 135
136static int prism2mib_fragmentationthreshold(mibrec_t *mib, 136static int prism2mib_fragmentationthreshold(mibrec_t * mib,
137 int isget, 137 int isget,
138 wlandevice_t *wlandev, 138 wlandevice_t * wlandev,
139 hfa384x_t *hw, 139 hfa384x_t * hw,
140 p80211msg_dot11req_mibset_t *msg, 140 p80211msg_dot11req_mibset_t * msg,
141 void *data); 141 void *data);
142 142
143static int prism2mib_priv(mibrec_t *mib, 143static int prism2mib_priv(mibrec_t * mib,
144 int isget, 144 int isget,
145 wlandevice_t *wlandev, 145 wlandevice_t * wlandev,
146 hfa384x_t *hw, 146 hfa384x_t * hw,
147 p80211msg_dot11req_mibset_t *msg, void *data); 147 p80211msg_dot11req_mibset_t * msg, void *data);
148 148
149static mibrec_t mibtab[] = { 149static mibrec_t mibtab[] = {
150 150
@@ -258,7 +258,7 @@ static mibrec_t mibtab[] = {
258* interrupt 258* interrupt
259----------------------------------------------------------------*/ 259----------------------------------------------------------------*/
260 260
261int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp) 261int prism2mgmt_mibset_mibget(wlandevice_t * wlandev, void *msgp)
262{ 262{
263 hfa384x_t *hw = wlandev->priv; 263 hfa384x_t *hw = wlandev->priv;
264 int result, isget; 264 int result, isget;
@@ -330,8 +330,7 @@ int prism2mgmt_mibset_mibget(wlandevice_t *wlandev, void *msgp)
330 330
331 if (msg->resultcode.data == P80211ENUM_resultcode_success) { 331 if (msg->resultcode.data == P80211ENUM_resultcode_success) {
332 if (result != 0) { 332 if (result != 0) {
333 pr_debug("get/set failure, result=%d\n", 333 pr_debug("get/set failure, result=%d\n", result);
334 result);
335 msg->resultcode.data = 334 msg->resultcode.data =
336 P80211ENUM_resultcode_implementation_failure; 335 P80211ENUM_resultcode_implementation_failure;
337 } else { 336 } else {
@@ -373,11 +372,11 @@ done:
373* 372*
374----------------------------------------------------------------*/ 373----------------------------------------------------------------*/
375 374
376static int prism2mib_bytearea2pstr(mibrec_t *mib, 375static int prism2mib_bytearea2pstr(mibrec_t * mib,
377 int isget, 376 int isget,
378 wlandevice_t *wlandev, 377 wlandevice_t * wlandev,
379 hfa384x_t *hw, 378 hfa384x_t * hw,
380 p80211msg_dot11req_mibset_t *msg, 379 p80211msg_dot11req_mibset_t * msg,
381 void *data) 380 void *data)
382{ 381{
383 int result; 382 int result;
@@ -423,11 +422,11 @@ static int prism2mib_bytearea2pstr(mibrec_t *mib,
423* 422*
424----------------------------------------------------------------*/ 423----------------------------------------------------------------*/
425 424
426static int prism2mib_uint32(mibrec_t *mib, 425static int prism2mib_uint32(mibrec_t * mib,
427 int isget, 426 int isget,
428 wlandevice_t *wlandev, 427 wlandevice_t * wlandev,
429 hfa384x_t *hw, 428 hfa384x_t * hw,
430 p80211msg_dot11req_mibset_t *msg, void *data) 429 p80211msg_dot11req_mibset_t * msg, void *data)
431{ 430{
432 int result; 431 int result;
433 u32 *uint32 = (u32 *) data; 432 u32 *uint32 = (u32 *) data;
@@ -470,11 +469,11 @@ static int prism2mib_uint32(mibrec_t *mib,
470* 469*
471----------------------------------------------------------------*/ 470----------------------------------------------------------------*/
472 471
473static int prism2mib_flag(mibrec_t *mib, 472static int prism2mib_flag(mibrec_t * mib,
474 int isget, 473 int isget,
475 wlandevice_t *wlandev, 474 wlandevice_t * wlandev,
476 hfa384x_t *hw, 475 hfa384x_t * hw,
477 p80211msg_dot11req_mibset_t *msg, void *data) 476 p80211msg_dot11req_mibset_t * msg, void *data)
478{ 477{
479 int result; 478 int result;
480 u32 *uint32 = (u32 *) data; 479 u32 *uint32 = (u32 *) data;
@@ -527,11 +526,11 @@ static int prism2mib_flag(mibrec_t *mib,
527* 526*
528----------------------------------------------------------------*/ 527----------------------------------------------------------------*/
529 528
530static int prism2mib_wepdefaultkey(mibrec_t *mib, 529static int prism2mib_wepdefaultkey(mibrec_t * mib,
531 int isget, 530 int isget,
532 wlandevice_t *wlandev, 531 wlandevice_t * wlandev,
533 hfa384x_t *hw, 532 hfa384x_t * hw,
534 p80211msg_dot11req_mibset_t *msg, 533 p80211msg_dot11req_mibset_t * msg,
535 void *data) 534 void *data)
536{ 535{
537 int result; 536 int result;
@@ -577,11 +576,11 @@ static int prism2mib_wepdefaultkey(mibrec_t *mib,
577* 576*
578----------------------------------------------------------------*/ 577----------------------------------------------------------------*/
579 578
580static int prism2mib_privacyinvoked(mibrec_t *mib, 579static int prism2mib_privacyinvoked(mibrec_t * mib,
581 int isget, 580 int isget,
582 wlandevice_t *wlandev, 581 wlandevice_t * wlandev,
583 hfa384x_t *hw, 582 hfa384x_t * hw,
584 p80211msg_dot11req_mibset_t *msg, 583 p80211msg_dot11req_mibset_t * msg,
585 void *data) 584 void *data)
586{ 585{
587 int result; 586 int result;
@@ -623,11 +622,11 @@ static int prism2mib_privacyinvoked(mibrec_t *mib,
623* 622*
624----------------------------------------------------------------*/ 623----------------------------------------------------------------*/
625 624
626static int prism2mib_excludeunencrypted(mibrec_t *mib, 625static int prism2mib_excludeunencrypted(mibrec_t * mib,
627 int isget, 626 int isget,
628 wlandevice_t *wlandev, 627 wlandevice_t * wlandev,
629 hfa384x_t *hw, 628 hfa384x_t * hw,
630 p80211msg_dot11req_mibset_t *msg, 629 p80211msg_dot11req_mibset_t * msg,
631 void *data) 630 void *data)
632{ 631{
633 int result; 632 int result;
@@ -662,11 +661,11 @@ static int prism2mib_excludeunencrypted(mibrec_t *mib,
662* 661*
663----------------------------------------------------------------*/ 662----------------------------------------------------------------*/
664 663
665static int prism2mib_fragmentationthreshold(mibrec_t *mib, 664static int prism2mib_fragmentationthreshold(mibrec_t * mib,
666 int isget, 665 int isget,
667 wlandevice_t *wlandev, 666 wlandevice_t * wlandev,
668 hfa384x_t *hw, 667 hfa384x_t * hw,
669 p80211msg_dot11req_mibset_t *msg, 668 p80211msg_dot11req_mibset_t * msg,
670 void *data) 669 void *data)
671{ 670{
672 int result; 671 int result;
@@ -711,11 +710,11 @@ static int prism2mib_fragmentationthreshold(mibrec_t *mib,
711* 710*
712----------------------------------------------------------------*/ 711----------------------------------------------------------------*/
713 712
714static int prism2mib_priv(mibrec_t *mib, 713static int prism2mib_priv(mibrec_t * mib,
715 int isget, 714 int isget,
716 wlandevice_t *wlandev, 715 wlandevice_t * wlandev,
717 hfa384x_t *hw, 716 hfa384x_t * hw,
718 p80211msg_dot11req_mibset_t *msg, void *data) 717 p80211msg_dot11req_mibset_t * msg, void *data)
719{ 718{
720 p80211pstrd_t *pstr = (p80211pstrd_t *) data; 719 p80211pstrd_t *pstr = (p80211pstrd_t *) data;
721 720
@@ -727,7 +726,7 @@ static int prism2mib_priv(mibrec_t *mib,
727 if (isget) { 726 if (isget) {
728 hfa384x_drvr_getconfig(hw, 727 hfa384x_drvr_getconfig(hw,
729 HFA384x_RID_CNFWPADATA, 728 HFA384x_RID_CNFWPADATA,
730 (u8 *)&wpa, 729 (u8 *) & wpa,
731 sizeof(wpa)); 730 sizeof(wpa));
732 pstr->len = le16_to_cpu(wpa.datalen); 731 pstr->len = le16_to_cpu(wpa.datalen);
733 memcpy(pstr->data, wpa.data, pstr->len); 732 memcpy(pstr->data, wpa.data, pstr->len);
@@ -738,7 +737,7 @@ static int prism2mib_priv(mibrec_t *mib,
738 result = 737 result =
739 hfa384x_drvr_setconfig(hw, 738 hfa384x_drvr_setconfig(hw,
740 HFA384x_RID_CNFWPADATA, 739 HFA384x_RID_CNFWPADATA,
741 (u8 *)&wpa, 740 (u8 *) & wpa,
742 sizeof(wpa)); 741 sizeof(wpa));
743 } 742 }
744 break; 743 break;
@@ -765,7 +764,7 @@ static int prism2mib_priv(mibrec_t *mib,
765* 764*
766----------------------------------------------------------------*/ 765----------------------------------------------------------------*/
767 766
768void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr) 767void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t * bytestr, p80211pstrd_t * pstr)
769{ 768{
770 bytestr->len = cpu_to_le16((u16) (pstr->len)); 769 bytestr->len = cpu_to_le16((u16) (pstr->len));
771 memcpy(bytestr->data, pstr->data, pstr->len); 770 memcpy(bytestr->data, pstr->data, pstr->len);
@@ -786,7 +785,7 @@ void prism2mgmt_pstr2bytestr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
786* 785*
787----------------------------------------------------------------*/ 786----------------------------------------------------------------*/
788 787
789void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr) 788void prism2mgmt_pstr2bytearea(u8 * bytearea, p80211pstrd_t * pstr)
790{ 789{
791 memcpy(bytearea, pstr->data, pstr->len); 790 memcpy(bytearea, pstr->data, pstr->len);
792} 791}
@@ -806,7 +805,7 @@ void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr)
806* 805*
807----------------------------------------------------------------*/ 806----------------------------------------------------------------*/
808 807
809void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr) 808void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t * bytestr, p80211pstrd_t * pstr)
810{ 809{
811 pstr->len = (u8) (le16_to_cpu((u16) (bytestr->len))); 810 pstr->len = (u8) (le16_to_cpu((u16) (bytestr->len)));
812 memcpy(pstr->data, bytestr->data, pstr->len); 811 memcpy(pstr->data, bytestr->data, pstr->len);
@@ -827,13 +826,8 @@ void prism2mgmt_bytestr2pstr(hfa384x_bytestr_t *bytestr, p80211pstrd_t *pstr)
827* 826*
828----------------------------------------------------------------*/ 827----------------------------------------------------------------*/
829 828
830void prism2mgmt_bytearea2pstr(u8 *bytearea, p80211pstrd_t *pstr, int len) 829void prism2mgmt_bytearea2pstr(u8 * bytearea, p80211pstrd_t * pstr, int len)
831{ 830{
832 pstr->len = (u8) len; 831 pstr->len = (u8) len;
833 memcpy(pstr->data, bytearea, len); 832 memcpy(pstr->data, bytearea, len);
834} 833}
835
836
837
838
839
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index 573e93ae7d4..f493cf430db 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -127,37 +127,37 @@ MODULE_PARM_DESC(prism2_reset_settletime, "reset settle time in ms");
127 127
128MODULE_LICENSE("Dual MPL/GPL"); 128MODULE_LICENSE("Dual MPL/GPL");
129 129
130static int prism2sta_open(wlandevice_t *wlandev); 130static int prism2sta_open(wlandevice_t * wlandev);
131static int prism2sta_close(wlandevice_t *wlandev); 131static int prism2sta_close(wlandevice_t * wlandev);
132static void prism2sta_reset(wlandevice_t *wlandev); 132static void prism2sta_reset(wlandevice_t * wlandev);
133static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, 133static int prism2sta_txframe(wlandevice_t * wlandev, struct sk_buff *skb,
134 p80211_hdr_t *p80211_hdr, 134 p80211_hdr_t * p80211_hdr,
135 p80211_metawep_t *p80211_wep); 135 p80211_metawep_t * p80211_wep);
136static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg); 136static int prism2sta_mlmerequest(wlandevice_t * wlandev, p80211msg_t * msg);
137static int prism2sta_getcardinfo(wlandevice_t *wlandev); 137static int prism2sta_getcardinfo(wlandevice_t * wlandev);
138static int prism2sta_globalsetup(wlandevice_t *wlandev); 138static int prism2sta_globalsetup(wlandevice_t * wlandev);
139static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev); 139static int prism2sta_setmulticast(wlandevice_t * wlandev, netdevice_t * dev);
140 140
141static void prism2sta_inf_handover(wlandevice_t *wlandev, 141static void prism2sta_inf_handover(wlandevice_t * wlandev,
142 hfa384x_InfFrame_t *inf); 142 hfa384x_InfFrame_t * inf);
143static void prism2sta_inf_tallies(wlandevice_t *wlandev, 143static void prism2sta_inf_tallies(wlandevice_t * wlandev,
144 hfa384x_InfFrame_t *inf); 144 hfa384x_InfFrame_t * inf);
145static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev, 145static void prism2sta_inf_hostscanresults(wlandevice_t * wlandev,
146 hfa384x_InfFrame_t *inf); 146 hfa384x_InfFrame_t * inf);
147static void prism2sta_inf_scanresults(wlandevice_t *wlandev, 147static void prism2sta_inf_scanresults(wlandevice_t * wlandev,
148 hfa384x_InfFrame_t *inf); 148 hfa384x_InfFrame_t * inf);
149static void prism2sta_inf_chinforesults(wlandevice_t *wlandev, 149static void prism2sta_inf_chinforesults(wlandevice_t * wlandev,
150 hfa384x_InfFrame_t *inf); 150 hfa384x_InfFrame_t * inf);
151static void prism2sta_inf_linkstatus(wlandevice_t *wlandev, 151static void prism2sta_inf_linkstatus(wlandevice_t * wlandev,
152 hfa384x_InfFrame_t *inf); 152 hfa384x_InfFrame_t * inf);
153static void prism2sta_inf_assocstatus(wlandevice_t *wlandev, 153static void prism2sta_inf_assocstatus(wlandevice_t * wlandev,
154 hfa384x_InfFrame_t *inf); 154 hfa384x_InfFrame_t * inf);
155static void prism2sta_inf_authreq(wlandevice_t *wlandev, 155static void prism2sta_inf_authreq(wlandevice_t * wlandev,
156 hfa384x_InfFrame_t *inf); 156 hfa384x_InfFrame_t * inf);
157static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev, 157static void prism2sta_inf_authreq_defer(wlandevice_t * wlandev,
158 hfa384x_InfFrame_t *inf); 158 hfa384x_InfFrame_t * inf);
159static void prism2sta_inf_psusercnt(wlandevice_t *wlandev, 159static void prism2sta_inf_psusercnt(wlandevice_t * wlandev,
160 hfa384x_InfFrame_t *inf); 160 hfa384x_InfFrame_t * inf);
161 161
162/*---------------------------------------------------------------- 162/*----------------------------------------------------------------
163* prism2sta_open 163* prism2sta_open
@@ -180,7 +180,7 @@ static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
180* Call context: 180* Call context:
181* process thread 181* process thread
182----------------------------------------------------------------*/ 182----------------------------------------------------------------*/
183static int prism2sta_open(wlandevice_t *wlandev) 183static int prism2sta_open(wlandevice_t * wlandev)
184{ 184{
185 /* We don't currently have to do anything else. 185 /* We don't currently have to do anything else.
186 * The setup of the MAC should be subsequently completed via 186 * The setup of the MAC should be subsequently completed via
@@ -214,7 +214,7 @@ static int prism2sta_open(wlandevice_t *wlandev)
214* Call context: 214* Call context:
215* process thread 215* process thread
216----------------------------------------------------------------*/ 216----------------------------------------------------------------*/
217static int prism2sta_close(wlandevice_t *wlandev) 217static int prism2sta_close(wlandevice_t * wlandev)
218{ 218{
219 /* We don't currently have to do anything else. 219 /* We don't currently have to do anything else.
220 * Higher layers know we're not ready from dev->start==0 and 220 * Higher layers know we're not ready from dev->start==0 and
@@ -242,7 +242,7 @@ static int prism2sta_close(wlandevice_t *wlandev)
242* Call context: 242* Call context:
243* process thread 243* process thread
244----------------------------------------------------------------*/ 244----------------------------------------------------------------*/
245static void prism2sta_reset(wlandevice_t *wlandev) 245static void prism2sta_reset(wlandevice_t * wlandev)
246{ 246{
247 return; 247 return;
248} 248}
@@ -268,9 +268,9 @@ static void prism2sta_reset(wlandevice_t *wlandev)
268* Call context: 268* Call context:
269* process thread 269* process thread
270----------------------------------------------------------------*/ 270----------------------------------------------------------------*/
271static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, 271static int prism2sta_txframe(wlandevice_t * wlandev, struct sk_buff *skb,
272 p80211_hdr_t *p80211_hdr, 272 p80211_hdr_t * p80211_hdr,
273 p80211_metawep_t *p80211_wep) 273 p80211_metawep_t * p80211_wep)
274{ 274{
275 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 275 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
276 int result; 276 int result;
@@ -310,7 +310,7 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
310* Call context: 310* Call context:
311* process thread 311* process thread
312----------------------------------------------------------------*/ 312----------------------------------------------------------------*/
313static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg) 313static int prism2sta_mlmerequest(wlandevice_t * wlandev, p80211msg_t * msg)
314{ 314{
315 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 315 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
316 316
@@ -401,12 +401,9 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg)
401 qualmsg->noise.status = 401 qualmsg->noise.status =
402 P80211ENUM_msgitem_status_data_ok; 402 P80211ENUM_msgitem_status_data_ok;
403 403
404 qualmsg->link.data = 404 qualmsg->link.data = le16_to_cpu(hw->qual.CQ_currBSS);
405 le16_to_cpu(hw->qual.CQ_currBSS); 405 qualmsg->level.data = le16_to_cpu(hw->qual.ASL_currBSS);
406 qualmsg->level.data = 406 qualmsg->noise.data = le16_to_cpu(hw->qual.ANL_currFC);
407 le16_to_cpu(hw->qual.ASL_currBSS);
408 qualmsg->noise.data =
409 le16_to_cpu(hw->qual.ANL_currFC);
410 407
411 break; 408 break;
412 } 409 }
@@ -440,7 +437,7 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg)
440* process thread (usually) 437* process thread (usually)
441* interrupt 438* interrupt
442----------------------------------------------------------------*/ 439----------------------------------------------------------------*/
443u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate) 440u32 prism2sta_ifstate(wlandevice_t * wlandev, u32 ifstate)
444{ 441{
445 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 442 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
446 u32 result; 443 u32 result;
@@ -448,7 +445,7 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
448 result = P80211ENUM_resultcode_implementation_failure; 445 result = P80211ENUM_resultcode_implementation_failure;
449 446
450 pr_debug("Current MSD state(%d), requesting(%d)\n", 447 pr_debug("Current MSD state(%d), requesting(%d)\n",
451 wlandev->msdstate, ifstate); 448 wlandev->msdstate, ifstate);
452 switch (ifstate) { 449 switch (ifstate) {
453 case P80211ENUM_ifstate_fwload: 450 case P80211ENUM_ifstate_fwload:
454 switch (wlandev->msdstate) { 451 switch (wlandev->msdstate) {
@@ -610,7 +607,7 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
610* Call context: 607* Call context:
611* Either. 608* Either.
612----------------------------------------------------------------*/ 609----------------------------------------------------------------*/
613static int prism2sta_getcardinfo(wlandevice_t *wlandev) 610static int prism2sta_getcardinfo(wlandevice_t * wlandev)
614{ 611{
615 int result = 0; 612 int result = 0;
616 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 613 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
@@ -811,10 +808,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
811 fields in byte order */ 808 fields in byte order */
812 hw->cap_act_pri_cfi.role = le16_to_cpu(hw->cap_act_pri_cfi.role); 809 hw->cap_act_pri_cfi.role = le16_to_cpu(hw->cap_act_pri_cfi.role);
813 hw->cap_act_pri_cfi.id = le16_to_cpu(hw->cap_act_pri_cfi.id); 810 hw->cap_act_pri_cfi.id = le16_to_cpu(hw->cap_act_pri_cfi.id);
814 hw->cap_act_pri_cfi.variant = 811 hw->cap_act_pri_cfi.variant = le16_to_cpu(hw->cap_act_pri_cfi.variant);
815 le16_to_cpu(hw->cap_act_pri_cfi.variant); 812 hw->cap_act_pri_cfi.bottom = le16_to_cpu(hw->cap_act_pri_cfi.bottom);
816 hw->cap_act_pri_cfi.bottom =
817 le16_to_cpu(hw->cap_act_pri_cfi.bottom);
818 hw->cap_act_pri_cfi.top = le16_to_cpu(hw->cap_act_pri_cfi.top); 813 hw->cap_act_pri_cfi.top = le16_to_cpu(hw->cap_act_pri_cfi.top);
819 814
820 printk(KERN_INFO 815 printk(KERN_INFO
@@ -836,10 +831,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
836 fields in byte order */ 831 fields in byte order */
837 hw->cap_act_sta_cfi.role = le16_to_cpu(hw->cap_act_sta_cfi.role); 832 hw->cap_act_sta_cfi.role = le16_to_cpu(hw->cap_act_sta_cfi.role);
838 hw->cap_act_sta_cfi.id = le16_to_cpu(hw->cap_act_sta_cfi.id); 833 hw->cap_act_sta_cfi.id = le16_to_cpu(hw->cap_act_sta_cfi.id);
839 hw->cap_act_sta_cfi.variant = 834 hw->cap_act_sta_cfi.variant = le16_to_cpu(hw->cap_act_sta_cfi.variant);
840 le16_to_cpu(hw->cap_act_sta_cfi.variant); 835 hw->cap_act_sta_cfi.bottom = le16_to_cpu(hw->cap_act_sta_cfi.bottom);
841 hw->cap_act_sta_cfi.bottom =
842 le16_to_cpu(hw->cap_act_sta_cfi.bottom);
843 hw->cap_act_sta_cfi.top = le16_to_cpu(hw->cap_act_sta_cfi.top); 836 hw->cap_act_sta_cfi.top = le16_to_cpu(hw->cap_act_sta_cfi.top);
844 837
845 printk(KERN_INFO 838 printk(KERN_INFO
@@ -861,10 +854,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
861 fields in byte order */ 854 fields in byte order */
862 hw->cap_act_sta_mfi.role = le16_to_cpu(hw->cap_act_sta_mfi.role); 855 hw->cap_act_sta_mfi.role = le16_to_cpu(hw->cap_act_sta_mfi.role);
863 hw->cap_act_sta_mfi.id = le16_to_cpu(hw->cap_act_sta_mfi.id); 856 hw->cap_act_sta_mfi.id = le16_to_cpu(hw->cap_act_sta_mfi.id);
864 hw->cap_act_sta_mfi.variant = 857 hw->cap_act_sta_mfi.variant = le16_to_cpu(hw->cap_act_sta_mfi.variant);
865 le16_to_cpu(hw->cap_act_sta_mfi.variant); 858 hw->cap_act_sta_mfi.bottom = le16_to_cpu(hw->cap_act_sta_mfi.bottom);
866 hw->cap_act_sta_mfi.bottom =
867 le16_to_cpu(hw->cap_act_sta_mfi.bottom);
868 hw->cap_act_sta_mfi.top = le16_to_cpu(hw->cap_act_sta_mfi.top); 859 hw->cap_act_sta_mfi.top = le16_to_cpu(hw->cap_act_sta_mfi.top);
869 860
870 printk(KERN_INFO 861 printk(KERN_INFO
@@ -940,7 +931,7 @@ done:
940* Call context: 931* Call context:
941* process thread 932* process thread
942----------------------------------------------------------------*/ 933----------------------------------------------------------------*/
943static int prism2sta_globalsetup(wlandevice_t *wlandev) 934static int prism2sta_globalsetup(wlandevice_t * wlandev)
944{ 935{
945 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 936 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
946 937
@@ -949,7 +940,7 @@ static int prism2sta_globalsetup(wlandevice_t *wlandev)
949 WLAN_DATA_MAXLEN); 940 WLAN_DATA_MAXLEN);
950} 941}
951 942
952static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev) 943static int prism2sta_setmulticast(wlandevice_t * wlandev, netdevice_t * dev)
953{ 944{
954 int result = 0; 945 int result = 0;
955 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 946 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
@@ -990,8 +981,8 @@ exit:
990* Call context: 981* Call context:
991* interrupt 982* interrupt
992----------------------------------------------------------------*/ 983----------------------------------------------------------------*/
993static void prism2sta_inf_handover(wlandevice_t *wlandev, 984static void prism2sta_inf_handover(wlandevice_t * wlandev,
994 hfa384x_InfFrame_t *inf) 985 hfa384x_InfFrame_t * inf)
995{ 986{
996 pr_debug("received infoframe:HANDOVER (unhandled)\n"); 987 pr_debug("received infoframe:HANDOVER (unhandled)\n");
997 return; 988 return;
@@ -1014,8 +1005,8 @@ static void prism2sta_inf_handover(wlandevice_t *wlandev,
1014* Call context: 1005* Call context:
1015* interrupt 1006* interrupt
1016----------------------------------------------------------------*/ 1007----------------------------------------------------------------*/
1017static void prism2sta_inf_tallies(wlandevice_t *wlandev, 1008static void prism2sta_inf_tallies(wlandevice_t * wlandev,
1018 hfa384x_InfFrame_t *inf) 1009 hfa384x_InfFrame_t * inf)
1019{ 1010{
1020 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 1011 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1021 u16 *src16; 1012 u16 *src16;
@@ -1031,13 +1022,13 @@ static void prism2sta_inf_tallies(wlandevice_t *wlandev,
1031 1022
1032 cnt = sizeof(hfa384x_CommTallies32_t) / sizeof(u32); 1023 cnt = sizeof(hfa384x_CommTallies32_t) / sizeof(u32);
1033 if (inf->framelen > 22) { 1024 if (inf->framelen > 22) {
1034 dst = (u32 *)&hw->tallies; 1025 dst = (u32 *) & hw->tallies;
1035 src32 = (u32 *)&inf->info.commtallies32; 1026 src32 = (u32 *) & inf->info.commtallies32;
1036 for (i = 0; i < cnt; i++, dst++, src32++) 1027 for (i = 0; i < cnt; i++, dst++, src32++)
1037 *dst += le32_to_cpu(*src32); 1028 *dst += le32_to_cpu(*src32);
1038 } else { 1029 } else {
1039 dst = (u32 *)&hw->tallies; 1030 dst = (u32 *) & hw->tallies;
1040 src16 = (u16 *)&inf->info.commtallies16; 1031 src16 = (u16 *) & inf->info.commtallies16;
1041 for (i = 0; i < cnt; i++, dst++, src16++) 1032 for (i = 0; i < cnt; i++, dst++, src16++)
1042 *dst += le16_to_cpu(*src16); 1033 *dst += le16_to_cpu(*src16);
1043 } 1034 }
@@ -1062,8 +1053,8 @@ static void prism2sta_inf_tallies(wlandevice_t *wlandev,
1062* Call context: 1053* Call context:
1063* interrupt 1054* interrupt
1064----------------------------------------------------------------*/ 1055----------------------------------------------------------------*/
1065static void prism2sta_inf_scanresults(wlandevice_t *wlandev, 1056static void prism2sta_inf_scanresults(wlandevice_t * wlandev,
1066 hfa384x_InfFrame_t *inf) 1057 hfa384x_InfFrame_t * inf)
1067{ 1058{
1068 1059
1069 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 1060 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
@@ -1080,14 +1071,14 @@ static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
1080 1071
1081 /* Print em */ 1072 /* Print em */
1082 pr_debug("rx scanresults, reason=%d, nbss=%d:\n", 1073 pr_debug("rx scanresults, reason=%d, nbss=%d:\n",
1083 inf->info.scanresult.scanreason, nbss); 1074 inf->info.scanresult.scanreason, nbss);
1084 for (i = 0; i < nbss; i++) { 1075 for (i = 0; i < nbss; i++) {
1085 pr_debug("chid=%d anl=%d sl=%d bcnint=%d\n", 1076 pr_debug("chid=%d anl=%d sl=%d bcnint=%d\n",
1086 sr->result[i].chid, 1077 sr->result[i].chid,
1087 sr->result[i].anl, 1078 sr->result[i].anl,
1088 sr->result[i].sl, sr->result[i].bcnint); 1079 sr->result[i].sl, sr->result[i].bcnint);
1089 pr_debug(" capinfo=0x%04x proberesp_rate=%d\n", 1080 pr_debug(" capinfo=0x%04x proberesp_rate=%d\n",
1090 sr->result[i].capinfo, sr->result[i].proberesp_rate); 1081 sr->result[i].capinfo, sr->result[i].proberesp_rate);
1091 } 1082 }
1092 /* issue a join request */ 1083 /* issue a join request */
1093 joinreq.channel = sr->result[0].chid; 1084 joinreq.channel = sr->result[0].chid;
@@ -1120,8 +1111,8 @@ static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
1120* Call context: 1111* Call context:
1121* interrupt 1112* interrupt
1122----------------------------------------------------------------*/ 1113----------------------------------------------------------------*/
1123static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev, 1114static void prism2sta_inf_hostscanresults(wlandevice_t * wlandev,
1124 hfa384x_InfFrame_t *inf) 1115 hfa384x_InfFrame_t * inf)
1125{ 1116{
1126 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 1117 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1127 int nbss; 1118 int nbss;
@@ -1162,8 +1153,8 @@ static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
1162* Call context: 1153* Call context:
1163* interrupt 1154* interrupt
1164----------------------------------------------------------------*/ 1155----------------------------------------------------------------*/
1165static void prism2sta_inf_chinforesults(wlandevice_t *wlandev, 1156static void prism2sta_inf_chinforesults(wlandevice_t * wlandev,
1166 hfa384x_InfFrame_t *inf) 1157 hfa384x_InfFrame_t * inf)
1167{ 1158{
1168 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 1159 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1169 unsigned int i, n; 1160 unsigned int i, n;
@@ -1174,29 +1165,26 @@ static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
1174 for (i = 0, n = 0; i < HFA384x_CHINFORESULT_MAX; i++) { 1165 for (i = 0, n = 0; i < HFA384x_CHINFORESULT_MAX; i++) {
1175 if (hw->channel_info.results.scanchannels & (1 << i)) { 1166 if (hw->channel_info.results.scanchannels & (1 << i)) {
1176 int channel = 1167 int channel =
1177 le16_to_cpu(inf->info.chinforesult.result[n]. 1168 le16_to_cpu(inf->info.chinforesult.result[n].chid) -
1178 chid) - 1; 1169 1;
1179 hfa384x_ChInfoResultSub_t *chinforesult = 1170 hfa384x_ChInfoResultSub_t *chinforesult =
1180 &hw->channel_info.results.result[channel]; 1171 &hw->channel_info.results.result[channel];
1181 chinforesult->chid = channel; 1172 chinforesult->chid = channel;
1182 chinforesult->anl = 1173 chinforesult->anl =
1183 le16_to_cpu(inf->info.chinforesult.result[n]. 1174 le16_to_cpu(inf->info.chinforesult.result[n].anl);
1184 anl);
1185 chinforesult->pnl = 1175 chinforesult->pnl =
1186 le16_to_cpu(inf->info.chinforesult.result[n]. 1176 le16_to_cpu(inf->info.chinforesult.result[n].pnl);
1187 pnl);
1188 chinforesult->active = 1177 chinforesult->active =
1189 le16_to_cpu(inf->info.chinforesult.result[n]. 1178 le16_to_cpu(inf->info.chinforesult.result[n].
1190 active); 1179 active);
1191 pr_debug( 1180 pr_debug
1192 "chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n", 1181 ("chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n",
1193 channel + 1, 1182 channel + 1,
1194 chinforesult-> 1183 chinforesult->
1195 active & HFA384x_CHINFORESULT_BSSACTIVE ? 1184 active & HFA384x_CHINFORESULT_BSSACTIVE ? "signal"
1196 "signal" : "noise", chinforesult->anl, 1185 : "noise", chinforesult->anl, chinforesult->pnl,
1197 chinforesult->pnl, 1186 chinforesult->
1198 chinforesult-> 1187 active & HFA384x_CHINFORESULT_PCFACTIVE ? 1 : 0);
1199 active & HFA384x_CHINFORESULT_PCFACTIVE ? 1 : 0);
1200 n++; 1188 n++;
1201 } 1189 }
1202 } 1190 }
@@ -1276,9 +1264,9 @@ void prism2sta_processing_defer(struct work_struct *data)
1276 wlandev->bssid, 1264 wlandev->bssid,
1277 WLAN_BSSID_LEN); 1265 WLAN_BSSID_LEN);
1278 if (result) { 1266 if (result) {
1279 pr_debug( 1267 pr_debug
1280 "getconfig(0x%02x) failed, result = %d\n", 1268 ("getconfig(0x%02x) failed, result = %d\n",
1281 HFA384x_RID_CURRENTBSSID, result); 1269 HFA384x_RID_CURRENTBSSID, result);
1282 goto failed; 1270 goto failed;
1283 } 1271 }
1284 1272
@@ -1286,23 +1274,23 @@ void prism2sta_processing_defer(struct work_struct *data)
1286 HFA384x_RID_CURRENTSSID, 1274 HFA384x_RID_CURRENTSSID,
1287 &ssid, sizeof(ssid)); 1275 &ssid, sizeof(ssid));
1288 if (result) { 1276 if (result) {
1289 pr_debug( 1277 pr_debug
1290 "getconfig(0x%02x) failed, result = %d\n", 1278 ("getconfig(0x%02x) failed, result = %d\n",
1291 HFA384x_RID_CURRENTSSID, result); 1279 HFA384x_RID_CURRENTSSID, result);
1292 goto failed; 1280 goto failed;
1293 } 1281 }
1294 prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid, 1282 prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *) & ssid,
1295 (p80211pstrd_t *)&wlandev-> 1283 (p80211pstrd_t *) &
1296 ssid); 1284 wlandev->ssid);
1297 1285
1298 /* Collect the port status */ 1286 /* Collect the port status */
1299 result = hfa384x_drvr_getconfig16(hw, 1287 result = hfa384x_drvr_getconfig16(hw,
1300 HFA384x_RID_PORTSTATUS, 1288 HFA384x_RID_PORTSTATUS,
1301 &portstatus); 1289 &portstatus);
1302 if (result) { 1290 if (result) {
1303 pr_debug( 1291 pr_debug
1304 "getconfig(0x%02x) failed, result = %d\n", 1292 ("getconfig(0x%02x) failed, result = %d\n",
1305 HFA384x_RID_PORTSTATUS, result); 1293 HFA384x_RID_PORTSTATUS, result);
1306 goto failed; 1294 goto failed;
1307 } 1295 }
1308 wlandev->macmode = 1296 wlandev->macmode =
@@ -1366,9 +1354,8 @@ void prism2sta_processing_defer(struct work_struct *data)
1366 HFA384x_RID_CURRENTBSSID, 1354 HFA384x_RID_CURRENTBSSID,
1367 wlandev->bssid, WLAN_BSSID_LEN); 1355 wlandev->bssid, WLAN_BSSID_LEN);
1368 if (result) { 1356 if (result) {
1369 pr_debug( 1357 pr_debug("getconfig(0x%02x) failed, result = %d\n",
1370 "getconfig(0x%02x) failed, result = %d\n", 1358 HFA384x_RID_CURRENTBSSID, result);
1371 HFA384x_RID_CURRENTBSSID, result);
1372 goto failed; 1359 goto failed;
1373 } 1360 }
1374 1361
@@ -1376,13 +1363,12 @@ void prism2sta_processing_defer(struct work_struct *data)
1376 HFA384x_RID_CURRENTSSID, 1363 HFA384x_RID_CURRENTSSID,
1377 &ssid, sizeof(ssid)); 1364 &ssid, sizeof(ssid));
1378 if (result) { 1365 if (result) {
1379 pr_debug( 1366 pr_debug("getconfig(0x%02x) failed, result = %d\n",
1380 "getconfig(0x%02x) failed, result = %d\n", 1367 HFA384x_RID_CURRENTSSID, result);
1381 HFA384x_RID_CURRENTSSID, result);
1382 goto failed; 1368 goto failed;
1383 } 1369 }
1384 prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid, 1370 prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *) & ssid,
1385 (p80211pstrd_t *)&wlandev->ssid); 1371 (p80211pstrd_t *) & wlandev->ssid);
1386 1372
1387 hw->link_status = HFA384x_LINK_CONNECTED; 1373 hw->link_status = HFA384x_LINK_CONNECTED;
1388 netif_carrier_on(wlandev->netdev); 1374 netif_carrier_on(wlandev->netdev);
@@ -1482,8 +1468,8 @@ failed:
1482* Call context: 1468* Call context:
1483* interrupt 1469* interrupt
1484----------------------------------------------------------------*/ 1470----------------------------------------------------------------*/
1485static void prism2sta_inf_linkstatus(wlandevice_t *wlandev, 1471static void prism2sta_inf_linkstatus(wlandevice_t * wlandev,
1486 hfa384x_InfFrame_t *inf) 1472 hfa384x_InfFrame_t * inf)
1487{ 1473{
1488 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 1474 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1489 1475
@@ -1512,8 +1498,8 @@ static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
1512* Call context: 1498* Call context:
1513* interrupt 1499* interrupt
1514----------------------------------------------------------------*/ 1500----------------------------------------------------------------*/
1515static void prism2sta_inf_assocstatus(wlandevice_t *wlandev, 1501static void prism2sta_inf_assocstatus(wlandevice_t * wlandev,
1516 hfa384x_InfFrame_t *inf) 1502 hfa384x_InfFrame_t * inf)
1517{ 1503{
1518 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 1504 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1519 hfa384x_AssocStatus_t rec; 1505 hfa384x_AssocStatus_t rec;
@@ -1574,8 +1560,8 @@ static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
1574* interrupt 1560* interrupt
1575* 1561*
1576----------------------------------------------------------------*/ 1562----------------------------------------------------------------*/
1577static void prism2sta_inf_authreq(wlandevice_t *wlandev, 1563static void prism2sta_inf_authreq(wlandevice_t * wlandev,
1578 hfa384x_InfFrame_t *inf) 1564 hfa384x_InfFrame_t * inf)
1579{ 1565{
1580 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 1566 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1581 struct sk_buff *skb; 1567 struct sk_buff *skb;
@@ -1589,8 +1575,8 @@ static void prism2sta_inf_authreq(wlandevice_t *wlandev,
1589 } 1575 }
1590} 1576}
1591 1577
1592static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev, 1578static void prism2sta_inf_authreq_defer(wlandevice_t * wlandev,
1593 hfa384x_InfFrame_t *inf) 1579 hfa384x_InfFrame_t * inf)
1594{ 1580{
1595 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 1581 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1596 hfa384x_authenticateStation_data_t rec; 1582 hfa384x_authenticateStation_data_t rec;
@@ -1763,8 +1749,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
1763* Call context: 1749* Call context:
1764* interrupt 1750* interrupt
1765----------------------------------------------------------------*/ 1751----------------------------------------------------------------*/
1766static void prism2sta_inf_psusercnt(wlandevice_t *wlandev, 1752static void prism2sta_inf_psusercnt(wlandevice_t * wlandev,
1767 hfa384x_InfFrame_t *inf) 1753 hfa384x_InfFrame_t * inf)
1768{ 1754{
1769 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 1755 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
1770 1756
@@ -1790,7 +1776,7 @@ static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
1790* Call context: 1776* Call context:
1791* interrupt 1777* interrupt
1792----------------------------------------------------------------*/ 1778----------------------------------------------------------------*/
1793void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf) 1779void prism2sta_ev_info(wlandevice_t * wlandev, hfa384x_InfFrame_t * inf)
1794{ 1780{
1795 inf->infotype = le16_to_cpu(inf->infotype); 1781 inf->infotype = le16_to_cpu(inf->infotype);
1796 /* Dispatch */ 1782 /* Dispatch */
@@ -1858,7 +1844,7 @@ void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
1858* Call context: 1844* Call context:
1859* interrupt 1845* interrupt
1860----------------------------------------------------------------*/ 1846----------------------------------------------------------------*/
1861void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status) 1847void prism2sta_ev_txexc(wlandevice_t * wlandev, u16 status)
1862{ 1848{
1863 pr_debug("TxExc status=0x%x.\n", status); 1849 pr_debug("TxExc status=0x%x.\n", status);
1864 1850
@@ -1881,7 +1867,7 @@ void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status)
1881* Call context: 1867* Call context:
1882* interrupt 1868* interrupt
1883----------------------------------------------------------------*/ 1869----------------------------------------------------------------*/
1884void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status) 1870void prism2sta_ev_tx(wlandevice_t * wlandev, u16 status)
1885{ 1871{
1886 pr_debug("Tx Complete, status=0x%04x\n", status); 1872 pr_debug("Tx Complete, status=0x%04x\n", status);
1887 /* update linux network stats */ 1873 /* update linux network stats */
@@ -1905,7 +1891,7 @@ void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status)
1905* Call context: 1891* Call context:
1906* interrupt 1892* interrupt
1907----------------------------------------------------------------*/ 1893----------------------------------------------------------------*/
1908void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb) 1894void prism2sta_ev_rx(wlandevice_t * wlandev, struct sk_buff *skb)
1909{ 1895{
1910 p80211netdev_rx(wlandev, skb); 1896 p80211netdev_rx(wlandev, skb);
1911 return; 1897 return;
@@ -1927,7 +1913,7 @@ void prism2sta_ev_rx(wlandevice_t *wlandev, struct sk_buff *skb)
1927* Call context: 1913* Call context:
1928* interrupt 1914* interrupt
1929----------------------------------------------------------------*/ 1915----------------------------------------------------------------*/
1930void prism2sta_ev_alloc(wlandevice_t *wlandev) 1916void prism2sta_ev_alloc(wlandevice_t * wlandev)
1931{ 1917{
1932 netif_wake_queue(wlandev->netdev); 1918 netif_wake_queue(wlandev->netdev);
1933 return; 1919 return;
@@ -2020,9 +2006,9 @@ void prism2sta_commsqual_defer(struct work_struct *data)
2020 } 2006 }
2021 2007
2022 pr_debug("commsqual %d %d %d\n", 2008 pr_debug("commsqual %d %d %d\n",
2023 le16_to_cpu(hw->qual.CQ_currBSS), 2009 le16_to_cpu(hw->qual.CQ_currBSS),
2024 le16_to_cpu(hw->qual.ASL_currBSS), 2010 le16_to_cpu(hw->qual.ASL_currBSS),
2025 le16_to_cpu(hw->qual.ANL_currFC)); 2011 le16_to_cpu(hw->qual.ANL_currFC));
2026 } 2012 }
2027 2013
2028 /* Lastly, we need to make sure the BSSID didn't change on us */ 2014 /* Lastly, we need to make sure the BSSID didn't change on us */
@@ -2030,9 +2016,8 @@ void prism2sta_commsqual_defer(struct work_struct *data)
2030 HFA384x_RID_CURRENTBSSID, 2016 HFA384x_RID_CURRENTBSSID,
2031 wlandev->bssid, WLAN_BSSID_LEN); 2017 wlandev->bssid, WLAN_BSSID_LEN);
2032 if (result) { 2018 if (result) {
2033 pr_debug( 2019 pr_debug("getconfig(0x%02x) failed, result = %d\n",
2034 "getconfig(0x%02x) failed, result = %d\n", 2020 HFA384x_RID_CURRENTBSSID, result);
2035 HFA384x_RID_CURRENTBSSID, result);
2036 goto done; 2021 goto done;
2037 } 2022 }
2038 2023
@@ -2040,13 +2025,12 @@ void prism2sta_commsqual_defer(struct work_struct *data)
2040 HFA384x_RID_CURRENTSSID, 2025 HFA384x_RID_CURRENTSSID,
2041 &ssid, sizeof(ssid)); 2026 &ssid, sizeof(ssid));
2042 if (result) { 2027 if (result) {
2043 pr_debug( 2028 pr_debug("getconfig(0x%02x) failed, result = %d\n",
2044 "getconfig(0x%02x) failed, result = %d\n", 2029 HFA384x_RID_CURRENTSSID, result);
2045 HFA384x_RID_CURRENTSSID, result);
2046 goto done; 2030 goto done;
2047 } 2031 }
2048 prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid, 2032 prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *) & ssid,
2049 (p80211pstrd_t *)&wlandev->ssid); 2033 (p80211pstrd_t *) & wlandev->ssid);
2050 2034
2051 /* Reschedule timer */ 2035 /* Reschedule timer */
2052 mod_timer(&hw->commsqual_timer, jiffies + HZ); 2036 mod_timer(&hw->commsqual_timer, jiffies + HZ);
diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c
index d9c6f5a97cf..7aa703ce9dd 100644
--- a/drivers/staging/wlan-ng/prism2usb.c
+++ b/drivers/staging/wlan-ng/prism2usb.c
@@ -24,9 +24,8 @@ static struct usb_device_id usb_prism_tbl[] = {
24 (0x066b, 0x2213, "Linksys WUSB12v1.1 11Mbps WLAN USB Adapter")}, 24 (0x066b, 0x2213, "Linksys WUSB12v1.1 11Mbps WLAN USB Adapter")},
25 {PRISM_USB_DEVICE 25 {PRISM_USB_DEVICE
26 (0x067c, 0x1022, "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter")}, 26 (0x067c, 0x1022, "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter")},
27 {PRISM_USB_DEVICE 27 {PRISM_USB_DEVICE(0x049f, 0x0033,
28 (0x049f, 0x0033, 28 "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter")},
29 "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter")},
30 {PRISM_USB_DEVICE 29 {PRISM_USB_DEVICE
31 (0x0411, 0x0016, "Melco WLI-USB-S11 11Mbps WLAN Adapter")}, 30 (0x0411, 0x0016, "Melco WLI-USB-S11 11Mbps WLAN Adapter")},
32 {PRISM_USB_DEVICE 31 {PRISM_USB_DEVICE